Akalabeth Main Game File

31 thoughts
last posted April 5, 2014, 6 a.m.

19 earlier thoughts

0

NORTH (Outside)

If there's not a mountain in the way, move north.

1100  PRINT "NORTH": IF TER%(TX,TY - 1) = 1 THEN  PRINT "YOU CAN'T PASS THE MOUNTAINS": GOTO 1090
1110 TY = TY - 1: GOTO 1090

FORWARD (Inside)

If it's possible to move forward, make the move:

1150  IF DNG%(PX + DX,PY + DY) <  > 1 AND DNG%(PX + DX,PY + DY) < 10 THEN PX = PX + DX:PY = PY + DY
1155  PRINT "FORWARD"

First we check if the location the player moved to has a TRAP. If it does, the player loses a random amount of HIT POINTS based on dungeon level, MR is set to 1 (don't know what that is yet), the dungeon level is incremented and we GOSUB to 500 to generate a new dudgeon map. Note that INOUT and IN are the same variable.

1160  IF DNG%(PX,PY) = 2 THEN  PRINT "AAARRRGGGHHH!!! A TRAP!":C(0) = C(0) -  INT ( RND (1) * INOUT + 3):MR = 1:INOUT = INOUT + 1: PRINT "FALLING TO LEVEL ";IN: GOSUB 500: GOTO 1090

If there's a chest where the player is located, we take the chest, randomly give an amount of GOLD based on dungeon level as well as an item.

1165 Z = 0
1170  IF DNG%(PX,PY) = 5 THEN DNG%(PX,PY) = 0: PRINT "GOLD!!!!!":Z =  INT ( RND (1) * 5 * INOUT + INOUT): PRINT Z;"-PIECES OF EIGHT":C(5) = C(5) + Z
1175  IF Z > 0 THEN Z =  INT ( RND (1) * 6): PRINT "AND A ";W$(Z):PW(Z) = PW(Z) + 1: GOTO 1090
1190  GOTO 1090

EAST (Outside)

Moving EAST is the same as moving NORTH but we increment TX instead of decrementing TY.

1200  PRINT "EAST": IF TER%(TX + 1,TY) = 1 THEN  PRINT "YOU CAN'T PASS THE MOUNTAINS": GOTO 1090
1210 TX = TX + 1: GOTO 1090

TURN RIGHT (Inside)

Rotate the player:

1250  PRINT "TURN RIGHT"
1255  IF DX <  > 0 THEN DY = DX:DX = 0: GOTO 1090
1260 DX =  - DY:DY = 0: GOTO 1090

WEST (Outside)

Moving WEST is the same as moving EAST but we decrement TX instead of incrementing it.

1300  PRINT "WEST": IF TER%(TX - 1,TY) = 1 THEN  PRINT "YOU CAN'T PASS THE MOUNTAINS": GOTO 1090
1310 TX = TX - 1: GOTO 1090

TURN LEFT (Inside)

Rotate the player:

1350  PRINT "TURN LEFT"
1355  IF DX <  > 0 THEN DY =  - DX:DX = 0: GOTO 1090
1360 DX = DY:DY = 0: GOTO 1090

SOUTH (Outside)

Moving SOUTH is the same as moving NORTH but we increment TY instead of decrementing it.

1400  PRINT "SOUTH": IF TER%(TX,TY + 1) = 1 THEN  PRINT "YOU CAN'T PASS THE MOUNTAINS": GOTO 1090
1410 TY = TY + 1: GOTO 1090

TURN AROUND (Inside)

Flip the direction of the player:

1450  PRINT "TURN AROUND":DX =  - DX:DY =  - DY: GOTO 1090

GO (Outside)

If it's a town, enter the shop:

1500  IF TE%(TX,TY) = 3 THEN  GOSUB 60080: GOSUB 60200: GOTO 1090

If it's a dungeon and INOUT is 0 (not sure when it wouldn't be at this point), enter the dungeon. Set INOUT to 1, randomize the dungeon map (GOSUB 500) then initialize the player location and direction.

1510  IF TE%(TX,TY) = 4 AND INOUT = 0 THEN  PRINT "GO DUNGEON": PRINT "PLEASE WAIT ":INOUT = 1: GOSUB 500:DX = 1:DY = 0:PX = 1:PY = 1: GOTO 1090

If it's Lord British's castle, enter:

1515  IF TE%(TX,TY) = 5 THEN 7000

Otherwise print "HUH?" and loop back (although don't do post-command):

1520  PRINT "HUH?": GOTO 1000

GO (Inside)

Skip ahead if it's not a ladder down (not yet sure distinction between 7 and 9):

1550  IF DNG%(PX,PY) <  > 7 AND DNG%(PX,PY) <  > 9 THEN 1580

Otherwise say we're going down a level, increment INOUT and randomize the next level (GOSUB 500):

1555  PRINT "GO DOWN TO LEVEL ";INOUT + 1
1560 INOUT = INOUT + 1: GOSUB 500:MR = 1: GOTO 1090

So here's where we go if it's not a down ladder (7 or 9). If it's also not an up ladder (8), print "HUH?"

1580  IF DNG%(PX,PY) <  > 8 THEN  PRINT "HUH?": GOTO 1090

But if it's an up ladder...

If the player was already at the first level, print that they're leaving and change IN (INOUT) to 0:

1581  IF IN = 1 THEN  PRINT "LEAVE DUNGEON":IN = 0: GOTO 1586

Otherwise say they're going up a level, decrement INOUT and randomize the dungeon level (GOSUB 500). Also set MR to 1 (not yet sure what that's for).

1584  PRINT "GO UP TO LEVEL ";INOUT - 1
1585 INOUT = INOUT - 1: GOSUB 500:MR = 1

If we've left the dungeon, increment the HIT POINTS (C(0)) by LK (which is incremented on monster kill below).

1586  IF IN = 0 THEN  PRINT "THOU HAST GAINED": PRINT LK;" HIT POINTS":C(0) = C(0) + LK:LK = 0
1587  GOTO 1090

ATTACK (Outside)

Attack is a no-op outside (although we run the post-command to reduce food, etc)

1600  GOTO 1090

ATTACK (Inside)

See separate analysis below.

STATISTICS / INVENTORY

Call the stats/inventory routine then prompt to hit CR to go back.

1700  GOSUB 60080: HOME : PRINT "PRESS -CR- TO CONTINUE";: INPUT Q$: TEXT : HOME : GOTO 1090

11 later thoughts