~ubuntu-branches/ubuntu/precise/egoboo-data/precise

« back to all changes in this revision

Viewing changes to modules/wizard.mod/objects/cobol.obj/script.txt

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2010-04-25 10:20:11 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100425102011-1aosouybjkexdg9v
Tags: 1:2.7.7-1
* New Upstream Release
* Switch to debhelper

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
IfSpawned
 
2
  // Decide which weapon to use
 
3
  IfHoldingRangedWeapon
 
4
    tmpargument = 0
 
5
    SetState
 
6
  Else
 
7
    tmpargument = 1
 
8
    SetState
 
9
  tmpargument = 2
 
10
  IfArmorIs
 
11
    // Sleeping
 
12
    tmpargument = 8
 
13
    SetState
 
14
    tmpargument = rand & 63 + 32
 
15
    SetTime
 
16
    tmpargument = ACTIONMK
 
17
    DoActionOverride
 
18
    KeepAction
 
19
  Else
 
20
    tmpargument = 100
 
21
    SetTime
 
22
 
 
23
 
 
24
//------------------------------------------------------------------------------
 
25
IfBumped
 
26
  SetTargetToWhoeverBumped
 
27
  IfStateIs8
 
28
    IfTargetIsOnHatedTeam
 
29
      // Bumping a sleeping Cobol...  How rude!
 
30
      tmpargument = 8
 
31
      tmpdistance = rand & 2047 + 13000
 
32
      PlaySound
 
33
 
 
34
 
 
35
      tmpargument = 4
 
36
      SendMessageNear
 
37
      tmpargument = ACTIONMJ
 
38
      DoActionOverride
 
39
      UnkeepAction
 
40
      // Start combat
 
41
      tmpargument = 2
 
42
      IfHoldingMeleeWeapon
 
43
        tmpargument = 5
 
44
      SetState
 
45
      tmpargument = 0
 
46
      ChangeArmor
 
47
      tmpargument = 15
 
48
      SetTime
 
49
  Else
 
50
    // Jump over barriers, onto mounts
 
51
    IfTargetIsAlive
 
52
      IfTargetIsAPlatform
 
53
        // Jump over some stuff
 
54
        tmpargument = LATCHJUMP
 
55
        PressLatchButton
 
56
      IfTargetIsAMount
 
57
        // Jump onto mounts
 
58
        tmpx = targetx
 
59
        tmpy = targety
 
60
        ClearWaypoints
 
61
        AddWaypoint
 
62
 
 
63
        tmpargument = 30
 
64
        SetTime
 
65
    Else
 
66
      // Jump over corpses
 
67
      tmpargument = LATCHJUMP
 
68
      PressLatchButton
 
69
    SetTargetToOldTarget
 
70
 
 
71
 
 
72
//------------------------------------------------------------------------------
 
73
IfStateIs7
 
74
  // Blocking...  Need to keep that button pressed
 
75
  IfTimeOut
 
76
    // Revert to combat state
 
77
    tmpargument = 5
 
78
    SetState
 
79
    // Attack now if possible
 
80
    GetContent
 
81
    tmpx = targetdistance
 
82
    tmpy = tmpargument
 
83
    IfXIsLessThanY
 
84
      IfHoldingMeleeWeapon
 
85
        PressLatchButton
 
86
  Else
 
87
    IfHoldingShield
 
88
      PressLatchButton
 
89
 
 
90
 
 
91
//------------------------------------------------------------------------------
 
92
IfKilled
 
93
  DropItems
 
94
  // Tell the players
 
95
  tmpargument = 0
 
96
  IfArmorIs
 
97
    // A normal Cobol
 
98
    tmpargument = rand & 2
 
99
    ChangeArmor
 
100
    tmpargument = 0
 
101
    IfTargetIsOnSameTeam
 
102
      tmpargument = 1
 
103
    SendMessageNear
 
104
  Else
 
105
    tmpargument = 1
 
106
    IfArmorIs
 
107
      // A Cobol Captain
 
108
      tmpargument = 2
 
109
      IfTargetIsOnSameTeam
 
110
        tmpargument = 3
 
111
      SendMessageNear
 
112
      // Give bonus points
 
113
      tmpargument = 10
 
114
      tmpdistance = EXPROLEPLAY
 
115
      GiveExperienceToTarget
 
116
 
 
117
 
 
118
 
 
119
 
 
120
  // Just to be sure
 
121
  tmpargument = ACTIONKA
 
122
  DoActionOverride
 
123
  KeepAction
 
124
 
 
125
 
 
126
  tmpargument = 1
 
127
  tmpdistance = rand & 2047 + 13000
 
128
  PlaySound
 
129
 
 
130
 
 
131
  // Drop goodies
 
132
  tmpargument = 65535
 
133
  DropMoney
 
134
 
 
135
 
 
136
  // Make the character body
 
137
  tmpargument = 40
 
138
  SetBumpHeight
 
139
 
 
140
 
 
141
  // Make the next part not happen...
 
142
  tmpargument = 50
 
143
  SetTime
 
144
 
 
145
 
 
146
 
 
147
//------------------------------------------------------------------------------
 
148
IfAttacked
 
149
  SetTargetToWhoeverAttacked
 
150
  IfStateIs8
 
151
    // A sleeping Cobol
 
152
    tmpargument = [DISA]
 
153
    IfTargetHasSkillID
 
154
      // This is what Rogues do best...
 
155
      tmpargument = 5
 
156
    Else
 
157
      // Just a normal player
 
158
      tmpargument = 6
 
159
    SendMessageNear
 
160
 
 
161
 
 
162
    // Give experience
 
163
    tmpargument = 30
 
164
    tmpdistance = EXPMURDER
 
165
    GiveExperienceToTarget
 
166
 
 
167
 
 
168
    // Do it
 
169
    SetTargetToSelf
 
170
    KillTarget
 
171
  Else
 
172
    IfTargetIsOnHatedTeam
 
173
      // Counter attack
 
174
      GetState
 
175
      tmpargument = tmpargument & 1 + 4 // Preserve even/odd
 
176
      SetState
 
177
 
 
178
      // Check for instant death
 
179
      tmpargument = [DISA]
 
180
      IfTargetHasSkillID
 
181
        // Allow Rogues to backstab
 
182
        GetDamageType
 
183
        tmpx = tmpargument
 
184
        tmpy = DAMAGEPOKE
 
185
        IfXIsEqualToY
 
186
          IfHitFromBehind
 
187
            tmpargument = 8
 
188
            SendMessageNear
 
189
 
 
190
            tmpargument = 30
 
191
            tmpdistance = EXPMURDER
 
192
            GiveExperienceToTarget
 
193
 
 
194
            // Do it
 
195
            tmpargument = 2
 
196
            ChangeArmor
 
197
            SetTargetToSelf
 
198
            KillTarget
 
199
    Else
 
200
      // Friendly fire, get out of the way
 
201
      tmpx = rand & 511 - 256 + selfx
 
202
      tmpy = rand & 511 - 256 + selfy
 
203
      ClearWaypoints
 
204
      AddWaypoint
 
205
      SetTargetToOldTarget
 
206
 
 
207
 
 
208
    // Tell everyone to charge
 
209
    tmpargument = 5
 
210
    IssueOrder
 
211
 
 
212
 
 
213
    tmpargument = rand & 1 + 2
 
214
    tmpdistance = rand & 2047 + 13000
 
215
    PlaySound
 
216
 
 
217
 
 
218
 
 
219
//------------------------------------------------------------------------------
 
220
IfTimeOut
 
221
  // Check if the current target is alive or not
 
222
  IfStateIs8
 
223
    GetState // NOP
 
224
  Else
 
225
    IfTargetIsAlive
 
226
      IfTargetIsOnHatedTeam
 
227
        GetState // NOP
 
228
      Else
 
229
        // Revert to target acquisition state ( Invisible enemy? Dismount? )
 
230
        GetState
 
231
        tmpargument = tmpargument & 1  // Retain even/odd
 
232
        SetState
 
233
    Else
 
234
      // Revert to target acquisition state
 
235
      GetState
 
236
      tmpargument = tmpargument & 1  // Retain even/odd
 
237
      SetState
 
238
 
 
239
 
 
240
  tmpargument = 100 // Default time...  Shouldn't be needed
 
241
  IfSitting
 
242
    // Riding some type of animal...
 
243
    // Acquire a target
 
244
    SetTurnModeToVelocity
 
245
    SetTargetToNearestEnemy
 
246
      // Charge towards enemy
 
247
      tmpx = targetx
 
248
      tmpy = targety
 
249
      tmpturn = targetturnto
 
250
      tmpdistance = 300
 
251
      Compass
 
252
      ClearWaypoints
 
253
      AddWaypoint
 
254
 
 
255
 
 
256
 
 
257
      // Check for special mount attacks
 
258
      tmpx = targetdistance
 
259
      tmpy = 200
 
260
      IfXIsLessThanY
 
261
        tmpargument = [XFUN]
 
262
        SetOldTarget
 
263
        SetTargetToWhoeverIsHolding
 
264
        IfTargetHasAnyID
 
265
          tmpargument = LATCHRIGHT
 
266
          PressLatchButton
 
267
          SetTargetToOldTarget
 
268
        Else
 
269
          // Don't let the enemy jump over
 
270
          SetTargetToOldTarget
 
271
          tmpx = selfz
 
272
          tmpy = targetz - 40
 
273
          IfXIsLessThanY
 
274
            IfHoldingMeleeWeapon
 
275
              PressLatchButton
 
276
 
 
277
 
 
278
      tmpargument = rand & 15 + 15 // TIme
 
279
    Else
 
280
      // Guard the start position
 
281
      tmpx = rand & 511 - 256 + selfspawnx
 
282
      tmpy = rand & 511 - 256 + selfspawny
 
283
      ClearWaypoints
 
284
      AddWaypoint
 
285
      tmpargument = rand & 31 + 30 // TIme
 
286
  Else
 
287
    // Foot soldier...
 
288
    // Behave according to state
 
289
    IfStateIsOdd
 
290
      // Odd states are for melee weapons
 
291
      IfTargetIsAttacking
 
292
        IfHoldingShield
 
293
          // Is the enemy facing the character?
 
294
          tmpturn = selfturn - targetturn
 
295
          tmpx = tmpturn
 
296
          tmpy = 24768
 
297
          IfXIsMoreThanY
 
298
            tmpy = 40768
 
299
            IfXIsLessThanY
 
300
              // Defend
 
301
              PressLatchButton
 
302
              tmpargument = 7
 
303
              SetState
 
304
 
 
305
              // Tell everyone to attack while Cobol hides...  Coward
 
306
              tmpargument = 5
 
307
              IssueOrder
 
308
              tmpargument = rand & 15 + 15 // Time
 
309
      IfStateIs3
 
310
        // Circle around the enemy
 
311
        SetTurnModeToWatchTarget
 
312
 
 
313
 
 
314
 
 
315
        tmpx = targetx
 
316
        tmpy = targety
 
317
        SetTargetToNearestFriend
 
318
          tmpdistance = 200
 
319
          tmpturn = targetdistance
 
320
          IfDistanceIsMoreThanTurn
 
321
            // The friend is close, so move away
 
322
            tmpturn = targetturnto + 32768
 
323
            tmpdistance = 400
 
324
            Compass
 
325
            // Make it look better
 
326
            tmpargument = ACTIONWB
 
327
            DoAction
 
328
          SetTargetToOldTarget
 
329
        tmpturn = targetturnto + 32768
 
330
        tmpdistance = 300
 
331
        Compass
 
332
        ClearWaypoints
 
333
        AddWaypoint
 
334
 
 
335
 
 
336
        // Randomly issue the battle cry
 
337
        tmpx = rand & 1023
 
338
        tmpy = 5
 
339
        IfXIsLessThanY
 
340
          tmpargument = 10
 
341
          tmpdistance = rand & 2047 + 13000
 
342
          PlaySound
 
343
          tmpargument = 5
 
344
          IssueOrder
 
345
 
 
346
 
 
347
        // Issue the battle cry if there's a threat
 
348
        tmpx = targetdistance
 
349
        tmpy = 250
 
350
        IfXIsLessThanY
 
351
          tmpargument = 5
 
352
          IssueOrder
 
353
          IfHoldingMeleeWeapon
 
354
            PressLatchButton
 
355
 
 
356
 
 
357
        tmpargument = rand & 15 + 10 // Time
 
358
      IfStateIs5
 
359
        // Randomly issue the retreat order
 
360
        tmpx = rand & 1023
 
361
        tmpy = 20
 
362
        IfXIsLessThanY
 
363
          tmpargument = 9
 
364
          tmpdistance = rand & 2047 + 13000
 
365
          PlaySound
 
366
          tmpargument = 3
 
367
          IssueOrder
 
368
 
 
369
 
 
370
 
 
371
        // Charge and attack the enemy
 
372
        GetContent  // Desired range
 
373
        tmpx = targetdistance
 
374
        tmpy = tmpargument
 
375
        IfXIsLessThanY
 
376
          // Close enough to attack
 
377
          IfHoldingMeleeWeapon
 
378
            PressLatchButton
 
379
          // Circle up again
 
380
          tmpx = targetx
 
381
          tmpy = targety
 
382
          tmpturn = targetturnto + 32768
 
383
          tmpdistance = 600
 
384
          Compass
 
385
          ClearWaypoints
 
386
          AddWaypoint
 
387
          tmpargument = 3
 
388
          SetState
 
389
          tmpargument = rand & 15 + 40 // Time
 
390
        Else
 
391
          // Too far, so get closer
 
392
          tmpx = targetx
 
393
          tmpy = targety
 
394
          tmpturn = targetturnto
 
395
          IfHoldingMeleeWeapon
 
396
            // 1 = left, 2 = right
 
397
            tmpargument = tmpargument < 13   // 8192 or 16384
 
398
            tmpturn = tmpturn + tmpargument - 12288
 
399
          tmpdistance = 400
 
400
          Compass
 
401
          ClearWaypoints
 
402
          AddWaypoint
 
403
          tmpargument = rand & 15 + 8 // Time
 
404
      IfStateIs1
 
405
        // Rummage for a weapon
 
406
        IfHoldingMeleeWeapon
 
407
          // Acquire a target
 
408
          SetTurnModeToVelocity
 
409
          tmpdistance = 250000 // Square of distance to check
 
410
          SetTargetToDistantEnemy
 
411
            // Charge towards enemy
 
412
            tmpx = targetx
 
413
            tmpy = targety
 
414
            ClearWaypoints
 
415
            AddWaypoint
 
416
 
 
417
            // Next time, circle up
 
418
            tmpargument = 3
 
419
            SetState
 
420
            tmpargument = 20 // Time
 
421
          Else
 
422
            // Guard the start position
 
423
            tmpx = rand & 511 - 256 + selfspawnx
 
424
            tmpy = rand & 511 - 256 + selfspawny
 
425
            ClearWaypoints
 
426
            AddWaypoint
 
427
            tmpargument = rand & 15 + 30 // Time
 
428
        Else
 
429
          // Draw a new weapon
 
430
          tmpargument = LATCHPACKRIGHT
 
431
          PressLatchButton
 
432
          tmpargument = 15 // Time
 
433
    Else
 
434
      // Even states are for ranged weapons...
 
435
      IfStateIs8    // ...and sleeping
 
436
        // Sleepy Z's
 
437
        tmpx = selfx
 
438
        tmpy = selfy
 
439
        tmpdistance = selfz
 
440
        tmpargument = 6
 
441
        SpawnExactParticle
 
442
 
 
443
 
 
444
        // Snore...
 
445
        tmpargument = rand & 3 + 4
 
446
        tmpdistance = rand & 2047 + 15000
 
447
        PlaySound
 
448
 
 
449
 
 
450
        tmpargument = ACTIONMK
 
451
        DoAction
 
452
        tmpdistance = 160000  // Distance to check
 
453
        SetTargetToDistantEnemy
 
454
          IfTargetIsSneaking
 
455
            tmpargument = 100 // Time
 
456
          Else
 
457
            // Too Loud
 
458
            // Too close...  Wake up
 
459
            tmpargument = 8
 
460
            tmpdistance = rand & 2047 + 13000
 
461
            PlaySound
 
462
 
 
463
 
 
464
            tmpargument = 4
 
465
            SendMessageNear
 
466
            tmpargument = ACTIONMJ
 
467
            DoActionOverride
 
468
            UnkeepAction
 
469
            // Start combat
 
470
            tmpargument = 2
 
471
            IfHoldingMeleeWeapon
 
472
              tmpargument = 5
 
473
            SetState
 
474
            tmpargument = 0
 
475
            ChangeArmor
 
476
            tmpargument = 30 // Time
 
477
          Else
 
478
            tmpargument = 100 // Time
 
479
      IfStateIs6
 
480
        // Decide whether to shoot again or not
 
481
        tmpy = 120
 
482
        tmpargument = 1
 
483
        IfArmorIs
 
484
          tmpy = 0 // Captains don't run away
 
485
        GetContent
 
486
        tmpx = targetdistance
 
487
        IfXIsLessThanY
 
488
          // Too close
 
489
          tmpargument = 0
 
490
          SetState
 
491
        Else
 
492
          // Fire again
 
493
          tmpy = tmpargument + 200
 
494
          IfXIsMoreThanY
 
495
            // Enemy is too far
 
496
            tmpargument = 0
 
497
            SetState
 
498
          Else
 
499
            // Fire again
 
500
            tmpargument = 4
 
501
            SetState
 
502
        // Time needn't be set here
 
503
      IfStateIs4
 
504
        // Fire at the enemy
 
505
        tmpargument = 6
 
506
        SetState
 
507
 
 
508
 
 
509
        // Don't shoot if friends are too close
 
510
        SetTargetToNearestFriend
 
511
          tmpx = targetdistance
 
512
          tmpy = 00
 
513
          IfXIsLessThanY
 
514
            // Keep distance from friends
 
515
            tmpx = targetx
 
516
            tmpy = targety
 
517
            tmpturn = rand & 8191 + 28000 + targetturnto
 
518
            tmpdistance = 300
 
519
            Compass
 
520
            ClearWaypoints
 
521
            AddWaypoint
 
522
          Else
 
523
            // Safe to fire
 
524
            SetTargetToOldTarget
 
525
            IfHoldingRangedWeapon
 
526
              SetTurnModeToWatchTarget
 
527
              IfFacingTarget
 
528
                PressLatchButton
 
529
            Else
 
530
//              // Reload the weapon...
 
531
//              SetOldTarget
 
532
//              SetTargetToSelf
 
533
//              tmpargument = [WOOD]
 
534
//              RestockTargetAmmoIDAll
 
535
//              SetTargetToOldTarget
 
536
 
 
537
 
 
538
              // Draw a new weapon
 
539
              DropWeapons
 
540
              // Go to close range mode
 
541
              tmpargument = 100
 
542
              SetContent
 
543
              // Now using melee weapons
 
544
              tmpargument = 1
 
545
              SetState
 
546
        Else
 
547
          // Safe to fire
 
548
          IfHoldingRangedWeapon
 
549
            IfFacingTarget
 
550
              PressLatchButton
 
551
          Else
 
552
//            // Reload the weapon...
 
553
//            SetOldTarget
 
554
//            SetTargetToSelf
 
555
//            tmpargument = [WOOD]
 
556
//            RestockTargetAmmoIDAll
 
557
//            SetTargetToOldTarget
 
558
 
 
559
 
 
560
            // Draw a new weapon
 
561
            DropWeapons
 
562
            // Go to close range mode
 
563
            tmpargument = 100
 
564
            SetContent
 
565
            // Now using melee weapons
 
566
            tmpargument = 1
 
567
            SetState
 
568
 
 
569
 
 
570
 
 
571
        tmpargument = rand & 7 + 10 // Time before next check
 
572
      IfStateIs2
 
573
        // Get into firing position
 
574
        SetTurnModeToVelocity
 
575
        tmpx = targetx
 
576
        tmpy = targety
 
577
 
 
578
 
 
579
        SetTargetToNearestFriend
 
580
          tmpx = targetdistance
 
581
          tmpy = 100
 
582
          IfXIsLessThanY
 
583
            // Keep distance from friends
 
584
            tmpx = targetx
 
585
            tmpy = targety
 
586
            SetTargetToOldTarget
 
587
          Else
 
588
            SetTargetToOldTarget
 
589
            tmpx = targetx
 
590
            tmpy = targety
 
591
        // Keep running away
 
592
        tmpturn = xyturnto + 32768
 
593
        GetContent
 
594
        tmpdistance = tmpargument // Desired range
 
595
        Compass
 
596
        ClearWaypoints
 
597
        AddWaypoint
 
598
 
 
599
 
 
600
 
 
601
        // Check distance to target
 
602
        tmpx = targetx - selfx
 
603
        tmpy = targety - selfy
 
604
        tmpx = xydistance // Pythag thing...  targetdistance isn't as good
 
605
        GetContent
 
606
        tmpy = tmpargument - 300 // The desired range ( MIN )
 
607
        tmpargument = rand & 15 + 15 // Default time
 
608
        IfXIsMoreThanY
 
609
          tmpy = tmpy + 600 // The desired range ( MAX )
 
610
          IfXIsLessThanY
 
611
            // Target is in range, so switch to fire state
 
612
            tmpargument = 4
 
613
            SetState
 
614
            SetTurnModeToWatchTarget
 
615
            tmpargument = 30 // Time before shooting
 
616
      IfStateIs0
 
617
        // Acquire a target
 
618
        SetTurnModeToVelocity
 
619
        SetTargetToNearestEnemy
 
620
          // Move away from enemy
 
621
          tmpx = targetx
 
622
          tmpy = targety
 
623
          tmpturn = targetturnto + 32768
 
624
          tmpdistance = 650
 
625
          Compass
 
626
          ClearWaypoints
 
627
          AddWaypoint
 
628
 
 
629
          // Go to position state
 
630
          tmpargument = 2
 
631
          SetState
 
632
          tmpargument = 50 // Time
 
633
        Else
 
634
          // Guard the start position
 
635
          tmpx = selfspawnx
 
636
          tmpy = selfspawny
 
637
          ClearWaypoints
 
638
          AddWaypoint
 
639
          tmpargument = rand & 15 + 30 // Time
 
640
 
 
641
 
 
642
  // tmpargument is set above
 
643
  SetTime
 
644
 
 
645
 
 
646
 
 
647
//------------------------------------------------------------------------------
 
648
IfOrdered
 
649
  // Someone said to wake up
 
650
  IfStateIs8
 
651
    tmpx = selforder
 
652
    tmpy = [WAKE]
 
653
    IfXIsEqualToY
 
654
      // Always awaken
 
655
      tmpx = 0
 
656
    Else
 
657
      // Check distance to enemy
 
658
      tmpx = 9999
 
659
      SetTargetToNearestEnemy
 
660
        tmpx = targetdistance
 
661
    tmpy = 800
 
662
    IfXIsLessThanY
 
663
      // Wake up
 
664
      tmpargument = 8
 
665
      tmpdistance = rand & 2047 + 13000
 
666
      PlaySound
 
667
 
 
668
 
 
669
      tmpargument = 4
 
670
      SendMessageNear
 
671
      tmpargument = ACTIONMJ
 
672
      DoActionOverride
 
673
      UnkeepAction
 
674
      // Start combat
 
675
      tmpargument = 2
 
676
      IfHoldingMeleeWeapon
 
677
        tmpargument = 5
 
678
      SetState
 
679
      tmpargument = 0
 
680
      ChangeArmor
 
681
      tmpargument = 15
 
682
      SetTime
 
683
  Else
 
684
    // Ignore wake orders...
 
685
    tmpx = selforder
 
686
    tmpy = [WAKE]
 
687
    IfXIsEqualToY
 
688
      GetState  // NOP
 
689
    Else
 
690
      // Someone said to attack ( hand to hand )
 
691
      IfStateIsOdd
 
692
        IfStateIs3
 
693
          tmpargument = 5
 
694
          SetState
 
695
        IfStateIs5
 
696
          tmpargument = selforder
 
697
          SetState
 
698
          tmpargument = rand & 7
 
699
          SetTime
 
700
 
 
701
 
 
702
//------------------------------------------------------------------------------
 
703
IfHealed
 
704
  tmpargument = 7
 
705
  SendMessageNear
 
706
 
 
707
 
 
708
 
 
709
//------------------------------------------------------------------------------
 
710
End
 
711
//------------------------------------------------------------------------------