-
Notifications
You must be signed in to change notification settings - Fork 6
/
A3.BAS.txt
2018 lines (1956 loc) · 75.1 KB
/
A3.BAS.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
' Copyright (c) 1995 Jeffrey R. Olson
'
' Permission is hereby granted, free of charge, to any person obtaining a copy
' of this software and associated documentation files (the "Software"), to deal
' in the Software without restriction, including without limitation the rights
' to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
' copies of the Software, and to permit persons to whom the Software is
' furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all
' copies or substantial portions of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
' OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
' SOFTWARE.
DECLARE SUB KillBadMaps (mode%)
DECLARE SUB SaveMaps (mode%)
DECLARE SUB MaybeMessPause (fc%, bc%)
DECLARE SUB box CDECL (BYVAL lc%, BYVAL rc%, BYVAL tc%, BYVAL bc%, BYVAL nl%, BYVAL fclr%, BYVAL pag%)
DECLARE SUB Compute (main%)
DECLARE SUB EatBerry (num%)
DECLARE SUB Scatter (num%)
DECLARE SUB cRandomize CDECL (BYVAL seed!)
DECLARE SUB Teleport (tBer%)
DECLARE SUB EndScreen (num%)
DECLARE SUB Level (newlev%, b$)
DECLARE SUB GotGrinch (beast%)
DECLARE SUB Help (ii%)
DECLARE SUB Awaken (i%)
DECLARE SUB EraseCreat (i%)
DECLARE SUB PutCreat (i%)
DECLARE SUB MakeCreature (x%, y%, border%, fake%)
DECLARE SUB SplitCre (ch%)
DECLARE SUB SelectGoody (num%, colr%, pak%)
DECLARE SUB SortGoody ()
DECLARE SUB PrintJnk (a%, b%, c%)
DECLARE SUB LjnkBig (a%, b%, c%, d%, e%, f%, a$, n%, i%)
DECLARE SUB ljnk (a%, b%, c%, i%)
DECLARE SUB TeleCreat (i%, j%)
DECLARE SUB ccls CDECL (BYVAL pag%)
DECLARE SUB ffEffect (damage%, ffkill%)
DECLARE SUB Explode (dx%, dy%, dam%, damtyp%, needed%, r!, slf%, fc%, div%)
DECLARE SUB SetCombatStats ()
DECLARE SUB AddToDrop (i%)
DECLARE SUB ShowHits ()
DECLARE SUB Pitt (fc%)
DECLARE SUB Trapp (fc%)
DECLARE SUB DotIt (x%, y%)
DECLARE SUB DotCorn ()
DECLARE SUB DumpBuffer ()
DECLARE SUB EnterCastle ()
DECLARE SUB CrDamAlter (ch%, dam%, damtyp%)
DECLARE SUB LeaveCastle ()
DECLARE SUB KillCreat (num%)
DECLARE SUB TargetLong (lsym%, r!, x%, y%, fc%, bc%)
DECLARE SUB DetermineSpecial (dropped%, num%)
DECLARE SUB DetermineShield (dropped%)
DECLARE SUB DetermineBerry (dropped%)
DECLARE SUB DetermineLSD (dropped%)
DECLARE SUB DetermineParts (dropped%)
DECLARE SUB DetermineSSD (dropped%)
DECLARE SUB DetermineArmor (dropped%)
DECLARE SUB DetermineWep (dropped%)
DECLARE SUB RemoveLocalGoody (x%, y%, dropped%)
DECLARE SUB AddSpam ()
DECLARE SUB AddBeef ()
DECLARE SUB DetailedMap (loadmappossible%)
DECLARE SUB MoveMain (dx%, dy%)
DECLARE SUB RemoveGoody (i%, pak%)
DECLARE SUB Dead (spec%)
DECLARE SUB Wrong ()
DECLARE SUB Target (num%, r!, dx%, dy%, fc%)
DECLARE SUB DarkMove (dx%, dy%)
DECLARE SUB ChangeDark ()
DECLARE SUB AttackCreat (dx%, dy%)
DECLARE SUB DrawDungeon ()
DECLARE SUB Move (num%)
DECLARE SUB PauseForKey ()
DECLARE SUB ClearMess ()
DECLARE SUB PrintMessage (a%, b%)
DECLARE SUB DisplayCharacter ()
DECLARE SUB DisplayGoodies (pak%)
DECLARE SUB MessPause (a%, b%)
DECLARE SUB GetSym (sym%, x%, y%, fc%, bc%, pag%)
DECLARE SUB putsym (sym%, x%, y%, fc%, bc%, pag%)
DECLARE SUB RemoveCreat (i%)
DECLARE FUNCTION RollDice% CDECL (BYVAL a%, BYVAL b%, BYVAL c%)
DECLARE FUNCTION Confuse% CDECL (BYVAL num%, BYVAL num2%)
DECLARE FUNCTION BadMoveCreat% CDECL (BYVAL dx%, BYVAL dy%, BYVAL nn%, BYVAL cre%, SEG n%)
DECLARE FUNCTION Fatigu! ()
DECLARE FUNCTION creatnam$ (typ%, num%)
DECLARE FUNCTION Creature% (typ%, stat%)
DECLARE FUNCTION jnk$ (num%, strt%, leng%)
DECLARE FUNCTION Nc% ()
DECLARE FUNCTION Nf% ()
DECLARE FUNCTION cRd% CDECL (BYVAL x%, BYVAL y%)
DECLARE FUNCTION cRoll% CDECL (BYVAL max%)
DECLARE FUNCTION Terr$ (i%)
DECLARE FUNCTION Insect% (n%)
DECLARE FUNCTION Yuck% (n%)
DECLARE FUNCTION Plant% (n%)
DECLARE FUNCTION SameRoom% (x%, y%)
DECLARE FUNCTION Der$ (kil%, n%, i%)
DECLARE FUNCTION BerEff$ (i%)
DECLARE FUNCTION ssdnm$ (i%)
DECLARE FUNCTION lsdnm$ (i%)
DECLARE FUNCTION WepNm$ (i%)
DECLARE FUNCTION ShNm$ (i%)
DECLARE FUNCTION ArmNm$ (i%)
DECLARE FUNCTION kolr$ (i%)
DEFINT A-Z
REM $INCLUDE: 'alpha.dc2'
REM $INCLUDE: 'alpha.dec'
END
SUB DamSuit (i, dam)
SELECT CASE i
CASE 0 'kinetic
IF bulletsuit THEN dam = dam * .81
CASE 1 'radiat
IF (radsuit OR spacesuit) THEN dam = dam * .51
CASE 2 'heat, cold
IF (heatsuit OR spacesuit) THEN dam = dam * .51
CASE 3 'laser
IF sunglasses THEN dam = dam - 1
IF (reflecsuit OR spacesuit) THEN dam = dam * .51
IF sunscreen THEN dam = dam * .51: sunscreen = sunscreen - 1
CASE 4 'electr
IF wetsuit THEN dam = dam * .51
CASE 5 'acid
IF wetsuit THEN dam = dam * .71
CASE ELSE
END SELECT
remnum = 0: yup = false
FOR j = 1 TO ngoody
IF goody(j, 1) = -8 AND cRoll(300) = 1 THEN
lsdtyp = goody(j, 11)
SELECT CASE lsdtyp
CASE 1, 2, 3, 7, 18, 19, 20
SELECT CASE i
CASE 1: IF lsdtyp <> 1 AND lsdtyp <> 19 AND lsdtyp <> 7 THEN yup = true 'rad
CASE 2: IF lsdtyp <> 2 AND lsdtyp <> 1 THEN yup = true 'h/c
CASE 3: IF lsdtyp <> 3 AND lsdtyp <> 2 THEN yup = true 'laser
CASE 4: IF lsdtyp <> 7 AND lsdtyp <> 18 THEN yup = true 'elec
CASE 5: yup = true 'acid
CASE ELSE
END SELECT
END SELECT
IF yup THEN remnum = j: EXIT FOR
END IF
NEXT j
IF remnum > 0 THEN
ClearMess
LjnkBig 10, 61, 5, 207, 1, 19, gdy(remnum), 1, 1
FOR mmm = 1 TO ngoody
IF ABS(goody(mmm, 1)) = 7 AND goody(mmm, 11) = 16 AND goody(mmm, 3) > 0 THEN
IF cRoll(10) < 9 THEN ljnk 123, 13, 33, 2: nobrk = true
END IF
NEXT
IF NOT nobrk THEN l2 = STRING$(32, 88): RemoveGoody remnum, false
MessPause 11, 0
END IF
END SUB
SUB DarkMove (dx, dy)
' moves from localx to localx + dx , etc
' only works if |dx| <= 1, |dy| <=1
SELECT CASE dark
CASE -1: delx = 0: dely = 0: GOSUB offdm
CASE IS > 0
IF incastle <> 1 THEN
IF dx THEN
delx = -dark * dx
FOR dely = -dark TO dark
GOSUB offdm
NEXT dely
END IF
IF dy THEN
dely = -dark * dy
FOR delx = -dark TO dark
GOSUB offdm
NEXT delx
END IF
END IF
localx = localx + dx: localy = localy + dy
IF incastle THEN
IF incastle = -1 THEN savecorn = 0
FOR dely = -dark TO dark
FOR delx = -dark TO dark
GOSUB ondm
NEXT delx
NEXT dely
IF incastle = -1 THEN DotCorn
ELSE
IF dx THEN
delx = dark * dx
FOR dely = -dark TO dark
GOSUB ondm
NEXT dely
END IF
IF dy THEN
dely = dark * dy
FOR delx = -dark TO dark
GOSUB ondm
NEXT delx
END IF
END IF
localx = localx - dx: localy = localy - dy
END SELECT
GOTO edm
offdm:
x = localx + delx: y = localy + dely
IF x < 2 OR x > 51 OR y < 2 OR y > 21 THEN RETURN
GetSym sym, x, y, fc, bc, 1
SELECT CASE sym
CASE 15, 42, 176, 177, 65 TO 90, 97 TO 122, 249, 250
putsym 32, x, y, 7, 0, 1
CASE 126, 247
IF dark >= 0 THEN putsym 32, x, y, 7, 0, 1
END SELECT
RETURN
ondm:
x = localx + delx: y = localy + dely
IF x < 2 OR x > 51 OR y < 2 OR y > 21 THEN RETURN
IF SameRoom(delx, dely) THEN
GetSym sym, x, y, fc, bc, 2: GetSym sym9, x, y, fc9, bc9, 1
SELECT CASE sym
CASE trap, pit, gas, 215, 216
IF sym9 <> trap AND sym9 <> pit AND sym9 <> gas AND sym9 <> 215 AND sym9 <> 216 THEN sym = 250: fc = 8 + 2 * (incastle = 0): bc = 0 ELSE sym = sym9
CASE 65 TO 90, 97 TO 122
ch = BadMoveCreat%(delx, dely, nnear, 0, ncre(0, 0))
IF ch = 0 THEN
sym = 250: fc = 8 + 2 * (incastle = 0): bc = 0
ELSE
sym1 = ncre(ch, 8) MOD 1000: fc1 = ncre(ch, 8) \ 1000: bc1 = 0
IF sym1 = secretdoor THEN
GetSym sym1, x + 1, y, fc2, bc1, 2
IF fc2 = wallcolr THEN sym = hor ELSE sym = ver
END IF
IF fc1 = wallcolr THEN
savecorn = savecorn + 1: sym = sym9: fc = wallcolr: bc = 0
savcrn(savecorn, 1) = x: savcrn(savecorn, 2) = y
END IF
END IF
IF fc = 0 AND incastle THEN sym = sym9: fc = fc9: bc = bc9
CASE secretdoor
GetSym sym1, x + 1, y, fc1, bc1, 2
IF fc1 = wallcolr THEN sym = hor ELSE sym = ver
CASE um, lm, ml, mrt
savecorn = savecorn + 1: sym = sym9: fc = wallcolr
savcrn(savecorn, 1) = x: savcrn(savecorn, 2) = y
CASE cen
GetSym sym1, x + 1, y, fc1, bc, 2
GetSym sym1, x, y + 1, fc2, bc, 2
IF fc1 = wallcolr AND fc2 = wallcolr THEN
savecorn = savecorn + 1: sym = sym9: fc = wallcolr
savcrn(savecorn, 1) = x: savcrn(savecorn, 2) = y
END IF
END SELECT
putsym sym, x, y, fc, bc, 1
END IF
RETURN
edm:
END SUB
SUB EndScreen (number)
SCREEN , , 3, vpage: ccls 3
OPEN "alphaman.6" FOR BINARY AS #2
FOR num = 195 + number TO 210
st1 = SPACE$(74): GET #2, num * 74 - 73, st1
FOR k = 1 TO 74
MID$(st1, k, 1) = CHR$(ASC(MID$(st1, k, 1)) XOR (ABS(17 * num + 31 * k) MOD 256))
NEXT k
SELECT CASE num
CASE 195: c = 13
CASE 196 TO 199: c = 5
CASE 200 TO 204: c = 3
CASE 205: c = 11
CASE 210: c = 10
CASE ELSE: c = 9
END SELECT
COLOR c
LOCATE num - 193 - (num > 195) - 2 * (num > 199) - 2 * (num > 205) - 2 * (num > 209), 4 - 3 * (num = 195)
PRINT st1;
NEXT num
box 2, 79, 1 + number * 2, 8, 1, 5, 3
box 2, 79, 9, 16, 1, 3, 3
box 2, 79, 17, 22, 1, 1, 3
box 20, 61, 23, 25, 1, 2, 3
SCREEN , , 3
' PauseForKey 'Debug: ASP stuff for later?
' ccls 3: COLOR 9
' FOR num = 222 TO 230
' st1 = SPACE$(74): GET #2, num * 74 - 73, st1
' FOR k = 1 TO 74
' MID$(st1, k, 1) = CHR$(ASC(MID$(st1, k, 1)) XOR (ABS(17 * num + 31 * k) MOD 256))
' NEXT k
' LOCATE num - 217, 4: PRINT st1;
' NEXT num
' box 2, 79, 4, 14, 1, 1, 3
CLOSE #2: PauseForKey: SCREEN , , vpage
END SUB
SUB GotGrinch (beast)
IF beast THEN
a = 408: c = 52: d = 409: f = 53: notoxin = -1
finishedcastles = finishedcastles OR 32
ELSE
a = 410: c = 36: d = 414: f = 48: notoxin = 1
END IF
ljnk a, 1, c, 1: ljnk d, 1, f, 2: l3 = "": MessPause 12, 0: ClearMess
IF beast THEN
expr& = expr& + grinchstole + 40000 + 6& * CLNG(10800 - gt!)
Level newlev, b$: DisplayCharacter
IF newlev THEN ClearMess: LjnkBig 14, 26, 17, 0, 0, 0, STR$(lvl), 1, 1: MessPause 10, 0
grinchstole = 0
extrapoints$ = LTRIM$(STR$(6& * CLNG(10800 - gt!)))
timedone$ = LTRIM$(STR$(CINT(gt! / 60) - 8))
LjnkBig 395, 1, 48, 0, 0, 0, extrapoints$, 1, 1
LjnkBig 396, 1, 24, 396, 24, 6, timedone$, 1, 2
MessPause 13, 0: ClearMess
EndScreen 0: ClearMess
ljnk 407, 27, 40, 2: PrintMessage 13, 0: PauseForKey: ClearMess
IF UCASE$(st1) = "Y" THEN
ljnk 416, 1, 32, 2: MessPause 14, 0: st1 = jnk$(406, 53, 10): Dead 3
ELSE
PrintMessage 14, 0
END IF
ELSE
expr& = expr& + 5000: ClearMess: Level newlev, b$: DisplayCharacter
IF newlev THEN LjnkBig 14, 26, 17, 0, 0, 0, STR$(lvl), 1, 1: MessPause 10, 0
END IF
FOR i = nnear TO 1 STEP -1
ncre(i, 11) = ncre(i, 11) AND (NOT 1)
IF (ncre(i, 1) = gdog) OR (ncre(i, 1) = grinch) THEN RemoveCreat i
NEXT i
END SUB
SUB Lightning
SCREEN , , 1: vpage = 1: done = false
looplight:
xlight = cRoll(50) + 1: ylight = cRoll(20) + 1: ClearMess
GetSym sym, xlight, ylight, fc, bc, 2: fc2 = fc
SELECT CASE sym
CASE 1, 65 TO 90, 97 TO 122 'player, critters
CASE 15, 42, 10, 19, 215, 216 'flora, traps, webs
CASE 22, 254, 24, 8, 9, 5, 236, 11, 12, 21, 157 'items
CASE 147, 167, 18, 29, 145, 234, 225, 35 'special items
CASE ELSE: GOTO looplight
END SELECT
IF fc = 3 THEN fc2 = 11
putsym sym, xlight, ylight, fc2, 3, 1
ljnk 161, 57, 10, 2: MessPause 11, 0
SELECT CASE sym
CASE 1: putsym sym, xlight, ylight, fc, bc, 1 'player
CASE 65 TO 90, 97 TO 122 'critters
ch = BadMoveCreat%(xlight - localx, ylight - localy, nnear, 0, ncre(0, 0))
IF (ncre(ch, 10) AND 4) = 0 THEN
ncre(ch, 2) = ncre(ch, 2) - RollDice(8, lvl + 2, lvl + 2)
IF ncre(ch, 2) < 0 THEN ncre(ch, 2) = -2000 'sign to remove
END IF
putsym 32, xlight, ylight, 7, 0, -1
CASE 15, 42 'flora
IF bc = 4 THEN goodythere(mainx, mainy) = goodythere(mainx, mainy) AND (NOT 256)
putsym 32, xlight, ylight, 7, 0, -1
CASE 22, 254, 24, 8, 9, 5, 236, 11, 12, 21, 157, 147, 167, 18, 29, 145, 234, 225, 35
RemoveLocalGoody xlight, ylight, dropped
putsym 32, xlight, ylight, 7, 0, -1
CASE 215, 216, trap, pit: putsym 32, xlight, ylight, 7, 0, 1 'webs, etc
END SELECT
d = cRd(xlight - localx, ylight - localy)
SELECT CASE d
CASE 0: siz = 8: num = lvl + 2
CASE 1: siz = 5: num = lvl + 1
CASE 2: siz = 4: num = (lvl + 1) / 2
CASE ELSE: siz = 0
END SELECT
IF siz > 0 THEN
IF num < 1 THEN num = 1
damg = RollDice(siz, num * 1.5, num): IF wetsuit THEN damg = damg * .51
hits = hits - damg: ShowHits
IF hits < 0 THEN st1 = jnk$(162, 1, 25): Dead 0
END IF
FOR i = nnear TO 1 STEP -1
IF ncre(i, 2) < -999 THEN RemoveCreat i
NEXT i
END SUB
SUB MapLevel
IF incastle = -1 THEN
FOR ll1 = lwall TO rwall: FOR ll2 = twall TO bwall
GetSym ss, ll1, ll2, fc, bc, 2: IF ss = secretdoor THEN ss = cen
putsym ss, ll1, ll2, fc, bc, -1
NEXT ll2, ll1
ELSE 'include incastle=0 for webs, traps
FOR ll1 = 2 TO 51: FOR ll2 = 2 TO 21
GetSym ss, ll1, ll2, fc, bc, 2: IF ss = secretdoor THEN ss = cen
putsym ss, ll1, ll2, fc, bc, -1
NEXT ll2, ll1
END IF
FOR ll1 = 1 TO nnear
IF localx + ncre(ll1, 4) > 0 AND localx + ncre(ll1, 4) < 52 THEN
IF localy + ncre(ll1, 5) > 0 AND localy + ncre(ll1, 5) < 22 THEN
sym = ncre(ll1, 7) MOD 1000: fc = ncre(ll1, 7) \ 1000: bc = 0
IF fc = 0 THEN fc = 8: bc = 8
putsym sym, localx + ncre(ll1, 4), localy + ncre(ll1, 5), fc, bc, 1
END IF
END IF
NEXT ll1
vpage = 1: SCREEN , , 1
END SUB
SUB Move (num)
'return num=1070 if doing trap in A1 is okay
IF inpit OR inweb OR inglue OR inbog OR insand THEN
ClearMess
IF inpit THEN
chan! = (str + stradd + dex + dexadd) / 200: bootsadd = 3: a = -2: b = 64: c = 3
ELSEIF inbog THEN
chan! = (str + stradd + dex + dexadd) / 200: bootsadd = 1: a = 378: b = 61: c = 6
ELSEIF insand THEN
chan! = (str + stradd) / 100: bootsadd = 1: a = 384: b = 39: c = 9
ELSEIF inglue THEN
chan! = (str + stradd) / 150: bootsadd = 2: a = 163: b = 58: c = 4
ELSE
chan! = (str + stradd) / 70: bootsadd = 0: a = 160: b = 55: c = 3
END IF
IF chan! < .03 THEN chan! = .03
st1 = jnk$(a, b, c)
IF RND > chan! - (boots <> 0) * bootsadd / 3! THEN
LjnkBig 84, 38, 25, 0, 0, 0, st1 + "!", 1, 1: MessPause 10, 0
fatadd! = 5: IF fatadd! < 1.5 * fatig! THEN fatadd! = 1.5 * fatig!
GOTO mve
ELSE
inpit = false: inweb = false: inglue = false: inbog = false: insand = false
LjnkBig 58, 1, 23, 0, 0, 0, st1, 1, 1: MessPause 7, 0
END IF
END IF
IF inwater THEN
ClearMess
IF (NOT wetsuit) AND cRoll(50) < (dex + dexadd) THEN
ljnk 84, 38, 31, 1: MessPause 11, 0
fatadd! = 15: IF fatadd! < 3 * fatig! THEN fatadd! = 3 * fatig!
GOTO mve
ELSE
inwater = false: waterturns = 0
ljnk 58, 1, 29, 1: ljnk 58, 30, 35, 2: MessPause 14, 0
END IF
END IF
vpage = 1: dx = 0: dy = 0
SELECT CASE num
CASE 1071: dx = -1: dy = -1 'home
CASE 1072: dy = -1 'up
CASE 1073: dx = 1: dy = -1 'PgUp
CASE 1075: dx = -1 'left
CASE 1077: dx = 1 'right
CASE 1079: dx = -1: dy = 1 'end
CASE 1080: dy = 1 'down
CASE 1081: dx = 1: dy = 1 'PgDn
END SELECT
IF attractx OR attracty THEN
dx = attractx: dy = attracty: attractx = 0: attracty = 0: DumpBuffer
END IF
newx = localx + dx: newy = localy + dy
GetSym sym, newx, newy, fc, bc, 2
GetSym sym1, newx, newy, fc1, bc1, 1
IF (sym > 64 AND sym < 91) OR (sym > 96 AND sym < 123) THEN
AttackCreat dx, dy: num = 1070: GOTO mve
END IF
IF repulse THEN ClearMess: ljnk 124, 14, 45, 1: MessPause 14, 0: GOTO mve
IF grabbed THEN
ClearMess
ljnk 240, 9, 26, 1: ljnk 240, 35, 29, 2: PrintMessage 10, 0
didstuff = false: ClearMess: DumpBuffer: GOTO mve
END IF
IF newx < 2 THEN
newx = 51: dmx = -1: firstlocal = true
ELSEIF newx > 51 THEN
newx = 2: dmx = 1: firstlocal = true
END IF
IF newy < 2 THEN
newy = 21: dmy = -1: firstlocal = true
ELSEIF newy > 21 THEN
newy = 2: dmy = 1: firstlocal = true
END IF
IF firstlocal THEN
DumpBuffer
okay = (mainx + dmx < 52 AND mainx + dmx > 1 AND mainy + dmy > 1 AND mainy + dmy < 22)
IF okay THEN 'to change main screens
FOR i = 1 TO nnear: ncre(i, 4) = ncre(i, 4) - dx: ncre(i, 5) = ncre(i, 5) - dy: NEXT i
localx = newx: localy = newy: MoveMain dmx, dmy
IF terrain = 247 THEN 'If in h2o,
FOR i = nnear TO 1 STEP -1 'remove landlubbers
IF (ncre(i, 1) <= ncreat + creextra - creh2o) OR (ncre(i, 1) > ncreat + creextra) THEN RemoveCreat i
NEXT i
ELSE 'not in h2o
FOR i = nnear TO 1 STEP -1 'remove sea critters
IF (ncre(i, 1) > ncreat + creextra - creh2o) AND (ncre(i, 1) <= ncreat + creextra) THEN RemoveCreat i
NEXT i
END IF
DetailedMap false
firstlocal = false
SCREEN , , 1: vpage = 1: ClearMess: DisplayCharacter
ljnk 59, 1, 13, 4: PrintMessage 7, 0: GOTO mve
ELSE
didstuff = false: ClearMess
ljnk 59, 14, 36, 2: PrintMessage 12, 0: GOTO mve
END IF
END IF
dropped = false: fatadd! = fatig!
SELECT CASE sym 'sym is from screen 2; sym1 is from screen 1
CASE 32, 250
CASE 15 'tree
num = 1070: DumpBuffer
fatadd! = 8 + fatadd!
IF bc = 4 OR bc = 12 THEN
GOSUB bertree
ELSE
IF RND < .5 THEN
IF dark < 0 THEN putsym 15, newx, newy, fc, bc, 1
GOTO mve
END IF
IF fc < 8 THEN
putsym 42, newx, newy, fc + 8, 0, -1
ELSE
putsym 15, newx, newy, fc - 8, 0, -1
END IF
END IF
GOTO mve
CASE 42 'bush
num = 1070: fatadd! = 5 + fatadd!: DumpBuffer
IF bc = 4 OR bc = 12 THEN
GOSUB bertree
ELSE
IF RND < .5 THEN
IF dark < 0 THEN putsym 42, newx, newy, fc, bc, 1
GOTO mve
END IF
IF fc < 8 THEN
putsym 32, newx, newy, fc, 0, -1
ELSE
putsym 42, newx, newy, fc - 8, 0, -1
END IF
END IF
GOTO mve
CASE 176 'marsh
fatadd! = fatadd! + 4
CASE 247, 126 'water
DumpBuffer
IF wetsuit THEN
fatadd! = fatadd! + 3
ELSE
fatadd! = 15: IF fatadd! < 3 * fatig! THEN fatadd! = 3 * fatig!
l1 = bl: ljnk 59, 50, 16, 2: ljnk 60, 1, 44, 3
PrintMessage 9, 0: inwater = true
END IF
CASE 22 'spam
DumpBuffer
IF ngoody = 20 AND ABS(goody(1, 1)) <> 1 GOTO noroom
fatadd! = fatadd! + 1: GOSUB movething: ngoody = ngoody - 1: AddSpam
SortGoody
CASE 254 'beef
DumpBuffer
IF ngoody = 20 AND ABS(goody(1, 1)) <> 2 AND ABS(goody(2, 1)) <> 2 GOTO noroom
fatadd! = fatadd! + 1: GOSUB movething: ngoody = ngoody - 1: AddBeef
SortGoody
CASE 24 'wep
DumpBuffer
IF ngoody = 20 GOTO noroom
fatadd! = fatadd! + 2: GOSUB movething: DetermineWep dropped
SortGoody
CASE 8 'armor
DumpBuffer
IF ngoody = 20 GOTO noroom
fatadd! = fatadd! + 3: GOSUB movething: DetermineArmor dropped
SortGoody
CASE 9 'shield
DumpBuffer
IF ngoody = 20 GOTO noroom
fatadd! = fatadd! + 2: GOSUB movething: DetermineShield dropped
SortGoody
CASE 5, 236 'berry
DumpBuffer
IF ngoody = 20 GOTO noroom
fatadd! = fatadd! + 1: GOSUB movething: DetermineBerry dropped
SortGoody
CASE 11, 12 'ssd
DumpBuffer
IF ngoody = 20 GOTO noroom
fatadd! = fatadd! + 2: GOSUB movething: DetermineSSD dropped
SortGoody
CASE 21, 157 'lsd
DumpBuffer
IF ngoody = 20 GOTO noroom
fatadd! = fatadd! + 4: GOSUB movething: DetermineLSD dropped
SortGoody
CASE 128, 135 'tech parts
DumpBuffer
IF ngoody = 20 GOTO noroom
fatadd! = fatadd! + 4: GOSUB movething: DetermineParts dropped
SortGoody
CASE 147, 167, 18, 29, 145, 234, 225, 35
' hat,serum, map, shoes,suit,rbeast,braft
DumpBuffer
IF ngoody = 20 GOTO noroom
fatadd! = fatadd! + 2: GOSUB movething: dropped = 1
SELECT CASE sym
CASE 147
SELECT CASE fc
CASE 1: typ = 8 'mets hat
CASE 15: typ = 1 'skipper hat
CASE ELSE: typ = 9 'Ivana wig
END SELECT
CASE 167: typ = 2 'serum
CASE 18, 29: typ = 3 'map
finishedcastles = finishedcastles OR 2
CASE 145: dropped = 2: typ = 4 'bsshoes
CASE 234: dropped = 10: typ = 5 'spacesuit
CASE 225: typ = 6 'rbeast
CASE 35: dropped = 15: typ = 7 'bamboo raft
END SELECT
DetermineSpecial dropped, typ 'actually, dropped=mass
SortGoody
CASE hor, ver, ur, ul, lr, ll
IF dark < 0 THEN putsym sym, newx, newy, wallcolr, 0, 1
didstuff = false: GOTO mve
CASE 219 ' rubble
putsym 219, newx, newy, wallcolr, 0, 1: didstuff = false: GOTO mve
CASE um, mrt, ml, lm
IF dark < 0 THEN
SELECT CASE sym
CASE um: numb = 11
CASE mrt: numb = 13
CASE ml: numb = 14
CASE lm: numb = 7
END SELECT
IF (currsym = cen) AND (dx * dy = 0) THEN numb = 3 - 9 * (dy <> 0)
SELECT CASE sym1
CASE hor: numb1 = 3
CASE ver: numb1 = 12
CASE ul: numb1 = 10
CASE ur: numb1 = 9
CASE ll: numb1 = 6
CASE lr: numb1 = 5
CASE um: numb1 = 11
CASE mrt: numb1 = 13
CASE ml: numb1 = 14
CASE lm: numb1 = 7
CASE ELSE: numb1 = 0
END SELECT
dir = 0
IF (dx = -1) THEN dir = dir OR 1
IF (dx = 1) THEN dir = dir OR 2
IF (dy = -1) THEN dir = dir OR 4
IF (dy = 1) THEN dir = dir OR 8
fc = wallcolr
IF dir = 1 OR dir = 2 THEN
numb = 12
ELSEIF dir = 4 OR dir = 8 THEN
numb = 3
ELSEIF ((dir AND numb) = 1) OR ((dir AND numb) = 2) OR ((dir AND numb) = 4) OR ((dir AND numb) = 8) THEN
numb = numb AND (NOT dir)
ELSEIF (numb AND 3) = 3 THEN
numb = 3
ELSEIF (numb AND 12) = 12 THEN
numb = 12
END IF
numb = numb OR numb1
SELECT CASE numb
CASE 3: sym = hor
CASE 12: sym = ver
CASE 10: sym = ul
CASE 9: sym = ur
CASE 6: sym = ll
CASE 5: sym = lr
END SELECT
putsym sym, newx, newy, fc, 0, 1
END IF
didstuff = false: GOTO mve
CASE secretdoor
IF dark < 0 THEN
GetSym symm, newx + 1, newy, fc, bc, 2
IF fc = wallcolr THEN symm = hor ELSE symm = ver
putsym symm, newx, newy, wallcolr, 0, 1
END IF
didstuff = false: GOTO mve
CASE cen
DumpBuffer
IF incastle THEN
GetSym sy, newx + 1, newy, fc21, bc21, 2
IF sy = 1 THEN fc21 = currf
GetSym sy, newx, newy + 1, fc22, bc21, 2
IF sy = 1 THEN fc22 = currf
GetSym sy, newx, newy - 1, fc23, bc21, 2
IF sy = 1 THEN fc23 = currf
GetSym sy, newx - 1, newy, fc24, bc21, 2
IF sy = 1 THEN fc22 = currf
IF (fc21 = 9 AND (fc22 = 9 OR fc23 = 9)) OR (fc24 = 9 AND (fc22 = 9 OR fc23 = 9)) THEN
IF dark < 0 THEN
SELECT CASE dx + 10 * dy
CASE -11: putsym ul, newx, newy, wallcolr, 0, 1
CASE -9: putsym ur, newx, newy, wallcolr, 0, 1
CASE 9: putsym ll, newx, newy, wallcolr, 0, 1
CASE 11: putsym lr, newx, newy, wallcolr, 0, 1
END SELECT
END IF
didstuff = false: GOTO mve
END IF
END IF
IF incastle = 0 THEN
FOR kl = 1 TO ngoody
IF ABS(goody(kl, 1)) = 8 THEN
typ = goody(kl, 11)
IF typ = 4 OR typ = 10 OR typ = 12 THEN
ClearMess
LjnkBig 10, 61, 5, 231, 41, 27, gdy(kl), 1, 2
MessPause 11, 0: GOTO mve
END IF
END IF
NEXT kl
SaveMaps 0: EnterCastle
newx = localx: newy = localy: DrawDungeon: dx = 0: dy = 0
KillBadMaps 1
ELSE
IF newx <= lwall OR newx >= rwall OR newy <= twall OR newy >= bwall THEN
SaveMaps -1: LeaveCastle
newx = localx: newy = localy: dx = 0: dy = 0
DetailedMap true: DisplayCharacter
ELSE
IF dark = 0 THEN
IF fc21 = wallcolr THEN ddx = 0: ddy = dy ELSE ddy = 0: ddx = dx
cx = newx + ddx: cy = newy + ddy
SWAP newx, localx: SWAP newy, localy
FOR i = 1 TO nnear
ncre(i, 4) = ncre(i, 4) - dx: ncre(i, 5) = ncre(i, 5) - dy
IF SameRoom(ncre(i, 4), ncre(i, 5)) THEN
crtyp = ncre(i, 1)
IF RND < .9 + (crtyp = elvis OR crtyp = elvimp OR crtyp = gill OR crtyp = puff) THEN Awaken i
END IF
NEXT i
savecorn = 0: DotIt cx, cy: DotCorn
FOR i = 1 TO nnear
ncre(i, 4) = ncre(i, 4) + dx: ncre(i, 5) = ncre(i, 5) + dy
NEXT i
SWAP newx, localx: SWAP newy, localy
ELSE
SWAP localx, newx: SWAP localy, newy
IF dark < 0 THEN
putsym cen, localx, localy, fc, bc, 1
ELSE
ChangeDark
END IF
FOR i = 1 TO nnear
ncre(i, 4) = ncre(i, 4) - dx: ncre(i, 5) = ncre(i, 5) - dy
IF SameRoom(ncre(i, 4), ncre(i, 5)) THEN
IF RND < .9 + (ncre(i, 1) = elvis OR ncre(i, 1) = elvimp OR ncre(i, 1) = gill) THEN Awaken i
END IF
ncre(i, 4) = ncre(i, 4) + dx: ncre(i, 5) = ncre(i, 5) + dy
NEXT i
SWAP localx, newx: SWAP localy, newy
END IF
END IF
END IF
CASE lockeddoor
IF dark < 0 THEN putsym lockeddoor, newx, newy, wallcolr, 0, 1
num = 1070: DumpBuffer
fatadd! = fatadd! + 2
zz = lvl + (str + stradd + dex + dexadd) / 2 + intl / 3
IF zz < 6 THEN zz = 7 ELSE IF zz > 50 THEN zz = 50
IF berscience THEN zz = 120
IF (mmut = 2 AND bermmut = 0) THEN zz = zz * (2 - 2 * (berhmmut > 0))
IF incastle = 0 AND castle = 6 THEN zz = -1
IF cRoll(120) < zz THEN putsym cen, newx, newy, wallcolr, 0, -1
GOTO mve
CASE 240 'stairs
IF dark < 0 THEN putsym 240, newx, newy, fc, 0, 1
DumpBuffer
ClearMess
IF fc = 13 THEN b = 45: c = 9 ELSE b = 54: c = 11
IF incastle <> -1 THEN b = 65: c = 4
ljnk 60, b, c, 1: PrintMessage fc, 0
CASE pit
putsym pit, newx, newy, fc, 0, 1
IF NOT boots THEN Pitt fc: fatadd! = fatadd! + 3
CASE trap
IF fc = 10 THEN
putsym gas, newx, newy, 8, 0, -1
ELSE
putsym trap, newx, newy, fc, 0, 1
END IF
Trapp fc: fatadd! = fatadd! + 2
IF fc < 0 THEN newx = localx: newy = localy: dx = 0: dy = 0 'telep
CASE 215, 216 'webs
fatadd! = fatadd! + 3
putsym sym, newx, newy, 8, 0, 1
inweb = true: ClearMess: ljnk 161, 34, 23, 2: MessPause 7, 0
putsym currsym, localx, localy, currf, currb, -1
crtyp = webspid: xweb = newx: yweb = newy
MakeCreature (xweb), (yweb), false, false
Awaken nnear: EraseCreat nnear: PutCreat nnear
CASE 1: putsym 250, newx, newy, 8, 0, -1: didstuff = false: GOTO mve
CASE gas
putsym gas, newx, newy, 8, 0, 1: fatadd! = fatadd! + 4: DumpBuffer
dic = (20 - con) / 3 + lvl / 2: IF dic < 1 THEN dic = 1
dam = RollDice(4, dic, dic): ClearMess: ljnk 157, 34, 19, 2
IF (pmut = 7 AND berpmut = 0) THEN dam = (dam + 1) / (2 - 2 * (berhpmut > 0))
IF gasmask OR spacesuit THEN dam = 0: l2 = bl ELSE hits = hits - dam
IF hits < 0 THEN MessPause 8, 0: st1 = jnk$(157, 53, 10): Dead 0: GOTO mve
PrintMessage 8, 0
CASE monosym: ljnk 160, 58, 8, 1: ljnk 406, 37, 16, 2: PrintMessage 11, 0
CASE chasm: IF NOT bsshoes THEN hits = -hitmax - 999: st1 = jnk$(336, 51, 18): Dead 0
END SELECT
mv:
putsym currsym, localx, localy, currf, currb, -1
IF dark THEN DarkMove dx, dy
localx = newx: localy = newy
GetSym currsym, localx, localy, currf, currb, 2
IF invisible THEN fc = 8 ELSE fc = 15
putsym 1, localx, localy, fc, 0, -1
FOR i = 1 TO nnear
ncre(i, 4) = ncre(i, 4) - dx: ncre(i, 5) = ncre(i, 5) - dy
NEXT i
tentgrab = 0
GOTO mve
noroom: ClearMess: ljnk 57, 25, 29, 2
PrintMessage 7, 0: fatadd! = 0: GOTO mv
bertree:
zz = cRoll(90) + lvl
IF zz > 80 THEN
goodythere(mainx, mainy) = goodythere(mainx, mainy) AND (NOT 256)
LjnkBig 238, 52, 13, 238, 38, 14, bl, 2, 1
putsym 32, newx, newy, 7, 0, -1
typ = cRoll(nberry)
numbr = 2 + cRoll(2): IF sym = 15 THEN numbr = numbr + cRoll(3)
FOR bbb = 1 TO numbr
retryber: xb = newx + cRoll(3) - 2
yb = newy + cRoll(3) - 2
GetSym sb, xb, yb, fb, bb, 2
SELECT CASE sb
CASE 32, 249, 250, 176
putsym 5, xb, yb, 12, 0, -1
AddToDrop -typ: drgoody(1, 15) = xb: drgoody(1, 16) = yb
CASE ELSE
IF cRoll(5) <> 1 GOTO retryber
END SELECT
NEXT bbb
ELSE
ljnk 238, 31, 21, 1: ljnk 239, 1, 24, 2
dam = RollDice(lvl - 4 * (sym = 15), 2, 1)
IF INT(RND * 2) THEN dam = 1
hits = hits - dam
IF hits < 0 THEN MessPause 12, 0: st1 = "a" + jnk$(239, 4, 10): Dead 0
END IF
MaybeMessPause 10, 0
RETURN
movething:
RemoveLocalGoody newx, newy, dropped: ngoody = ngoody + 1
IF incastle THEN
putsym 250, newx, newy, 8, 0, -1
ELSE
putsym 32, newx, newy, 7, 0, -1
END IF
fatig! = Fatigu!
RETURN
mve:
END SUB
SUB Ride (num, dis)
inpit = false: inweb = false: inglue = false: inbog = false: insand = false
IF inwater THEN
ClearMess
IF (NOT wetsuit) AND RND < 1 - dex / 50 THEN
fatadd! = 15: IF fatadd! < 3 * fatig! THEN fatadd! = 3 * fatig!
ljnk 84, 38, 31, 1: MessPause 11, 0: EXIT SUB
ELSE
inwater = false: waterturns = 0
ljnk 58, 1, 29, 1: ljnk 58, 30, 35, 2: MessPause 14, 0
END IF
END IF
vpage = 1: dx = 0: dy = 0
IF vehicle = 4 THEN num = Confuse(num, 2)
IF vehicle = 7 THEN num = Confuse(num, 2)
SELECT CASE num
CASE 1071: dx = -1: dy = -1 'home
CASE 1072: dy = -1 'up
CASE 1073: dx = 1: dy = -1 'PgUp
CASE 1075: dx = -1 'left
CASE 1077: dx = 1: 'right
CASE 1079: dx = -1: dy = 1 'end
CASE 1080: dy = 1 'down
CASE 1081: dx = 1: dy = 1 'PgDn
END SELECT
IF attractx OR attracty THEN
dx = attractx: dy = attracty: attractx = 0: attracty = 0: DumpBuffer
END IF
IF vehicle = 7 AND cRoll(18) = 1 THEN
FOR i = ngoody TO 1 STEP -1
IF goody(i, 1) = -9 AND goody(i, 3) = 7 THEN braft = i
NEXT i
IF braft THEN
goody(braft, 4) = goody(braft, 4) - 1: ClearMess: ljnk 410, 49, 20, 1
IF goody(braft, 4) <= 0 THEN
ljnk 408, 53, 14, 2: RemoveGoody braft, false: vehicle = 0: turbo! = 1
IF (currsym = 247 OR currsym = 126) AND (wetsuit = 0) THEN inwater = true
END IF
MessPause 6, 0
END IF
dx = 0: dy = 0: dis = 0
END IF
FOR i = 1 TO dis
newx = localx + dx: newy = localy + dy: GetSym sym, newx, newy, fc, bc, 2
IF ((sym > 64 AND sym < 91) OR (sym > 96 AND sym < 123)) THEN
IF vehicle <> 2 THEN AttackCreat dx, dy: EXIT FOR
i = i - 1
END IF
IF repulse THEN ClearMess: ljnk 124, 14, 45, 1: MessPause 14, 0: EXIT FOR
IF grabbed THEN
ClearMess
ljnk 240, 9, 26, 1: ljnk 240, 35, 29, 2
MessPause 10, 0: ClearMess: DumpBuffer: EXIT FOR
END IF
IF vehicle = 5 OR vehicle = 6 OR vehicle = 7 THEN
SELECT CASE sym
CASE 247, 126, 179, 191, 192, 196, 217, 218 'water or border
CASE ELSE: IF cRoll(2) = 1 GOTO nxrid
END SELECT
END IF
IF newx < 2 THEN
newx = 51: dmx = -1: firstlocal = true
ELSEIF newx > 51 THEN
newx = 2: dmx = 1: firstlocal = true
END IF
IF newy < 2 THEN
newy = 21: dmy = -1: firstlocal = true
ELSEIF newy > 21 THEN
newy = 2: dmy = 1: firstlocal = true
END IF
IF firstlocal THEN
DumpBuffer
IF mainx + dmx < 52 AND mainx + dmx > 1 AND mainy + dmy > 1 AND mainy + dmy < 22 THEN okay = true ELSE okay = false
IF okay THEN
FOR j = 1 TO nnear: ncre(j, 4) = ncre(j, 4) - dx: ncre(j, 5) = ncre(j, 5) - dy: NEXT j
localx = newx: localy = newy: MoveMain dmx, dmy
IF terrain = 247 THEN 'If in h2o,
FOR j = nnear TO 1 STEP -1 'remove landlubbers
IF (ncre(j, 1) <= ncreat + creextra - creh2o) OR (ncre(j, 1) > ncreat + creextra) THEN RemoveCreat j
NEXT j
ELSE 'not in h2o
FOR j = nnear TO 1 STEP -1 'remove sea critters
IF (ncre(j, 1) > ncreat + creextra - creh2o) AND (ncre(j, 1) <= ncreat + creextra) THEN RemoveCreat j
NEXT j
END IF
DetailedMap false
firstlocal = false
SCREEN , , 1: vpage = 1: ClearMess: DisplayCharacter
ljnk 59, 1, 13, 4: PrintMessage 7, 0: GOTO nxrid
ELSE
ClearMess
ljnk 59, 14, 36, 2: PrintMessage 12, 0: EXIT FOR
END IF