-
Notifications
You must be signed in to change notification settings - Fork 6
/
A4.BAS.txt
1569 lines (1488 loc) · 55 KB
/
A4.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 FUNCTION LoadMaps% (mode%)
DECLARE SUB MaybeMessPause (fc%, bc%)
DECLARE SUB clpage2 ()
DECLARE SUB CrDamAlter (num%, dam%, damtype%)
DECLARE SUB GotGrinch (beast%)
DECLARE SUB Awaken (i%)
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 DamSuit (typ%, dam%)
DECLARE SUB CreatSort CDECL (BYVAL nnear%, tentgrab%, SEG nn%)
DECLARE SUB cMainMap CDECL (BYVAL irnd%, BYVAL jrnd%)
DECLARE SUB cDetailedMap CDECL (BYVAL t%, BYVAL t1%, BYVAL t2%, BYVAL t3%, BYVAL t4%)
DECLARE SUB CrDef (ch%, atktyp%, Roll%, missspec%, r%)
DECLARE SUB ccls CDECL (BYVAL pag%)
DECLARE SUB ffEffect (damage%, ffkill%)
DECLARE SUB SetDark (dark%, olddark%, changed%)
DECLARE SUB AddToDrop (i%)
DECLARE SUB SetCombatStats ()
DECLARE SUB ChangeDark ()
DECLARE SUB KillCreat (i%)
DECLARE SUB Explode (dx%, dy%, dam%, damtype%, need%, r!, slf%, clr%, div%)
DECLARE SUB mphk (ch%, atktyp%)
DECLARE SUB Level (diff%, b$)
DECLARE SUB RemoveCreat (i%)
DECLARE SUB TargetLong (lsym%, range!, nlx%, nly%, fc%, bc%)
DECLARE SUB DetailedMap (loadmappossible%)
DECLARE SUB MakeCreature (x%, y%, border%, fake%)
DECLARE SUB MakeStuff (i%)
DECLARE SUB DisplayGoodies (p%)
DECLARE SUB DisplayCharacter ()
DECLARE SUB Dead (spec%)
DECLARE SUB PutCreat (i%)
DECLARE SUB ShowHits ()
DECLARE SUB ShiftDropped (rm%)
DECLARE SUB EraseCreat (i%)
DECLARE SUB PauseForKey ()
DECLARE SUB FindDot CDECL (x%, y%, BYVAL i%)
DECLARE SUB DumpBuffer ()
DECLARE SUB MessPause (fc%, bc%)
DECLARE SUB ClearMess ()
DECLARE SUB PutSym (sym%, col%, row%, fcolr%, bcolr%, pag%)
DECLARE SUB GetSym (sym%, col%, row%, fcolr%, bcolr%, pag%)
DECLARE SUB PrintMessage (fcolr%, bcolr%)
DECLARE FUNCTION RollDice% CDECL (BYVAL dsize%, BYVAL nroll%, BYVAL nuse%)
DECLARE SUB Box CDECL (BYVAL lc%, BYVAL rc%, BYVAL tc%, BYVAL bc%, BYVAL nl%, BYVAL fclr%, BYVAL pag%)
DECLARE SUB cRandomize CDECL (BYVAL seed!)
DECLARE FUNCTION BadMoveCreat% CDECL (BYVAL dx%, BYVAL dy%, BYVAL n%, BYVAL c%, SEG nn%)
DECLARE FUNCTION CreatNam$ (typ%, num%)
DECLARE FUNCTION Creature% (typ%, stat%)
DECLARE FUNCTION jnk$ (num%, strt%, leng%)
DECLARE FUNCTION cRd% CDECL (BYVAL x%, BYVAL y%)
DECLARE FUNCTION cRoll% CDECL (BYVAL max%)
DECLARE FUNCTION Terr$ (i%)
DECLARE FUNCTION Insect% (num%)
DECLARE FUNCTION Plant% (num%)
DECLARE FUNCTION Yuck% (num%)
DECLARE FUNCTION SameRoom% (ddx%, ddy%)
DECLARE FUNCTION Der$ (kil%, num%, 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 pmutnm$ (i%)
DECLARE FUNCTION mmutnm$ (i%)
DECLARE FUNCTION Kolr$ (i%)
REM $INCLUDE: 'alpha.dc2'
REM $INCLUDE: 'alpha.dec'
mut: DATA 21, 20, 19, 17, 17, 12, 22, 15, 16, 20, 9, 13, 12, 16, 20, 6, 9
mmmut: DATA 15, 17, 20, 12, 13, 14, 11, 20, 10, 12, 10, 8, 13
END
DEFINT A-Z
SUB AddBeef
IF goody(1, 1) = 2 THEN
goody(1, 3) = goody(1, 3) + 1
ELSEIF goody(2, 1) = 2 THEN
goody(2, 3) = goody(2, 3) + 1
ELSE
ngoody = ngoody + 1: goody(ngoody, 1) = 2
goody(ngoody, 2) = 0: goody(ngoody, 3) = 1
gdy(ngoody) = jnk$(1, 23, 11)
END IF
ClearMess
ljnk 1, 1, 33, 2: PrintMessage 6, 0
IF rdisp <> 1 THEN DisplayGoodies false
END SUB
SUB AddSpam
IF ABS(goody(1, 1)) = 1 THEN
goody(1, 3) = goody(1, 3) + 1
ELSE
ngoody = ngoody + 1: goody(ngoody, 1) = 1
goody(ngoody, 2) = 0: goody(ngoody, 3) = 1
gdy(ngoody) = "Spam"
END IF
ClearMess
Ljnkbig 1, 1, 22, 0, 0, 0, "Spam", 1, 2: PrintMessage 13, 0
IF rdisp <> 1 THEN DisplayGoodies false
END SUB
SUB AddToDrop (i)
IF ndropped = 30 THEN
IF ABS(drgoody(30, 1)) = 8 AND drgoody(30, 11) = 8 THEN 'safe
FOR j = 1 TO 16: SWAP drgoody(25, j), drgoody(30, j): NEXT
SWAP drgdy(25), drgdy(30)
END IF
IF drgoody(30, 13) = mainx AND drgoody(30, 14) = mainy THEN
PutSym 250, drgoody(30, 15), drgoody(30, 16), 8, 0, -1
END IF
ndropped = 29
END IF
FOR j = ndropped TO 1 STEP -1
drgdy(j + 1) = drgdy(j)
FOR k = 1 TO 16: drgoody(j + 1, k) = drgoody(j, k): NEXT k
NEXT j
ndropped = ndropped + 1
FOR ijk = 1 TO 12: drgoody(1, ijk) = 0: NEXT ijk
drgoody(1, 13) = mainx: drgoody(1, 14) = mainy
SELECT CASE i
CASE IS > 0 'dropped from character,pack,safe
SELECT CASE i
CASE IS > ngoody + npack: drgdy(1) = saf(i - ngoody - npack)
FOR j = 1 TO 12: drgoody(1, j) = safe(i - ngoody - npack, j): NEXT j
CASE IS > ngoody: drgdy(1) = bakpak(i - ngoody)
FOR j = 1 TO 12: drgoody(1, j) = backpack(i - ngoody, j): NEXT j
CASE ELSE: drgdy(1) = gdy(i)
FOR j = 1 TO 12: drgoody(1, j) = goody(i, j): NEXT j
END SELECT
drgoody(1, 1) = ABS(drgoody(1, 1)): th = drgoody(1, 1)
IF th <> 9 THEN
currsym = symb(th, 1): currf = symb(th, 2): currb = symb(th, 3)
ELSE
currb = 0
SELECT CASE drgoody(1, 3)
CASE 1: currsym = 147: currf = 15
CASE 2: currsym = 167: currf = 12
CASE 3: currsym = 7 + cRoll(2) * 11: currf = 15
CASE 4: currsym = 145: currf = 1
CASE 5: currsym = 234: currf = 15
CASE 6: currsym = 225: currf = 6
CASE 7: currsym = 35: currf = 6
CASE 8: currsym = 147: currf = 1
CASE 9: currsym = 147: currf = 14
END SELECT
END IF
drgoody(1, 15) = localx: drgoody(1, 16) = localy
CASE -nberry - 1 'SSD
drgoody(1, 1) = 7: j = cRoll(nssd + ntechwep + nstrash)
IF j = 2 OR j = 5 THEN j = 6
IF j > nssd AND j <= nssd + ntechwep THEN nmaxi = 9 ELSE nmaxi = 4
FOR k = 2 TO nmaxi: drgoody(1, k) = ssd(j, k - 1): NEXT
drgoody(1, 10) = ssdknown(j): drgoody(1, 11) = j
IF ssdknown(j) THEN drgdy(1) = ssdnm$(j) ELSE a = 155: b = 1: c = 18
CASE -nberry - 2 'skiphat
drgoody(1, 1) = 9: drgoody(1, 2) = 1: drgoody(1, 3) = 1
a = 294: b = 25: c = 17
CASE -nberry - 3 'keptibora
drgoody(1, 1) = 9: drgoody(1, 2) = 1: drgoody(1, 3) = 2
a = 117: b = 29: c = 15: drgoody(1, 5) = 0
CASE -nberry - 4 'map
drgoody(1, 1) = 9: drgoody(1, 2) = 1: drgoody(1, 3) = 3
a = 289: b = 62: c = 3
CASE -nberry - 5 'BSshoes
drgoody(1, 1) = 9: drgoody(1, 2) = 1: drgoody(1, 3) = 4
a = 296: b = 3: c = 24
CASE -nberry - 6 'Spacesuit
drgoody(1, 1) = 9: drgoody(1, 2) = 10: drgoody(1, 3) = 5
a = 294: b = 58: c = 10
CASE -nberry - 7 'PID
drgoody(1, 1) = 7: drgoody(1, 2) = 1: drgoody(1, 3) = -1
drgoody(1, 4) = 15: drgoody(1, 5) = 4 'pres
drgoody(1, 10) = ssdknown(19): drgoody(1, 11) = 19
IF ssdknown(19) THEN
drgdy(1) = ssdnm$(19)
ELSE
drgdy(1) = jnk$(3, 62, 6) + jnk$(155, 25, 4) + jnk$(-2, 44, 7)
END IF
CASE -nberry - 8 'bamboo raft
drgoody(1, 1) = 9: drgoody(1, 2) = 15: drgoody(1, 3) = 7
drgoody(1, 4) = 20 - cRoll(cRoll(10)): drgoody(1, 5) = 0
a = 409: b = 54: c = 11
CASE -nberry - 9 'Roast Beast
drgoody(1, 1) = 9: drgoody(1, 2) = 0: drgoody(1, 3) = 6
a = 199: b = 32: c = 11
CASE -nberry - 10 'tech components
drgoody(1, 1) = 10: drgoody(1, 2) = cRoll(cRoll(50))
drgoody(1, 3) = RollDice(10, 3, 3)
a = 319: b = 50: c = 17
CASE -nberry - 11 'spam
drgoody(1, 1) = 1: drgoody(1, 2) = 1: drgoody(1, 3) = 1
drgdy(1) = "Spam"
CASE -nberry - 12 'beef-a-roni
drgoody(1, 1) = 2: drgoody(1, 2) = 1: drgoody(1, 3) = 1
a = 1: b = 23: c = 11
CASE -nberry - 13 'armor
typ = 12 - cRoll(cRoll(11))
drgoody(1, 1) = 4: drgoody(1, 2) = arm(drgoody(1, 3), 1): drgoody(1, 3) = typ
drgoody(1, 4) = (cRoll(arm(typ, 2)) * 2 + arm(typ, 2)) / 3
drgdy(1) = armnm$(typ)
CASE -nberry - 14 'shield
typ = 6 - cRoll(cRoll(5))
IF typ < 3 THEN typ = 6 - cRoll(cRoll(5))
drgoody(1, 1) = 5: drgoody(1, 2) = sh(typ, 1): drgoody(1, 3) = typ
drgoody(1, 4) = (cRoll(sh(typ, 2)) * 2 + sh(typ, 2)) / 3
drgdy(1) = shnm$(typ) + jnk$(3, 55, 7)
CASE -nberry - 15 'weapon
SELECT CASE cRoll(12)
CASE 1, 2, 3
typ = cRoll(cRoll(nrwep - 4)) + nwep 'all but Ti, duralloy weps
CASE 4, 5
typ = cRoll(cRoll(nrwep)) + nwep
CASE 6, 7, 8, 9
typ = cRoll(cRoll(nwep - 5)) 'all but Ti, duralloy weps
CASE ELSE
typ = cRoll(cRoll(nwep))
END SELECT
IF (typ < 1) OR (typ > nwep + nrwep) THEN typ = 1
drgoody(1, 1) = 3
FOR jj = 1 TO 6: drgoody(1, jj + 1) = wep(typ, jj): NEXT jj
drgoody(1, 8) = typ
drgdy(1) = wepnm$(typ)
IF typ > nwep THEN
num = RollDice(drgoody(1, 3), 2, 1): drgoody(1, 3) = num
END IF
CASE -nberry - 16 'mets hat
drgoody(1, 1) = 9: drgoody(1, 2) = 1: drgoody(1, 3) = 8
a = 94: b = 46: c = 8
CASE -nberry - 17 'tape recorder
FOR i = 1 TO 8: drgoody(1, i + 1) = ssd(5, i): NEXT
drgoody(1, 1) = 7: drgoody(1, 10) = ssdknown(5): drgoody(1, 11) = 5
IF ssdknown(5) THEN drgdy(1) = ssdnm$(5) ELSE drgdy(1) = jnk$(35, 39, 17)
CASE -nberry - 18 'Ivana wig
drgoody(1, 1) = 9: drgoody(1, 2) = 1: drgoody(1, 3) = 9
drgoody(1, 4) = RollDice(3, 2, 2): a = 265: b = 59: c = 9
CASE ELSE 'berry
clr = cRoll(6): IF i = 0 THEN clr = 4 'Gregre berry
drgdy(1) = Kolr$(clr) + berry$(-i) + bl + jnk$(-2, 37, 5)
drgoody(1, 1) = 6: drgoody(1, 2) = 0: drgoody(1, 3) = -i
drgoody(1, 4) = clr: drgoody(1, 5) = 0
drgoody(1, 6) = cRoll(3) - 1: IF i = 0 THEN drgoody(1, 6) = 1
END SELECT
IF c > 0 THEN drgdy(1) = jnk$(a, b, c)
END SUB
FUNCTION armnm$ (i)
place = 6 * (nwep + nrwep + nsh + i) - 5
GET #1, place, a: GET #1, , b: GET #1, , c
st1 = jnk$(a, b, c)
IF incastle AND (castle = 4) THEN st1 = jnk$(246, 63, 6) + st1
armnm$ = st1
END FUNCTION
SUB DetailedMap (loadmappossible)
oldl1$ = l1: oldl2$ = l2: oldl3$ = l3
SCREEN , , 0: ljnk 1, 38, 8, 4: ClearMess: t1! = TIMER
ljnk 1, 46, 18, 2: LOCATE 24, 1: PRINT l2;
vpage = 0: DisplayCharacter
SCREEN , , 1, 0: ccls 1: SCREEN , , 2, 0: clpage2
cRandomize seed! + 1.3 * mainx + 62.2 * mainy
x! = RND(-(seed! + 1.3 * mainx + 62.2 * mainy))
FOR i = 1 TO (mainx MOD 5) * 7 + (mainy MOD 11) * 3
x = RND + cRoll(10)
NEXT i
IF ((looking OR teleporting) = 0) AND loadmappossible THEN
IF LoadMaps(0) THEN
IF starting = -1 THEN starting = 1 ELSE starting = 0
GOTO enddm
END IF
END IF
'----------------------------------------------
t1 = terrain
FOR i = 1 TO 4: j = (i - 2) MOD 2: k = (i - 3) MOD 2
GetSym scratch(i), mainx + j, mainy + k, f, b, 0
IF scratch(i) = 1 THEN scratch(i) = looksym
IF t1 = 247 THEN scratch(i) = 247
SELECT CASE scratch(i)
CASE 15, 42, 176, 177, 32, 247
CASE ELSE: scratch(i) = t1
END SELECT
NEXT i
SELECT CASE t1
CASE 234, 239, 30, 94, 127, 71: j = cRoll(3): t1 = scratch(j)
SELECT CASE t1
CASE 234, 239, 30, 94, 127, 71: t1 = scratch(j + 1)
CASE ELSE: t1 = 32
END SELECT
END SELECT
cDetailedMap t1, scratch(1), scratch(2), scratch(3), scratch(4)
IF radint AND (bergreen = 0 AND spacesuit = 0) THEN
Box 1, 52, 1, 22, 1, 76, 1
Box 1, 52, 1, 22, 1, 76, 2
END IF
lwall = 0: rwall = 0: twall = 0: bwall = 0
lwscr = 0: rwscr = 0: twscr = 0: bwscr = 0
ruins = (cRoll(7) = 1) * (2 * (cRoll(3) = 1) + 1)
bldg = false: monolith = false: mononum = 0
FOR i = 1 TO nmonolith
IF monozone(i, 1) = mainx AND monozone(i, 2) = mainy THEN
ruins = 0: monolith = true: mononum = i
END IF
NEXT
SELECT CASE terrain
CASE 234, 239, 30, 94, 127, 71
SELECT CASE terrain
CASE 127: castle = 1: maxlevel = 4: minlevel = -4
CASE 30: castle = 2: maxlevel = 0: minlevel = -7
CASE 239: castle = 3: maxlevel = 5: minlevel = -2
CASE 234: castle = 4: maxlevel = 7: minlevel = 0
CASE 94: castle = 5: maxlevel = 2: minlevel = -5
CASE 71: castle = 6: maxlevel = 5: minlevel = -5
END SELECT
bldg = true: ruins = false
lwall = 5: rwall = 48: twall = 3: bwall = 20
lwscr = 15: rwscr = 37: twscr = 6: bwscr = 15
CASE 247: ruins = false
CASE ELSE
IF ruins < 0 THEN
bldg = true: castle = 0
maxlevel = cRoll(cRoll(5)): minlevel = -cRoll(cRoll(5))
lwall = 5 + cRoll(17): rwall = 48 - cRoll(18)
twall = 3 + cRoll(5): bwall = 19 - cRoll(4)
dx = (rwall - lwall) / 3: dy = (bwall - twall) / 3
IF dx < 3 THEN dx = 3
IF dy < 2 THEN dy = 2
lwscr = cRoll(42 - dx) + 5: twscr = cRoll(16 - dy) + 3
rwscr = lwscr + dx: bwscr = twscr + dy
ELSEIF ruins > 0 THEN
xenter = cRoll(30) + 10: yenter = cRoll(8) + 6
PutSym 240, xenter, yenter, 5, 0, -1
ELSEIF monolith THEN
FindDot xmono, ymono, incastle
PutSym monosym, xmono, ymono, 11, 0, -1
END IF
END SELECT
IF bldg THEN
Box lwscr, rwscr, twscr, bwscr, 2, wallcolr, 1
Box lwscr, rwscr, twscr, bwscr, 2, wallcolr, 2
IF castle = 6 THEN
FOR i = lwscr - 1 TO rwscr + 1
PutSym chasm, i, twscr - 1, 8, 0, -1: PutSym chasm, i, bwscr + 1, 8, 0, -1
NEXT
FOR i = twscr TO bwscr
PutSym chasm, lwscr - 1, i, 8, 0, -1: PutSym chasm, rwscr + 1, i, 8, 0, -1
NEXT
END IF
FOR s = -10 TO 10: xstairs(s) = 0: ystairs(s) = 0: NEXT s
FOR s = minlevel TO maxlevel - 1
xstairs(s) = cRoll(rwall - lwall - 5) + lwall + 2
ystairs(s) = cRoll(bwall - twall - 5) + twall + 2
NEXT s
enterdir = cRoll(4): zz = cRoll(100)
xenter = zz * (rwall - lwall - 2) \ 100 + 1 + lwall
xenterscr = zz * (rwscr - lwscr - 2) \ 100 + 1 + lwscr
yenter = zz * (bwall - twall - 2) \ 100 + 1 + twall
yenterscr = zz * (bwscr - twscr - 2) \ 100 + 1 + twscr
SELECT CASE enterdir
CASE 1: xenter = lwall: xenterscr = lwscr
CASE 2: xenter = rwall: xenterscr = rwscr
CASE 3: yenter = bwall: yenterscr = bwscr
CASE ELSE: yenter = twall: yenterscr = twscr
END SELECT
doorsym = cen
IF castle = 6 OR cRoll(10) = 1 THEN doorsym = lockeddoor
PutSym doorsym, xenterscr, yenterscr, wallcolr, 0, -1
FOR i = lwscr + 1 TO rwscr - 1: FOR j = twscr + 1 TO bwscr - 1
PutSym 32, i, j, 7, 0, -1
NEXT j, i
END IF
IF (starting = -1) AND bldg THEN
localx = xenterscr: localy = yenterscr
SELECT CASE enterdir
CASE 1: localx = localx - 2
CASE 2: localx = localx + 2
CASE 3: localy = localy + 2
CASE ELSE: localy = localy - 2
END SELECT
END IF
FOR i = 1 TO ncastle + nruins: lobyte = RND * cRoll(2): NEXT i
SELECT CASE cRoll(200)
CASE 1 TO 20: numcre = 0
CASE 21 TO 85: numcre = 1
CASE 86 TO 155: numcre = 2
CASE 156 TO 187: numcre = 3
CASE 188 TO 197: numcre = 4
CASE 198, 199: numcre = 5
CASE ELSE: numcre = 5 + cRoll(5)
END SELECT
IF (terrain = 15 OR terrain = 177) THEN numcre = numcre + 1
IF (terrain = 42 OR terrain = 176) AND RND < .5 THEN numcre = numcre + 1
IF terrain = 247 THEN numcre = numcre + RollDice(2, 4, 4) - 4
g = goodythere(mainx, mainy)
lobyte = g MOD 256: hibyte = (g - lobyte) \ 256
SELECT CASE cRoll(100)
CASE 1 TO 20: nstuff = 0
CASE 21 TO 69: nstuff = 1
CASE 70 TO 93: nstuff = 2
CASE 94 TO 98: nstuff = 3
CASE 99: nstuff = 4
CASE ELSE: nstuff = 4 + cRoll(4)
END SELECT
IF nstuff < numcre - 3 THEN nstuff = numcre - 3
IF nstuff > numcre + 1 THEN numcre = nstuff - 1 + (cRoll(3) = 1)
IF nstuff > 8 THEN nstuff = 8
IF terrain = 247 THEN nstuff = 0
FOR i = 1 TO nstuff: MakeStuff i: NEXT i
IF ((hibyte AND 4) = 0) THEN
lobyte = lobyte + 2 ^ nstuff - 1: hibyte = hibyte OR 1
END IF
FOR i = 1 TO nstuff
IF (lobyte AND 2 ^ (i - 1)) THEN
s = localgoody(i, 1) MOD 256: f = localgoody(i, 1) \ 256
PutSym s, localgoody(i, 2), localgoody(i, 3), f, 0, 2
END IF
NEXT i
IF starting THEN
AddToDrop -nberry - 17
incr: x = 3 + cRoll(46): y = 2 + cRoll(18)
IF bldg THEN
IF x >= lwscr AND x <= rwscr THEN
IF y >= twscr AND y <= bwscr THEN GOTO incr
END IF
END IF
GetSym sym, x, y, f, b, 1
IF sym <> 32 AND sym <> 249 AND sym <> 250 THEN GOTO incr
drgoody(1, 15) = x: drgoody(1, 16) = y
IF starting = -1 THEN starting = 1 ELSE starting = 0
END IF
FOR i = 1 TO ndropped
IF drgoody(i, 13) = mainx AND drgoody(i, 14) = mainy THEN
th = ABS(drgoody(i, 1))
IF th <> 9 THEN
sym = symb(th, 1): fc = symb(th, 2): bc = symb(th, 3)
ELSE
bc = 0
SELECT CASE drgoody(i, 3)
CASE 1: sym = 147: fc = 15
CASE 2: sym = 167: fc = 12
CASE 3: sym = 7 + cRoll(2) * 11: fc = 15
CASE 4: sym = 145: fc = 1
CASE 5: sym = 234: fc = 15
CASE 6: sym = 225: fc = 6
CASE 7: sym = 35: fc = 6
CASE 8: sym = 147: fc = 1
CASE 9: sym = 147: fc = 14
END SELECT
END IF
PutSym sym, drgoody(i, 15), drgoody(i, 16), fc, bc, 2
END IF
NEXT i
IF (hibyte AND 1) THEN
SELECT CASE terrain
CASE 42, 176, 239, 30, 127, 94, 234, 71: chan = 15
CASE 15, 177: chan = 8
CASE 247: chan = -1000
CASE ELSE: chan = 5
END SELECT
chan = chan + 15 * radint
WHILE cRoll(100) < chan
nobush = true: chan = chan - 100
WHILE nobush
xb = cRoll(45) + 3: yb = cRoll(15) + 3
GetSym sym, xb, yb, f, b, 2
IF (sym = 42 OR sym = 15) THEN
PutSym sym, xb, yb, f, 4, 2: nobush = false
END IF
IF cRoll(200) = 1 THEN nobush = false
WEND
WEND
END IF
FOR i = 1 TO nnear: PutCreat i: NEXT i
IF (hibyte AND 4) = 0 THEN
FOR j = 1 TO numcre: MakeCreature 0, 0, false, looking: NEXT j
END IF
IF NOT looking THEN
hibyte = hibyte OR 2 'square has been seen
hibyte = hibyte OR 4 'don't create new dudes in this square later
goodythere(mainx, mainy) = lobyte + 256 * hibyte
END IF
chan = SQR(lvl) * (2 + 2 * terrain = 247)
numroll = 10
maketrap:
IF cRoll(numroll) <= chan THEN '++++ create trap ++++
rdotrp: FindDot x, y, incastle
IF bldg THEN
IF x > lwscr AND x < rwscr AND y < bwscr AND y > twscr GOTO rdotrp
END IF
sym = trap: fc = 10: bc = 0
SELECT CASE terrain
CASE 15, 42
SELECT CASE cRoll(4)
'CASE 1: fc = 10 'gas, not needed
CASE 2: fc = 7 'gopher hole
CASE 3: fc = 6 'quicksand
CASE 4: fc = 12 'explosive gas
END SELECT
CASE 176, 177
SELECT CASE cRoll(4)
'CASE 1: fc = 10 'gas, not needed
CASE 2: fc = 8 'tarpit
CASE 3: fc = 6 'quicksand
CASE 4: fc = 12 'explosive gas
END SELECT
CASE ELSE
SELECT CASE cRoll(3)
'CASE 1: fc = 10 'gas, not needed
CASE 2: fc = 7 'gopher hole
CASE 3: fc = 12 'explosive gas
END SELECT
END SELECT
PutSym sym, x, y, fc, bc, 2
numroll = numroll + 6: GOTO maketrap
END IF
chan = SQR(lvl)
SELECT CASE terrain
CASE 15, 42: chan = chan * 2
CASE 176, 177
CASE 247: chan = 0
CASE ELSE: chan = chan / 2
END SELECT
z = cRoll(20)
WHILE z <= chan '++++ create web ++++
xweb = cRoll(46) + 3: yweb = cRoll(16) + 3
GetSym sym, xweb, yweb, fc, bc, 2
SELECT CASE sym
CASE 32, 249, 250: PutSym 214 + cRoll(2), xweb, yweb, 8, 0, 2
END SELECT
chan = chan - z: z = cRoll(20)
WEND
IF NOT (looking OR teleporting) THEN
GetSym currsym, localx, localy, currf, currb, 2
IF invisible THEN ffc = 8 ELSE ffc = 15
PutSym 1, localx, localy, ffc, 0, -1
END IF
'----------------------------------------------
enddm:
SetDark dark, olddark, changed: ChangeDark
SCREEN , , 0, 0: l1 = oldl1$: l2 = oldl2$: l3 = oldl3$
IF starting THEN vpage = 0 ELSE vpage = 1
PrintMessage 7, 0
WHILE ABS(TIMER - t1!) < 1: WEND: DumpBuffer
SCREEN , , vpage, vpage: numroll = RND(-seed! - gt!)
END SUB
SUB Explode (dx, dy, damage, damtype, need, r!, slf, clr, div)
a$ = RTRIM$(l1): aaa$ = jnk$(86, 34, 19)
IF r! >= 0 THEN
dumx = localx + dx: dumy = localy + dy ' for sameroom in loop
SWAP dumx, localx: SWAP dumy, localy ' swaps back below
FOR ix = localx - r! TO localx + r!
FOR iy = localy - r! TO localy + r!
IF cRd(ix - localx, iy - localy) <= r! AND SameRoom(ix - localx, iy - localy) THEN
GetSym sym, ix, iy, ifc, ibc, 1
PutSym sym, ix, iy, ifc, clr MOD 8, 1
END IF
NEXT iy, ix
localx = dumx: localy = dumy 'right here
FOR num = nnear TO 1 STEP -1
IF cRd(ncre(num, 4) - dx, ncre(num, 5) - dy) <= r! THEN
cx = ncre(num, 4) - dx: cy = ncre(num, 5) - dy
localx = localx + dx: localy = localy + dy
nope = NOT SameRoom(cx, cy)
localx = localx - dx: localy = localy - dy
IF nope THEN GOTO nexp
cx = ncre(num, 4) + localx: cy = ncre(num, 5) + localy
typ = ncre(num, 1): Awaken num
GetSym csym, cx, cy, cf, cbb, 1: PutSym csym, cx, cy, clr, 0, 1
kl = 0: GOSUB getem: IF kl = 0 THEN PutSym csym, cx, cy, cf, cbb, 1
END IF
nexp: NEXT num
ELSE
r! = -r!: crr = cRd(dx, dy): IF crr = 0 THEN crr = 1
ddx! = dx / crr: ddy! = dy / crr
FOR i = 1 TO INT(r!)
cx = localx + i * ddx!: cy = localy + i * ddy!
IF NOT SameRoom(cx - localx, cy - localy) THEN EXIT FOR
GetSym csym1, cx, cy, fc1, bc1, 1
PutSym csym1, cx, cy, fc1, clr MOD 8, 1
NEXT i
FOR i = 1 TO INT(r!)
cx = localx + i * ddx!: cy = localy + i * ddy!
IF NOT SameRoom(cx - localx, cy - localy) THEN EXIT FOR
GetSym csym, cx, cy, fc, bc, 2
GetSym csym1, cx, cy, fc1, bc1, 1
PutSym csym1, cx, cy, fc1, clr MOD 8, 1
SELECT CASE csym
CASE 15, 42
PutSym 32, cx, cy, 7, clr MOD 8, 1: PutSym 32, cx, cy, 7, 0, 2
CASE ELSE
num = BadMoveCreat%(cx - localx, cy - localy, nnear, 0, ncre(0, 0))
IF num > 0 THEN typ = ncre(num, 1): Awaken num: GOSUB getem
END SELECT
NEXT i
FOR i = 1 TO INT(r!)
x = localx + i * ddx!: y = localy + i * ddy!
IF NOT SameRoom(x - localx, y - localy) THEN EXIT FOR
GetSym csym1, x, y, fc1, bc1, 1: PutSym csym1, x, y, fc1, 0, 1
NEXT
r! = -r!
END IF
IF r! >= 0 THEN
IF (cRd(dx, dy) <= r! + .1) AND slf AND SameRoom(dx, dy) THEN
dam = damage: needed = need - ac \ div: tohit = cRoll(20)
IF tohit >= needed THEN
SELECT CASE damtype
CASE 1: DamSuit 0, dam
CASE 2: DamSuit 1, dam
IF rr > 0 THEN dam = dam * 10 / rr ELSE dam = dam * 20
CASE 3, 4, 5
IF con > 0 THEN dam = dam * 10 / con ELSE dam = dam * 20
IF gasmask THEN dam = 0
CASE 6: DamSuit 5, dam
CASE 7: DamSuit 3, dam
CASE 8
IF mindweb AND (cRoll(10) = 1) THEN
mindweb = 0: ljnk 111, 14, 23, 1: MessPause 10, 0
END IF
IF mindweb THEN dam = 0
IF mr > 0 THEN dam = dam * 10 / mr ELSE dam = dam * 20
CASE 9: DamSuit 4, dam
CASE 10: DamSuit 2, dam
CASE 12: inglue = true
CASE 18: berhic = berhic + RollDice(3, 4, 4): ber$ = "aaaChoo!"
CASE 22: berblind = berblind + RollDice(4, 4, 4)
CASE 27: asleep = true: berhic = 0: sick = 0
CASE 28: berhic = berhic + RollDice(3, 4, 4): ber$ = "Burrrp!"
END SELECT
IF dam > 0 THEN
ClearMess
Ljnkbig 53, 31, 8, 0, 0, 0, a$, 0, 1: ffEffect dam, ffkill
IF ffkill THEN Ljnkbig 83, 1, 5, 207, 1, 19, jnk$(205, 39, 21), 1, 2
MessPause clr, 0: hits = hits - dam: ShowHits
IF hits < 0 THEN st1 = a$: Dead 0
END IF
ELSE
ClearMess
Ljnkbig 152, 10, 11, 0, 0, 0, a$, 0, 1: MessPause clr, 0
END IF
END IF
FOR ix = localx + dx - r! TO localx + dx + r!
FOR iy = localy + dy - r! TO localy + dy + r!
IF cRd(ix - localx - dx, iy - localy - dy) <= r! THEN
GetSym sym1, ix, iy, ifc, ibc, 1: PutSym sym1, ix, iy, ifc, 0, 1
GetSym sym, ix, iy, ifc, ibc, 2
SELECT CASE damtype
CASE 1, 2, 6, 7, 9, 10, 11
SELECT CASE sym
CASE 15, 42: PutSym 32, ix, iy, 7, 0, -1
END SELECT
CASE 5
SELECT CASE sym
CASE 250, 249, 32
snum = -1: IF (incastle AND sym1 = 32) THEN snum = 2
PutSym gas, ix, iy, 8, 0, snum
END SELECT
END SELECT
END IF
NEXT iy, ix
END IF
EXIT SUB
getem:
dam = damage: needed = need - ncre(num, 9) \ div
IF needed > 18 THEN needed = 18 ELSE IF needed < 4 THEN needed = 4
tohitroll = cRoll(20)
CrDef num, damtype, tohitroll, misspec, INT(r!)
kl = 0
IF tohitroll >= needed THEN
IF tohitroll = 20 THEN dam = dam * 2
typ = ncre(num, 1): CrDamAlter num, dam, damtype
SELECT CASE damtype
CASE 3, 4, 5 ': IF defnum AND 1024 THEN dam = 0
ccfc = ncre(num, 8) \ 1000: ccsym = ncre(num, 8) MOD 1000
IF (damtype = 5) AND ((ccsym = 250) OR (ccsym = 32)) THEN
ncre(num, 8) = 8000 + gas
ELSEIF (damtype = 4) AND (dam > 0) THEN
ncre(num, 6) = -ABS(ncre(num, 6))
END IF
END SELECT
IF dam = 0 THEN l2 = aaa$
IF dam > 0 THEN
ncre(num, 2) = ncre(num, 2) - dam: az = 38
SELECT CASE damtype
CASE 2: bz = 1: cz = 5 'nuked
CASE 3, 4, 5: az = 54: bz = 29: cz = 8 'poisoned
CASE 6: az = 97: bz = 45: cz = 8 'corroded
CASE 7: bz = 26: cz = 5 'fried
CASE 8: az = 108: bz = 59: cz = 8 'assailed
CASE 9: bz = 42: cz = 6 'zapped
CASE 10: az = 55: bz = 57: cz = 5 'burnt
CASE 11: bz = 49: cz = 5 'froze
CASE 12: az = 97: bz = 53: cz = 11 'immobilized
CASE 22: az = 116: bz = 27: cz = 7 'blinded
CASE 31: az = 271: bz = 58: cz = 11 'shorted out
CASE ELSE: az = 51: bz = 62: cz = 7 'injured
END SELECT
IF damtype = 26 AND typ <> gill THEN ljnk 306, 37, 19, 2
ELSE
ncre(num, 2) = ncre(num, 2) - dam: ncre(num, 3) = ncre(num, 3) - dam \ 2
az = 50: bz = 30: cz = 3
END IF
IF ncre(num, 2) < 0 THEN
l1 = a$ + bl + jnk$(az, bz, cz) + bl + Der$(false, num, 1)
kl = num: KillCreat kl: IF r! = 0 THEN : need = 0
END IF
ELSEIF (damtype = 3 AND r! = 0) OR (damtype = 11 AND r! = 0) THEN
need = -need: az = 50: bz = 37: cz = 6
ELSEIF misspec = 0 THEN
az = 50: bz = 37: cz = 6
END IF
IF kl = 0 AND cz > 0 AND misspec = 0 THEN l1 = a$ + bl + jnk$(az, bz, cz) + bl + Der$(false, num, 1)
MessPause clr, 0
RETURN
END SUB
SUB KillCreat (i)
STATIC firstspecial
typ = ncre(i, 1)
IF typ = grinch THEN GotGrinch false: EXIT SUB ELSE MaybeMessPause 13, 0
SELECT CASE typ
CASE IS > ncreat + creextra + 1, pryor
IF (NOT firstspecial) AND (typ <> grinch) THEN
firstspecial = true: ClearMess: ljnk 385, 29, 31, 1: MessPause 13, 0
ljnk 386, 1, 54, 1: ljnk 387, 1, 51, 2: ljnk 388, 1, 54, 3
PrintMessage 13, 0: PauseForKey
END IF
END SELECT
a = 30: b = 1: c = 14 'default "you've killed "
SELECT CASE typ
CASE spot: c = 0: d = 295: e = 39: f = 12
CASE elvimp: c = 0: d = 295: e = 1: f = 38
CASE elvis: c = 0: Ljnkbig 295, 1, 16, 0, 0, 0, Der$(true, i, 1), 1, 1
ljnk 361, 34, 32, 2 'will print in calling routine
EraseCreat i: FindDot ix, iy, incastle
ncre(i, 4) = ix - localx: ncre(i, 5) = iy - localy: PutCreat i
ncre(i, 2) = ncre(i, 3): ncre(i, 11) = ncre(i, 11) AND (NOT 1): EXIT SUB
CASE phoe: yup = false
IF ncre(i, 14) = 0 THEN
yup = true
ELSEIF RND < .3 / ncre(i, 14) THEN
yup = true
END IF
IF yup THEN
ncre(i, 14) = ncre(i, 14) + 1: ncre(i, 2) = ncre(i, 3): Awaken i
c = 0: Ljnkbig 30, 1, 14, 0, 0, 0, Der$(true, i, 1), 1, 1
ljnk 161, 1, 33, 2: EXIT SUB 'will print in calling routine
END IF
CASE IS > ncreat + creextra + 1, wimp, pryor: a = 295: b = 1: c = 16
END SELECT
IF c > 0 THEN Ljnkbig a, b, c, 0, 0, 0, Der$(true, i, 1), 1, 1 ELSE ljnk d, e, f, 1
SELECT CASE cRoll(15)
CASE 1: a = 30: b = 15: c = 30
CASE 2: a = 30: b = 45: c = 7
CASE 3: a = 31: b = 1: c = 15
CASE 4: a = 31: b = 16: c = 17
CASE 5: a = 31: b = 33: c = 13
CASE 6: a = 31: b = 46: c = 20
CASE 7: a = 32: b = 1: c = 21
CASE 8: a = 82: b = 60: c = 9
CASE 9: a = 77: b = 63: c = 6
CASE 10: a = 266: b = 21: c = 10
CASE 11: a = 266: b = 31: c = 19
CASE 12: a = 143: b = 62: c = 7
CASE 13: a = 267: b = 1: c = 27
CASE 14: a = 278: b = 1: c = 31
CASE ELSE: a = 30: b = 52: c = 10
END SELECT
ljnk a, b, c, 2
x = ncre(i, 4): y = ncre(i, 5): sym = 0
SELECT CASE typ
CASE puff
IF cRd%(x, y) < 4 THEN
dam = RollDice(4 + 2 * lvl, 2, 2)
ffEffect dam, ffkill: DamSuit 0, dam: hits = hits - dam
IF hits < 0 THEN st1 = jnk$(136, 41, 21): Dead 0: EXIT SUB
ljnk 134, 59, 7, 2
IF ffkill THEN
Ljnkbig 83, 1, 5, 207, 1, 19, jnk$(205, 39, 21), 1, 2
END IF
END IF
ljnk 136, 19, 22, 1
CASE gspore
IF cRd%(x, y) < 4 THEN
dam = RollDice(4 + 1.5 * lvl, 2, 2)
ffEffect dam, ffkill: DamSuit 0, dam: hits = hits - dam
IF hits < 0 THEN st1 = jnk$(33, 24, 22): Dead 0: EXIT SUB
ljnk 33, 46, 23, 2
IF ffkill THEN
Ljnkbig 83, 1, 5, 207, 1, 19, jnk$(205, 39, 21), 1, 2
END IF
END IF
ljnk 33, 1, 23, 1
CASE bush: ljnk 32, 22, 18, 1: ljnk 95, 1, 26, 2
crtyp = quayle: MakeCreature (x + localx), (y + localy), false, false
CASE skip: sym = 147: fc = 15: iop = 2
CASE gill: sym = 167: fc = 12: iop = 3
finishedcastles = finishedcastles OR 4
CASE buzz: sym = 234: fc = 15: iop = 6
finishedcastles = finishedcastles OR 8
CASE trump: sym = 11: fc = 14: iop = 7
finishedcastles = finishedcastles OR 16
CASE ivana: sym = 147: fc = 14: iop = 18
END SELECT
IF (ncre(i, 13) <> 0) AND (grabbed > 0) THEN grabbed = grabbed - 1
SELECT CASE ncre(i, 8) MOD 1000
CASE 250, 32, 249: candrop = true
CASE ELSE: candrop = false
END SELECT
SELECT CASE typ
CASE gill, buzz, trump
AddToDrop -nberry - 17
inctr: xz = cRoll(8) + 22: yz = cRoll(4) + 9
GetSym symz, xz, yz, f, b, 2
IF symz <> 250 GOTO inctr
PutSym 10 + cRoll(2), xz, yz, 14, 0, -1
drgoody(1, 15) = xz: drgoody(1, 16) = yz
END SELECT
RemoveCreat i: xcre = x + localx: ycre = y + localy: droprad = 1
IF sym > 0 THEN
WHILE NOT candrop
xz = xcre + cRoll(2 * droprad + 1) - droprad - 1
yz = ycre + cRoll(2 * droprad + 1) - droprad - 1
IF xz < 2 OR xz > 50 THEN xz = xcre + 1
IF yz < 2 OR yz > 20 THEN yz = ycre
GetSym ss, xz, yz, fc2, bc2, 2: IF ss = 250 THEN candrop = true
droprad = droprad - (cRoll(10) = 1)
WEND
PutSym sym, xcre, ycre, fc, 0, -1: AddToDrop -nberry - iop
drgoody(1, 15) = xcre: drgoody(1, 16) = ycre
ELSEIF candrop AND (RND < .25 - (typ = prof) - (typ = fern)) THEN
SELECT CASE typ
CASE japb, rdro, ddro, sdro, wdro, robot, prof
PutSym 11, xcre, ycre, 14, 0, -1: AddToDrop -nberry - 1
drgoody(1, 15) = xcre: drgoody(1, 16) = ycre
CASE cb, bfoot, fern
PutSym 236, xcre, ycre, 4, 0, -1
gtyp = cRoll(nberry): AddToDrop -gtyp
drgoody(1, 15) = xcre: drgoody(1, 16) = ycre
CASE fox
PutSym 22, xcre, ycre, 5, 0, -1: AddToDrop -nberry - 11
drgoody(1, 15) = xcre: drgoody(1, 16) = ycre
END SELECT
ELSEIF candrop AND (RND < .3) AND mmut = 2 THEN
SELECT CASE typ
CASE rdro, ddro, sdro, wdro, robot
compsym = 128 - 7 * (cRoll(2) = 1)
PutSym compsym, xcre, ycre, 14, 0, -1: AddToDrop -nberry - 10
drgoody(1, 15) = xcre: drgoody(1, 16) = ycre
END SELECT
END IF
expadd& = Creature(typ, 5) * (10 + cRoll(4) - cRoll(4)) / 10
IF typ = webspid THEN expadd& = expadd& * lvl
IF (expadd& > (expr& + 10) \ 2) AND (expr& > 0) THEN expadd& = (expr& + 10) \ 2
expr& = expr& + expadd&: Level newlev, b$
IF rdisp = 1 THEN DisplayCharacter
IF newlev THEN
MaybeMessPause 13, 0
Ljnkbig 14, 26, 17, 0, 0, 0, STR$(lvl), 1, 1: l2 = b$
END IF
END SUB
SUB Level (ChangedLevel, b$)
ChangedLevel = false
IF lvl <= 12 THEN
needed& = 5& * 2 ^ lvl: oldneeded& = needed& \ 2
ELSE
needed& = (5& * 2 ^ 12) * (lvl - 11): oldneeded& = needed& - 5& * 2 ^ 12
END IF
IF oldneeded& < 10 THEN oldneeded& = -30
a = 0: b = 0: c = 0
IF expr& >= needed& THEN
lvl = lvl + 1
IF cRoll(3) = 1 THEN
SELECT CASE cRoll(6)
CASE 1: str = str + 1: b = 1: c = 8
CASE 2: dex = dex + 1: b = 9: c = 9
CASE 3: con = con + 1: b = 18: c = 12: hitadd = hitadd + 1
CASE 4: rr = rr + 1: b = 30: c = 20
CASE 5: mr = mr + 1: a = -1: b = 1: c = 17
CASE ELSE: intl = intl + 1: a = -1: b = 18: c = 12
END SELECT
b$ = jnk$(34, 1, 5) + jnk$(a, b, c) + jnk$(34, 5, 9)
ELSE
statup = 0
rstatup: statup = statup + 1
SELECT CASE cRoll(6)
CASE 1: IF str < 10 THEN str = str + 1: b = 1: c = 8: statup = 4
CASE 2: IF dex < 10 THEN dex = dex + 1: b = 9: c = 9: statup = 4
CASE 3: IF con < 10 THEN con = con + 1: b = 18: c = 12: hitadd = hitadd + 1: statup = 4
CASE 4: IF rr < 10 THEN rr = rr + 1: b = 30: c = 20: statup = 4
CASE 5: IF mr < 10 THEN mr = mr + 1: a = -1: b = 1: c = 17: statup = 4
CASE ELSE: IF intl < 10 THEN intl = intl + 1: a = -1: b = 18: c = 12: statup = 4
END SELECT
IF statup < 4 GOTO rstatup
IF b > 0 THEN b$ = jnk$(34, 1, 5) + jnk$(a, b, c) + jnk$(34, 5, 9)
END IF
siza = 3
IF pmut = 7 THEN siza = 3 - 2 * (berhpmut > 0) 'leave as 3
IF con > 11 THEN sizb = siza + 1 ELSE sizb = siza
IF con > 15 THEN sizc = siza + 1 ELSE sizc = siza
IF pmut = 7 THEN siza = siza - (berhpmut = 0) 'this is correct
IF pmut = 10 THEN siza = siza + 1 - (berhpmut > 0) 'so is this
hitadd = hitadd + cRoll(siza) + cRoll(sizb) + cRoll(sizc) - (wpturns > 0)
hitmax = hitmax + hitadd: hits = hits + hitadd
Level newlev, b$: ChangedLevel = true
ELSEIF expr& < oldneeded& THEN
lvl = lvl - 1: siza = 3
IF pmut = 7 THEN siza = 3 - 2 * (berhpmut > 0) 'leave as 3
IF con > 13 THEN sizb = siza + 1 ELSE sizb = siza
IF pmut = 7 THEN siza = siza - (berhpmut = 0) 'this is correct
IF pmut = 10 THEN siza = siza + 1 - (berhpmut > 0) 'so is this
hitadd = cRoll(siza) + cRoll(sizb) + cRoll(sizb) - (wpturns > 0)
SELECT CASE cRoll(6)
CASE 1: str = str - 1: b = 1: c = 8
CASE 2: dex = dex - 1: b = 9: c = 9
CASE 3: con = con - 1: b = 18: c = 12: hitadd = hitadd + 1
CASE 4: rr = rr - 1: b = 30: c = 20
CASE 5: mr = mr - 1: a = -1: b = 1: c = 17
CASE ELSE: intl = intl - 1: a = -1: b = 18: c = 12
END SELECT
b$ = jnk$(34, 1, 5) + jnk$(a, b, c) + jnk$(34, 31, 11)
hitmax = hitmax - hitadd: hits = hits - hitadd
IF hits < 0 OR expr& < -30 THEN
st1 = jnk$(34, 42, 13): Dead 0
ELSE
Level newlev, b$: ChangedLevel = true
END IF
END IF
SetCombatStats
END SUB
FUNCTION lsdnm$ (i)
place = 6 * (nwep + nrwep + nsh + narm + nssd + ntechwep + nstrash + i) - 5
GET #1, place, a: GET #1, , b: GET #1, , c
st1 = jnk$(a, b, c)
IF incastle AND (castle = 4) THEN
SELECT CASE i
CASE 10, nlsd + 12
CASE ELSE: st1 = jnk$(246, 63, 6) + st1
END SELECT
END IF
lsdnm$ = st1