theTower - A Text Adventure Game

Just BASIC Games
Machiavvelli3060
Posts: 6
Joined: Tue May 14, 2013 5:54 pm

theTower - A Text Adventure Game

Post by Machiavvelli3060 »

I tried my hand at a text adventure game. With some generous assistance from JustBASIC members etc, I have gotten a pretty good start. See what you think and let me know. I love getting suggestions and trying to make them happen!

1. There really is no way to win. Just enter the tower and explore.
2. You will be reset back to 100 hit points if you can make it back out of the tower with some hit points left.
3. So far, all of the creatures have the same chance to hit and they do the same random damage. I'll work on that soon.
4. If the zombie damages you, even for just one point, you are doomed.
5. The werewolf regenerates 2 hit points every round of combat; it's much easier to kill him with the sword.
6. Poisons and potions are unlimited...for now.
7. I'm trying to figure out how to cap the werewolf's regeneration at his starting hit points. I'll sit down and figure out that one in a few minutes here.
8. I'm also trying to figure out how to have just one [roomdescription] matrix, instead of three. That will be a small puzzle.
9. You can amass quite a bit of gold, if you can stay alive, but there is nothing on which to spend the gold...yet.

As far as text adventures go, it's coming along nicely.

Let me know what you think.

- Machiavvelli3060

Code: Select all

REM This program is named theTower.  It was first started on June 30th, 2013 by Alan J. Robinson.

REM THE FOLLOWING SECTION IS THE GAME'S INTRODUCTION, DESCRIBING THE EXTERIOR OF THE TOWER.

[INTRO]
CHARACTERHEALTH = 100
CHARACTERGOLD = 0
SWORD = 0
HEALINGPOTIONSUSED = 0
POISONSTAKEN = 0
SWORDPOSSESSION$ = "NO"
LEVEL = 1
SWORDDESCRIPTOR$ = "your hands and feet"
ZOMBIESCRATCH$ = "NO"
PRINT "THE TOWER"
PRINT "A JustBASIC-based text adventure"
PRINT "developed by Alan J. Robinson"
PRINT ""
PRINT "You are in the middle of a field."
PRINT "You feel invigorated and refreshed."
PRINT "You see in front of you a black stone tower."
PRINT "It is round and about 150 feet across."
PRINT "It is so tall it disappears into the clouds."
IF ZOMBIESCRATCH$ = "YES" THEN GOSUB [BECOMINGAZOMBIE]
PRINT ""
PRINT "HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; SWORDDESCRIPTOR$
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "1 - enter the tower or"
PRINT "2 - walk away"
[INTROREPEAT]
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [GL]
IF REPLY$ = "2" THEN GOTO [ENDING]
PRINT "Please type 1 or 2."
GOTO [INTROREPEAT]

REM THE FOLLOWING SECTION DESCRIBES THE GROUND LEVEL OF THE TOWER.

[GL]
LEVEL = 1
PRINT ""
PRINT "You are in a giant atrium on the ground floor of the tower."
PRINT "A massive spiral staircase dominates the center of the tower."
PRINT "The staircase spirals up and up out of sight."
PRINT "It also spirals down and down, out of sight."
IF ZOMBIESCRATCH$ = "YES" THEN GOSUB [BECOMINGAZOMBIE]
PRINT ""
PRINT "HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; SWORDDESCRIPTOR$
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "1 - go up,"
PRINT "2 - go down or,"
PRINT "3 - leave the tower"
[GLREPEAT]
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [GOUPTHESTAIRCASE]
IF REPLY$ = "2" THEN GOTO [GODOWNTHESTAIRCASE2]
IF REPLY$ = "3" THEN GOTO [INTRO]
PRINT "Please enter a 1, 2 or 3."
GOTO [GLREPEAT]

REM THE FOLLOWING SECTION INCREASES THE LEVEL BY ONE

[GOUPTHESTAIRCASE]
LEVEL = LEVEL + 1
IF LEVEL = 0 THEN GOTO [GL]
GOTO [ROOMDESCRIPTION]

REM THE FOLLOWING SECTION COVERS GOING DOWN FROM THE FIRST SUB-LEVEL

[GODOWNTHESTAIRCASE]
LEVEL = LEVEL - 1
IF LEVEL = 1 THEN GOTO [GL]
GOTO [ROOMDESCRIPTION]

REM THE FOLLOWING SECTION COVERS GOING DOWN FROM THE GROUND LEVEL

[GODOWNTHESTAIRCASE2]
LEVEL = LEVEL - 2
IF LEVEL = 1 THEN GOTO [GL]
GOTO [ROOMDESCRIPTION]

REM THE FOLLOWING SECTION TELLS THE PROGRAM WHICH ROOM DESCRIPTION TO USE, DEPENDING UPON WETHER THE PLAYER IS ABOVEGROUND OR BELOWGROUND
REM IF THE PLAYER IS BELOWGROUND, THERE IS NO OPTION TO LOOK OUT THE WINDOW

[ROOMDESCRIPTION]
IF LEVEL >= 1 THEN GOTO [ROOMDESCRIPTIONABOVEGROUND]
IF LEVEL < 1 THEN GOTO [ROOMDESCRIPTIONBELOWGROUND]

REM THE FOLLOWING SECTION TELLS THE PROGRAM WHICH ROOM DESCRIPTION TO START A LITTLE WAYS INTO THE SUBROUTINE

[ROOMDESCRIPTION2]
IF LEVEL >= 1 THEN GOTO [ROOMDESCRIPTIONABOVEGROUNDREPEAT]
IF LEVEL < 1 THEN GOTO [ROOMDESCRIPTIONBELOWGROUNDREPEAT]

REM THE FOLLOWING SECTION DESCRIBES ALL ROOMS ABOVEGROUND, EXCEPT FOR THE GROUND LEVEL

[ROOMDESCRIPTIONABOVEGROUND]
PRINT "Floor: " ; LEVEL
GOSUB [ENVIRONMENTDESCRIPTION]
PRINT ENVIRONMENTDESCRIPTION$
IF ZOMBIESCRATCH$ = "YES" THEN GOSUB [BECOMINGAZOMBIE]
GOTO [RANDOMOCCURENCE]
[ROOMDESCRIPTIONABOVEGROUNDREPEAT]
PRINT "HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; SWORDDESCRIPTOR$
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "1 - go up,"
PRINT "2 - go down or"
PRINT "3 - look out a window"
INPUT REPLY$
PRINT ""
IF REPLY$ = "1" THEN GOTO [GOUPTHESTAIRCASE]
IF REPLY$ = "2" THEN GOTO [GODOWNTHESTAIRCASE]
IF REPLY$ = "3" THEN GOTO [WINDOWVIEW]
PRINT ""
PRINT "Please enter a 1, 2 or 3."
GOTO [ROOMDESCRIPTIONABOVEGROUNDREPEAT]
PRINT WINDOWVIEW$
RETURN

REM THE FOLLOWING SECTION DESCRIBES ALL ROOMS BELOWGROUND

[ROOMDESCRIPTIONBELOWGROUND]
PRINT "Floor: " ; LEVEL
GOSUB [ENVIRONMENTDESCRIPTION]
PRINT ENVIRONMENTDESCRIPTION$
IF ZOMBIESCRATCH$ = "YES" THEN GOSUB [BECOMINGAZOMBIE]
GOTO [RANDOMOCCURENCE]
[ROOMDESCRIPTIONBELOWGROUNDREPEAT]
PRINT "HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; SWORDDESCRIPTOR$
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "1 - go up or"
PRINT "2 - go down"
INPUT REPLY$
PRINT ""
IF REPLY$ = "1" THEN GOTO [GOUPTHESTAIRCASE]
IF REPLY$ = "2" THEN GOTO [GODOWNTHESTAIRCASE]
PRINT ""
PRINT "Please enter a 1 or 2."
GOTO [ROOMDESCRIPTIONBELOWGROUNDREPEAT]
RETURN

REM THE FOLLOWING SECTION DESCRIBES THE VIEW (BASED ON THE LEVEL NUMBER) WHEN THE PLAYER LOOKS OUT A WINDOW

[WINDOWVIEW]
WINDOWVIEW = INT(RND(0)*3)
IF LEVEL >= 2 AND LEVEL < 20 AND WINDOWVIEW = 0 THEN WINDOWVIEW$ = "You see rolling hills not too far off in the distance."
IF LEVEL >= 2 AND LEVEL < 20 AND WINDOWVIEW = 1 THEN WINDOWVIEW$ = "You see farm fields not too far off in the distance."
IF LEVEL >= 2 AND LEVEL < 20 AND WINDOWVIEW = 2 THEN WINDOWVIEW$ = "You see a hawk circling the tower."
IF LEVEL >= 20 AND LEVEL < 50 AND WINDOWVIEW = 0 THEN WINDOWVIEW$ = "You are very high up now.  You see mountains far off in the distance."
IF LEVEL >= 20 AND LEVEL < 50 AND WINDOWVIEW = 1 THEN WINDOWVIEW$ = "You are very high up now.  You can see land for miles."
IF LEVEL >= 20 AND LEVEL < 50 AND WINDOWVIEW = 2 THEN WINDOWVIEW$ = "You are very high up now.  You see five buzzards circling the tower."
IF LEVEL >= 50 AND LEVEL < 100 AND WINDOWVIEW = 0 THEN WINDOWVIEW$ = "You are very, very high up now.  Clouds obscure the view."
IF LEVEL >= 50 AND LEVEL < 100 AND WINDOWVIEW = 1 THEN WINDOWVIEW$ = "You are very, very high up now.  You can see what looks like a dragon, flying in the distance."
IF LEVEL >= 50 AND LEVEL < 100 AND WINDOWVIEW = 2 THEN WINDOWVIEW$ = "You are very, very high up now.  The air is very cold and windy."
IF LEVEL >= 100 AND LEVEL < 500 THEN WINDOWVIEW$ = "The clouds completely obscure the view."
IF LEVEL >= 500 AND LEVEL < 600 THEN WINDOWVIEW$ = "The clouds look like they are starting to thin out."
IF LEVEL >= 600 AND LEVEL < 1000 THEN WINDOWVIEW$ = "You can see the clouds spread out below you.  This should not be possible."
PRINT WINDOWVIEW$
PRINT ""
GOTO [ROOMDESCRIPTION]

REM THE FOLLOWING SECTION DESCRIBES THE ENVIRONMENT WITHIN THE TOWER, BASED ON WHICH LEVEL THE PLAYER IS AT

[ENVIRONMENTDESCRIPTION]
IF LEVEL <= -1000 THEN GOTO [TOOHIGHENDING]
IF LEVEL >= -1000 AND LEVEL < -200 THEN GOSUB [LOWALTITUDETROUBLE]
IF LEVEL >= -200 AND LEVEL < -100 THEN PRINT ENVIRONMENTDESCRIPTION$ = "You are so hot and sweaty you are having a hard time breathing."
IF LEVEL >= -100 AND LEVEL < -20 THEN ENVIRONMENTDESCRIPTION$ = "It is extremely hot, humid and oppressive down here."
IF LEVEL >= -20 AND LEVEL < -10 THEN ENVIRONMENTDESCRIPTION$ = "The lower you climb, the warmer it gets."
IF LEVEL >= 10 AND LEVEL < 20 THEN ENVIRONMENTDESCRIPTION$ = "The wind is whipping through the windows and it is getting colder the higher you climb."
IF LEVEL >= 20 AND LEVEL < 100 THEN ENVIRONMENTDESCRIPTION$ = "The air is getting thin up here."
IF LEVEL >= 100 AND LEVEL < 200 THEN PRINT ENVIRONMENTDESCRIPTION$ = "Your nose is starting to bleed."
IF LEVEL >= 200 AND LEVEL < 300 THEN PRINT ENVIRONMENTDESCRIPTION$ = "You should not be able to breathe this high up."
IF LEVEL >= 300 AND LEVEL < 1000 THEN GOSUB [HIGHALTITUDETROUBLE]
IF LEVEL >= 1000 THEN GOTO [TOOHIGHENDING]
RETURN

REM THE FOLLOWING SECTION DESCRIBES WHAT HAPPENS IF THE PLAYER GOES EITHER TOO HIGH OR TOO LOW IN THE TOWER

[TOOHIGHENDING]
PRINT ""
PRINT "You can't breathe anymore.  Your vision dims."
GOTO [ENDING]

REM ALL ROADS EVENTUALLY LEAD HERE...

[ENDING]
PRINT ""
PRINT "You have sustained fatal injury."
PRINT ""
PRINT "Your adventures are over..."
[REPEATENDINGOPTION]
PRINT ""
PRINT "Do you want to:"
PRINT ""
PRINT "1 - start over from the beginning or"
PRINT "2 - quit and leave the game"
INPUT REPLY$
PRINT ""
IF REPLY$ = "1" THEN GOTO [INTRO]
IF REPLY$ = "2" THEN END
PRINT ""
PRINT "Please enter a 1 or 2."
GOTO [REPEATENDINGOPTION]

REM IT TAKES A ZOMBIE TO MAKE A ZOMBIE!

[ZOMBIEENDING]
PRINT ""
PRINT "As your heart stops, you turn into a zombie.  You roam the tower,"
PRINT "attacking unlucky visitors and turning them into zombies."
GOTO [ENDING]

REM EVERY TIME THE PLAYER GOES TO A DIFFERENT FLOOR IN THE TOWER, S/HE MIGHT RUN ACROSS EITHER A CREATURE OR AN ITEM

[RANDOMOCCURENCE]
IF SWORDPOSSESSION$ = "NO" THEN GOTO [RANDOMOCCURENCE1]
IF SWORDPOSSESSION$ = "YES" THEN GOTO [RANDOMOCCURENCE2]
[RANDOMOCCURENCE1]
RANDOMOCCURENCE = INT(RND(0)*100)
IF RANDOMOCCURENCE <= 80 THEN GOTO [ROOMDESCRIPTION2]
IF RANDOMOCCURENCE > 80 AND RANDOMOCCURENCE <= 93 THEN GOTO [ENCOUNTERACREATURE]
IF RANDOMOCCURENCE > 93 AND RANDOMOCCURENCE <= 96 THEN GOTO [PICKUPMAGICSWORD]
IF RANDOMOCCURENCE > 96 AND RANDOMOCCURENCE <= 98 THEN GOTO [DRINKHEALINGPOTION]
IF RANDOMOCCURENCE > 98 THEN GOTO [DRINKPOISON]
[RANDOMOCCURENCE2]
RANDOMOCCURENCE = INT(RND(0)*100)
IF RANDOMOCCURENCE <= 83 THEN GOTO [ROOMDESCRIPTION2]
IF RANDOMOCCURENCE > 83 AND RANDOMOCCURENCE <= 96 THEN GOTO [ENCOUNTERACREATURE]
IF RANDOMOCCURENCE > 96 AND RANDOMOCCURENCE <= 98 THEN GOTO [DRINKHEALINGPOTION]
IF RANDOMOCCURENCE > 98 THEN GOTO [DRINKHEALINGPOTION]




REM THIS SECTION IS THE ALGORITM FOR COMBATTING CREATURES IN THE TOWER

[ENCOUNTERACREATURE]
[SELECTCREATURETYPE]
SELECTCREATURETYPE = INT(RND(0)*11)
SELECT CASE SELECTCREATURETYPE
    CASE 0
        SELECTACREATURETYPE$ = "skeleton"
        CREATUREWEAPON$ = "bony hands"
        CREATUREATTACKINTRO$ = "An animated skeleton comes towards you, reaching out with its bony fingers..."
    CASE 1
        SELECTACREATURETYPE$ = "zombie"
        CREATUREWEAPON$ = "rotting hands"
        CREATUREATTACKINTRO$ = "A rotting zombie corpse shambles towards you..."
    CASE 2
        SELECTACREATURETYPE$ = "lich"
        CREATUREWEAPON$ = "undead magic"
        CREATUREATTACKINTRO$ = "A lich floats into your path, threatening you."
    CASE 3
        SELECTACREATURETYPE$ = "bandit"
        CREATUREWEAPON$ = "a small dagger"
        CREATUREATTACKINTRO$ = "A bandit jumps out from behind a wall, brandishing a dagger."
    CASE 4
        SELECTACREATURETYPE$ = "swordsman"
        CREATUREWEAPON$ = "a short sword"
        CREATUREATTACKINTRO$ = "A swordsman blocks your way, holding a sword and a shield."
    CASE 5
        SELECTACREATURETYPE$ = "mercenary"
        CREATUREWEAPON$ = "a long sword"
        CREATUREATTACKINTRO$ = "A mercenary runs at you, intent on attacking you."
    CASE 6
        SELECTACREATURETYPE$ = "werewolf"
        CREATUREWEAPON$ = "teeth and claws"
        CREATUREATTACKINTRO$ = "A werewolf rushes you, clawing and snapping its massive jaws."
    CASE 7
        SELECTACREATURETYPE$ = "goblin"
        CREATUREWEAPON$ = "a spear"
        CREATUREATTACKINTRO$ = "A goblin brandishes a spear at you."
    CASE 8
        SELECTACREATURETYPE$ = "orc"
        CREATUREWEAPON$ = "a large dirty sword"
        CREATUREATTACKINTRO$ = "An orc uses an ugly, cruel-looking sword to try to cut your head off."
    CASE 9
        SELECTACREATURETYPE$ = "ogre"
        CREATUREWEAPON$ = "hands and feet"
        CREATUREATTACKINTRO$ = "An ogre roars and kicks at you."
    CASE 10
        SELECTACREATURETYPE$ = "troll"
        CREATUREWEAPON$ = "hands and feet"
        CREATUREATTACKINTRO$ = "A troll brings both of his fists smashing down on you."
END SELECT
PRINT ""
PRINT CREATUREATTACKINTRO$
CREATUREHEALTH = INT(RND(0)*30)+20
CREATUREGOLD = INT(RND(0)*30)+20
[HITCREATUREAGAIN]
PRINT ""
PRINT "you: HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; SWORDDESCRIPTOR$
PRINT SELECTACREATURETYPE$ + ": HP: " ; CREATUREHEALTH ; "  Gold: " ; CREATUREGOLD ; "  Weapon: " + CREATUREWEAPON$
[REPEATHITCREATURE]
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "3 - attack the " + SELECTACREATURETYPE$ + " or"
PRINT "4 - run back to the staircase"
INPUT REPLY$
PRINT ""
IF REPLY$ = "3" THEN GOTO [CHARACTERATTACKSCREATURE]
IF REPLY$ = "4" THEN GOTO [ROOMDESCRIPTION2]
PRINT ""
PRINT "Please enter a 3 or 4."
GOTO [REPEATHITCREATURE]
[CHARACTERATTACKSCREATURE]
CHARACTERATTACKSCREATURE = INT(RND(0)*2)+1
IF CHARACTERATTACKSCREATURE = 1 THEN GOTO [CHARACTERHITSCREATURE]
IF CHARACTERATTACKSCREATURE = 2 THEN PRINT "You swing at the " + SELECTACREATURETYPE$ + " and miss."
IF CHARACTERATTACKSCREATURE = 2 THEN GOTO [CREATUREATTACKSCHARACTER]
[CHARACTERHITSCREATURE]
CHARACTERDAMAGESCREATURE = INT(RND(0)*9)+2
TOTALDAMAGE = CHARACTERDAMAGESCREATURE + SWORD
CREATUREHEALTH=CREATUREHEALTH-TOTALDAMAGE
PRINT "You hit the " + SELECTACREATURETYPE$ + " and do " ; CHARACTERDAMAGESCREATURE ; " points of damage."
IF CREATUREHEALTH <= 0 THEN GOTO [CREATUREDEFEATED]
IF SELECTCREATURETYPE = 6 THEN GOSUB [WEREWOLFREGENERATES]
[CREATUREATTACKSCHARACTER]
CREATUREATTACKSCHARACTER = INT(RND(0)*2)+1
IF CREATUREATTACKSCHARACTER = 1 THEN GOTO [CREATUREHITSCHARACTER]
IF CREATUREATTACKSCHARACTER = 2 THEN PRINT "The " + SELECTACREATURETYPE$ + " lashes out at you and misses."
GOTO [HITCREATUREAGAIN]
[CREATUREHITSCHARACTER]
CREATUREHITSCHARACTERDAMAGE = INT(RND(0)*9)+2
TOTALDAMAGE = CREATUREHITSCHARACTERDAMAGE
CHARACTERHEALTH=CHARACTERHEALTH-TOTALDAMAGE
SELECT CASE SELECTCREATURETYPE
    CASE 0
        PRINT "The skeleton hits you for " ; CREATUREHITSCHARACTERDAMAGE ; " points of damage."
    CASE 1
        PRINT "The zombie scratches you and does " ; CREATUREHITSCHARACTERDAMAGE ; " points of damage."
        ZOMBIESCRATCH$ = "YES"
    CASE 2
        PRINT "The lich saps " ; CREATUREHITSCHARACTERDAMAGE ; " hit points worth of your life force."
    CASE 3
        PRINT "The bandit stabs you and does " ; CREATUREHITSCHARACTERDAMAGE ; " points of damage."
    CASE 4
        PRINT "The swordsman slashes you for " ; CREATUREHITSCHARACTERDAMAGE ; " points of damage."
    CASE 5
        PRINT "The mercenary hits you with his cudgel for " ; CREATUREHITSCHARACTERDAMAGE ; " points of damage."
    CASE 6
        PRINT "The werewolf nips you for " ; CREATUREHITSCHARACTERDAMAGE ; " points of damage."
    CASE 7
        PRINT "The goblin stabs you and does " ; CREATUREHITSCHARACTERDAMAGE ; " points of damage."
    CASE 8
        PRINT "The orc slashes you, inflicting " ; CREATUREHITSCHARACTERDAMAGE ; " points of damage."
    CASE 9
        PRINT "The ogre kicks you and does " ; CREATUREHITSCHARACTERDAMAGE ; " points of damage."
    CASE 10
        PRINT "The troll hits you, inflicting " ; CREATUREHITSCHARACTERDAMAGE ; " points of damage."
END SELECT
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
PRINT CREATUREGOESATCHARACTER$
GOTO [HITCREATUREAGAIN]
[CREATUREDEFEATED]
PRINT ""
PRINT "Victory!  The " + SELECTACREATURETYPE$ + " is a heap on the floor."
PRINT ""
CHARACTERGOLD = CHARACTERGOLD + CREATUREGOLD
GOTO [ROOMDESCRIPTION]







REM THIS CODE ALLOWS THE CHARACTER TO PICK UP AND DRINK A HEALING POTION, REVITALIZING THE CHARACTER.

[DRINKHEALINGPOTION]
PRINT "You find a vial with a glowing green liquid in it."
[DRINKHEALINGPOTIONREPEAT]
PRINT "HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; SWORDDESCRIPTOR$
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "3 - drink the liquid or"
PRINT "4 - leave it where it is"
INPUT REPLY$
IF REPLY$ = "3" THEN GOTO [DRINKPOTION]
IF REPLY$ = "4" THEN GOTO [DONTDRINKPOTION]
PRINT ""
PRINT "Please enter a 3 or 4."
GOTO [DRINKHEALINGPOTIONREPEAT]
[DRINKPOTION]
HEALINGPOTIONSUSED = 1
HEALINGPOTION = INT(RND(0)*9)+2
CHARACTERHEALTH=CHARACTERHEALTH+HEALINGPOTION
PRINT "The potion energizes you.  You gain " ; HEALINGPOTION ; " hit points, bringing you up to " ; CHARACTERHEALTH ; " total hit points."
PRINT ""
GOTO [ROOMDESCRIPTION2]
[DONTDRINKPOTION]
HEALINGPOTIONUSED$ = "NO"
PRINT "You cautiously decide to leave the unknown liquid where it is."
GOTO [ROOMDESCRIPTION2]

REM THIS CODE ALLOWS THE PLAYER TO PICK UP AND RETAIN A MAGIC SWORD.  THE STRENGTH OF THE SWORD IS SELECTED RANDOMLY.

[PICKUPMAGICSWORD]
PRINT "You find a beautiful sword on the ground."
[PICKUPMAGICSWORDREPEAT]
PRINT "HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; SWORDDESCRIPTOR$
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "3 - pick it up or"
PRINT "4 - leave it where it is"
INPUT REPLY$
IF REPLY$ = "3" THEN GOTO [PICKUPSWORD]
IF REPLY$ = "4" THEN GOTO [DONTPICKUPSWORD]
PRINT ""
PRINT "Please enter a 3 or 4."
GOTO [PICKUPMAGICSWORDREPEAT]
[PICKUPSWORD]
SWORDDAMAGEFACTOR = INT(RND(0)*20)+1
SWORD = SWORDDAMAGEFACTOR
SWORDPOSSESSION$ = "YES"
SWORDDESCRIPTOR$ = "+" ; SWORDDAMAGEFACTOR ; " magic sword"
PRINT ""
PRINT "The sword feels very strong, light and balanced in your hand."
GOTO [ROOMDESCRIPTION2]
[DONTPICKUPSWORD]
SWORD = 0
SWORDPOSSESSION$ = "NO"
PRINT ""
PRINT "You leave the sword lying on the ground."
GOTO [ROOMDESCRIPTION2]

REM THIS CODE CAUSES THE PLAYER TO DRINK POISON AND HURT THEMSELF

[DRINKPOISON]
PRINT "You find a vial with a glowing green liquid in it."
[DRINKPOISONREPEAT]
PRINT "HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; SWORDDESCRIPTOR$
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "3 - drink the liquid or"
PRINT "4 - leave it where it is"
INPUT REPLY$
IF REPLY$ = "3" THEN GOTO [DODRINKPOISON]
IF REPLY$ = "4" THEN GOTO [DONTDRINKPOISON]
PRINT ""
PRINT "Please enter a 3 or 4."
GOTO [DRINKPOISONREPEAT]
[DODRINKPOISON]
POISONSTAKEN = 0
POISONDAMAGE = INT(RND(0)*9)+2
CHARACTERHEALTH = CHARACTERHEALTH - POISONDAMAGE
PRINT ""
PRINT "The liquid burns you on the inside.  You lose " ; POISONDAMAGE ; " hit points, bringing you down to " ; CHARACTERHEALTH ; " total hit points."
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
GOTO [ROOMDESCRIPTION2]
[DONTDRINKPOISON]
POISONTAKEN$ = "NO"
PRINT ""
PRINT "You cautiously decide to leave the unknown liquid where it is."
GOTO [ROOMDESCRIPTION2]

REM THIS CODE TAKES ONE HIT POINT AWAY FROM THE PLAYER FOR EACH TURN S/HE TAKES ABOVE FLOOR 199.

[HIGHALTITUDETROUBLE]
CHARACTERHEALTH = CHARACTERHEALTH - 1
PRINT "The air is getting so thin, you are having difficulty climbing."
PRINT "You just lost a hit point due to lack of breath and stamina."
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
RETURN

REM THIS CODE TAKES ONE HIT POINT AWAY FROM THE PLAYER FOR EACH TURN S/HE TAKES ABOVE FLOOR 199.

[LOWALTITUDETROUBLE]
CHARACTERHEALTH = CHARACTERHEALTH - 1
PRINT "The air is so humid and thick you can hardly breathe."
PRINT "You just lost a hit point due to losing sweat and your breath."
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
RETURN

REM THIS CODE WILL MAKE THE ZOMBIE SCRATCH EVENTUALLY OVERCOME THE PLAYER, TURNING THEM INTO A ZOMBIE, TOO

[BECOMINGAZOMBIE]
CHARACTERHEALTH = CHARACTERHEALTH - 2
IF ZOMBIESCRATCH$ = "YES" AND CHARACTERHEALTH <= 0 THEN GOTO [ZOMBIEENDING]
PRINT ""
PRINT "That zombie scratch is looking red, puffy and nasty.  You're getting feverish."
PRINT ""
RETURN

REM THIS CODE MAKES THE WEREWOLF REGENERATE.  I HAVENT QUITE FIGURED OUT HOW TO KEEP HIM FROM REGENERATING ABOVE HIS STARTING HIT POINTS, BUT ILL FIGURE IT OUT SOON

[WEREWOLFREGENERATES]
WEREWOLFREGENERATES = INT(RND(0)*9)+1
CREATUREHEALTH = CREATUREHEALTH + WEREWOLFREGENERATES
PRINT ""
PRINT "The werewolf regenerates and grows larger.  It gains " ; WEREWOLFREGENERATES ; " hit points, giving it " ; CREATUREHEALTH ; " hit points."
RETURN

Machiavvelli3060
Posts: 6
Joined: Tue May 14, 2013 5:54 pm

Re: theTower - A Text Adventure Game

Post by Machiavvelli3060 »

I've made some modifications.
1. There are more than 40 different creature types to encounter. So far, they are all about the same strength.
2. I have created one matrix for all floors on the tower. It wasn't difficult; it just took some time and patience.
3. You can now jump out the window. What fun!

- Machiavvelli3060

Code: Select all

REM This program is named theTower.  It was first started on June 30th, 2013 by Alan J. Robinson.

REM THE FOLLOWING SECTION IS THE GAMES INTRODUCTION.

[INTRO]
LEVEL = 1
CHARACTERHEALTH = 100
CHARACTERGOLD = 0
MAGICITEMDESCRIPTOR$ = "your hands and feet"
ZOMBIESCRATCH$ = "NO"
PRINT "theTower, a text-based adventure game"
[OUTSIDETHETOWER]
LEVEL = 1
OUTSIDETHETOWER$ = "YES"
PRINT ""
PRINT "You are standing outside a massive round tower.  It is so"
PRINT "tall its top cannot be seen; it disappears into the clouds."
PRINT ""
PRINT "HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; MAGICITEMDESCRIPTOR$
PRINT ""
[REPEATOUTSIDETHETOWEROPTIONS]
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "(1) enter the tower"
PRINT "(2) walk around the base of the tower"
PRINT "(3) exit the game"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [ROOMDESCRIPTION]
IF REPLY$ = "2" THEN GOTO [WALKAROUNDTHETOWER]
IF REPLY$ = "3" THEN GOTO [REPEATENDINGOPTION2]
PRINT "Please enter a 1, 2 or 3."
GOTO [REPEATOUTSIDETHETOWEROPTIONS]
[WALKAROUNDTHETOWER]
PRINT ""
PRINT "You walk around the base of the tower, inspecting and assessing it.  The material"
PRINT "used is unfamiliar, completely ebony and impossible to even scratch.  The blocks"
PRINT "used are all uniform in color and dimension, perfectly tuckpointed.  The tower"
PRINT "is about 100 paces around, which comes to about 300 feet.  Each floor appears to"
PRINT "have windows, at least as far as the eye can see.  The tower does not appear to"
PRINT "curve at all as it rises up into the blue sky.  There is no technology known to"
PRINT "man that could have created this tower; its very existence is a perplexing splin-"
PRINT "ter in one's mind.  How far up can this tower possibly go?  Does it go down?  How"
PRINT "far does it go down?  Who built it?  For what purpose was it built?"
GOTO [REPEATOUTSIDETHETOWEROPTIONS]


REM THE FOLLOWING SECTION DESCRIBES EACH ROOM

[ROOMDESCRIPTION]
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
IF LEVEL = 1 THEN THIRDOPTION$ = "(3) leave the tower" ELSE THIRDOPTION$ = "(3) explore this floor"
IF LEVEL > 0 THEN FIFTHOPTION$ = "(5) jump out the window" ELSE FIFTHOPTION$ = ""
PRINT ""
[ENVIRONMENTDESCRIPTION]
IF LEVEL < -1000 THEN CHARACTERHEALTH = CHARACTERHEALTH - 4
IF LEVEL <= -500 AND LEVEL > -1000 THEN CHARACTERHEALTH = CHARACTERHEALTH - 3
IF LEVEL <= -300 AND LEVEL > -500 THEN CHARACTERHEALTH = CHARACTERHEALTH - 2
IF LEVEL <= -100 AND LEVEL > -300 THEN CHARACTERHEALTH = CHARACTERHEALTH - 1
IF LEVEL < -50 THEN INTERNALENVIRONMENT$ = "The stifling conditions are starting to have a noticable effect on you."
IF LEVEL >= -50 AND LEVEL < -10 THEN INTERNALENVIRONMENT$ = "The lower you climb, the warmer it gets."
IF LEVEL >= -10 AND LEVEL < 50 THEN INTERNALENVIRONMENT$ = "The air is cool and calm here."
IF LEVEL >= 50 AND LEVEL < 100 THEN INTERNALENVIRONMENT$ = "The air is getting thin up here."
IF LEVEL >= 100 AND LEVEL < 200 THEN INTERNALENVIRONMENT$ = "Your nose is starting to bleed.  You feel weak."
IF LEVEL >= 200 THEN INTERNALENVIRONMENT$ = "You are weakening with every step up."
PRINT "You are inside a massive black tower, on a huge ebony spiral staircase."
PRINT "Internal environment: " + INTERNALENVIRONMENT$
IF LEVEL > 0 AND LEVEL <= 10 THEN PRINT "Window view: You can see hills and farm fields."
IF LEVEL > 10 AND LEVEL <= 50 THEN PRINT "Window view: You are getting pretty high, but you still cannot see the top."
IF LEVEL > 50 AND LEVEL <= 100 THEN PRINT "Window view: You see birds of prey circling the tower."
IF LEVEL > 100 AND LEVEL <= 200 THEN PRINT "Window view: It is starting to get cloudy."
IF LEVEL > 200 AND LEVEL <= 300 THEN PRINT "Window view: The view is completely obscured by clouds and it is getting very cold."
IF LEVEL > 300 AND LEVEL <= 500 THEN PRINT "Window view: The clouds are starting to clear."
IF LEVEL > 500 AND LEVEL <= 1000 THEN PRINT "Window view: You can see the tops of the clouds!  You should not be able to breathe up here."
IF LEVEL > 100 AND LEVEL <= 300 THEN CHARACTERHEALTH = CHARACTERHEALTH - 1
IF LEVEL > 300 AND LEVEL <= 500 THEN CHARACTERHEALTH = CHARACTERHEALTH - 2
IF LEVEL > 500 AND LEVEL <= 1000 THEN CHARACTERHEALTH = CHARACTERHEALTH - 3
IF LEVEL > 1000 THEN CHARACTERHEALTH = CHARACTERHEALTH - 4
IF ZOMBIESCRATCH$ = "YES" AND CHARACTERHEALTH <= 0 THEN GOTO [ZOMBIEENDING]
IF ZOMBIESCRATCH$ = "YES" AND CHARACTERHEALTH > 0 THEN GOTO [REPEATZOMBIEOPTION]
IF ZOMBIESCRATCH$ = "NO" THEN GOTO [BECOMINGAZOMBIE2]
[ZOMBIEENDING]
PRINT ""
PRINT "As your heart stops, you turn into a zombie.  You roam the tower,"
PRINT "attacking unlucky visitors and turning them into zombies."
GOTO [REPEATENDINGOPTION]
[REPEATZOMBIEOPTION]
CHARACTERHEALTH = CHARACTERHEALTH - 2
PRINT ""
PRINT "That zombie scratch is looking red, puffy and nasty.  You're getting feverish."
PRINT ""
[BECOMINGAZOMBIE2]
[ROOMDESCRIPTION2]
PRINT ""
PRINT "Floor: " ; LEVEL ; "  HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; MAGICITEMDESCRIPTOR$
PRINT ""
[REPEATROOMDESCRIPTIONOPTIONS]
PRINT "Do you want to..."
PRINT ""
PRINT "(1) go up      " + THIRDOPTION$ + "   " + FIFTHOPTION$
PRINT "(2) go down    (4) exit the game"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [STAIRCASE]
IF REPLY$ = "2" THEN GOTO [STAIRCASE]
IF REPLY$ = "3" AND LEVEL < 1 THEN GOTO [RANDOMOCCURENCE]
IF REPLY$ = "3" AND LEVEL = 1 THEN GOTO [OUTSIDETHETOWER]
IF REPLY$ = "3" AND LEVEL > 1 THEN GOTO [RANDOMOCCURENCE]
IF REPLY$ = "4" AND LEVEL < 1 THEN GOTO [REPEATENDINGOPTION]
IF REPLY$ = "4" AND LEVEL = 1 THEN GOTO [REPEATENDINGOPTION]
IF REPLY$ = "4" AND LEVEL > 1 THEN GOTO [REPEATENDINGOPTION]
IF REPLY$ = "5" AND LEVEL > 0 THEN GOTO [JUMPOUTTHEWINDOW]
IF LEVEL > 0 THEN PRINT "Please enter a 1, 2, 3, 4 or 5." ELSE PRINT "Please enter a 1, 2, 3 or 4."
GOTO [REPEATROOMDESCRIPTIONOPTIONS]

[STAIRCASE]
IF REPLY$ = "1" AND LEVEL = -1 THEN LEVEL = LEVEL + 1
IF REPLY$ = "1" THEN LEVEL = LEVEL +1
IF REPLY$ = "2" AND LEVEL < 0 THEN LEVEL = LEVEL - 1
IF REPLY$ = "2" AND LEVEL = 1 THEN LEVEL = LEVEL - 2
IF REPLY$ = "2" AND LEVEL > 0 THEN LEVEL = LEVEL - 1
GOTO [ROOMDESCRIPTION]

REM THIS IS THE END MY ONLY FRIEND

[ENDING]
PRINT "You have sustained fatal injury."
GOTO [GAMEOVER]
[REPEATENDINGOPTION]
PRINT ""
PRINT "Are you certain you wish to leave the game?"
PRINT ""
PRINT "(1) yes"
PRINT "(2) no"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [GAMEOVER]
IF REPLY$ = "2" GOTO [ROOMDESCRIPTION2]
PRINT ""
PRINT "Please enter a 1 or 2."
GOTO [REPEATENDINGOPTION]

[REPEATENDINGOPTION2]
PRINT ""
PRINT "Are you certain you wish to leave the game?"
PRINT ""
PRINT "(1) yes"
PRINT "(2) no"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [GAMEOVER]
IF REPLY$ = "2" THEN GOTO [OUTSIDETHETOWER]
PRINT ""
PRINT "Please enter a 1 or 2."
GOTO [REPEATENDINGOPTION2]

[GAMEOVER]
PRINT ""
PRINT "Your adventures are over..."
[LEAVETHETOWER]
PRINT ""
PRINT "Do you want to:"
PRINT ""
PRINT "(1) start over from the beginning or"
PRINT "(2) quit and leave the game"
INPUT REPLY$
PRINT ""
IF REPLY$ = "1" THEN GOTO [INTRO]
IF REPLY$ = "2" THEN END
PRINT ""
PRINT "Please enter a 1 or 2."
GOTO [REPEATENDINGOPTION]


REM EVERY TIME THE PLAYER GOES TO A DIFFERENT FLOOR IN THE TOWER, S/HE MIGHT RUN ACROSS EITHER A CREATURE OR AN ITEM

[RANDOMOCCURENCE]
RANDOMOCCURENCE = INT(RND(0)*100)
IF RANDOMOCCURENCE <= 75 THEN GOTO [ENVIRONMENTDESCRIPTION]
IF RANDOMOCCURENCE > 75 AND RANDOMOCCURENCE <= 80 THEN GOTO [DRINKVIAL]
IF RANDOMOCCURENCE > 80 AND RANDOMOCCURENCE <= 85 THEN GOTO [PICKUPMAGICITEM]

REM THIS SECTION IS THE ALGORITM FOR COMBATTING CREATURES IN THE TOWER

[ENCOUNTERACREATURE]
[SELECTCREATURETYPE]
SELECTCREATURETYPE = INT(RND(0)*47)

SELECT CASE SELECTCREATURETYPE
    CASE 0
        SELECTACREATURETYPE$ = "skeleton"
    CASE 1
        SELECTACREATURETYPE$ = "zombie"
     CASE 2
        SELECTACREATURETYPE$ = "lich"
    CASE 3
        SELECTACREATURETYPE$ = "bandit"
    CASE 4
        SELECTACREATURETYPE$ = "swordsman"
    CASE 5
        SELECTACREATURETYPE$ = "mercenary"
    CASE 6
        SELECTACREATURETYPE$ = "werewolf"
    CASE 7
        SELECTACREATURETYPE$ = "goblin"
    CASE 8
        SELECTACREATURETYPE$ = "giant spider"
    CASE 9
        SELECTACREATURETYPE$ = "vampire"
    CASE 10
        SELECTACREATURETYPE$ = "cave troll"
    CASE 11
        SELECTACREATURETYPE$ = "basilisk"
    CASE 12
        SELECTACREATURETYPE$ = "giant bat"
    CASE 13
        SELECTACREATURETYPE$ = "beholder"
    CASE 14
        SELECTACREATURETYPE$ = "carrion crawler"
    CASE 15
        SELECTACREATURETYPE$ = "crocodile"
    CASE 16
        SELECTACREATURETYPE$ = "cyclops"
    CASE 17
        SELECTACREATURETYPE$ = "centaur"
    CASE 18
        SELECTACREATURETYPE$ = "minotaur"
    CASE 19
        SELECTACREATURETYPE$ = "demon"
    CASE 20
        SELECTACREATURETYPE$ = "displacer beast"
    CASE 21
        SELECTACREATURETYPE$ = "dracolich"
    CASE 22
        SELECTACREATURETYPE$ = "dragon"
    CASE 23
        SELECTACREATURETYPE$ = "drow elf"
    CASE 24
        SELECTACREATURETYPE$ = "mummy"
    CASE 25
        SELECTACREATURETYPE$ = "phase spider"
    CASE 26
        SELECTACREATURETYPE$ = "medusa"
    CASE 27
        SELECTACREATURETYPE$ = "manticore"
    CASE 28
        SELECTACREATURETYPE$ = "hydra"
    CASE 29
        SELECTACREATURETYPE$ = "golem"
    CASE 30
        SELECTACREATURETYPE$ = "giant lizard"
    CASE 31
        SELECTACREATURETYPE$ = "wyvern"
    CASE 32
        SELECTACREATURETYPE$ = "shambling mound"
    CASE 33
        SELECTACREATURETYPE$ = "roc"
    CASE 34
        SELECTACREATURETYPE$ = "giant rat"
    CASE 35
        SELECTACREATURETYPE$ = "purple worm"
    CASE 36
        SELECTACREATURETYPE$ = "short-faced bear"
    CASE 37
        SELECTACREATURETYPE$ = "giant hound"
    CASE 38
        SELECTACREATURETYPE$ = "harpy"
    CASE 39
        SELECTACREATURETYPE$ = "griffon"
    CASE 40
        SELECTACREATURETYPE$ = "gargoyle"
    CASE 41
        SELECTACREATURETYPE$ = "blink dog"
    CASE 42
        SELECTACREATURETYPE$ = "chimera"
    CASE 43
        SELECTACREATURETYPE$ = "dryad"
    CASE 44
        SELECTACREATURETYPE$ = "gorgon"
    CASE 45
        SELECTACREATURETYPE$ = "hippogriff"
    CASE 46
        SELECTACREATURETYPE$ = "naga"
END SELECT
CREATUREATTACKVERBAGE = INT(RND(0)*4)
SELECT CASE CREATUREATTACKVERBAGE
    CASE 0
        CREATUREATTACKVERBAGE$ = "threatens you"
    CASE 1
        CREATUREATTACKVERBAGE$ = "lunges at you"
    CASE 2
        CREATUREATTACKVERBAGE$ = "hurls itself at you"
    CASE 3
        CREATUREATTACKVERBAGE$ = "rushes at you"
END SELECT
PRINT ""
PRINT "A " + SELECTACREATURETYPE$ + " " + CREATUREATTACKVERBAGE$ + "."
CREATUREHEALTH = INT(RND(0)*30)+20
CREATUREINITIALHEALTH = CREATUREHEALTH
CREATUREGOLD = INT(RND(0)*30)+20
[HITCREATUREAGAIN]
PRINT ""
PRINT "you: HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; MAGICITEMDESCRIPTOR$
PRINT SELECTACREATURETYPE$ + ": HP: " ; CREATUREHEALTH ; "  Gold: " ; CREATUREGOLD
[REPEATHITCREATURE]
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "(1) engage the " + SELECTACREATURETYPE$ + " or"
PRINT "(2) run back to the staircase"
INPUT REPLY$
PRINT ""
IF REPLY$ = "1" THEN GOTO [CHARACTERATTACKSCREATURE]
IF REPLY$ = "2" THEN GOTO [ROOMDESCRIPTION]
PRINT ""
PRINT "Please enter a 1 or 2."
GOTO [REPEATHITCREATURE]
[CHARACTERATTACKSCREATURE]
CHARACTERATTACKSCREATURE = INT(RND(0)*2)+1
IF CHARACTERATTACKSCREATURE = 1 THEN GOTO [CHARACTERHITSCREATURE]
IF CHARACTERATTACKSCREATURE = 2 THEN PRINT "You swing at the " + SELECTACREATURETYPE$ + " and miss."
IF CHARACTERATTACKSCREATURE = 2 THEN GOTO [CREATUREATTACKSCHARACTER]
[CHARACTERHITSCREATURE]
CHARACTERDAMAGESCREATURE = INT(RND(0)*9)+2
TOTALDAMAGE = CHARACTERDAMAGESCREATURE + MAGICITEMDAMAGEFACTOR
CREATUREHEALTH = CREATUREHEALTH - TOTALDAMAGE
PRINT "You hit the " + SELECTACREATURETYPE$ + " and do " ; TOTALDAMAGE ; " points of damage."
IF CREATUREHEALTH <= 0 THEN GOTO [CREATUREDEFEATED]
[CREATUREATTACKSCHARACTER]
IF SELECTCREATURETYPE = 6 AND CREATUREHEALTH < CREATUREINITIALHEALTH THEN GOSUB [REGENERATION]
IF SELECTCREATURETYPE = 9 AND CREATUREHEALTH < CREATUREINITIALHEALTH THEN GOSUB [REGENERATION]
CREATUREATTACKSCHARACTER = INT(RND(0)*2)+1
IF CREATUREATTACKSCHARACTER = 1 THEN GOTO [CREATUREHITSCHARACTER]
IF CREATUREATTACKSCHARACTER = 2 THEN PRINT "The " + SELECTACREATURETYPE$ + " lashes out at you and misses."
GOTO [HITCREATUREAGAIN]
[CREATUREHITSCHARACTER]
CREATUREHITSCHARACTERDAMAGE = INT(RND(0)*9)+2
TOTALDAMAGE = CREATUREHITSCHARACTERDAMAGE
CHARACTERHEALTH=CHARACTERHEALTH-TOTALDAMAGE
PRINT "The " + SELECTACREATURETYPE$ + " attacks you and does " ; CREATUREHITSCHARACTERDAMAGE ; " points of damage."
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
GOTO [HITCREATUREAGAIN]
[CREATUREDEFEATED]
PRINT ""
PRINT "Victory!  The " + SELECTACREATURETYPE$ + " is crumpled on the floor, dead.  You also found some gold."
PRINT ""
CHARACTERGOLD = CHARACTERGOLD + CREATUREGOLD
GOTO [ENVIRONMENTDESCRIPTION]



REM THIS CODE ALLOWS THE PLAYER TO PICK UP AND RETAIN A MAGIC ITEM.  THE STRENGTH OF THE ITEM IS SELECTED RANDOMLY.

[PICKUPMAGICITEM]
MAGICITEMTYPE = INT(RND(0)*11)+1
SELECT CASE MAGICITEMTYPE
    CASE 1
        MAGICITEMTYPE$ = "long sword"
    CASE 2
        MAGICITEMTYPE$ = "staff"
    CASE 3
        MAGICITEMTYPE$ = "short sword"
    CASE 4
        MAGICITEMTYPE$ = "dagger"
    CASE 5
        MAGICITEMTYPE$ = "mace"
    CASE 6
        MAGICITEMTYPE$ = "morningstar"
    CASE 7
        MAGICITEMTYPE$ = "flail"
    CASE 8
        MAGICITEMTYPE$ = "two-handed sword"
    CASE 9
        MAGICITEMTYPE$ = "spiked gauntlet"
    CASE 10
        MAGICITEMTYPE$ = "cudgel"
    CASE 11
        MAGICITEMTYPE$ = "club"
END SELECT
PRINT "You find a " + MAGICITEMTYPE$ + " on the ground."
[PICKUPMAGICITEMREPEAT]
PRINT "HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; MAGICITEMDESCRIPTOR$
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "(1) pick it up or"
PRINT "(2) leave it where it is"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [PICKUPITEM]
IF REPLY$ = "2" THEN GOTO [DONTPICKUPITEM]
PRINT ""
PRINT "Please enter a 1 or 2."
GOTO [PICKUPMAGICITEMREPEAT]
[PICKUPITEM]
MAGICITEMDAMAGEFACTOR = INT(RND(0)*10)+1
MAGICITEM = MAGICITEMDAMAGEFACTOR
MAGICITEMDESCRIPTOR$ = MAGICITEMTYPE$ + " (+ " ; MAGICITEMDAMAGEFACTOR ; " damage)"
PRINT ""
PRINT "The " + MAGICITEMTYPE$ + " feels very strong, light and balanced in your hand."
GOTO [ENVIRONMENTDESCRIPTION]
[DONTPICKUPITEM]
PRINT ""
PRINT "You leave the unknown " + MAGICITEMTYPE$ + " lying on the ground."
GOTO [ENVIRONMENTDESCRIPTION]



REM THIS CODE CAUSES THE PLAYER TO ENCOUNTER A VIAL OF UNKNOWN LIQUID AND SEE IF IT HELPS OR HURTS

[DRINKVIAL]
LIQUIDCOLOR = INT(RND(0)*20)+1
SELECT CASE LIQUIDCOLOR
    CASE 1
        LIQUIDCOLOR$ = "red "
    CASE 2
        LIQUIDCOLOR$ = "pink "
    CASE 3
        LIQUIDCOLOR$ = "burnt orange "
    CASE 4
        LIQUIDCOLOR$ = "black "
    CASE 5
        LIQUIDCOLOR$ = "magenta "
    CASE 6
        LIQUIDCOLOR$ = "pea green "
    CASE 7
        LIQUIDCOLOR$ = "sky blue "
    CASE 8
        LIQUIDCOLOR$ = "custard yellow "
    CASE 9
        LIQUIDCOLOR$ = "clear "
    CASE 10
        LIQUIDCOLOR$ = "milky "
    CASE 11
        LIQUIDCOLOR$ = "brown and yellow "
    CASE 12
        LIQUIDCOLOR$ = "taupe "
    CASE 13
        LIQUIDCOLOR$ = "cerulean "
    CASE 14
        LIQUIDCOLOR$ = "midnight blue "
    CASE 15
        LIQUIDCOLOR$ = "glittery "
    CASE 16
        LIQUIDCOLOR$ = "honey-colored "
    CASE 17
        LIQUIDCOLOR$ = "snow white "
    CASE 18
        LIQUIDCOLOR$ = "goldenrod "
    CASE 19
        LIQUIDCOLOR$ = "copper "
    CASE 20
        LIQUIDCOLOR$ = "silver "
END SELECT
PRINT "You find a vial with a glowing " + LIQUIDCOLOR$ + "liquid in it."
[DRINKVIALREPEAT]
PRINT "HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; SWORDDESCRIPTOR$
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "(1) drink the liquid or"
PRINT "(2) leave it where it is"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [DODRINKVIAL]
IF REPLY$ = "2" THEN GOTO [DONTDRINKVIAL]
PRINT ""
PRINT "Please enter a 1 or 2."
GOTO [DRINKVIALREPEAT]
[DODRINKVIAL]
HEALORHURT = INT(RND(0)*2)+1
VIALEFFECTAMOUNT = INT(RND(0)*9)+2
IF HEALORHURT = 1 THEN GOTO [HEAL]
IF HEALORHURT = 2 THEN GOTO [HURT]
[HEAL]
CHARACTERHEALTH = CHARACTERHEALTH + VIALEFFECTAMOUNT
PRINT ""
PRINT "The liquid refreshes and energizes you.  You gain " ; VIALEFFECTAMOUNT ; " hit points, bringing you to " ; CHARACTERHEALTH ; " total hit points."
PRINT ""
GOTO [ENVIRONMENTDESCRIPTION]
[HURT]
CHARACTERHEALTH = CHARACTERHEALTH - VIALEFFECTAMOUNT
PRINT ""
PRINT "The liquid burns you on the inside.  You lose " ; VIALEFFECTAMOUNT ; " hit points, bringing you to " ; CHARACTERHEALTH ; " total hit points."
PRINT ""
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
GOTO [ENVIRONMENTDESCRIPTION]
[DONTDRINKVIAL]
PRINT ""
PRINT "You cautiously decide to leave the unknown liquid where it is."
GOTO [ENVIRONMENTDESCRIPTION]

REM THIS CODE MAKES BOTH THE WEREWOLF AND THE VAMPIRE REGENERATE.

[REGENERATION]
REGENERATION = INT(RND(0)*9)+1
CREATUREHEALTH = CREATUREHEALTH + REGENERATION
PRINT ""
PRINT "The " + SELECTACREATURETYPE$ + " regenerates.  It gains " ; REGENERATION ; " hit points, giving it " ; CREATUREHEALTH ; " hit points."
PRINT ""
RETURN

[JUMPOUTTHEWINDOW]
FALLINGDAMAGE = LEVEL * 5
CHARACTERHEALTH = CHARACTERHEALTH - FALLINGDAMAGE
PRINT ""
PRINT "You throw yourself out the window and plummet to the ground, taking " ; FALLINGDAMAGE ; " points of damage."
IF LEVEL > 20 AND LEVEL <= 50 THEN PRINT "Your body hits the ground and bounces like a rag doll."
IF LEVEL > 50  AND LEVEL <= 100 THEN PRINT "Your body makes an audible crack as it hits the solid earth."
IF LEVEL > 100  AND LEVEL <= 1000 THEN PRINT "Your body hits the ground so hard that an arm and a leg detach and go flying onto the hillside."
IF LEVEL > 1000 THEN PRINT "A dragon spots you falling, swoops down and swallows you just before you hit the ground."
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
PRINT "You stand up and brush the dirt off of your clothes."
GOTO [OUTSIDETHETOWER]
Machiavvelli3060
Posts: 6
Joined: Tue May 14, 2013 5:54 pm

Re: theTower - A Text Adventure Game

Post by Machiavvelli3060 »

Here is the most recent installment.

1. There is now one matrix to describe all areas of play, inside the tower or outside the tower.
2. The creatures now vary in attack method and hit points. Combat is more interesting now.
3. I've changed the name of the game to 'Tower of Rodinia'.
4. I've even created an icon for the game.

Code: Select all

REM This program is named 'Tower of Rodinia'.  It was first started on June 30th, 2013 by Alan J. Robinson.

REM THE FOLLOWING SECTION IS THE GAMES INTRODUCTION.

[INTRO]
LEVEL = 1
CHARACTERHEALTH = 100
CHARACTERGOLD = 0
MAGICITEMDESCRIPTOR$ = "your hands and feet"
ZOMBIESCRATCH$ = "NO"
OUTSIDETHETOWER$ = "YES"
PRINT "Tower of Rodinia, a text-based adventure game"
GOTO [ROOMDESCRIPTION]

[WALKAROUNDTHETOWER]
HITBYAJUMPER = INT(RND(0)*100)
IF HITBYAJUMPER = 20 THEN GOTO [HITBYAJUMPER]
PRINT ""
PRINT "You walk around the base of the tower, inspecting and assessing it.  The material"
PRINT "used is unfamiliar, completely ebony and impossible to even scratch.  The blocks"
PRINT "used are all uniform in color and dimension, perfectly tuckpointed.  The tower is"
PRINT "about 100 paces around, which comes to about 300 feet.  Each floor seems to have"
PRINT "windows, at least as far as the eye can see.  The tower does not appear to curve"
PRINT "at all as it rises up into the blue sky.  There is no technology known to man that"
PRINT "could have created this tower; its very existence is a perplexing splinter in the"
PRINT "mind.  How far up can this tower possibly go?  Does it go down?  How far does it"
PRINT "go down?  Who built it?  For what purpose was it built?"
GOTO [ROOMDESCRIPTION]

REM THE FOLLOWING SECTION DESCRIBES EACH ROOM

[ROOMDESCRIPTION]
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
IF OUTSIDETHETOWER$ = "YES" THEN FIRSTOPTION$ = "(1) enter the tower"
IF OUTSIDETHETOWER$ = "YES" THEN SECONDOPTION$ = "(2) walk around the tower"
IF OUTSIDETHETOWER$ = "YES" THEN THIRDOPTION$ = "(3) exit the game"
IF OUTSIDETHETOWER$ = "YES" THEN FOURTHOPTION$ = ""
IF OUTSIDETHETOWER$ = "YES" THEN FIFTHOPTION$ = ""
IF OUTSIDETHETOWER$ = "YES" THEN SIXTHOPTION$ = ""
IF OUTSIDETHETOWER$ = "NO" THEN FIRSTOPTION$ = "(1) go up the staircase"
IF OUTSIDETHETOWER$ = "NO" THEN SECONDOPTION$ = "(2) go down the staircase"
IF OUTSIDETHETOWER$ = "NO" THEN THIRDOPTION$  = "(3) explore this floor"
IF OUTSIDETHETOWER$ = "NO" THEN FOURTHOPTION$ = "(4) exit the game"
IF OUTSIDETHETOWER$ = "NO" AND LEVEL > 0 THEN FIFTHOPTION$ = "(5) jump out the window"
IF OUTSIDETHETOWER$ = "NO" AND LEVEL < 0 THEN FIFTHOPTION$ = ""
IF OUTSIDETHETOWER$ = "NO" AND LEVEL < 1 THEN SIXTHOPTION$ = ""
IF OUTSIDETHETOWER$ = "NO" AND LEVEL = 1 THEN SIXTHOPTION$ = "(6) leave the tower"
IF OUTSIDETHETOWER$ = "NO" AND LEVEL > 1 THEN SIXTHOPTION$ = ""
PRINT ""
[ENVIRONMENTDESCRIPTION]
IF LEVEL < -1000 THEN CHARACTERHEALTH = CHARACTERHEALTH - 4
IF LEVEL <= -500 AND LEVEL > -1000 THEN CHARACTERHEALTH = CHARACTERHEALTH - 3
IF LEVEL <= -300 AND LEVEL > -500 THEN CHARACTERHEALTH = CHARACTERHEALTH - 2
IF LEVEL <= -100 AND LEVEL > -300 THEN CHARACTERHEALTH = CHARACTERHEALTH - 1
IF LEVEL < -50 THEN ENVIRONMENTDESCRIPTION$ = "The stifling conditions are starting to have a noticable effect on you."
IF LEVEL >= -50 AND LEVEL < -25 THEN ENVIRONMENTDESCRIPTION$ = "The lower you climb, the warmer it gets."
IF LEVEL >= -25 AND LEVEL < 1 AND OUTSIDETHETOWER$ = "NO" THEN ENVIRONMENTDESCRIPTION$ = "It is hot, humid and unpleasant down here."
IF LEVEL >= 1 AND LEVEL < 25 AND OUTSIDETHETOWER$ = "NO" THEN ENVIRONMENTDESCRIPTION$ = "The air is cool and calm here."
IF LEVEL >= 25 AND LEVEL < 50 AND OUTSIDETHETOWER$ = "NO" THEN ENVIRONMENTDESCRIPTION$ = "The air is getting noticeably cooler."
IF LEVEL >= 50 AND LEVEL < 100 THEN ENVIRONMENTDESCRIPTION$ = "The air is getting thin up here."
IF LEVEL >= 100 AND LEVEL < 200 THEN ENVIRONMENTDESCRIPTION$ = "Your nose is starting to bleed.  You feel weak."
IF LEVEL >= 200 THEN ENVIRONMENTDESCRIPTION$ = "You are weakening with every step up."
IF OUTSIDETHETOWER$ = "YES" THEN ENVIRONMENTDESCRIPTION$ = "The air is tepid, still and stangnant."
IF OUTSIDETHETOWER$ = "YES" THEN GOTO [DESCRIBETHESCENEOUTSIDETHETOWER]
IF OUTSIDETHETOWER$ = "NO" AND LEVEL > 0 THEN GOTO [DESCRIBETHESCENEINSIDETHETOWERABOVEGROUND]
IF OUTSIDETHETOWER$ = "NO" AND LEVEL < 1 THEN GOTO [DESCRIBETHESCENEINSIDETHETOWERBELOWGROUND]
[DESCRIBETHESCENEOUTSIDETHETOWER]
PRINT "Surroundings: You are standing outside the doors to a massive black round tower."
PRINT "              It is so tall its top cannot be seen; it disappears into the clouds."
GOTO [WINDOWVIEW]
[DESCRIBETHESCENEINSIDETHETOWERABOVEGROUND]
PRINT "Surroundings: You are inside a massive black round tower.  The center of the tower is"
PRINT "              dominated by a massive ebony spiral staircase that goes up and down as"
PRINT "              far as the eye can see.  There are windows on the external walls."
GOTO [WINDOWVIEW]
[DESCRIBETHESCENEINSIDETHETOWERBELOWGROUND]
PRINT "Surroundings: You are inside a massive black round tower, underground.  It is dark,"
PRINT "              humid and oppressive down here.  The center of the tower is dominated"
PRINT "              by a massive ebony spiral staircase that goes up and down as far as"
PRINT "              the eye can see."
GOTO [WINDOWVIEW]
[WINDOWVIEW]
PRINT "Environment:  " + ENVIRONMENTDESCRIPTION$
IF LEVEL > 0 AND LEVEL <= 10 THEN PRINT "View:         You can see hills and farm fields."
IF LEVEL > 10 AND LEVEL <= 50 AND OUTSIDETHETOWER$ = "NO" THEN PRINT "View:         You are getting pretty high, but you still cannot see the top."
IF LEVEL > 50 AND LEVEL <= 100 AND OUTSIDETHETOWER$ = "NO" THEN PRINT "View:         You see birds of prey circling the tower."
IF LEVEL > 100 AND LEVEL <= 200 AND OUTSIDETHETOWER$ = "NO" THEN PRINT "View:         It is starting to get cloudy."
IF LEVEL > 200 AND LEVEL <= 300 AND OUTSIDETHETOWER$ = "NO" THEN PRINT "View:         The view is completely obscured by clouds and it is getting very cold."
IF LEVEL > 300 AND LEVEL <= 500 AND OUTSIDETHETOWER$ = "NO" THEN PRINT "View:         The clouds are starting to clear."
IF LEVEL > 500 AND LEVEL <= 1000 AND OUTSIDETHETOWER$ = "NO" THEN PRINT "View:         You can see the tops of the clouds!  You should not be able to breathe up here."
IF LEVEL > 100 AND LEVEL <= 300 THEN CHARACTERHEALTH = CHARACTERHEALTH - 1
IF LEVEL > 300 AND LEVEL <= 500 THEN CHARACTERHEALTH = CHARACTERHEALTH - 2
IF LEVEL > 500 AND LEVEL <= 1000 THEN CHARACTERHEALTH = CHARACTERHEALTH - 3
IF LEVEL > 1000 THEN CHARACTERHEALTH = CHARACTERHEALTH - 4
IF ZOMBIESCRATCH$ = "YES" AND CHARACTERHEALTH <= 0 THEN GOTO [ZOMBIEENDING]
IF ZOMBIESCRATCH$ = "YES" AND CHARACTERHEALTH > 0 THEN GOTO [REPEATZOMBIEOPTION]
IF ZOMBIESCRATCH$ = "NO" THEN GOTO [ROOMDESCRIPTION2]
[REPEATZOMBIEOPTION]
CHARACTERHEALTH = CHARACTERHEALTH - 2
PRINT ""
PRINT "That zombie scratch is looking red, puffy and nasty.  You're getting feverish."
PRINT ""
[ROOMDESCRIPTION2]
IF LEVEL < 1 THEN PRINT "Level:        " ; LEVEL ; ",  HP: " ; CHARACTERHEALTH ; ",  Gold: " ; CHARACTERGOLD ; ",  Weapon: " ; MAGICITEMDESCRIPTOR$
IF LEVEL = 1 THEN PRINT "Level:        Ground floor,  HP: " ; CHARACTERHEALTH ; ",  Gold: " ; CHARACTERGOLD ; ",  Weapon: " ; MAGICITEMDESCRIPTOR$
IF LEVEL > 1 THEN PRINT "Level:        " ; LEVEL ; ",  HP: " ; CHARACTERHEALTH ; ",  Gold: " ; CHARACTERGOLD ; ",  Weapon: " ; MAGICITEMDESCRIPTOR$
[REPEATROOMDESCRIPTIONOPTIONS]
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT FIRSTOPTION$ + "        " + THIRDOPTION$  + "    " + FIFTHOPTION$
PRINT SECONDOPTION$+ "      " + FOURTHOPTION$   + "         " + SIXTHOPTION$
INPUT REPLY$
IF REPLY$ = "1" AND OUTSIDETHETOWER$ = "NO" THEN GOTO [STAIRCASE]
IF REPLY$ = "1" AND OUTSIDETHETOWER$ = "YES" THEN GOTO [ENTERTHETOWER]
IF REPLY$ = "2" AND OUTSIDETHETOWER$ = "NO" THEN GOTO [STAIRCASE]
IF REPLY$ = "2" AND OUTSIDETHETOWER$ = "YES" THEN GOTO [WALKAROUNDTHETOWER]
IF REPLY$ = "3" AND OUTSIDETHETOWER$ = "NO" THEN GOTO [RANDOMOCCURENCE]
IF REPLY$ = "3" AND OUTSIDETHETOWER$ = "YES" THEN GOTO [REPEATENDINGOPTION]
IF REPLY$ = "4" AND OUTSIDETHETOWER$ = "NO" THEN GOTO [REPEATENDINGOPTION]
IF REPLY$ = "4" AND OUTSIDETHETOWER$ = "YES" THEN GOTO [OPTIONCORRECTION]
IF REPLY$ = "5" AND OUTSIDETHETOWER$ = "YES" THEN GOTO [OPTIONCORRECTION]
IF REPLY$ = "5" AND OUTSIDETHETOWER$ = "NO" AND LEVEL < 1 THEN GOTO [OPTIONCORRECTION]
IF REPLY$ = "5" AND OUTSIDETHETOWER$ = "NO" AND LEVEL > 0 THEN GOTO [JUMPOUTTHEWINDOW]
IF REPLY$ = "6" AND LEVEL < 1 THEN GOTO [OPTIONCORRECTION]
IF REPLY$ = "6" AND LEVEL = 1 AND OUTSIDETHETOWER$ = "NO" THEN GOTO [LEAVETHETOWER]
IF REPLY$ = "6" AND LEVEL = 1 AND OUTSIDETHETOWER$ = "YES" THEN GOTO [OPTIONCORRECTION]
IF REPLY$ = "6" AND LEVEL > 1 THEN GOTO [OPTIONCORRECTION]
IF LEVEL < 1 THEN GOTO [OPTIONCORRECTION]
IF LEVEL = 1 THEN GOTO [OPTIONCORRECTION]
[OPTIONCORRECTION]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [REPEATROOMDESCRIPTIONOPTIONS]

[LEAVETHETOWER]
OUTSIDETHETOWER$ = "YES"
GOTO [ROOMDESCRIPTION]

[ENTERTHETOWER]
OUTSIDETHETOWER$ = "NO"
GOTO [ROOMDESCRIPTION]

[STAIRCASE]
IF REPLY$ = "1" AND LEVEL = -1 THEN LEVEL = LEVEL + 1
IF REPLY$ = "1" THEN LEVEL = LEVEL +1
IF REPLY$ = "2" AND LEVEL < 0 THEN LEVEL = LEVEL - 1
IF REPLY$ = "2" AND LEVEL = 1 THEN LEVEL = LEVEL - 2
IF REPLY$ = "2" AND LEVEL > 0 THEN LEVEL = LEVEL - 1
GOTO [ROOMDESCRIPTION]

REM THIS IS THE END MY ONLY FRIEND

[ENDING]
PRINT "You have sustained fatal injury."
[REPEATFATALINJURYOPTION]
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "(1) start over from the beginning"
PRINT "(2) quit"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [INTRO]
IF REPLY$ = "2" GOTO [GAMEOVER]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [REPEATFATALINJURYOPTION]


GOTO [GAMEOVER]
[REPEATENDINGOPTION]
PRINT ""
PRINT "Are you certain you wish to leave the game?"
PRINT ""
PRINT "(1) yes"
PRINT "(2) no"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [GAMEOVER]
IF REPLY$ = "2" GOTO [ROOMDESCRIPTION]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [REPEATENDINGOPTION]

[REPEATENDINGOPTION2]
PRINT ""
PRINT "Are you certain you wish to leave the game?"
PRINT ""
PRINT "(1) yes"
PRINT "(2) no"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [GAMEOVER]
IF REPLY$ = "2" THEN GOTO [OUTSIDETHETOWER]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [REPEATENDINGOPTION2]

[GAMEOVER]
END

REM EVERY TIME THE PLAYER GOES TO A DIFFERENT FLOOR IN THE TOWER, S/HE MIGHT RUN ACROSS EITHER A CREATURE OR AN ITEM

[RANDOMOCCURENCE]
RANDOMOCCURENCE = INT(RND(0)*100)
IF RANDOMOCCURENCE <= 75 THEN GOTO [ROOMDESCRIPTION]
IF RANDOMOCCURENCE > 75 AND RANDOMOCCURENCE <= 80 THEN GOTO [DRINKVIAL]
IF RANDOMOCCURENCE > 80 AND RANDOMOCCURENCE <= 85 THEN GOTO [PICKUPMAGICITEM]

REM THIS SECTION IS THE ALGORITM FOR COMBATTING CREATURES IN THE TOWER

[ENCOUNTERACREATURE]
[SELECTCREATURETYPE]
SELECTCREATURETYPE = INT(RND(0)*47)
CREATUREHEALTH = INT(RND(0)*20)+1
CREATUREINITIALHEALTH = CREATUREHEALTH
CREATUREGOLD = INT(RND(0)*30)+20
SELECT CASE SELECTCREATURETYPE
    CASE 0
        SELECTACREATURETYPE$ = "skeleton"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "strangles"
        CREATUREWEAPON$ = "its hands"
    CASE 1
        SELECTACREATURETYPE$ = "zombie"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "scratches"
        CREATUREWEAPON$ = "its hands"
    CASE 2
        SELECTACREATURETYPE$ = "lich"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "curses"
        CREATUREWEAPON$ = "its dark magic"
    CASE 3
        SELECTACREATURETYPE$ = "bandit"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "fires a dart at"
        CREATUREWEAPON$ = "his pistol crossbow"
    CASE 4
        SELECTACREATURETYPE$ = "swordsman"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "chops at"
        CREATUREWEAPON$ = "his saber"
    CASE 5
        SELECTACREATURETYPE$ = "mercenary"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "stabs"
        CREATUREWEAPON$ = "his trident"
    CASE 6
        SELECTACREATURETYPE$ = "werewolf"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "tears at"
        CREATUREWEAPON$ = "its claws"
    CASE 7
        SELECTACREATURETYPE$ = "goblin"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "stabs"
        CREATUREWEAPON$ = "his trident"
    CASE 8
        SELECTACREATURETYPE$ = "giant spider"
        CREATUREHEALTH = CREATUREHEALTH + 10
        CREATUREATTACKVERBAGE$ = "bites"
        CREATUREWEAPON$ = "its teeth"
    CASE 9
        SELECTACREATURETYPE$ = "vampire"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "slices you"
        CREATUREWEAPON$ = "his claws"
    CASE 10
        SELECTACREATURETYPE$ = "cave troll"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "pummels"
        CREATUREWEAPON$ = "his huge fists"
    CASE 11
        SELECTACREATURETYPE$ = "basilisk"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "lashes out at"
        CREATUREWEAPON$ = "its tail"
    CASE 12
        SELECTACREATURETYPE$ = "giant bat"
        CREATUREHEALTH = CREATUREHEALTH + 10
        CREATUREATTACKVERBAGE$ = "bites"
        CREATUREWEAPON$ = "its teeth"
    CASE 13
        SELECTACREATURETYPE$ = "beholder"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "fires a magic missile at"
        CREATUREWEAPON$ = "its magical spells"
    CASE 14
        SELECTACREATURETYPE$ = "carrion crawler"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "bites"
        CREATUREWEAPON$ = "its teeth"
    CASE 15
        SELECTACREATURETYPE$ = "crocodile"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "slams"
        CREATUREWEAPON$ = "its tail"
    CASE 16
        SELECTACREATURETYPE$ = "cyclops"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "bashes"
        CREATUREWEAPON$ = "his club"
    CASE 17
        SELECTACREATURETYPE$ = "centaur"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "fires an aoorw at"
        CREATUREWEAPON$ = "his long bow"
    CASE 18
        SELECTACREATURETYPE$ = "minotaur"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "gores"
        CREATUREWEAPON$ = "his horns"
    CASE 19
        SELECTACREATURETYPE$ = "greater demon"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "smothers and saps strength from"
        CREATUREWEAPON$ = "its dark magic"
    CASE 20
        SELECTACREATURETYPE$ = "displacer beast"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "slices"
        CREATUREWEAPON$ = "its claws"
    CASE 21
        SELECTACREATURETYPE$ = "dracolich"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "curses"
        CREATUREWEAPON$ = "its dark magic"
    CASE 22
        SELECTACREATURETYPE$ = "dragon"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "bashes"
        CREATUREWEAPON$ = "its spiked tail"
    CASE 23
        SELECTACREATURETYPE$ = "drow elf"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "stabs"
        CREATUREWEAPON$ = "a long knife"
    CASE 24
        SELECTACREATURETYPE$ = "mummy"
        CREATUREHEALTH = CREATUREHEALTH + 10
        CREATUREATTACKVERBAGE$ = "strangles"
        CREATUREWEAPON$ = "its strong hands"
    CASE 25
        SELECTACREATURETYPE$ = "phase spider"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "appears above you and bites"
        CREATUREWEAPON$ = "its teeth"
    CASE 26
        SELECTACREATURETYPE$ = "medusa"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "hits"
        CREATUREWEAPON$ = "her tail"
    CASE 27
        SELECTACREATURETYPE$ = "manticore"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "slashes"
        CREATUREWEAPON$ = "its claws"
    CASE 28
        SELECTACREATURETYPE$ = "hydra"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "bites"
        CREATUREWEAPON$ = "its many heads"
    CASE 29
        SELECTACREATURETYPE$ = "golem"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "bashes"
        CREATUREWEAPON$ = "its stone hands"
    CASE 30
        SELECTACREATURETYPE$ = "giant lizard"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "lashes"
        CREATUREWEAPON$ = "its tail"
    CASE 31
        SELECTACREATURETYPE$ = "wyvern"
        CREATUREHEALTH = CREATUREHEALTH + 70
        CREATUREATTACKVERBAGE$ = "stings"
        CREATUREWEAPON$ = "its tail stinger"
    CASE 32
        SELECTACREATURETYPE$ = "shambling mound"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "smothers"
        CREATUREWEAPON$ = "layers of vegetation"
    CASE 33
        SELECTACREATURETYPE$ = "roc"
        CREATUREHEALTH = CREATUREHEALTH + 80
        CREATUREATTACKVERBAGE$ = "rends"
        CREATUREWEAPON$ = "its talons"
    CASE 34
        SELECTACREATURETYPE$ = "giant rat"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "gnaws on"
        CREATUREWEAPON$ = "its teeth"
    CASE 35
        SELECTACREATURETYPE$ = "purple worm"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "bites"
        CREATUREWEAPON$ = "its teeth"
    CASE 36
        SELECTACREATURETYPE$ = "short-faced bear"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "cuts"
        CREATUREWEAPON$ = "its claws"
    CASE 37
        SELECTACREATURETYPE$ = "giant hound"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "death-shakes"
        CREATUREWEAPON$ = "its powerful jaws"
    CASE 38
        SELECTACREATURETYPE$ = "harpy"
        CREATUREHEALTH = CREATUREHEALTH + 40
        CREATUREATTACKVERBAGE$ = "claws"
        CREATUREWEAPON$ = "its talons"
    CASE 39
        SELECTACREATURETYPE$ = "griffon"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "slashes"
        CREATUREWEAPON$ = "its claws"
    CASE 40
        SELECTACREATURETYPE$ = "gargoyle"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "slams"
        CREATUREWEAPON$ = "its stone mass"
    CASE 41
        SELECTACREATURETYPE$ = "blink dog"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "bites"
        CREATUREWEAPON$ = "its fangs"
    CASE 42
        SELECTACREATURETYPE$ = "chimera"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "slices"
        CREATUREWEAPON$ = "its claws"
    CASE 43
        SELECTACREATURETYPE$ = "dryad"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "stabs"
        CREATUREWEAPON$ = "her short spear"
    CASE 44
        SELECTACREATURETYPE$ = "gorgon"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "gazes at"
        CREATUREWEAPON$ = "her eyes"
    CASE 45
        SELECTACREATURETYPE$ = "hippogriff"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "body slams"
        CREATUREWEAPON$ = "its body weight"
    CASE 46
        SELECTACREATURETYPE$ = "naga"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "body slams"
        CREATUREWEAPON$ = "its body weight"
END SELECT
PRINT ""
PRINT "A " + SELECTACREATURETYPE$ + " confronts you."
[HITCREATUREAGAIN]
PRINT ""
PRINT "you:    HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; MAGICITEMDESCRIPTOR$
PRINT SELECTACREATURETYPE$ + ": HP: " ; CREATUREHEALTH ; "  Gold: " ; CREATUREGOLD ; "  Weapon: " ; CREATUREWEAPON$
[REPEATHITCREATURE]
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "(1) engage the " + SELECTACREATURETYPE$ + " or"
PRINT "(2) run back to the staircase"
INPUT REPLY$
PRINT ""
IF REPLY$ = "1" THEN GOTO [CHARACTERATTACKSCREATURE]
IF REPLY$ = "2" THEN GOTO [ROOMDESCRIPTION]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [REPEATHITCREATURE]
[CHARACTERATTACKSCREATURE]
CHARACTERATTACKSCREATURE = INT(RND(0)*2)+1
IF CHARACTERATTACKSCREATURE = 1 THEN GOTO [CHARACTERHITSCREATURE]
IF CHARACTERATTACKSCREATURE = 2 THEN PRINT "You swing at the " + SELECTACREATURETYPE$ + " and miss."
IF CHARACTERATTACKSCREATURE = 2 THEN GOTO [CREATUREATTACKSCHARACTER]
[CHARACTERHITSCREATURE]
CHARACTERDAMAGESCREATURE = INT(RND(0)*9)+2
TOTALDAMAGE = CHARACTERDAMAGESCREATURE + MAGICITEMDAMAGEFACTOR
CREATUREHEALTH = CREATUREHEALTH - TOTALDAMAGE
PRINT "You hit the " + SELECTACREATURETYPE$ + " and do " ; TOTALDAMAGE ; " points of damage."
IF CREATUREHEALTH <= 0 THEN GOTO [CREATUREDEFEATED]
[CREATUREATTACKSCHARACTER]
IF SELECTCREATURETYPE = 6 AND CREATUREHEALTH < CREATUREINITIALHEALTH THEN GOSUB [REGENERATION]
IF SELECTCREATURETYPE = 9 AND CREATUREHEALTH < CREATUREINITIALHEALTH THEN GOSUB [REGENERATION]
CREATUREATTACKSCHARACTER = INT(RND(0)*2)+1
IF CREATUREATTACKSCHARACTER = 1 THEN GOTO [CREATUREHITSCHARACTER]
IF CREATUREATTACKSCHARACTER = 2 THEN PRINT "The " + SELECTACREATURETYPE$ + " " +  CREATUREATTACKVERBAGE$ + " you with " + CREATUREWEAPON$ + " and misses."
GOTO [HITCREATUREAGAIN]
[CREATUREHITSCHARACTER]
CREATUREHITSCHARACTERDAMAGE = INT(RND(0)*9)+2
TOTALDAMAGE = CREATUREHITSCHARACTERDAMAGE
CHARACTERHEALTH=CHARACTERHEALTH-TOTALDAMAGE
PRINT "The " + SELECTACREATURETYPE$ + " " + CREATUREATTACKVERBAGE$ + " you with " + CREATUREWEAPON$ + " and does " ; CREATUREHITSCHARACTERDAMAGE ; " points of damage."
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
GOTO [HITCREATUREAGAIN]
[CREATUREDEFEATED]
PRINT ""
PRINT "Victory!  The " + SELECTACREATURETYPE$ + " is dead.  You also found some gold."
PRINT ""
CHARACTERGOLD = CHARACTERGOLD + CREATUREGOLD
GOTO [ENVIRONMENTDESCRIPTION]

REM THIS CODE ALLOWS THE PLAYER TO PICK UP AND RETAIN A MAGIC ITEM.  THE STRENGTH OF THE ITEM IS SELECTED RANDOMLY.

[PICKUPMAGICITEM]
MAGICITEMTYPE = INT(RND(0)*11)+1
SELECT CASE MAGICITEMTYPE
    CASE 1
        MAGICITEMTYPE$ = "long sword"
    CASE 2
        MAGICITEMTYPE$ = "staff"
    CASE 3
        MAGICITEMTYPE$ = "short sword"
    CASE 4
        MAGICITEMTYPE$ = "dagger"
    CASE 5
        MAGICITEMTYPE$ = "mace"
    CASE 6
        MAGICITEMTYPE$ = "morningstar"
    CASE 7
        MAGICITEMTYPE$ = "flail"
    CASE 8
        MAGICITEMTYPE$ = "two-handed sword"
    CASE 9
        MAGICITEMTYPE$ = "spiked gauntlet"
    CASE 10
        MAGICITEMTYPE$ = "cudgel"
    CASE 11
        MAGICITEMTYPE$ = "club"
END SELECT
PRINT "You find a " + MAGICITEMTYPE$ + " on the ground."
[PICKUPMAGICITEMREPEAT]
PRINT "HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; MAGICITEMDESCRIPTOR$
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "(1) pick it up or"
PRINT "(2) leave it where it is"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [PICKUPITEM]
IF REPLY$ = "2" THEN GOTO [DONTPICKUPITEM]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [PICKUPMAGICITEMREPEAT]
[PICKUPITEM]
MAGICITEMDAMAGEFACTOR = INT(RND(0)*10)+1
MAGICITEM = MAGICITEMDAMAGEFACTOR
MAGICITEMDESCRIPTOR$ = MAGICITEMTYPE$ + " (+ " ; MAGICITEMDAMAGEFACTOR ; " damage)"
PRINT ""
PRINT "The " + MAGICITEMTYPE$ + " feels very strong, light and balanced in your hand."
GOTO [ENVIRONMENTDESCRIPTION]
[DONTPICKUPITEM]
PRINT ""
PRINT "You leave the unknown " + MAGICITEMTYPE$ + " lying on the ground."
GOTO [ENVIRONMENTDESCRIPTION]

REM THIS CODE CAUSES THE PLAYER TO ENCOUNTER A VIAL OF UNKNOWN LIQUID AND SEE IF IT HELPS OR HURTS

[DRINKVIAL]
LIQUIDCOLOR = INT(RND(0)*20)+1
SELECT CASE LIQUIDCOLOR
    CASE 1
        LIQUIDCOLOR$ = "red "
    CASE 2
        LIQUIDCOLOR$ = "pink "
    CASE 3
        LIQUIDCOLOR$ = "burnt orange "
    CASE 4
        LIQUIDCOLOR$ = "black "
    CASE 5
        LIQUIDCOLOR$ = "magenta "
    CASE 6
        LIQUIDCOLOR$ = "pea green "
    CASE 7
        LIQUIDCOLOR$ = "sky blue "
    CASE 8
        LIQUIDCOLOR$ = "custard yellow "
    CASE 9
        LIQUIDCOLOR$ = "clear "
    CASE 10
        LIQUIDCOLOR$ = "milky "
    CASE 11
        LIQUIDCOLOR$ = "brown and yellow "
    CASE 12
        LIQUIDCOLOR$ = "taupe "
    CASE 13
        LIQUIDCOLOR$ = "cerulean "
    CASE 14
        LIQUIDCOLOR$ = "midnight blue "
    CASE 15
        LIQUIDCOLOR$ = "glittery "
    CASE 16
        LIQUIDCOLOR$ = "honey-colored "
    CASE 17
        LIQUIDCOLOR$ = "snow white "
    CASE 18
        LIQUIDCOLOR$ = "goldenrod "
    CASE 19
        LIQUIDCOLOR$ = "copper "
    CASE 20
        LIQUIDCOLOR$ = "silver "
END SELECT
PRINT ""
PRINT "You find a vial with a glowing " + LIQUIDCOLOR$ + "liquid in it."
[DRINKVIALREPEAT]
PRINT "HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; SWORDDESCRIPTOR$
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "(1) drink the liquid or"
PRINT "(2) leave it where it is"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [DODRINKVIAL]
IF REPLY$ = "2" THEN GOTO [DONTDRINKVIAL]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [DRINKVIALREPEAT]
[DODRINKVIAL]
HEALORHURT = INT(RND(0)*2)+1
VIALEFFECTAMOUNT = INT(RND(0)*9)+2
IF HEALORHURT = 1 THEN GOTO [HEAL]
IF HEALORHURT = 2 THEN GOTO [HURT]
[HEAL]
CHARACTERHEALTH = CHARACTERHEALTH + VIALEFFECTAMOUNT
PRINT ""
PRINT "The liquid refreshes and energizes you.  You gain " ; VIALEFFECTAMOUNT ; " hit points, bringing you to " ; CHARACTERHEALTH ; " total hit points."
PRINT ""
GOTO [ENVIRONMENTDESCRIPTION]
[HURT]
CHARACTERHEALTH = CHARACTERHEALTH - VIALEFFECTAMOUNT
PRINT ""
PRINT "The liquid burns you on the inside.  You lose " ; VIALEFFECTAMOUNT ; " hit points, bringing you to " ; CHARACTERHEALTH ; " total hit points."
PRINT ""
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
GOTO [ENVIRONMENTDESCRIPTION]
[DONTDRINKVIAL]
PRINT ""
PRINT "You cautiously decide to leave the unknown liquid where it is."
GOTO [ENVIRONMENTDESCRIPTION]

REM THIS CODE MAKES BOTH THE WEREWOLF AND THE VAMPIRE REGENERATE.

[REGENERATION]
REGENERATION = INT(RND(0)*9)+1
CREATUREHEALTH = CREATUREHEALTH + REGENERATION
PRINT ""
PRINT "The " + SELECTACREATURETYPE$ + " regenerates.  It gains " ; REGENERATION ; " hit points, giving it " ; CREATUREHEALTH ; " hit points."
PRINT ""
RETURN

[JUMPOUTTHEWINDOW]
FALLINGDAMAGE = LEVEL * 5
CHARACTERHEALTH = CHARACTERHEALTH - FALLINGDAMAGE
PRINT ""
PRINT "You throw yourself out the window and plummet to the ground, taking " ; FALLINGDAMAGE ; " points of damage."
IF LEVEL > 20 AND LEVEL <= 50 THEN PRINT "Your body hits the ground and bounces like a rag doll.  Vultures take notice and rejoice."
IF LEVEL > 50  AND LEVEL <= 100 THEN PRINT "Your body makes an audible crack as it hits the solid earth."
IF LEVEL > 100  AND LEVEL <= 1000 THEN PRINT "Your body hits the ground so hard that an arm and a leg detach and go flying onto the hillside."
IF LEVEL > 1000 THEN PRINT "A dragon spots you falling, swoops down and swallows you just before you hit the ground."
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
LEVEL = 1
PRINT "You stand up and brush the dirt off of your clothes."
GOTO [LEAVETHETOWER]

[ZOMBIEENDING]
PRINT ""
PRINT "As your heart stops, you turn into a zombie.  You roam the tower,"
PRINT "attacking unlucky visitors and turning them into zombies."
GOTO [REPEATENDINGOPTION]

[HITBYAJUMPER]
GOSUB [ENCOUNTERACREATURE]
PRINT ""
PRINT "You are hit and killed by a " + SELECTACREATURETYPE$ + " that fell from a window high up in the tower."
PRINT "For the record, the " + SELECTACREATURETYPE$ + " was alive before falling, but now both of you are a"
PRINT "large amount of pureed effluence spattered on and oozing down a pleasant hillside."
GOTO [ENDING]
Machiavvelli3060
Posts: 6
Joined: Tue May 14, 2013 5:54 pm

Re: theTower - A Text Adventure Game

Post by Machiavvelli3060 »

1. I have re-named this game 'Tower of Rodinia'.
2. I have inserted the endless tower inside an endless jungle, for more exploration interest and excitement.
3. I have been working on a version of this game with a GUI, but it is taking a REALLY long time to reverse-engineer all of my user interfaces. I think I'm happy the way it is, without a GUI.

Anyway, without any additional ado:

Code: Select all


REM This program is named 'Tower of Rodinia'.  It was first started on June 30th, 2013 by Alan J. Robinson.

REM THE FOLLOWING SECTION IS THE GAMES INTRODUCTION.

[INTRO]
LEVEL = 1
CHARACTERHEALTH = 100
CHARACTERGOLD = 0
MAGICITEMDESCRIPTOR$ = "your hands and feet"
ZOMBIESCRATCH$ = "NO"
OUTSIDETHETOWER$ = "YES"
LATITUDE = 0
LONGITUDE = 0
PRINT "Tower of Rodinia, a text-based adventure game"
PRINT ""
GOTO [ROOMDESCRIPTION]

REM THE FOLLOWING SECTION DESCRIBES EACH ROOM

[ROOMDESCRIPTION]
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
IF LATITUDE = 0 AND LONGITUDE = 0 AND OUTSIDETHETOWER$ = "YES" THEN GOTO [BASEOFTHETOWER]
IF OUTSIDETHETOWER$ = "YES" THEN FIRSTOPTION$ = "(1) walk north"
IF OUTSIDETHETOWER$ = "YES" THEN SECONDOPTION$ = "(2) walk east"
IF OUTSIDETHETOWER$ = "YES" THEN THIRDOPTION$ = "(3) walk south"
IF OUTSIDETHETOWER$ = "YES" THEN FOURTHOPTION$ = "(4) walk west"
IF OUTSIDETHETOWER$ = "YES" THEN FIFTHOPTION$ = "(5) exit the game"
IF OUTSIDETHETOWER$ = "YES" THEN SIXTHOPTION$ = ""
IF OUTSIDETHETOWER$ = "NO" THEN FIRSTOPTION$ = "(1) go up the staircase"
IF OUTSIDETHETOWER$ = "NO" THEN SECONDOPTION$ = "(2) go down the staircase"
IF OUTSIDETHETOWER$ = "NO" THEN THIRDOPTION$  = "(3) explore this floor"
IF OUTSIDETHETOWER$ = "NO" THEN FOURTHOPTION$ = "(4) exit the game"
IF OUTSIDETHETOWER$ = "NO" AND LEVEL > 0 THEN FIFTHOPTION$ = "(5) jump out the window"
IF OUTSIDETHETOWER$ = "NO" AND LEVEL < 0 THEN FIFTHOPTION$ = ""
IF OUTSIDETHETOWER$ = "NO" AND LEVEL < 1 THEN SIXTHOPTION$ = ""
IF OUTSIDETHETOWER$ = "NO" AND LEVEL = 1 THEN SIXTHOPTION$ = "(6) leave the tower"
IF OUTSIDETHETOWER$ = "NO" AND LEVEL > 1 THEN SIXTHOPTION$ = ""
PRINT ""
[ENVIRONMENTDESCRIPTION]
IF LEVEL < -1000 THEN CHARACTERHEALTH = CHARACTERHEALTH - 4
IF LEVEL <= -500 AND LEVEL > -1000 THEN CHARACTERHEALTH = CHARACTERHEALTH - 3
IF LEVEL <= -300 AND LEVEL > -500 THEN CHARACTERHEALTH = CHARACTERHEALTH - 2
IF LEVEL <= -100 AND LEVEL > -300 THEN CHARACTERHEALTH = CHARACTERHEALTH - 1
IF LEVEL < -50 THEN ENVIRONMENTDESCRIPTION$ = "The stifling conditions are starting to have a noticable effect on you."
IF LEVEL >= -50 AND LEVEL < -25 THEN ENVIRONMENTDESCRIPTION$ = "The lower you climb, the warmer it gets."
IF LEVEL >= -25 AND LEVEL < 1 AND OUTSIDETHETOWER$ = "NO" THEN ENVIRONMENTDESCRIPTION$ = "It is hot, humid and unpleasant down here."
IF LEVEL >= 1 AND LEVEL < 25 AND OUTSIDETHETOWER$ = "NO" THEN ENVIRONMENTDESCRIPTION$ = "The air is cool and calm here."
IF LEVEL >= 25 AND LEVEL < 50 AND OUTSIDETHETOWER$ = "NO" THEN ENVIRONMENTDESCRIPTION$ = "The air is getting noticeably cooler."
IF LEVEL >= 50 AND LEVEL < 100 THEN ENVIRONMENTDESCRIPTION$ = "The air is getting thin up here."
IF LEVEL >= 100 AND LEVEL < 200 THEN ENVIRONMENTDESCRIPTION$ = "Your nose is starting to bleed.  You feel weak."
IF LEVEL >= 200 THEN ENVIRONMENTDESCRIPTION$ = "You are weakening with every step up."
IF OUTSIDETHETOWER$ = "YES" THEN ENVIRONMENTDESCRIPTION$ = "The air is tepid, still and stangnant."
IF OUTSIDETHETOWER$ = "YES" THEN GOTO [DESCRIBETHESCENEOUTSIDETHETOWER]
IF OUTSIDETHETOWER$ = "NO" AND LEVEL > 0 THEN GOTO [DESCRIBETHESCENEINSIDETHETOWERABOVEGROUND]
IF OUTSIDETHETOWER$ = "NO" AND LEVEL < 1 THEN GOTO [DESCRIBETHESCENEINSIDETHETOWERBELOWGROUND]
[DESCRIBETHESCENEINTHEJUNGLEAWAYFROMTHETOWER]
PRINT ""
PRINT "Surroundings: You are standing in a dense jungle.  The only thing you can see, aside from the jungle,"
PRINT "              is the impossibly tall black tower, rising up, acting as a point of reference to you."
GOTO [WINDOWVIEW]
[DESCRIBETHESCENEOUTSIDETHETOWER]
PRINT ""
PRINT "Surroundings: You are standing in a dense jungle, outside the doors to a massive black"
PRINT "              round tower.  It is so tall its top cannot be seen; it disappears into the clouds."
GOTO [WINDOWVIEW]
[DESCRIBETHESCENEINSIDETHETOWERABOVEGROUND]
PRINT ""
PRINT "Surroundings: You are inside a massive black round tower.  The center of the tower is"
PRINT "              dominated by a massive ebony spiral staircase that goes up and down as"
PRINT "              far as the eye can see.  There are windows on the external walls."
GOTO [WINDOWVIEW]
[DESCRIBETHESCENEINSIDETHETOWERBELOWGROUND]
PRINT ""
PRINT "Surroundings: You are inside a massive black round tower, underground.  It is dark,"
PRINT "              humid and oppressive down here.  The center of the tower is dominated"
PRINT "              by a massive ebony spiral staircase that goes up and down as far as"
PRINT "              the eye can see."
GOTO [WINDOWVIEW]
[WINDOWVIEW]
PRINT "Environment:  " + ENVIRONMENTDESCRIPTION$
IF LEVEL > 0 AND LEVEL <= 10 THEN PRINT "View:         You can see hills and farm fields."
IF LEVEL > 10 AND LEVEL <= 50 AND OUTSIDETHETOWER$ = "NO" THEN PRINT "View:         You are getting pretty high, but you still cannot see the top."
IF LEVEL > 50 AND LEVEL <= 100 AND OUTSIDETHETOWER$ = "NO" THEN PRINT "View:         You see birds of prey circling the tower."
IF LEVEL > 100 AND LEVEL <= 200 AND OUTSIDETHETOWER$ = "NO" THEN PRINT "View:         It is starting to get cloudy."
IF LEVEL > 200 AND LEVEL <= 300 AND OUTSIDETHETOWER$ = "NO" THEN PRINT "View:         The view is completely obscured by clouds and it is getting very cold."
IF LEVEL > 300 AND LEVEL <= 500 AND OUTSIDETHETOWER$ = "NO" THEN PRINT "View:         The clouds are starting to clear."
IF LEVEL > 500 AND LEVEL <= 1000 AND OUTSIDETHETOWER$ = "NO" THEN PRINT "View:         You can see the tops of the clouds!  You should not be able to breathe up here."
IF LEVEL > 100 AND LEVEL <= 300 THEN CHARACTERHEALTH = CHARACTERHEALTH - 1
IF LEVEL > 300 AND LEVEL <= 500 THEN CHARACTERHEALTH = CHARACTERHEALTH - 2
IF LEVEL > 500 AND LEVEL <= 1000 THEN CHARACTERHEALTH = CHARACTERHEALTH - 3
IF LEVEL > 1000 THEN CHARACTERHEALTH = CHARACTERHEALTH - 4
IF ZOMBIESCRATCH$ = "YES" AND CHARACTERHEALTH <= 0 THEN GOTO [ZOMBIEENDING]
IF ZOMBIESCRATCH$ = "YES" AND CHARACTERHEALTH > 0 THEN GOTO [REPEATZOMBIEOPTION]
IF ZOMBIESCRATCH$ = "NO" THEN GOTO [ROOMDESCRIPTION2]
[REPEATZOMBIEOPTION]
CHARACTERHEALTH = CHARACTERHEALTH - 2
PRINT ""
PRINT "That zombie scratch is looking red, puffy and nasty.  You're getting feverish."
PRINT ""
[ROOMDESCRIPTION2]
IF LEVEL < 1 THEN PRINT "Level: " ; LEVEL ; ", Latitude: " ; LATITUDE ; ", Longitude: " ; LONGITUDE ; ",  HP: " ; CHARACTERHEALTH ; ",  Gold: " ; CHARACTERGOLD ; ",  Weapon: " ; MAGICITEMDESCRIPTOR$
IF LEVEL = 1 THEN PRINT "Level: Ground floor, Latitude: " ; LATITUDE ; ", Longitude: " ; LONGITUDE ; ",  HP: " ; CHARACTERHEALTH ; ",  Gold: " ; CHARACTERGOLD ; ",  Weapon: " ; MAGICITEMDESCRIPTOR$
IF LEVEL > 1 THEN PRINT "Level: " ; LEVEL ; ", Latitude: " ; LATITUDE ; ", Longitude: " ; LONGITUDE ; ",  HP: " ; CHARACTERHEALTH ; ",  Gold: " ; CHARACTERGOLD ; ",  Weapon: " ; MAGICITEMDESCRIPTOR$
[REPEATROOMDESCRIPTIONOPTIONS]
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT FIRSTOPTION$ + "   " + SECONDOPTION$  + "   " + THIRDOPTION$ + "   " + FOURTHOPTION$ + "   " + FIFTHOPTION$ + "   " + SIXTHOPTION$
INPUT REPLY$
IF REPLY$ = "1" AND OUTSIDETHETOWER$ = "YES" AND LATITUDE = 0 AND LONGITUDE = 0 THEN GOTO [ENTERTHETOWER]
IF REPLY$ = "1" AND OUTSIDETHETOWER$ = "YES" THEN GOTO [WALKTHROUGHTHEJUNGLE]
IF REPLY$ = "1" AND OUTSIDETHETOWER$ = "NO" THEN GOTO [STAIRCASE]
IF REPLY$ = "2" AND OUTSIDETHETOWER$ = "YES" THEN GOTO [WALKTHROUGHTHEJUNGLE]
IF REPLY$ = "2" AND OUTSIDETHETOWER$ = "NO" THEN GOTO [STAIRCASE]
IF REPLY$ = "3" AND OUTSIDETHETOWER$ = "YES" THEN GOTO [WALKTHROUGHTHEJUNGLE]
IF REPLY$ = "3" AND OUTSIDETHETOWER$ = "NO" THEN GOTO [RANDOMOCCURENCE]
IF REPLY$ = "4" AND OUTSIDETHETOWER$ = "YES" THEN GOTO [WALKTHROUGHTHEJUNGLE]
IF REPLY$ = "4" AND OUTSIDETHETOWER$ = "NO" THEN GOTO [REPEATENDINGOPTION]
IF REPLY$ = "5" AND OUTSIDETHETOWER$ = "YES" AND LATITUDE = 0 AND LONGITUDE = 0 THEN GOTO [WALKTHROUGHTHEJUNGLE]
IF REPLY$ = "5" AND OUTSIDETHETOWER$ = "YES" THEN GOTO [WALKTHROUGHTHEJUNGLE]
IF REPLY$ = "5" AND OUTSIDETHETOWER$ = "NO" THEN GOTO [JUMPOUTTHEWINDOW]
IF REPLY$ = "6" AND OUTSIDETHETOWER$ = "YES" AND LATITUDE = 0 AND LONGITUDE = 0 THEN GOTO [REPEATENDINGOPTION]
IF REPLY$ = "6" AND OUTSIDETHETOWER$ = "NO" THEN GOTO [LEAVETHETOWER]
[OPTIONCORRECTION]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [REPEATROOMDESCRIPTIONOPTIONS]

[LEAVETHETOWER]
OUTSIDETHETOWER$ = "YES"
GOTO [ROOMDESCRIPTION]

[ENTERTHETOWER]
OUTSIDETHETOWER$ = "NO"
GOTO [ROOMDESCRIPTION]

[STAIRCASE]
IF REPLY$ = "1" AND LEVEL = -1 THEN LEVEL = LEVEL + 1
IF REPLY$ = "1" THEN LEVEL = LEVEL + 1
IF REPLY$ = "2" AND LEVEL < 0 THEN LEVEL = LEVEL - 1
IF REPLY$ = "2" AND LEVEL = 1 THEN LEVEL = LEVEL - 2
IF REPLY$ = "2" AND LEVEL > 0 THEN LEVEL = LEVEL - 1
GOTO [RANDOMOCCURENCE]

REM THIS IS THE END MY ONLY FRIEND

[ENDING]
PRINT "You have sustained fatal injury."
[REPEATFATALINJURYOPTION]
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "(1) start over from the beginning"
PRINT "(2) quit"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [INTRO]
IF REPLY$ = "2" GOTO [GAMEOVER]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [REPEATFATALINJURYOPTION]


GOTO [GAMEOVER]
[REPEATENDINGOPTION]
PRINT ""
PRINT "Are you certain you wish to leave the game?"
PRINT ""
PRINT "(1) yes"
PRINT "(2) no"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [GAMEOVER]
IF REPLY$ = "2" GOTO [ROOMDESCRIPTION]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [REPEATENDINGOPTION]

[REPEATENDINGOPTION2]
PRINT ""
PRINT "Are you certain you wish to leave the game?"
PRINT ""
PRINT "(1) yes"
PRINT "(2) no"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [GAMEOVER]
IF REPLY$ = "2" THEN GOTO [OUTSIDETHETOWER]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [REPEATENDINGOPTION2]

[GAMEOVER]
END

REM EVERY TIME THE PLAYER GOES TO A DIFFERENT FLOOR IN THE TOWER, S/HE MIGHT RUN ACROSS EITHER A CREATURE OR AN ITEM

[RANDOMOCCURENCE]
RANDOMOCCURENCE = INT(RND(0)*100)
IF RANDOMOCCURENCE <= 75 THEN GOTO [ROOMDESCRIPTION]
IF RANDOMOCCURENCE > 75 AND RANDOMOCCURENCE <= 80 THEN GOTO [DRINKVIAL]
IF RANDOMOCCURENCE > 80 AND RANDOMOCCURENCE <= 85 THEN GOTO [PICKUPMAGICITEM]

REM THIS SECTION IS THE ALGORITM FOR COMBATTING CREATURES IN THE TOWER

[ENCOUNTERACREATURE]
[SELECTCREATURETYPE]
SELECTCREATURETYPE = INT(RND(0)*47)
CREATUREHEALTH = INT(RND(0)*20)+1
CREATUREINITIALHEALTH = CREATUREHEALTH
CREATUREGOLD = INT(RND(0)*30)+20
SELECT CASE SELECTCREATURETYPE
    CASE 0
        SELECTACREATURETYPE$ = "skeleton"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "strangles"
        CREATUREWEAPON$ = "its hands"
    CASE 1
        SELECTACREATURETYPE$ = "zombie"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "scratches"
        CREATUREWEAPON$ = "its hands"
    CASE 2
        SELECTACREATURETYPE$ = "lich"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "curses"
        CREATUREWEAPON$ = "its dark magic"
    CASE 3
        SELECTACREATURETYPE$ = "bandit"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "fires a dart at"
        CREATUREWEAPON$ = "his pistol crossbow"
    CASE 4
        SELECTACREATURETYPE$ = "swordsman"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "chops at"
        CREATUREWEAPON$ = "his saber"
    CASE 5
        SELECTACREATURETYPE$ = "mercenary"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "stabs"
        CREATUREWEAPON$ = "his trident"
    CASE 6
        SELECTACREATURETYPE$ = "werewolf"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "tears at"
        CREATUREWEAPON$ = "its claws"
    CASE 7
        SELECTACREATURETYPE$ = "goblin"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "stabs"
        CREATUREWEAPON$ = "his trident"
    CASE 8
        SELECTACREATURETYPE$ = "giant spider"
        CREATUREHEALTH = CREATUREHEALTH + 10
        CREATUREATTACKVERBAGE$ = "bites"
        CREATUREWEAPON$ = "its teeth"
    CASE 9
        SELECTACREATURETYPE$ = "vampire"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "slices you"
        CREATUREWEAPON$ = "his claws"
    CASE 10
        SELECTACREATURETYPE$ = "cave troll"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "pummels"
        CREATUREWEAPON$ = "his huge fists"
    CASE 11
        SELECTACREATURETYPE$ = "basilisk"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "lashes out at"
        CREATUREWEAPON$ = "its tail"
    CASE 12
        SELECTACREATURETYPE$ = "giant bat"
        CREATUREHEALTH = CREATUREHEALTH + 10
        CREATUREATTACKVERBAGE$ = "bites"
        CREATUREWEAPON$ = "its teeth"
    CASE 13
        SELECTACREATURETYPE$ = "beholder"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "fires a magic missile at"
        CREATUREWEAPON$ = "its magical spells"
    CASE 14
        SELECTACREATURETYPE$ = "carrion crawler"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "bites"
        CREATUREWEAPON$ = "its teeth"
    CASE 15
        SELECTACREATURETYPE$ = "crocodile"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "slams"
        CREATUREWEAPON$ = "its tail"
    CASE 16
        SELECTACREATURETYPE$ = "cyclops"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "bashes"
        CREATUREWEAPON$ = "his club"
    CASE 17
        SELECTACREATURETYPE$ = "centaur"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "fires an arrow at"
        CREATUREWEAPON$ = "his long bow"
    CASE 18
        SELECTACREATURETYPE$ = "minotaur"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "gores"
        CREATUREWEAPON$ = "his horns"
    CASE 19
        SELECTACREATURETYPE$ = "greater demon"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "smothers and saps strength from"
        CREATUREWEAPON$ = "its dark magic"
    CASE 20
        SELECTACREATURETYPE$ = "displacer beast"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "slices"
        CREATUREWEAPON$ = "its claws"
    CASE 21
        SELECTACREATURETYPE$ = "dracolich"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "curses"
        CREATUREWEAPON$ = "its dark magic"
    CASE 22
        SELECTACREATURETYPE$ = "dragon"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "bashes"
        CREATUREWEAPON$ = "its spiked tail"
    CASE 23
        SELECTACREATURETYPE$ = "drow elf"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "stabs"
        CREATUREWEAPON$ = "a long knife"
    CASE 24
        SELECTACREATURETYPE$ = "mummy"
        CREATUREHEALTH = CREATUREHEALTH + 10
        CREATUREATTACKVERBAGE$ = "strangles"
        CREATUREWEAPON$ = "its strong hands"
    CASE 25
        SELECTACREATURETYPE$ = "phase spider"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "appears above you and bites"
        CREATUREWEAPON$ = "its teeth"
    CASE 26
        SELECTACREATURETYPE$ = "medusa"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "hits"
        CREATUREWEAPON$ = "her tail"
    CASE 27
        SELECTACREATURETYPE$ = "manticore"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "slashes"
        CREATUREWEAPON$ = "its claws"
    CASE 28
        SELECTACREATURETYPE$ = "hydra"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "bites"
        CREATUREWEAPON$ = "its many heads"
    CASE 29
        SELECTACREATURETYPE$ = "golem"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "bashes"
        CREATUREWEAPON$ = "its stone hands"
    CASE 30
        SELECTACREATURETYPE$ = "giant lizard"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "lashes"
        CREATUREWEAPON$ = "its tail"
    CASE 31
        SELECTACREATURETYPE$ = "wyvern"
        CREATUREHEALTH = CREATUREHEALTH + 70
        CREATUREATTACKVERBAGE$ = "stings"
        CREATUREWEAPON$ = "its tail stinger"
    CASE 32
        SELECTACREATURETYPE$ = "shambling mound"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "smothers"
        CREATUREWEAPON$ = "layers of vegetation"
    CASE 33
        SELECTACREATURETYPE$ = "roc"
        CREATUREHEALTH = CREATUREHEALTH + 80
        CREATUREATTACKVERBAGE$ = "rends"
        CREATUREWEAPON$ = "its talons"
    CASE 34
        SELECTACREATURETYPE$ = "giant rat"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "gnaws on"
        CREATUREWEAPON$ = "its teeth"
    CASE 35
        SELECTACREATURETYPE$ = "purple worm"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "bites"
        CREATUREWEAPON$ = "its teeth"
    CASE 36
        SELECTACREATURETYPE$ = "short-faced bear"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "cuts"
        CREATUREWEAPON$ = "its claws"
    CASE 37
        SELECTACREATURETYPE$ = "giant hound"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "death-shakes"
        CREATUREWEAPON$ = "its powerful jaws"
    CASE 38
        SELECTACREATURETYPE$ = "harpy"
        CREATUREHEALTH = CREATUREHEALTH + 40
        CREATUREATTACKVERBAGE$ = "claws"
        CREATUREWEAPON$ = "its talons"
    CASE 39
        SELECTACREATURETYPE$ = "griffon"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "slashes"
        CREATUREWEAPON$ = "its claws"
    CASE 40
        SELECTACREATURETYPE$ = "gargoyle"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "slams"
        CREATUREWEAPON$ = "its stone mass"
    CASE 41
        SELECTACREATURETYPE$ = "blink dog"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "bites"
        CREATUREWEAPON$ = "its fangs"
    CASE 42
        SELECTACREATURETYPE$ = "chimera"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "slices"
        CREATUREWEAPON$ = "its claws"
    CASE 43
        SELECTACREATURETYPE$ = "dryad"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "stabs"
        CREATUREWEAPON$ = "her short spear"
    CASE 44
        SELECTACREATURETYPE$ = "gorgon"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "gazes at"
        CREATUREWEAPON$ = "her eyes"
    CASE 45
        SELECTACREATURETYPE$ = "hippogriff"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "body slams"
        CREATUREWEAPON$ = "its body weight"
    CASE 46
        SELECTACREATURETYPE$ = "naga"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "body slams"
        CREATUREWEAPON$ = "its body weight"
END SELECT
PRINT ""
PRINT "A " + SELECTACREATURETYPE$ + " confronts you."
[HITCREATUREAGAIN]
PRINT ""
PRINT "you:    HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; MAGICITEMDESCRIPTOR$
PRINT SELECTACREATURETYPE$ + ": HP: " ; CREATUREHEALTH ; "  Gold: " ; CREATUREGOLD ; "  Weapon: " ; CREATUREWEAPON$
[REPEATHITCREATURE]
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "(1) engage the " + SELECTACREATURETYPE$ + " or"
PRINT "(2) retreat"
INPUT REPLY$
PRINT ""
IF REPLY$ = "1" THEN GOTO [CHARACTERATTACKSCREATURE]
IF REPLY$ = "2" THEN GOTO [ROOMDESCRIPTION]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [REPEATHITCREATURE]
[CHARACTERATTACKSCREATURE]
CHARACTERATTACKSCREATURE = INT(RND(0)*2)+1
IF CHARACTERATTACKSCREATURE = 1 THEN GOTO [CHARACTERHITSCREATURE]
IF CHARACTERATTACKSCREATURE = 2 THEN PRINT "You swing at the " + SELECTACREATURETYPE$ + " and miss."
IF CHARACTERATTACKSCREATURE = 2 THEN GOTO [CREATUREATTACKSCHARACTER]
[CHARACTERHITSCREATURE]
CHARACTERDAMAGESCREATURE = INT(RND(0)*9)+2
TOTALDAMAGE = CHARACTERDAMAGESCREATURE + MAGICITEMDAMAGEFACTOR
CREATUREHEALTH = CREATUREHEALTH - TOTALDAMAGE
PRINT "You hit the " + SELECTACREATURETYPE$ + " and do " ; TOTALDAMAGE ; " points of damage."
IF CREATUREHEALTH <= 0 THEN GOTO [CREATUREDEFEATED]
[CREATUREATTACKSCHARACTER]
IF SELECTCREATURETYPE = 6 AND CREATUREHEALTH < CREATUREINITIALHEALTH THEN GOSUB [REGENERATION]
IF SELECTCREATURETYPE = 9 AND CREATUREHEALTH < CREATUREINITIALHEALTH THEN GOSUB [REGENERATION]
CREATUREATTACKSCHARACTER = INT(RND(0)*2)+1
IF CREATUREATTACKSCHARACTER = 1 THEN GOTO [CREATUREHITSCHARACTER]
IF CREATUREATTACKSCHARACTER = 2 THEN PRINT "The " + SELECTACREATURETYPE$ + " " +  CREATUREATTACKVERBAGE$ + " you with " + CREATUREWEAPON$ + " and misses."
GOTO [HITCREATUREAGAIN]
[CREATUREHITSCHARACTER]
CREATUREHITSCHARACTERDAMAGE = INT(RND(0)*9)+2
TOTALDAMAGE = CREATUREHITSCHARACTERDAMAGE
CHARACTERHEALTH=CHARACTERHEALTH-TOTALDAMAGE
PRINT "The " + SELECTACREATURETYPE$ + " " + CREATUREATTACKVERBAGE$ + " you with " + CREATUREWEAPON$ + " and does " ; CREATUREHITSCHARACTERDAMAGE ; " points of damage."
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
GOTO [HITCREATUREAGAIN]
[CREATUREDEFEATED]
PRINT ""
PRINT "Victory!  The " + SELECTACREATURETYPE$ + " is dead.  You also found some gold."
PRINT ""
CHARACTERGOLD = CHARACTERGOLD + CREATUREGOLD
GOTO [ENVIRONMENTDESCRIPTION]

REM THIS CODE ALLOWS THE PLAYER TO PICK UP AND RETAIN A MAGIC ITEM.  THE STRENGTH OF THE ITEM IS SELECTED RANDOMLY.

[PICKUPMAGICITEM]
MAGICITEMTYPE = INT(RND(0)*11)+1
SELECT CASE MAGICITEMTYPE
    CASE 1
        MAGICITEMTYPE$ = "long sword"
    CASE 2
        MAGICITEMTYPE$ = "staff"
    CASE 3
        MAGICITEMTYPE$ = "short sword"
    CASE 4
        MAGICITEMTYPE$ = "dagger"
    CASE 5
        MAGICITEMTYPE$ = "mace"
    CASE 6
        MAGICITEMTYPE$ = "morningstar"
    CASE 7
        MAGICITEMTYPE$ = "flail"
    CASE 8
        MAGICITEMTYPE$ = "two-handed sword"
    CASE 9
        MAGICITEMTYPE$ = "spiked gauntlet"
    CASE 10
        MAGICITEMTYPE$ = "cudgel"
    CASE 11
        MAGICITEMTYPE$ = "club"
END SELECT
PRINT "You find a " + MAGICITEMTYPE$ + " on the ground."
[PICKUPMAGICITEMREPEAT]
PRINT "HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; MAGICITEMDESCRIPTOR$
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "(1) pick it up or"
PRINT "(2) leave it where it is"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [PICKUPITEM]
IF REPLY$ = "2" THEN GOTO [DONTPICKUPITEM]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [PICKUPMAGICITEMREPEAT]
[PICKUPITEM]
MAGICITEMDAMAGEFACTOR = INT(RND(0)*10)+1
MAGICITEM = MAGICITEMDAMAGEFACTOR
MAGICITEMDESCRIPTOR$ = MAGICITEMTYPE$ + " (+ " ; MAGICITEMDAMAGEFACTOR ; " damage)"
PRINT ""
PRINT "The " + MAGICITEMTYPE$ + " feels very strong, light and balanced in your hand."
GOTO [ENVIRONMENTDESCRIPTION]
[DONTPICKUPITEM]
PRINT ""
PRINT "You leave the unknown " + MAGICITEMTYPE$ + " lying on the ground."
GOTO [ENVIRONMENTDESCRIPTION]

REM THIS CODE CAUSES THE PLAYER TO ENCOUNTER A VIAL OF UNKNOWN LIQUID AND SEE IF IT HELPS OR HURTS

[DRINKVIAL]
LIQUIDCOLOR = INT(RND(0)*20)+1
SELECT CASE LIQUIDCOLOR
    CASE 1
        LIQUIDCOLOR$ = "red "
    CASE 2
        LIQUIDCOLOR$ = "pink "
    CASE 3
        LIQUIDCOLOR$ = "burnt orange "
    CASE 4
        LIQUIDCOLOR$ = "black "
    CASE 5
        LIQUIDCOLOR$ = "magenta "
    CASE 6
        LIQUIDCOLOR$ = "pea green "
    CASE 7
        LIQUIDCOLOR$ = "sky blue "
    CASE 8
        LIQUIDCOLOR$ = "custard yellow "
    CASE 9
        LIQUIDCOLOR$ = "clear "
    CASE 10
        LIQUIDCOLOR$ = "milky "
    CASE 11
        LIQUIDCOLOR$ = "brown and yellow "
    CASE 12
        LIQUIDCOLOR$ = "taupe "
    CASE 13
        LIQUIDCOLOR$ = "cerulean "
    CASE 14
        LIQUIDCOLOR$ = "midnight blue "
    CASE 15
        LIQUIDCOLOR$ = "glittery "
    CASE 16
        LIQUIDCOLOR$ = "honey-colored "
    CASE 17
        LIQUIDCOLOR$ = "snow white "
    CASE 18
        LIQUIDCOLOR$ = "goldenrod "
    CASE 19
        LIQUIDCOLOR$ = "copper "
    CASE 20
        LIQUIDCOLOR$ = "silver "
END SELECT
PRINT ""
PRINT "You find a vial with a glowing " + LIQUIDCOLOR$ + "liquid in it."
[DRINKVIALREPEAT]
PRINT "HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; SWORDDESCRIPTOR$
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "(1) drink the liquid or"
PRINT "(2) leave it where it is"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [DODRINKVIAL]
IF REPLY$ = "2" THEN GOTO [DONTDRINKVIAL]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [DRINKVIALREPEAT]
[DODRINKVIAL]
HEALORHURT = INT(RND(0)*2)+1
VIALEFFECTAMOUNT = INT(RND(0)*9)+2
IF HEALORHURT = 1 THEN GOTO [HEAL]
IF HEALORHURT = 2 THEN GOTO [HURT]
[HEAL]
CHARACTERHEALTH = CHARACTERHEALTH + VIALEFFECTAMOUNT
PRINT ""
PRINT "The liquid refreshes and energizes you.  You gain " ; VIALEFFECTAMOUNT ; " hit points, bringing you to " ; CHARACTERHEALTH ; " total hit points."
PRINT ""
GOTO [ENVIRONMENTDESCRIPTION]
[HURT]
CHARACTERHEALTH = CHARACTERHEALTH - VIALEFFECTAMOUNT
PRINT ""
PRINT "The liquid burns you on the inside.  You lose " ; VIALEFFECTAMOUNT ; " hit points, bringing you to " ; CHARACTERHEALTH ; " total hit points."
PRINT ""
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
GOTO [ENVIRONMENTDESCRIPTION]
[DONTDRINKVIAL]
PRINT ""
PRINT "You cautiously decide to leave the unknown liquid where it is."
GOTO [ENVIRONMENTDESCRIPTION]

REM THIS CODE MAKES BOTH THE WEREWOLF AND THE VAMPIRE REGENERATE.

[REGENERATION]
REGENERATION = INT(RND(0)*9)+1
CREATUREHEALTH = CREATUREHEALTH + REGENERATION
PRINT ""
PRINT "The " + SELECTACREATURETYPE$ + " regenerates.  It gains " ; REGENERATION ; " hit points, giving it " ; CREATUREHEALTH ; " hit points."
PRINT ""
RETURN

[JUMPOUTTHEWINDOW]
FALLINGDAMAGE = LEVEL * 5
CHARACTERHEALTH = CHARACTERHEALTH - FALLINGDAMAGE
PRINT ""
PRINT "You throw yourself out the window and plummet to the ground, taking " ; FALLINGDAMAGE ; " points of damage."
IF LEVEL > 20 AND LEVEL <= 50 THEN PRINT "Your body hits the ground and bounces like a rag doll.  Vultures take notice and rejoice."
IF LEVEL > 50  AND LEVEL <= 100 THEN PRINT "Your body makes an audible crack as it hits the solid earth."
IF LEVEL > 100  AND LEVEL <= 1000 THEN PRINT "Your body hits the ground so hard that an arm and a leg detach and go flying onto the hillside."
IF LEVEL > 1000 THEN PRINT "A dragon spots you falling, swoops down and swallows you just before you hit the ground."
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
LEVEL = 1
PRINT "You stand up and brush the dirt off of your clothes."
GOTO [LEAVETHETOWER]

[ZOMBIEENDING]
PRINT ""
PRINT "As your heart stops, you turn into a zombie.  You roam the tower,"
PRINT "attacking unlucky visitors and turning them into zombies."
GOTO [REPEATENDINGOPTION]

[HITBYAJUMPER]
GOSUB [ENCOUNTERACREATURE]
PRINT ""
PRINT "You are hit and killed by a " + SELECTACREATURETYPE$ + " that fell from a window high up in the tower."
PRINT "For the record, the " + SELECTACREATURETYPE$ + " was alive before falling, but now both of you are a"
PRINT "large amount of pureed effluence spattered on and oozing down a pleasant hillside."
GOTO [ENDING]

[WALKTHROUGHTHEJUNGLE]
IF LATITUDE = 0 AND LONGITUDE = 0 THEN GOTO [JUNGLEOUTSIDETHETOWER] ELSE GOTO [JUNGLEELSEWHERE]
[JUNGLEOUTSIDETHETOWER]
IF REPLY$ = "1" THEN GOTO [ENTERTHETOWER]
IF REPLY$ = "2" THEN LATITUDE = LATITUDE + 1
IF REPLY$ = "3" THEN LONGITUDE = LONGITUDE + 1
IF REPLY$ = "4" THEN LATITUDE = LATITUDE - 1
IF REPLY$ = "5" THEN LONGITUDE = LONGITUDE - 1
IF REPLY$ = "6" THEN GOTO [REPEATENDINGOPTION]
GOTO [RANDOMOCCURENCE]
[JUNGLEELSEWHERE]
IF REPLY$ = "1" THEN LATITUDE = LATITUDE + 1
IF REPLY$ = "2" THEN LONGITUDE = LONGITUDE + 1
IF REPLY$ = "3" THEN LATITUDE = LATITUDE - 1
IF REPLY$ = "4" THEN LONGITUDE = LONGITUDE - 1
IF REPLY$ = "5" THEN GOTO [REPEATENDINGOPTION]
IF REPLY$ = "6" THEN GOTO [OPTIONCORRECTION]
GOTO [RANDOMOCCURENCE]

[BASEOFTHETOWER]
FIRSTOPTION$ = "(1) enter the tower"
SECONDOPTION$ = "(2) walk north"
THIRDOPTION$ = "(3) walk east"
FOURTHOPTION$ = "(4) walk south"
FIFTHOPTION$ = "(5) walk west"
SIXTHOPTION$ = "(6) exit the game"
GOTO [ENVIRONMENTDESCRIPTION]

Machiavvelli3060
Posts: 6
Joined: Tue May 14, 2013 5:54 pm

Re: theTower - A Text Adventure Game

Post by Machiavvelli3060 »

I have enhanced "Tower of Rodinia" with a simple yet elegant experience system.

The character begins with a fighting skill of 50. When he swings at a monster, the program selects a random number from 1 to 100 (percentile). If the number is equal or less than the character's fighting skill, the character hits his opponent. If the number is greater than the character's fighting skill, the characetr misses. If the character misses, the program selects another random number from 1 to 100 (percentile). If the number is equal to or greater than the character's fighting skill, the character's fighting skill increases by one permanently.

This system achieves three important goals:
1. Unlike D&D, you can't spend experience points wherever you like; if you want your fighting skill to increase, you have to fight. It's that simple.
2. The higher the character's fighting skill is, the more difficult it will be for that number to increase, and vice versa.
3. Humans don't learn anything from easy success. The only way to improve the character's fighting ability is by TRYING AND FAILING AND TRYING AGAIN.

I'm very proud of this system. I have been working on it for a couple of decades.

The code is below. Enjoy.

- Machiavvelli

Code: Select all


REM This program is named 'Tower of Rodinia'.  It was first started on June 30th, 2013 by Alan J. Robinson.

REM THE FOLLOWING SECTION IS THE GAMES INTRODUCTION.

[INTRO]
LEVEL = 1
CHARACTERHEALTH = 100
CHARACTERGOLD = 0
MAGICITEMDESCRIPTOR$ = "your hands and feet"
ZOMBIESCRATCH$ = "NO"
OUTSIDETHETOWER$ = "YES"
LATITUDE = 0
LONGITUDE = 0
FIGHTINGSKILL = 50
PRINT "Game"
PRINT ""
GOTO [ROOMDESCRIPTION]

REM THE FOLLOWING SECTION DESCRIBES EACH ROOM

[ROOMDESCRIPTION]
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
IF LATITUDE = 0 AND LONGITUDE = 0 AND OUTSIDETHETOWER$ = "YES" THEN GOTO [BASEOFTHETOWER]
IF OUTSIDETHETOWER$ = "YES" THEN FIRSTOPTION$ = "(1) walk north"
IF OUTSIDETHETOWER$ = "YES" THEN SECONDOPTION$ = "(2) walk east"
IF OUTSIDETHETOWER$ = "YES" THEN THIRDOPTION$ = "(3) walk south"
IF OUTSIDETHETOWER$ = "YES" THEN FOURTHOPTION$ = "(4) walk west"
IF OUTSIDETHETOWER$ = "YES" THEN FIFTHOPTION$ = "(5) exit the game"
IF OUTSIDETHETOWER$ = "YES" THEN SIXTHOPTION$ = ""
IF OUTSIDETHETOWER$ = "NO" THEN FIRSTOPTION$ = "(1) go up the staircase"
IF OUTSIDETHETOWER$ = "NO" THEN SECONDOPTION$ = "(2) go down the staircase"
IF OUTSIDETHETOWER$ = "NO" THEN THIRDOPTION$  = "(3) explore this floor"
IF OUTSIDETHETOWER$ = "NO" THEN FOURTHOPTION$ = "(4) exit the game"
IF OUTSIDETHETOWER$ = "NO" AND LEVEL > 0 THEN FIFTHOPTION$ = "(5) jump out the window"
IF OUTSIDETHETOWER$ = "NO" AND LEVEL < 0 THEN FIFTHOPTION$ = ""
IF OUTSIDETHETOWER$ = "NO" AND LEVEL < 1 THEN SIXTHOPTION$ = ""
IF OUTSIDETHETOWER$ = "NO" AND LEVEL = 1 THEN SIXTHOPTION$ = "(6) leave the tower"
IF OUTSIDETHETOWER$ = "NO" AND LEVEL > 1 THEN SIXTHOPTION$ = ""
PRINT ""
[ENVIRONMENTDESCRIPTION]
IF LEVEL < -1000 THEN CHARACTERHEALTH = CHARACTERHEALTH - 4
IF LEVEL <= -500 AND LEVEL > -1000 THEN CHARACTERHEALTH = CHARACTERHEALTH - 3
IF LEVEL <= -300 AND LEVEL > -500 THEN CHARACTERHEALTH = CHARACTERHEALTH - 2
IF LEVEL <= -100 AND LEVEL > -300 THEN CHARACTERHEALTH = CHARACTERHEALTH - 1
IF LEVEL < -50 THEN ENVIRONMENTDESCRIPTION$ = "The stifling conditions are starting to have a noticable effect on you."
IF LEVEL >= -50 AND LEVEL < -25 THEN ENVIRONMENTDESCRIPTION$ = "The lower you climb, the warmer it gets."
IF LEVEL >= -25 AND LEVEL < 1 AND OUTSIDETHETOWER$ = "NO" THEN ENVIRONMENTDESCRIPTION$ = "It is hot, humid and unpleasant down here."
IF LEVEL >= 1 AND LEVEL < 25 AND OUTSIDETHETOWER$ = "NO" THEN ENVIRONMENTDESCRIPTION$ = "The air is cool and calm here."
IF LEVEL >= 25 AND LEVEL < 50 AND OUTSIDETHETOWER$ = "NO" THEN ENVIRONMENTDESCRIPTION$ = "The air is getting noticeably cooler."
IF LEVEL >= 50 AND LEVEL < 100 THEN ENVIRONMENTDESCRIPTION$ = "The air is getting thin up here."
IF LEVEL >= 100 AND LEVEL < 200 THEN ENVIRONMENTDESCRIPTION$ = "Your nose is starting to bleed.  You feel weak."
IF LEVEL >= 200 THEN ENVIRONMENTDESCRIPTION$ = "You are weakening with every step up."
IF OUTSIDETHETOWER$ = "YES" THEN ENVIRONMENTDESCRIPTION$ = "The air is tepid, still and stangnant."
IF OUTSIDETHETOWER$ = "YES" AND LATITUDE = 0 AND LONGITUDE = 0 THEN SURROUNDINGS$ = "You are standing in a dense jungle, outside the doors to a tall black round tower." ELSE SURROUNDINGS$ = "You are standing in a dense jungle, the tall black mysterious tower nearby."
IF LATITUDE > 50 OR LONGITUDE > 50 THEN SURROUNDINGS$ = "You are standing in a dense jungle.  You see the black tower far in the distance."
IF OUTSIDETHETOWER$ = "NO" AND LEVEL > 0 THEN SURROUNDINGS$ = "You are inside a massive black round tower with a giant central spiral staircase."
IF OUTSIDETHETOWER$ = "NO" AND LEVEL < 1 THEN SURROUNDINGS$ = "You are inside a massive black round tower, underground. "
PRINT "Surroundings: " + SURROUNDINGS$
[WINDOWVIEW]
PRINT "Environment:  " + ENVIRONMENTDESCRIPTION$
IF LEVEL > 0 AND LEVEL <= 10 THEN PRINT "View:         You can see hills and farm fields."
IF LEVEL > 10 AND LEVEL <= 50 AND OUTSIDETHETOWER$ = "NO" THEN PRINT "View:         You are getting pretty high, but you still cannot see the top."
IF LEVEL > 50 AND LEVEL <= 100 AND OUTSIDETHETOWER$ = "NO" THEN PRINT "View:         You see birds of prey circling the tower."
IF LEVEL > 100 AND LEVEL <= 200 AND OUTSIDETHETOWER$ = "NO" THEN PRINT "View:         It is starting to get cloudy."
IF LEVEL > 200 AND LEVEL <= 300 AND OUTSIDETHETOWER$ = "NO" THEN PRINT "View:         The view is completely obscured by clouds and it is getting very cold."
IF LEVEL > 300 AND LEVEL <= 500 AND OUTSIDETHETOWER$ = "NO" THEN PRINT "View:         The clouds are starting to clear."
IF LEVEL > 500 AND LEVEL <= 1000 AND OUTSIDETHETOWER$ = "NO" THEN PRINT "View:         You can see the tops of the clouds!  You should not be able to breathe up here."
IF LEVEL > 100 AND LEVEL <= 300 THEN CHARACTERHEALTH = CHARACTERHEALTH - 1
IF LEVEL > 300 AND LEVEL <= 500 THEN CHARACTERHEALTH = CHARACTERHEALTH - 2
IF LEVEL > 500 AND LEVEL <= 1000 THEN CHARACTERHEALTH = CHARACTERHEALTH - 3
IF LEVEL > 1000 THEN CHARACTERHEALTH = CHARACTERHEALTH - 4
IF ZOMBIESCRATCH$ = "YES" AND CHARACTERHEALTH <= 0 THEN GOTO [ZOMBIEENDING]
IF ZOMBIESCRATCH$ = "YES" AND CHARACTERHEALTH > 0 THEN GOTO [REPEATZOMBIEOPTION]
IF ZOMBIESCRATCH$ = "NO" THEN GOTO [ROOMDESCRIPTION2]
[REPEATZOMBIEOPTION]
CHARACTERHEALTH = CHARACTERHEALTH - 2
PRINT ""
PRINT "That zombie scratch is looking red, puffy and nasty.  You're getting feverish."
PRINT ""
[ROOMDESCRIPTION2]
IF LEVEL < 1 THEN PRINT "Location:     Level " ; LEVEL ; ", Latitude: " ; LATITUDE ; ", Longitude: " ; LONGITUDE ; ",  HP: " ; CHARACTERHEALTH ; ",  Gold: " ; CHARACTERGOLD ; ",  Weapon: " ; MAGICITEMDESCRIPTOR$
IF LEVEL = 1 THEN PRINT "Location:     Ground floor, Latitude: " ; LATITUDE ; ", Longitude: " ; LONGITUDE ; ",  HP: " ; CHARACTERHEALTH ; ",  Gold: " ; CHARACTERGOLD ; ",  Weapon: " ; MAGICITEMDESCRIPTOR$
IF LEVEL > 1 THEN PRINT "Location:     Level " ; LEVEL ; ", Latitude: " ; LATITUDE ; ", Longitude: " ; LONGITUDE ; ",  HP: " ; CHARACTERHEALTH ; ",  Gold: " ; CHARACTERGOLD ; ",  Weapon: " ; MAGICITEMDESCRIPTOR$
PRINT "Character:    Species: Human, Gender: Male, Fighting Skill: " ; FIGHTINGSKILL
[REPEATROOMDESCRIPTIONOPTIONS]
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT FIRSTOPTION$ + "   " + SECONDOPTION$  + "   " + THIRDOPTION$ + "   " + FOURTHOPTION$ + "   " + FIFTHOPTION$ + "   " + SIXTHOPTION$
INPUT REPLY$
IF REPLY$ = "1" AND OUTSIDETHETOWER$ = "YES" AND LATITUDE = 0 AND LONGITUDE = 0 THEN GOTO [ENTERTHETOWER]
IF REPLY$ = "1" AND OUTSIDETHETOWER$ = "YES" THEN GOTO [WALKTHROUGHTHEJUNGLE]
IF REPLY$ = "1" AND OUTSIDETHETOWER$ = "NO" THEN GOTO [STAIRCASE]
IF REPLY$ = "2" AND OUTSIDETHETOWER$ = "YES" THEN GOTO [WALKTHROUGHTHEJUNGLE]
IF REPLY$ = "2" AND OUTSIDETHETOWER$ = "NO" THEN GOTO [STAIRCASE]
IF REPLY$ = "3" AND OUTSIDETHETOWER$ = "YES" THEN GOTO [WALKTHROUGHTHEJUNGLE]
IF REPLY$ = "3" AND OUTSIDETHETOWER$ = "NO" THEN GOTO [RANDOMOCCURENCE]
IF REPLY$ = "4" AND OUTSIDETHETOWER$ = "YES" THEN GOTO [WALKTHROUGHTHEJUNGLE]
IF REPLY$ = "4" AND OUTSIDETHETOWER$ = "NO" THEN GOTO [REPEATENDINGOPTION]
IF REPLY$ = "5" AND OUTSIDETHETOWER$ = "YES" AND LATITUDE = 0 AND LONGITUDE = 0 THEN GOTO [WALKTHROUGHTHEJUNGLE]
IF REPLY$ = "5" AND OUTSIDETHETOWER$ = "YES" THEN GOTO [WALKTHROUGHTHEJUNGLE]
IF REPLY$ = "5" AND OUTSIDETHETOWER$ = "NO" AND LEVEL >= 1 THEN GOTO [JUMPOUTTHEWINDOW]
IF REPLY$ = "5" AND OUTSIDETHETOWER$ = "NO" AND LEVEL < 1 THEN GOTO [OPTIONCORRECTION]
IF REPLY$ = "6" AND OUTSIDETHETOWER$ = "YES" AND LATITUDE = 0 AND LONGITUDE = 0 THEN GOTO [REPEATENDINGOPTION]
IF REPLY$ = "6" AND OUTSIDETHETOWER$ = "NO" AND LEVEL = 1 THEN GOTO [LEAVETHETOWER]
[OPTIONCORRECTION]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [REPEATROOMDESCRIPTIONOPTIONS]

[LEAVETHETOWER]
OUTSIDETHETOWER$ = "YES"
GOTO [ROOMDESCRIPTION]

[ENTERTHETOWER]
OUTSIDETHETOWER$ = "NO"
GOTO [ROOMDESCRIPTION]

[STAIRCASE]
IF REPLY$ = "1" AND LEVEL = -1 THEN LEVEL = LEVEL + 1
IF REPLY$ = "1" THEN LEVEL = LEVEL + 1
IF REPLY$ = "2" AND LEVEL < 0 THEN LEVEL = LEVEL - 1
IF REPLY$ = "2" AND LEVEL = 1 THEN LEVEL = LEVEL - 2
IF REPLY$ = "2" AND LEVEL > 0 THEN LEVEL = LEVEL - 1
GOTO [RANDOMOCCURENCE]

REM THIS IS THE END MY ONLY FRIEND

[ENDING]
PRINT "You have sustained fatal injury."
[REPEATFATALINJURYOPTION]
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "(1) start over from the beginning"
PRINT "(2) quit"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [INTRO]
IF REPLY$ = "2" GOTO [GAMEOVER]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [REPEATFATALINJURYOPTION]


GOTO [GAMEOVER]
[REPEATENDINGOPTION]
PRINT ""
PRINT "Are you certain you wish to leave the game?"
PRINT ""
PRINT "(1) yes"
PRINT "(2) no"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [GAMEOVER]
IF REPLY$ = "2" GOTO [ROOMDESCRIPTION]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [REPEATENDINGOPTION]

[REPEATENDINGOPTION2]
PRINT ""
PRINT "Are you certain you wish to leave the game?"
PRINT ""
PRINT "(1) yes"
PRINT "(2) no"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [GAMEOVER]
IF REPLY$ = "2" THEN GOTO [OUTSIDETHETOWER]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [REPEATENDINGOPTION2]

[GAMEOVER]
END

REM EVERY TIME THE PLAYER GOES TO A DIFFERENT FLOOR IN THE TOWER, S/HE MIGHT RUN ACROSS EITHER A CREATURE OR AN ITEM

[RANDOMOCCURENCE]
RANDOMOCCURENCE = INT(RND(0)*100)
IF RANDOMOCCURENCE <= 75 THEN GOTO [ROOMDESCRIPTION]
IF RANDOMOCCURENCE > 75 AND RANDOMOCCURENCE <= 80 THEN GOTO [DRINKVIAL]
IF RANDOMOCCURENCE > 80 AND RANDOMOCCURENCE <= 85 THEN GOTO [PICKUPMAGICITEM]
IF RANDOMOCCURENCE > 85 AND RANDOMOCCURENCE < 87 AND OUTSIDETHETOWER$ = "YES" THEN GOTO [POOL]

REM THIS SECTION IS THE ALGORITM FOR COMBATTING CREATURES IN THE TOWER

[ENCOUNTERACREATURE]
[SELECTCREATURETYPE]
SELECTCREATURETYPE = INT(RND(0)*47)
CREATUREHEALTH = INT(RND(0)*20)+1
CREATUREINITIALHEALTH = CREATUREHEALTH
CREATUREGOLD = INT(RND(0)*30)+20
SELECT CASE SELECTCREATURETYPE
    CASE 0
        SELECTACREATURETYPE$ = "skeleton"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "strangles"
        CREATUREWEAPON$ = "its hands"
    CASE 1
        SELECTACREATURETYPE$ = "zombie"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "scratches"
        CREATUREWEAPON$ = "its hands"
    CASE 2
        SELECTACREATURETYPE$ = "lich"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "curses"
        CREATUREWEAPON$ = "its dark magic"
    CASE 3
        SELECTACREATURETYPE$ = "bandit"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "fires a dart at"
        CREATUREWEAPON$ = "his pistol crossbow"
    CASE 4
        SELECTACREATURETYPE$ = "swordsman"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "chops at"
        CREATUREWEAPON$ = "his saber"
    CASE 5
        SELECTACREATURETYPE$ = "mercenary"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "stabs"
        CREATUREWEAPON$ = "his trident"
    CASE 6
        SELECTACREATURETYPE$ = "werewolf"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "tears at"
        CREATUREWEAPON$ = "its claws"
    CASE 7
        SELECTACREATURETYPE$ = "goblin"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "stabs"
        CREATUREWEAPON$ = "his trident"
    CASE 8
        SELECTACREATURETYPE$ = "giant spider"
        CREATUREHEALTH = CREATUREHEALTH + 10
        CREATUREATTACKVERBAGE$ = "bites"
        CREATUREWEAPON$ = "its teeth"
    CASE 9
        SELECTACREATURETYPE$ = "vampire"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "slices you"
        CREATUREWEAPON$ = "his claws"
    CASE 10
        SELECTACREATURETYPE$ = "cave troll"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "pummels"
        CREATUREWEAPON$ = "his huge fists"
    CASE 11
        SELECTACREATURETYPE$ = "basilisk"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "lashes out at"
        CREATUREWEAPON$ = "its tail"
    CASE 12
        SELECTACREATURETYPE$ = "giant bat"
        CREATUREHEALTH = CREATUREHEALTH + 10
        CREATUREATTACKVERBAGE$ = "bites"
        CREATUREWEAPON$ = "its teeth"
    CASE 13
        SELECTACREATURETYPE$ = "beholder"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "fires a magic missile at"
        CREATUREWEAPON$ = "its magical spells"
    CASE 14
        SELECTACREATURETYPE$ = "carrion crawler"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "bites"
        CREATUREWEAPON$ = "its teeth"
    CASE 15
        SELECTACREATURETYPE$ = "crocodile"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "slams"
        CREATUREWEAPON$ = "its tail"
    CASE 16
        SELECTACREATURETYPE$ = "cyclops"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "bashes"
        CREATUREWEAPON$ = "his club"
    CASE 17
        SELECTACREATURETYPE$ = "centaur"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "fires an arrow at"
        CREATUREWEAPON$ = "his long bow"
    CASE 18
        SELECTACREATURETYPE$ = "minotaur"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "gores"
        CREATUREWEAPON$ = "his horns"
    CASE 19
        SELECTACREATURETYPE$ = "greater demon"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "smothers and saps strength from"
        CREATUREWEAPON$ = "its dark magic"
    CASE 20
        SELECTACREATURETYPE$ = "displacer beast"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "slices"
        CREATUREWEAPON$ = "its claws"
    CASE 21
        SELECTACREATURETYPE$ = "dracolich"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "curses"
        CREATUREWEAPON$ = "its dark magic"
    CASE 22
        SELECTACREATURETYPE$ = "dragon"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "bashes"
        CREATUREWEAPON$ = "its spiked tail"
    CASE 23
        SELECTACREATURETYPE$ = "drow elf"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "stabs"
        CREATUREWEAPON$ = "a long knife"
    CASE 24
        SELECTACREATURETYPE$ = "mummy"
        CREATUREHEALTH = CREATUREHEALTH + 10
        CREATUREATTACKVERBAGE$ = "strangles"
        CREATUREWEAPON$ = "its strong hands"
    CASE 25
        SELECTACREATURETYPE$ = "phase spider"
        CREATUREHEALTH = CREATUREHEALTH + 0
        CREATUREATTACKVERBAGE$ = "appears above you and bites"
        CREATUREWEAPON$ = "its teeth"
    CASE 26
        SELECTACREATURETYPE$ = "medusa"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "hits"
        CREATUREWEAPON$ = "her tail"
    CASE 27
        SELECTACREATURETYPE$ = "manticore"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "slashes"
        CREATUREWEAPON$ = "its claws"
    CASE 28
        SELECTACREATURETYPE$ = "hydra"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "bites"
        CREATUREWEAPON$ = "its many heads"
    CASE 29
        SELECTACREATURETYPE$ = "golem"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "bashes"
        CREATUREWEAPON$ = "its stone hands"
    CASE 30
        SELECTACREATURETYPE$ = "giant lizard"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "lashes"
        CREATUREWEAPON$ = "its tail"
    CASE 31
        SELECTACREATURETYPE$ = "wyvern"
        CREATUREHEALTH = CREATUREHEALTH + 70
        CREATUREATTACKVERBAGE$ = "stings"
        CREATUREWEAPON$ = "its tail stinger"
    CASE 32
        SELECTACREATURETYPE$ = "shambling mound"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "smothers"
        CREATUREWEAPON$ = "layers of vegetation"
    CASE 33
        SELECTACREATURETYPE$ = "roc"
        CREATUREHEALTH = CREATUREHEALTH + 80
        CREATUREATTACKVERBAGE$ = "rends"
        CREATUREWEAPON$ = "its talons"
    CASE 34
        SELECTACREATURETYPE$ = "giant rat"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "gnaws on"
        CREATUREWEAPON$ = "its teeth"
    CASE 35
        SELECTACREATURETYPE$ = "purple worm"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "bites"
        CREATUREWEAPON$ = "its teeth"
    CASE 36
        SELECTACREATURETYPE$ = "short-faced bear"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "cuts"
        CREATUREWEAPON$ = "its claws"
    CASE 37
        SELECTACREATURETYPE$ = "giant hound"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "death-shakes"
        CREATUREWEAPON$ = "its powerful jaws"
    CASE 38
        SELECTACREATURETYPE$ = "harpy"
        CREATUREHEALTH = CREATUREHEALTH + 40
        CREATUREATTACKVERBAGE$ = "claws"
        CREATUREWEAPON$ = "its talons"
    CASE 39
        SELECTACREATURETYPE$ = "griffon"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "slashes"
        CREATUREWEAPON$ = "its claws"
    CASE 40
        SELECTACREATURETYPE$ = "gargoyle"
        CREATUREHEALTH = CREATUREHEALTH + 100
        CREATUREATTACKVERBAGE$ = "slams"
        CREATUREWEAPON$ = "its stone mass"
    CASE 41
        SELECTACREATURETYPE$ = "blink dog"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "bites"
        CREATUREWEAPON$ = "its fangs"
    CASE 42
        SELECTACREATURETYPE$ = "chimera"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "slices"
        CREATUREWEAPON$ = "its claws"
    CASE 43
        SELECTACREATURETYPE$ = "dryad"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "stabs"
        CREATUREWEAPON$ = "her short spear"
    CASE 44
        SELECTACREATURETYPE$ = "gorgon"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "gazes at"
        CREATUREWEAPON$ = "her eyes"
    CASE 45
        SELECTACREATURETYPE$ = "hippogriff"
        CREATUREHEALTH = CREATUREHEALTH + 30
        CREATUREATTACKVERBAGE$ = "body slams"
        CREATUREWEAPON$ = "its body weight"
    CASE 46
        SELECTACREATURETYPE$ = "naga"
        CREATUREHEALTH = CREATUREHEALTH + 20
        CREATUREATTACKVERBAGE$ = "body slams"
        CREATUREWEAPON$ = "its body weight"
END SELECT
PRINT ""
PRINT "A " + SELECTACREATURETYPE$ + " confronts you."
[HITCREATUREAGAIN]
PRINT ""
PRINT "you:    HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; MAGICITEMDESCRIPTOR$ ; " Fighting Skill: " ; FIGHTINGSKILL
PRINT SELECTACREATURETYPE$ + ": HP: " ; CREATUREHEALTH ; "  Gold: " ; CREATUREGOLD ; "  Weapon: " ; CREATUREWEAPON$
[REPEATHITCREATURE]
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "(1) engage the " + SELECTACREATURETYPE$ + " or"
PRINT "(2) retreat"
INPUT REPLY$
PRINT ""
IF REPLY$ = "1" THEN GOTO [CHARACTERATTACKSCREATURE]
IF REPLY$ = "2" THEN GOTO [ROOMDESCRIPTION]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [REPEATHITCREATURE]
[CHARACTERATTACKSCREATURE]
CHARACTERATTACKSCREATURE = INT(RND(0)*100)+1
IF CHARACTERATTACKSCREATURE <= FIGHTINGSKILL THEN GOTO [CHARACTERHITSCREATURE]
IF CHARACTERATTACKSCREATURE > FIGHTINGSKILL THEN PRINT "You swing at the " + SELECTACREATURETYPE$ + " and miss."
CHARACTEREXPERIENCE = INT(RND(0)*100)+1
IF CHARACTEREXPERIENCE >= FIGHTINGSKILL THEN FIGHTINGSKILL = FIGHTINGSKILL + 1
IF CHARACTEREXPERIENCE >= FIGHTINGSKILL THEN GOTO [CREATUREATTACKSCHARACTER]
IF CHARACTEREXPERIENCE < FIGHTINGSKILL THEN GOTO [CREATUREATTACKSCHARACTER]
IF CHARACTERATTACKSCREATURE > FIGHTINGSKILL THEN GOTO [CREATUREATTACKSCHARACTER]
[CHARACTERHITSCREATURE]
CHARACTERDAMAGESCREATURE = INT(RND(0)*9)+2
TOTALDAMAGE = CHARACTERDAMAGESCREATURE + MAGICITEMDAMAGEFACTOR
CREATUREHEALTH = CREATUREHEALTH - TOTALDAMAGE
PRINT "You hit the " + SELECTACREATURETYPE$ + " and do " ; TOTALDAMAGE ; " points of damage."
IF CREATUREHEALTH <= 0 THEN GOTO [CREATUREDEFEATED]
[CREATUREATTACKSCHARACTER]
IF SELECTCREATURETYPE = 6 AND CREATUREHEALTH < CREATUREINITIALHEALTH THEN GOSUB [REGENERATION]
IF SELECTCREATURETYPE = 9 AND CREATUREHEALTH < CREATUREINITIALHEALTH THEN GOSUB [REGENERATION]
CREATUREATTACKSCHARACTER = INT(RND(0)*2)+1
IF CREATUREATTACKSCHARACTER = 1 THEN GOTO [CREATUREHITSCHARACTER]
IF CREATUREATTACKSCHARACTER = 2 THEN PRINT "The " + SELECTACREATURETYPE$ + " " +  CREATUREATTACKVERBAGE$ + " you with " + CREATUREWEAPON$ + " and misses."
GOTO [HITCREATUREAGAIN]
[CREATUREHITSCHARACTER]
CREATUREHITSCHARACTERDAMAGE = INT(RND(0)*9)+2
TOTALDAMAGE = CREATUREHITSCHARACTERDAMAGE
CHARACTERHEALTH=CHARACTERHEALTH-TOTALDAMAGE
PRINT "The " + SELECTACREATURETYPE$ + " " + CREATUREATTACKVERBAGE$ + " you with " + CREATUREWEAPON$ + " and does " ; CREATUREHITSCHARACTERDAMAGE ; " points of damage."
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
GOTO [HITCREATUREAGAIN]
[CREATUREDEFEATED]
PRINT ""
PRINT "Victory!  The " + SELECTACREATURETYPE$ + " is dead.  You also found some gold."
PRINT ""
CHARACTERGOLD = CHARACTERGOLD + CREATUREGOLD
GOTO [ENVIRONMENTDESCRIPTION]

REM THIS CODE ALLOWS THE PLAYER TO PICK UP AND RETAIN A MAGIC ITEM.  THE STRENGTH OF THE ITEM IS SELECTED RANDOMLY.

[PICKUPMAGICITEM]
MAGICITEMTYPE = INT(RND(0)*11)+1
SELECT CASE MAGICITEMTYPE
    CASE 1
        MAGICITEMTYPE$ = "long sword"
    CASE 2
        MAGICITEMTYPE$ = "staff"
    CASE 3
        MAGICITEMTYPE$ = "short sword"
    CASE 4
        MAGICITEMTYPE$ = "dagger"
    CASE 5
        MAGICITEMTYPE$ = "mace"
    CASE 6
        MAGICITEMTYPE$ = "morningstar"
    CASE 7
        MAGICITEMTYPE$ = "flail"
    CASE 8
        MAGICITEMTYPE$ = "two-handed sword"
    CASE 9
        MAGICITEMTYPE$ = "spiked gauntlet"
    CASE 10
        MAGICITEMTYPE$ = "cudgel"
    CASE 11
        MAGICITEMTYPE$ = "club"
END SELECT
PRINT "You find a " + MAGICITEMTYPE$ + " on the ground."
[PICKUPMAGICITEMREPEAT]
PRINT "HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; MAGICITEMDESCRIPTOR$
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "(1) pick it up or"
PRINT "(2) leave it where it is"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [PICKUPITEM]
IF REPLY$ = "2" THEN GOTO [DONTPICKUPITEM]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [PICKUPMAGICITEMREPEAT]
[PICKUPITEM]
MAGICITEMDAMAGEFACTOR = INT(RND(0)*10)+1
MAGICITEM = MAGICITEMDAMAGEFACTOR
MAGICITEMDESCRIPTOR$ = MAGICITEMTYPE$ + " (+ " ; MAGICITEMDAMAGEFACTOR ; " damage)"
PRINT ""
PRINT "The " + MAGICITEMTYPE$ + " feels very strong, light and balanced in your hand."
GOTO [ENVIRONMENTDESCRIPTION]
[DONTPICKUPITEM]
PRINT ""
PRINT "You leave the unknown " + MAGICITEMTYPE$ + " lying on the ground."
GOTO [ENVIRONMENTDESCRIPTION]

REM THIS CODE CAUSES THE PLAYER TO ENCOUNTER A VIAL OF UNKNOWN LIQUID AND SEE IF IT HELPS OR HURTS

[DRINKVIAL]
LIQUIDCOLOR = INT(RND(0)*20)+1
SELECT CASE LIQUIDCOLOR
    CASE 1
        LIQUIDCOLOR$ = "red "
    CASE 2
        LIQUIDCOLOR$ = "pink "
    CASE 3
        LIQUIDCOLOR$ = "burnt orange "
    CASE 4
        LIQUIDCOLOR$ = "black "
    CASE 5
        LIQUIDCOLOR$ = "magenta "
    CASE 6
        LIQUIDCOLOR$ = "pea green "
    CASE 7
        LIQUIDCOLOR$ = "sky blue "
    CASE 8
        LIQUIDCOLOR$ = "custard yellow "
    CASE 9
        LIQUIDCOLOR$ = "clear "
    CASE 10
        LIQUIDCOLOR$ = "milky "
    CASE 11
        LIQUIDCOLOR$ = "brown and yellow "
    CASE 12
        LIQUIDCOLOR$ = "taupe "
    CASE 13
        LIQUIDCOLOR$ = "cerulean "
    CASE 14
        LIQUIDCOLOR$ = "midnight blue "
    CASE 15
        LIQUIDCOLOR$ = "glittery "
    CASE 16
        LIQUIDCOLOR$ = "honey-colored "
    CASE 17
        LIQUIDCOLOR$ = "snow white "
    CASE 18
        LIQUIDCOLOR$ = "goldenrod "
    CASE 19
        LIQUIDCOLOR$ = "copper "
    CASE 20
        LIQUIDCOLOR$ = "silver "
END SELECT
PRINT ""
PRINT "You find a vial with a glowing " + LIQUIDCOLOR$ + "liquid in it."
[DRINKVIALREPEAT]
PRINT "HP: " ; CHARACTERHEALTH ; "  Gold: " ; CHARACTERGOLD ; "  Weapon: " ; SWORDDESCRIPTOR$
PRINT ""
PRINT "Do you want to..."
PRINT ""
PRINT "(1) drink the liquid or"
PRINT "(2) leave it where it is"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [DODRINKVIAL]
IF REPLY$ = "2" THEN GOTO [DONTDRINKVIAL]
PRINT ""
PRINT "Please enter a number from the menu above."
GOTO [DRINKVIALREPEAT]
[DODRINKVIAL]
HEALORHURT = INT(RND(0)*2)+1
VIALEFFECTAMOUNT = INT(RND(0)*9)+2
IF HEALORHURT = 1 THEN GOTO [HEAL]
IF HEALORHURT = 2 THEN GOTO [HURT]
[HEAL]
CHARACTERHEALTH = CHARACTERHEALTH + VIALEFFECTAMOUNT
PRINT ""
PRINT "The liquid refreshes and energizes you.  You gain " ; VIALEFFECTAMOUNT ; " hit points, bringing you to " ; CHARACTERHEALTH ; " total hit points."
PRINT ""
GOTO [ENVIRONMENTDESCRIPTION]
[HURT]
CHARACTERHEALTH = CHARACTERHEALTH - VIALEFFECTAMOUNT
PRINT ""
PRINT "The liquid burns you on the inside.  You lose " ; VIALEFFECTAMOUNT ; " hit points, bringing you to " ; CHARACTERHEALTH ; " total hit points."
PRINT ""
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
GOTO [ENVIRONMENTDESCRIPTION]
[DONTDRINKVIAL]
PRINT ""
PRINT "You cautiously decide to leave the unknown liquid where it is."
GOTO [ENVIRONMENTDESCRIPTION]

REM THIS CODE MAKES BOTH THE WEREWOLF AND THE VAMPIRE REGENERATE.

[REGENERATION]
REGENERATION = INT(RND(0)*9)+1
CREATUREHEALTH = CREATUREHEALTH + REGENERATION
PRINT ""
PRINT "The " + SELECTACREATURETYPE$ + " regenerates.  It gains " ; REGENERATION ; " hit points, giving it " ; CREATUREHEALTH ; " hit points."
PRINT ""
RETURN

[JUMPOUTTHEWINDOW]
FALLINGDAMAGE = LEVEL * 5
CHARACTERHEALTH = CHARACTERHEALTH - FALLINGDAMAGE
PRINT ""
PRINT "You throw yourself out the window and plummet to the ground, taking " ; FALLINGDAMAGE ; " points of damage."
IF LEVEL > 20 AND LEVEL <= 50 THEN PRINT "Your body hits the ground and bounces like a rag doll.  Vultures take notice and rejoice."
IF LEVEL > 50  AND LEVEL <= 100 THEN PRINT "Your body makes an audible crack as it hits the solid earth.  Scavengers will dine well tonight."
IF LEVEL > 100  AND LEVEL <= 1000 THEN PRINT "Your body hits the ground so hard that an arm and a leg detach and go flying into the jungle."
IF LEVEL > 1000 THEN PRINT "A dragon spots you falling, swoops down and swallows you just before you hit the ground."
IF CHARACTERHEALTH <= 0 THEN GOTO [ENDING]
LEVEL = 1
PRINT "You stand up and brush the dirt off of your clothes."
GOTO [LEAVETHETOWER]

[ZOMBIEENDING]
PRINT ""
PRINT "As your heart stops, you turn into a zombie.  You roam the tower,"
PRINT "attacking unlucky visitors and turning them into zombies."
GOTO [REPEATENDINGOPTION]

[WALKTHROUGHTHEJUNGLE]
IF LATITUDE = 0 AND LONGITUDE = 0 THEN GOTO [JUNGLEOUTSIDETHETOWER] ELSE GOTO [JUNGLEELSEWHERE]
[JUNGLEOUTSIDETHETOWER]
IF REPLY$ = "1" THEN GOTO [ENTERTHETOWER]
IF REPLY$ = "2" THEN LATITUDE = LATITUDE + 1
IF REPLY$ = "3" THEN LONGITUDE = LONGITUDE + 1
IF REPLY$ = "4" THEN LATITUDE = LATITUDE - 1
IF REPLY$ = "5" THEN LONGITUDE = LONGITUDE - 1
IF REPLY$ = "6" THEN GOTO [REPEATENDINGOPTION]
GOTO [RANDOMOCCURENCE]
[JUNGLEELSEWHERE]
IF REPLY$ = "1" THEN LATITUDE = LATITUDE + 1
IF REPLY$ = "2" THEN LONGITUDE = LONGITUDE + 1
IF REPLY$ = "3" THEN LATITUDE = LATITUDE - 1
IF REPLY$ = "4" THEN LONGITUDE = LONGITUDE - 1
IF REPLY$ = "5" THEN GOTO [REPEATENDINGOPTION]
IF REPLY$ = "6" THEN GOTO [OPTIONCORRECTION]
GOTO [RANDOMOCCURENCE]

[BASEOFTHETOWER]
FIRSTOPTION$ = "(1) enter the tower"
SECONDOPTION$ = "(2) walk north"
THIRDOPTION$ = "(3) walk east"
FOURTHOPTION$ = "(4) walk south"
FIFTHOPTION$ = "(5) walk west"
SIXTHOPTION$ = "(6) exit the game"
GOTO [ENVIRONMENTDESCRIPTION]

[POOL]
PRINT "You stumble upon a small pool of water."
PRINT "Do you"
PRINT ""
PRINT "(1) drink some water or"
PRINT "(2) leave it alone"
INPUT REPLY$
IF REPLY$ = "1" THEN GOTO [DRINKFROMPOOL]
IF REPLY$ = "2" THEN GOTO [ROOMDESCRIPTION]
[DRINKFROMPOOL]
CHARACTERHEALTH = 100
PRINT "You feel completely rested and refreshed.  All of your hit points have been restored."
GOTO [ROOMDESCRIPTION]

Keagster101
Posts: 6
Joined: Sat Sep 14, 2013 5:32 pm

Tower of Rodinia My version, made by Alex J. Robinson I thin

Post by Keagster101 »

Hi this is my version of "Tower of Rodinia"

https://docs.google.com/file/d/0B38tCbo ... sp=sharing
Here is the website to go to: https://sites.google.com/site/codesforjustbasic/

~Keagster101