Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DRAGON CAVE
#1
here's a wumpus-a-like I've been fiddling with. A simple treasure hunting/dragon slaying adventure. Simple text or choice base input control.

All planned features aren't in place yet but it's moving along.

Code: (Select All)
'dragon cave
'
'A wumpus-a-like by James D. Jarvis may,2022
'
_Title "D R A G O N C A V E"
Randomize Timer
Dim Shared cave(30, 9), cd$(50), pcl, score, havehearthstone, gd, gold
Dim Shared lootd$(8)
Dim Shared monster$(7)
Const pnorth = 1: Const peast = 3: Const psouth = 2: Const pwest = 4: Const pup = 5: Const pdown = 6
Const foe = 7: Const loot = 8: Const desc = 9
Dim Shared vigor, luck, perception, stealth, magic, arrows
Dim Shared maxvigor, maxluck, maxperception, maxstealth, maxmagic
Dim Shared dragonstate As Integer
Dim Shared spellheal, spellrabbitfoot, spellblast, spelloracle
load_cavedesc
load_monsters
load_loot

playagain:
score = 0
havehearthstone = 0
Cls
Print "D R A G O N   C A V E"
Print
Print "Your quest is a simple one, seek the HearthStone and return it the Iron Dwarves."
Print ""
Print "Simple enough really, except for the dragon of course ..."

Print ""


Print "You have 3 magic arrows to defend yourself but be careful..."
Print "... as the Dragon is not alone."

Print " "
Print "<enter to continue>": Input any$
build_Player
show_scores
build_caves
pcl = droll(1, 10)

Print "<enter to continue>": Input any$
Cls
Print "The dwarves lower you deep into the caves, drawing back the line and sealing the way above"
Print "so the dragon can not escape through that route and catch them unaware."
Print "You will have to discover your own route out."
Print "<enter to continue>": Input any$


Do
    Print
    Print "====================================================================="
    Print cd$(cave(pcl, desc))
    Print "====================================================================="
    Print " "
    If cave(pcl, foe) > 0 Then
        Print "There is a "; monster$(cave(pcl, foe)); " in this cave."
        Print " "
    End If
    onward:
    Print pickprompt$;: Input ask$
    ask$ = LCase$(ask$)
    ask$ = truncate$(ask$)

    Select Case ask$
        Case "scores", "stats", "abilities", "show scores", "show stats", "show abilities": show_scores
        Case "score", "show score", "show": show_scores
        Case "look", "search": do_look
        Case "n", "north", "go n", "go north", "walk n", "walk north": go_passage pnorth, "walk"
        Case "e", "east", "go e", "go east", "walk e", "walk east": go_passage peast, "walk"
        Case "s", "south", "go s", "go south", "walk s", "walk south": go_passage psouth, "walk"
        Case "w", "west", "go west", "go west", "walk west", "walk west": go_passage pwest, "walk"
        Case "u", "up", "go u", "go up", "climb u", "climb up": go_passage pup, "climb"
        Case "d", "down", "go d", "go down", "climb d", "climb down": go_passage pdown, "climb"
        Case "run north", "run n": go_passage pnorth, "run"
        Case "run south", "run s": go_passage psouth, "run"
        Case "run south", "run e": go_passage peast, "run"
        Case "run south", "run w": go_passage pwest, "run"
        Case "jump up", "leap up", "hop up", "jump u", "leap u", "leap up": go_passage pup, "jump"
        Case "jump down", "leap down", "hop down", "jump d", "leap down", "leap d": go_passage pdown, "jump"
        Case "hit", "kill", "strike", "slay", "attack", "stab": attack
        Case "shoot", "fire": shootarrow 0
        Case "shootnorth": shootarrow pnorth
        Case "shootsouth": shootarrow psouth
        Case "shooteast": shootarrow peast
        Case "shootwest": shootarrow pwest
        Case "shootup": shootarrow pup
        Case "shootdown": shootarrow pdown
        Case "castblast": cast_spell "castblast"
        Case "castheal": cast_spell "castheal"
        Case "castrabbit": cast_spell "castrabbit"
        Case "castoracle": cast_spell "castoracle"
        Case "listen": do_listen
        Case "sniff", "smell": do_smell
        Case "get", "fetch", "pickup", "pick-up", "pick up", "grab": get_loot
        Case "help", "h", "?": show_help

    End Select


    If cave(pcl, foe) > 0 And droll(1, 8) < cave(pcl, foe) Then
        Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
        Print
        Print "The "; monster$(cave(pcl, foe)); " attacks you."
        Print
        mattack = droll(1, 20) + cave(pcl, foe)
        If mattack > vigor Then
            di = droll(1, cave(pcl, foe))
            Print "It strikes you for "; di; " points of damage "
            vigor = vigor - di
            Print
        Else
            ar = droll(1, 3)
            Select Case ar
                Case 1: Print "You narrowly avoid the blow."
                Case 2: Print "It fails to stike you."
                Case 3: Print "You parry the atatck."
            End Select
            Print
        End If
    End If





    If cave(pcl, foe) < 0 And droll(1, 4) < cave(pcl, foe) Then
        Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
        Print
        cave(pcl, foe) = Abs(cave(pcl, foe))
        Print "A "; monster$(cave(pcl, foe)); " attempts to ambush you."
        Print
        mattack = droll(2, 20) + cave(pcl, foe)
        If mattack > vigor + luck Then
            di = droll(1, cave(pcl, foe))
            Print "It strikes you for "; di; " points of damage "
            vigor = vigor - di
            Print
        Else
            luck = luck + 1
            If luck > maxluck Then luck = maxluck
            Print "You avoid it's attack"
            Print
        End If
    End If

    If vigor > 0 And vigor < 4 Then
        Print
        wr = droll(1, 3)
        Select Case wr
            Case 1: Print "You are exhausted..."
            Case 2: Print "You feel weak..."
            Case 3: Print "You are battered and bruised..."
        End Select
        lcheck = droll(1, 20)
        If lcheck < luck Then
            If luck < maxluck Then luck = luck + 1
            Print "... but you pull through for now."
        Else
            luck = luck - (droll(1, 2) - 1)
            Print " ..."
            Sleep 0.25
            Print "    .... "
            Sleep 0.25
            Print "      ..... you collapse."
        End If
        If Abs(cave(pcl, foe)) > 0 And droll(1, 100) > luck Then
            cave(pcl, foe) = Abs(cave(pcl, foe))
            Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
            Print "  "
            Print "The "; monster$(cave(pcl, foe)); " mauls you while you are down."
            Print " "
            di = droll(1, cave(pcl, foe))
            Print "It harms you for "; di; " points of damage "
            vigor = vigor - di
            Print
            Print "<enter to continue>": Input any$
        End If
    End If
    If vigor < 1 Then
        Print "! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"
        Print "-----------------------------------------------------------"
        Print "! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"
        Print " "

        dm = droll(1, 4)
        Select Case dm
            Case 1: Print "      YOU HAVE BEEN VANQUISHED !"
            Case 2: Print "      YOU HAVE DIED !"
            Case 3: Print "      YOU HAVE FALLEN DUE TO YOUR WOUNDS !"
            Case 4: Print "      THE LAST THING YOU HEAR A DRAGONS ROAR !"
        End Select
        Print

        Print "! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"
        Print "-----------------------------------------------------------"
        Print "! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"
        ask$ = "quit"
    End If


Loop Until ask$ = "quit"
Print
Sleep 0.25
Print "             G A M E     O V E R"
Print
Print "Final Score : "; score
Print
Print "play again";: Input A$
A$ = LCase$(A$)
If A$ = "y" Or A$ = "yes" Then GoTo playagain



cavedata:
Data 0,2,0,0,0,0,0,0,0: '1
Data 1,0,4,0,0,0,0,0,0: '2
Data 0,4,5,0,0,0,0,0,0: '3
Data 3,0,0,2,0,0,0,0,0: '4
Data 0,6,0,3,0,0,0,0,0: '5
Data 5,0,8,0,0,0,0,0,0: '6
Data 0,8,9,0,0,0,0,0,0: '7
Data 7,0,0,6,0,0,0,0,0: '8
Data 0,11,10,7,0,0,0,0,0: '9
Data 0,0,0,9,0,0,0,0,0: '10
Data 9,0,12,0,0,0,0,0,0: '11
Data 0,13,0,11,0,0,0,0,0: '12
Data 12,15,0,0,0,0,0,0,0: '13
Data 0,0,15,0,0,0,0,0,0: '14
Data 13,16,0,14,0,0,0,0,0: '15
Data 15,0,0,17,0,0,0,0,0: '16
Data 0,22,16,18,0,0,0,0,0: '17
Data 0,0,17,19,0,0,0,0,0: '18
Data 0,20,18,0,0,0,0,0,0: '19
Data 19,24,21,0,0,0,0,0,0: '20
Data 0,0,0,20,0,0,0,0,0: '21
Data 17,0,23,0,0,0,0,0,0: '22
Data 0,0,0,22,0,0,0,0,0: '23
Data 20,25,0,0,0,0,0,0,0: '24
Data 24,0,0,26,0,0,0,0,0: '25
Data 0,27,25,0,0,0,0,0,0: '26
Data 26,29,28,0,0,0,0,0,0: '27
Data 0,0,0,27,0,0,0,0,0: '28
Data 27,0,30,0,0,0,0,0,0: '29
Data 0,0,0,29,0,0,0,0,0: '30
cavedescdata:
Data "Musty cave"
Data "Cramped cave"
Data "Muddy cave"
Data "Bubbling pool of mud."
Data "Rancid pool of water."
Data "Dripping stalactities."
Data "Slippery sloped cave."
Data "Mineshaft."
Data "Crumbling old mineshaft."
Data "Mushroom garden."
Data "Fungus forest."
Data "Gloomy grotto."
Data "Dry cave."
Data "Cramped dusty cave."
Data "Mold encrusted walls."
Data "Carpeted in black mold."
Data "Floor covered in slime."
Data "Waist deep guano."
Data "Piles of guano crawling with vermin."
Data "Bottomles pit."
Data "Precarious bridge across a chasm."
Data "Chasm edge, no bottom in sight."
Data "Lava lake."
Data "Stream of lava splitting the chamber north and south."
Data "Lava flow splitting the chamber east and west."
Data "Bubbling pool of lava."
Data "Damp cave."
Data "Cavern choked with cave clams."
Data "Slime pit."
Data "Snake pit."
Data "Worm pit."
Data "Bone pit."
Data "Lava pit."
Data "Steamy cave."
Data "Cold cave."
Data "Ice Cave."
Data "Dusty cave."
Data "Cave full of crumbling pillars."
Data "Unearthy crytsal grotto."
Data "Pool of darkness."
Data "Hall of echoes."
Data "Heart of darkness."
Data "Ancient dwarf crypt."
Data "Ancient dwarf warehouse."
Data "Cold dwarven forge."
Data "Shattered dwarven throne."
Data "Cave littered with shards of dragon eggs."
Data "An old dragon nest."
Data "A fresh dragon nest."
Data "Dragon hoard."
monsterdata:
Data "Bat",
Data "Cavewight"
Data "Huge Bat"
Data "Molebear"
Data "Cave Clam"
Data "Shroombie"
Data "Dragon"

lootdata:
Data "Gold Nugget"
Data "Gold Coins"
Data "Gold Ingot"
Data "Healing Rune"
Data "Rabbit's Foot Rune"
Data "Blast Rune"
Data "Oracle Rune"
Data "HearthStone"

Sub heading_out
    Print " TO THE SURFACE ..."
    Print
    Print "   ... "
    Sleep 0.25
    If havehearthstone = 0 Then
        Print "But you lack the HearthStone"
        Print
        Print "Turn back? <Y,N>"
        Input A$
        If LCase$(A$) = "yes" Or LCase$(A$) = "y" Then
            ask$ = ""
            gd = 0
            Print " "
            Print "back to..."
            Print
        Else
            keepaskinghere:
            Print "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
            Print "How are yuo going to handle this situation?"

            Print "1 - Sneak past the Iron dwarves?"
            Print "2 - Tell them you quit."
            Print "3 - Run away !"
            Print "4- Challneg the king of the Iron Dwarves to single combat!"
            Print
            Print "Make yuor selection"
            Input AA
            If AA < 1 Or AA > 4 Then GoTo keepaskinghere
            Select Case AA
                Case 1:
                    If droll(1, 20) < luck Then
                        Print "You slip past the Iron Dwarves to go live your life in peace."
                        gd = 0
                        ask$ = "quit"
                    Else
                        Print
                        Print "The Dwarves grab you and give you a sound thrashing..."
                        Print " "
                        Print "'YOU AREN'T GETING OUT IF THIS DEAL SO EASY!'"
                        Print
                        Print "They toss you back in the caves."
                        Print
                        Sleep 0.25
                        vigor = vigor - droll(1, 4)
                        gd = 0
                        ask$ = ""
                    End If
                Case 2:
                    Print "The dwarves ponder your request..."
                    Print
                    Sleep 0.25
                    If droll(1, 30) < luck Then
                        Print "Okay we'll let you off the hook..."
                        If droll(1, 20) < luck Then
                            Print "...the dwarves let yuo break tyour contract and live yuor life in peace."
                            gd = 0
                            ask$ = "quit"
                        Else
                            Print "...the dwarves rough yuo up and sieze your loot for being a coward."
                            gold = 0
                            score = score / 2
                            gd = 0
                            ask$ = "quit"

                        End If
                    Else
                        Print " "
                        Print "The Iron Dwarves laugh at you and send yuo back into the caves."
                        gd = 0
                        ask$ = ""
                    End If
                Case 3:
                    Print "... Well that was easy..."
                    Print " "
                    Print "You are way too fast for the Iron dwarves to catch you, for now..."
                    Print
                    gd = 0
                    ask$ = "quit"
                Case 4:
                    Print " "
                    Print "The dwarves all laugh at you and push yuo back into the caves."
                    Print " "
                    Sleep 0.25
                    gd = 0
                    ask$ = ""
            End Select

        End If
    End If
    If havehearthstone = 1 Then
        Print
        Print "YOU HAVE MADE IT OUT OF THE CAVES WITH THE HEARTHSTONE !!!"
        Print
        Print "What now?"
        Print
        Print "1 - Hand the HearhtStone over to the Iron Dwarves."
        Print "2 - Sneak Away with the HearthStone."
        Print "3 - Demand a larger reward."
        Print
        askhere2:
        Input AA
        If AA < 0 Or AA > 3 Then GoTo askhere2
        Select Case AA
            Case 1
                Print " "
                Print "There is much rejoicing !!!"
                Print " "
                Print " you are fairly rewarded and welcome in the hall sof the Iron Dwarves for the remainder off all yuor days."
                Print
                score = score + 1000
                gold = gold + 500
                gd = 0
                ask$ = "quit"
            Case 2
                If droll(1, 30) < luck Then
                    Print
                    Print "You manage to slip past the Iro Dwarves..."
                    Print
                    Sleep 0.25
                    Print "Yuo find a byer for the HearhtStone in Skullport."
                    Print "If the Iron Dwarves ever find you it will not be pretty."
                    gold = gold + 5000
                    score = score + 500
                    gd = 0
                    ask$ = "quit"
                Else
                    Print " "
                    Print "THIEF!!!"
                    Print
                    Print " .... COWARD ...."
                    Print
                    Print "        ...VILLAIN!"
                    Print
                    Sleep 0.25
                    Print "The dwarves put you to the sword for your treachery."
                    gold = 0
                    score = score / 10
                    gd = 0
                    ask$ = "quit"
                End If
            Case 3
                Print " "
                Print "The Iron Dwarves all laugh at you..."
                Print
                Print "... they take the HearthStone and send you on your way."
                Print
                score = score + 100
                gd = 0
                ask$ = "quit"

        End Select
    End If
End Sub

Sub load_cavedesc
    Restore cavedescdata
    For c = 1 To 50
        Read cd$(c)
    Next c

End Sub
Sub do_look
    Print
    Print "====================================================================="
    Print cd$(cave(pcl, desc))
    Print "====================================================================="
    Print " "

    pcheck = droll(1, 12)
    pcheck2 = droll(1, 20)
    pcheck3 = droll(1, 24)
    If pcheck <= perception Then
        Print "There are exits:"
        If cave(pcl, pnorth) > 0 Then Print "North"
        If cave(pcl, psouth) > 0 Then Print "South"
        If cave(pcl, peast) > 0 Then Print "East"
        If cave(pcl, pwest) > 0 Then Print "West"
        If cave(pcl, pup) > 0 Then Print "Up"
        If cave(pcl, pdown) > 0 Then Print "Down"
    Else
        Print "The darkness keeps you from seeing much else."
    End If
    If pcheck2 <= perception And cave(pcl, foe) < 0 Then
        Print "There is a "; monster$(Abs(cave(pcl, foe))); " hiding in here."
    End If
    If cave(pcl, loot) < 0 And cave(pcl, foe) = 0 Then
        If pcheck3 < perception Then
            cave(pcl, loot) = Abs(cave(pcl, loot))
            Print "You discover a "; lootd$(cave(pcl, loot)); "."
        End If
    End If
    If cave(pcl, loot) > 0 And pcheck3 / 2 < perception Then
        Print "There is a "; lootd$(cave(pcl, loot)); " in this cave."
    End If

End Sub
Sub load_loot
    Restore lootdata
    For x = 1 To 8
        Read lootd$(x)
    Next x
End Sub


Function pickprompt$

    Dim pp$(4)
    pp$(1) = "What now"
    pp$(2) = "Choose your action"
    pp$(3) = "What now burglar"
    pp$(4) = "Be careful"
    p = droll(1, 4)
    pickprompt$ = pp$(p)
End Function

Sub build_caves
    Restore cavedata
    For c = 1 To 30
        Read cave(c, 1), cave(c, 2), cave(c, 3), cave(c, 4), cave(c, 5), cave(c, 6), cave(c, 7), cave(c, 8), cave(c, 9)

        Select Case c
            Case 1, 2, 3, 4, 5, 6, 7, 8, 9, 10: cave(c, 9) = droll(1, 20)
            Case 11, 12, 13, 14, 15, 16, 16, 18, 19, 20: cave(c, 9) = droll(1, 40)
            Case 21, 22, 23, 24, 25: cave(c, 9) = droll(1, 20) + 20
            Case 26, 27, 28, 29, 30: cave(c, 9) = droll(1, 10) + 40
        End Select
        mr = droll(1, 20) - droll(1, 20)
        If mr < -6 Or mr > 6 Then mr = 0
        cave(c, foe) = mr
        tr = droll(1, 16) - droll(1, 16)
        If tr < -7 Or tr > 7 Then tr = 0
        cave(c, loot) = tr
        For x = 1 To 6
            If cave(c, x) = 0 And droll(1, 6) > 5 Then
                If c < 20 Then
                    nr = droll(1, 24)
                    cave(c, x) = nr
                End If
                If c > 19 Then
                    nr = droll(1, 15) + 15
                    cave(c, x) = nr
                End If
            End If
        Next x

    Next c

    dragonlocation = droll(1, 10) + 20
    heartstonelocation = droll(1, 10) + 20
    cave(hearstone, loot) = 8
    cave(dragonlocation, foe) = 7
    exitlocation = droll(1, 6)
    cave(exitlocation, dup) = 99
End Sub
Sub load_monsters
    Restore monsterdata
    For x = 1 To 7
        Read monster$(x)
    Next x
End Sub

Sub do_listen
    pr = roll(1, 20) + perception
    If pr > 10 And cave(pcl, foe) < 0 Then
        cave(pcl, foe) = Abs(cave(pcl, foe))
        Print "? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"
        Print "You hear a "; monster$(cave(pcl, foe)); " lurking in the shadows."
        Print
        Sleep 0.25
    End If
    If pr > 20 Then
        Print "? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"
        For x = 1 To 6
            If cave(pcl, x) > 0 Then
                cn = Abs(cave(pcl, x))
                Select Case x
                    Case 1
                        If cave(cn, foe) > 0 Then Print "Something stirs to the north."
                    Case 2
                        If cave(cn, foe) > 0 Then Print "There is a tiny noise to the south."
                    Case 3
                        If cave(cn, foe) > 0 Then Print "You hear whispers to the east."
                    Case 4
                        If cave(cn, foe) > 0 Then Print "The faintest of clamors can be heard to the west."
                    Case 5
                        If cave(cn, foe) > 0 Then Print "Steps from above can be heard."
                    Case 6
                        If cave(cn, foe) > 0 Then Print "A stir of echoes wafts up fron beneath you."
                End Select
            End If
        Next x
    End If

End Sub
Sub show_help
    Cls
    Print "DRAGON CAVE HELP"
    Print "----------------------"

    Print "This game uses simple text commands."
    Print "Valid commands include the directions: north,south,east,west,up, and down."
    Print "you can try to sneak, walk, go, run, climb, or jump as applicable."
    Print "shoot, cast <spell name>, attack, hit, and such are valid as well."
    Print "with some minor variations here and there."
    Print
    Print "Don't foget to search, look, listen, and sniff."
    Print

    Sleep 0.25
End Sub





Sub do_smell
    dragonflag$ = "no"
    Print "---------------  Sniff, sniff   -------------"
    Print
    If droll(1, 16) < perception Then
        If cave(pcl, foe) = -7 Then Print "You smell The Dragon nearby."
        For x = 1 To 6
            If cave(pcl, x) > 0 Then
                cn = cave(pcl, x)
                If Abs(cave(cn, foe)) = 7 Then Print "You smell The Dragon nearby."
            End If
        Next x
    End If
End Sub



Sub get_loot
    If cave(pcl, loot) > 0 Then
        Print "+ + + + + + + + + + + + + + + + + + + + +"
        Print
        Print "You fetch the "; lootd$(cave(pcl, loot))
        Print
        Select Case cave(pcl, loot)
            Case 1
                cave(pcl, loot) = 0
                gold = gold + droll(1, 4)
            Case 2
                cave(pcl, loot) = 0
                gold = gold + droll(2, 10)
            Case 3
                cave(pcl, loot) = 0
                gold = gold + droll(2, 20) * 5
            Case 4
                cave(pcl, loot) = 0
                If spellheal = 0 Then
                    spellheal = 4
                    Beep
                    Print "\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/"
                    Print "        You have learned the Heal Spell"
                    Print "/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\"

                Else
                    If spellheal > 1 Then spellheal = spellheal - 1

                End If
                score = score + 250
            Case 5
                cave(pcl, loot) = 0
                If spellrabbitfoot = 0 Then
                    spellrabbitfoot = droll(2, 3)
                    Beep
                    Print "\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/"
                    Print "     You have learned the Rabbit's Foot Spell"
                    Print "/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\"

                Else
                    If spellrabbitfoot > 1 Then spellrabbitfoot = spellrabbitfoot - 1

                End If
                score = score + 250

            Case 6
                cave(pcl, loot) = 0
                If spellblast = 0 Then
                    spellbalst = 4
                    Beep
                    Print "\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/"
                    Print "        You have learned the Blast Spell"
                    Print "/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\"

                Else
                    If spellblast > 1 Then spellblast = spellblast - 1

                End If
                score = score + 250

            Case 7
                cave(pcl, loot) = 0
                If spelloracle = 0 Then
                    spelloracle = 4
                    Beep
                    Print "\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/"
                    Print "        You have learned the Orcacle Spell"
                    Print "/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\"
                Else
                    If spelloracle > 1 Then spelloracle = spelloracle - 1

                End If
                score = score + 250

            Case 8
                cave(pcl, loot) = 0
                havehearthstone = 1
                score = score + 2000
                Print "+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+"
                Print "    YOU HAVE  THE HEARTHSTONE, SEEK THE EXIT"
                Print "+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+"

        End Select

    End If
End Sub



Sub attack
    par = vigor + droll(2, 6)
    md = cave(pcl, foe)
    mdr = droll(3, md) + droll(1, 12)
    If cave(pcl, foe) = 0 Then
        huh = droll(1, 3)
        Print "? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"
        Print

        Select Case huh
            Case 1: Print "There is nothing there."
            Case 2: Print "The air nimbly dodges your blow."
            Case 3: Print "You attack the darkness."
        End Select
        Print
        Print "? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"
        Print


    Else
        If par > mdr Then
            Print "! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"
            Print
            Print "You hit the "; monster$(Abs(cave(pcl, foe))); " ..."
            Sleep 0.25
            lr = luck - droll(1, 20)
            If lr > 0 Then
                score = score + Abs(cave(pcl, foe)) * 100
                Print "       S L A Y I N G  I T ! "
                Print
                cave(pcl, foe) = 0
            Else
                score = score + Abs(cave(pcl, foe)) * 5
                Print "  forcing it to retreat."
                Sleep 0.25
                ishide = droll(1, 8)
                If ishide > cave(pcl, foe) Then
                    Print
                    Print "The "; monster$(Abs(cave(pcl, foe))), " has scurried into the shadows."
                    Print
                    cave(pcl, foe) = -1 * cave(pcl, foe)
                Else
                    score = score + Abs(cave(pcl, foe)) * 20
                    Print " "
                    Print "The ", monster$(Abs(cave(pcl, foe))), "has fled from this cave!"
                    Print
                    cave(pcl, foe) = 0
                    didhide = 0
                    go = 0
                    Do
                        go = go + 1
                        If cave(pcl, go) > 0 Then
                            cave(cave(pcl, go), foe) = cave(pcl, foe)
                            cave(pcl, foe) = 0
                            didhide = 1
                        End If
                    Loop Until didhide > 0
                End If
            End If

        End If
    End If
End Sub

Sub go_passage (gd As Integer, mode$)
    walkflag$ = "no"
    If cave(pcl, gd) = 0 Then
        Print "You can't go that way."; ""
    End If
    If mode$ = "walk" Then
        Print "walking"
        If Abs(cave(pcl, foe)) > 0 Then
            cave(pcl, foe) = Abs(cave(pcl, foe))
            Print
            Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
            Print
            Print "A "; monster$(cave(pcl, foe)); " blocks your way."
            Print
            Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
            Print
        Else
            walkflag$ = "yes"
        End If
    End If
    If mode$ = "sneak" Then
        Print "trying to sneak"
        If Abs(cave(pcl, foe)) > 0 Then
            cave(pcl, foe) = Abs(cave(pcl, foe))
            If stealth + droll(2, 6) < (droll(4, 6) + cave(pcl, foe)) Then
                Print
                Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                Print
                Print "A "; monster$(cave(pcl, foe)); " blocks your way."
                Print
                Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                Print
            Else
                Print
                Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                Print
                Print "You slip past the "; monster$(cave(pcl, foe)); "."
                Print
                Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                Print
                Print
                walkflag$ = "yes"
            End If
        End If
    End If
    If mode$ = "run" Then
        Print "trying to run"
        If Abs(cave(pcl, foe)) > 0 And vigor > 0 Then
            cave(pcl, foe) = Abs(cave(pcl, foe))
            If vigor + droll(2, 6) < (droll(4, 6) + cave(pcl, foe)) And cave(pcl, foe) <> 5 Then
                Print
                Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                Print
                Print "The "; monster$(cave(pcl, foe)); " blocks your way."
                Print
                Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                Print
            Else
                Print
                Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                Print
                Print "You run past the "; monster$(cave(pcl, foe)); "."
                Print
                Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                Print
                Print
                walkflag$ = "yes"
            End If
            vigor = vigor - 1
        End If
    End If
    If mode$ = "climb" Then
        Print "trying to climb..."

        If Abs(cave(pcl, foe)) > 0 And vigor > 0 Then
            cave(pcl, foe) = Abs(cave(pcl, foe))
            If vigor + droll(2, 6) < (droll(4, 6) + cave(pcl, foe)) And cave(pcl, foe) <> 5 Then
                Print
                Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                Print
                Print "The "; monster$(cave(pcl, foe)); " blocks your way."
                Print
                Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                Print
            Else
                Print
                Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                Print
                Print "You scramble past the "; monster$(cave(pcl, foe)); "."
                Print
                Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                Print
                Print
                If luck > droll(1, 12) Then
                    luck = luck - 1
                    Print
                    Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                    Print
                    Print "You slip and hurt youself !."
                    Print
                    Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                    Print
                    vigor = vigor - droll(1, 3)
                Else
                    walkflag$ = "yes"
                End If
            End If
            vigor = vigor - 1
        End If
        If mode$ = "jump" Then
            If Abs(cave(pcl, foe)) > 0 And vigor > 0 Then
                cave(pcl, foe) = Abs(cave(pcl, foe))
                If vigor + droll(3, 6) < (droll(4, 6) + cave(pcl, foe)) Then
                    Print
                    Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                    Print
                    Print "The "; monster$(cave(pcl, foe)); " blocks your way."
                    Print
                    Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                    Print
                Else
                    Print
                    Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                    Print
                    Print "You leap past the "; monster$(cave(pcl, foe)); "."
                    Print
                    Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                    Print
                    Print
                    If luck > droll(1, 24) Then
                        luck = luck - 1
                        Print
                        Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                        Print
                        Print "You stumble and slam onto the rocky cave floor."
                        Print
                        Print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
                        Print
                        vigor = vigor - droll(1, 3) + 1
                    Else
                        walkflag$ = "yes"
                    End If
                End If
                vigor = vigor - 1
            End If

        End If

    End If
    If walkflag$ = "yes" Then
        Print
        Print "-----------------------------------------------------------"
        Print
        Print "You travel onward to..."
        Print " "
        If cave(pcl, gd) = 99 Then heading_out

        If gd <> 0 Then pcl = cave(pcl, gd)
        Print cd$(cave(pcl, desc))
        Print
        Print "-----------------------------------------------------------"
    End If

End Sub


Function truncate$ (a$)
    b$ = "-"
    If InStr(a$, "kill ") > 0 Then b$ = "hit"
    If InStr(a$, "hit ") > 0 Then b$ = "hit"
    If InStr(a$, "strike ") > 0 Then b$ = "hit"
    If InStr(a$, "slay ") > 0 Then b$ = "hit"
    If InStr(a$, "fight ") > 0 Then b$ = "hit"
    If InStr(a$, "attack ") > 0 Then b$ = "hit"
    If InStr(a$, "arrow") > 0 Then b$ = "shoot"
    If InStr(a$, "fire ") > 0 Then b$ = "shoot"
    If InStr(a$, "shoot ") > 0 Then b$ = "shoot"
    If InStr(a$, "loose ") > 0 Then b$ = "shoot"
    If InStr(a$, "blast") > 0 Then b$ = "castblast"
    If InStr(a$, "heal") > 0 Then b$ = "castheal"
    If InStr(a$, "rabbit") > 0 Then b$ = "castrabbit"
    If InStr(a$, "oracle") > 0 Then b$ = "castoracle"


    If b$ = "shoot" And InStr(a$, "north") Then b$ = "shootnorth"
    If b$ = "shoot" And InStr(a$, "east") Then b$ = "shooteast"
    If b$ = "shoot" And InStr(a$, "south") Then b$ = "shootsouth"
    If b$ = "shoot" And InStr(a$, "west") Then b$ = "shootwest"
    If b$ = "shoot" And InStr(a$, "up") Then b$ = "shootup"
    If b$ = "shoot" And InStr(a$, "down") Then b$ = "shootdown"

    If b$ = "-" Then
        a$ = a$
    Else
        a$ = b$
    End If
    truncate$ = a$

End Function

Sub shootarrow (ad As Integer)
    shootflag$ = "no"
    If arrows > 0 Then shootflag$ = "arrow"

    If Abs(cave(pcl, foe)) > 0 And shootflag$ = "arrow" Then
        Select Case ad
            Case 1, 2, 3, 4, 5, 6
                Print " ! ! ! ! ! ! ! ! ! ! !"
                Print
                Print "You can't fire an arrow into another cave..."
                Print "              ... while this cave is occupied !"
                Print "<enter>": Input a$
            Case 0
                shootflag$ = "yes"
        End Select
    End If
    If shootflag$ = "arrow" And cave(pcl, ad) > 0 Then
        Print " "
        Print ">>>>----------------------------->"
        Print
        Print "You loose a magical arrow into the distance..."
        Sleep 0.25
        tr = cave(pcl, ad)
        If cave(tr, foe) = 7 Then
            arrows = arrows - 1
            ad = droll(1, 12)
            If ad <= luck Then
                Print "... and hear the dragon roar in angush... "
                Print "    ... AS THE DRAGON DIES !!!"
                Print
                Print ">>>>----------------------------->"
                Print
                Print "<enter>": Input a$
                cave(tr, foe) = 0
                score = score + 1000
            End If

        Else
            Print "... and hear it break against stone."
            arrows = arrows - 1
            Print " "
            If droll(1, 20) > luck Then Print "You hear the dragon roar in the distance."
        End If

    End If
    If shootflag$ = "arrow" And cave(pcl, ad) = 0 Then
        Print "   "
        Print "You can't shoot in that direction."
        Print
        Print "<enter>": Input a$
    End If
    If shootflag$ = "yes" Then
        Print
        Print ">>>>----------------------------->"
        Print
        Print "You loose a magcial arrow..."
        arrows = arrows - 1
        Sleep 0.25
        If droll(1, 6) > 1 And cave(pcl, foe) <> 7 Then

            Print "slaying the "; monster$(Abs(cave(pcl, foe))); " !"
            Print
            cave(pcl, foe) = 0
            score = score + cave(pcl, foe) * 100
        End If
        Print
        If droll(1, 10) > 2 And cave(pcl, foe) = 7 Then
            Print "Sinking it into the dragon's heart."
            Print
            Print "YOU HAVE KILLED THE DRAGON !!!"
            Print
            Print
            cave(pcl, foe) = 0
            score = score + 1000
        End If
    End If
    Print "<enter>": Input a$
End Sub




Sub build_Player
    maxvigor = droll(2, 6) + 6
    maxluck = droll(4, 4)
    maxperception = droll(3, 6)
    maxstealth = droll(3, 6)
    maxmagic = droll(3, 6)
    vigor = maxvigor
    luck = maxluck
    perception = maxperception
    stealth = maxstealth
    magic = maxmagic
    gold = 0
    arrows = 3

End Sub
Sub show_scores
    If havehearthstone = 1 Then
        Print "+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+"
        Print "You have the HearthStone"
        Print "+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+"
    End If
    Print "Your Ability Scores."
    Print
    Print "Vigor", maxvigor; "/"; vigor
    Print "Luck", luck
    Print "Perception ", perception
    Print "Stealth ", stealth
    Print "Magic ", maxmagic; "/"; magic
    Print
    Print "Spells Known:";
    If spellheal > 0 Then Print "Heal",
    If spellblast > 0 Then Print "Blast",
    If spelloracle > 0 Then Print "Oracle",
    If spellrabbitfoot > 0 Then Print "Rabbit's Foot",

    Print
    Print "Gold ", gold
    Print "Arrows ", arrows

    Print
    Print "Score ", score
End Sub




Sub cast_spell (cast$)
    If cast$ = "heal" And spellheal > 0 Then
        mcheck = magic - spellheal
        Print " * * * * * * * * * * * * * * * * * * * *"
        Print
        If mcheck > magic Then
            Print "You lack the magical power to cast that."
        Else
            Print "You magciall yheal some of your wounds."
            magic = magic - droll(1, spellheal)
            vigor = vigor + 4
            If vigor > maxvigor Then vigor = maxvigor
        End If
        Print
        Print " * * * * * * * * * * * * * * * * * * * *"
        Print
        Sleep 0.25
    End If
    If cast$ = "rabbit" And spellrabbitfoot > 0 Then
        mcheck = magic - spellrabbitfoot
        Print " * * * * * * * * * * * * * * * * * * * *"
        Print
        If mcheck > magic Then
            Print "You lack the magical power to cast that."
            luck = luck - 1
        Else
            Print "You improve your luck."
            magic = magic - droll(1, spellrabbitfoot)
            luck = luck + droll(1, 6)
            'luck can go over maxluck with thius spell
        End If
        Print
        Print " * * * * * * * * * * * * * * * * * * * *"
        Print
        Sleep 0.25
    End If

    If cast$ = "oracle" And spelloracle > 0 Then
        mcheck = magic - spelloracle
        Print " * * * * * * * * * * * * * * * * * * * *"
        Print
        If mcheck > oracle Then
            Print "You lack the magical power to cast that."
            perception = perception - (droll(1, 2) - 1)
        Else
            Print "You improve your perception."
            magic = magic - droll(1, spelloracle)
            perception = perception + 2
            cave(pcl, foe) = Abs(cave(pcl, foe))
            cave(pcl, loot) = Abs(cave(pcl, loot))
            'the can go overmax perception
        End If
        Print
        Print " * * * * * * * * * * * * * * * * * * * *"
        Print
        Sleep 0.25
    End If
    If cast$ = "blast" And spellblast > 0 Then
        mcheck = magic - spellblast
        Print " * * * * * * * * * * * * * * * * * * * *"
        Print
        If mcheck > magic Then
            Print "You lack the magical power to cast that."
        Else
            Print "You blast your foe with magical energy."
            magic = magic - droll(1, spellblast)
            perception = perception - (droll(1, 3) - 1)
            'this is a loud spell
            If cave(pcl, foe) = 0 Then
                Print "This would be much more effective against a foe you could see."
            Else
                If droll(1, 12) > cave(pcl, foe) Then
                    Print "Destroying the "; cave(pcl, foe); " !!!"
                    score = score + cave(pcl, foe) * 50
                    cave(pcl, foe) = 0
                End If

            End If
        End If
        Print
        Print " * * * * * * * * * * * * * * * * * * * *"
        Print
        Sleep 0.25
    End If
    Select Case cast$
        Case "castblast"
            If spellblast < 1 Then Print "You have yet to learn that spell."
        Case "castheal"
            If spellheal < 1 Then Print "You are not a healer, yet."
        Case "castrabbit"
            If spellrabbitfoot < 1 Then Print "Do not tempt fate as you have yet to learn that spell."
            luck = luck - 1
        Case "castorcale"
            If spellrabbitfoot < 1 Then Print "You have yet to discover an Oracle's Rune."
    End Select

End Sub

Function droll (num, sides)
    dsum = 0
    For x = 1 To num
        dsum = dsum + Int(Rnd * sides) + 1
    Next x
    droll = dsum
End Function
Reply


Messages In This Thread
DRAGON CAVE - by James D Jarvis - 05-26-2022, 01:12 PM



Users browsing this thread: 2 Guest(s)