Microsoft Small Basic

Program Listing: BDB469
player()
variables()
Menu()
'Done
'got all mobs and bosses
'got hp and mp pots
'got skills
'got saving and loading
'Need
'equipment
'questgiver
'town
'map

Sub variables
path = Program.Directory + "\Overworld Slayer.txt"
' The following line could be harmful and has been automatically commented.
' variables=File.ReadContents(path)
x = 0
y = 0
EndSub

Sub Save_game
path = Program.Directory + "\Overworld Slayer.txt"
variables[1] = x
variables[2] = y
variables[3] = level
variables[4] = playerhp
variables[5] = playerstr
variables[6] = playerdef
variables[7] = playergold
variables[8] = playerxp
variables[9] = totalplayerhp
variables[10] = sp
variables[11] = totalplayermp
variables[12] = playermp
variables[13] = hppot
variables[14] = mppot
variables[15] = playervitinc
variables[16] = playerintinc
variables[17] = playervit
variables[18] = playerint
variables[19] = activatevls
variables[20] = activatelbs
variables[21] = activatescm
variables[22] = activateepa
variables[23] = activatesk
variables[24] = activatezh
variables[25] = activatedg
' The following line could be harmful and has been automatically commented.
' File.WriteContents(path, variables)
EndSub

Sub load_game
path = Program.Directory + "\Overworld Slayer.txt"
x = variables[1]
y = variables [2]
level = variables[3]
playerhp = variables[4]
playerstr = variables[5]
playerdef = variables[6]
playergold = variables[7]
playerxp = variables[8]
totalplayerhp = variables[9]
sp = variables[10]
totalplayermp = variables[11]
playermp = variables[12]
hppot =variables[13]
mppot = variables[14]
playervitinc = variables[15]
playerintinc = variables[16]
playervit = variables[17]
playerint = variables[18]
activatevls = variables[19]
activatelbs = variables[20]
activatescm = variables[21]
activateepa = variables[22]
activatesk = variables[23]
activatezh =variables[24]
activatedg= variables[25]
EndSub

Sub player
sp = 0
weapon = "Sword"
level = 1
totalplayerhp = 100 + playervitinc
playerhp = 100 + playervitinc
playerstr = 10 - enemydef
playerdef = 10
playergold = 0
playerxp = 0
playermp = 30 + playerintinc
totalplayermp = 30 + playerintinc
hppot = 10
mppot = 10
playervitinc = 0
playerintinc = 0
playervit = 10
playerint = 10
activatevls = 0
activatelbs = 0
activatescm = 0
activateepa = 0
activatedg = 0
activatesk = 0
activatezh = 0
EndSub

Sub skeleton
enemyname = "Skeleton"
enemyhp = 10
totalenemyhp = 10
enemystr = 12 - playerdef
enemydef = 1
xpdrop = 5
golddrop = 3
EndSub

Sub zombie
enemyname = "Zombie"
enemyhp = 20
totalenemyhp = 20
enemystr = 14 - playerdef
enemydef = 2
xpdrop = 10
golddrop = 6
EndSub

Sub demon
enemyname = "Demon"
enemyhp = 30
totalenemyhp = 30
enemystr = 16- playerdef
enemydef = 3
xpdrop = 15
golddrop = 9
EndSub

Sub skeletonking
enemyname = "Skeleton King"
enemyhp = 250
totalenemyhp = 250
enemystr = 25- playerdef
enemydef = 15
xpdrop = 25
golddrop = 45
EndSub

Sub zombiehulk
enemyname = "Zombie Hulk"
enemyhp = 300
totalenemyhp = 300
enemystr = 30- playerdef
enemydef = 20
xpdrop = 30
golddrop = 50
EndSub

Sub demongeneral
enemyname = "Demon General"
enemyhp = 500
totalenemyhp = 500
enemystr = 35- playerdef
enemydef = 25
xpdrop = 40
golddrop = 60
EndSub

Sub Satan
enemyname = "Satan"
enemyhp = 1000
totalenemyhp = 1000
enemystr = 60- playerdef
enemydef = 50
xpdrop = 50
golddrop = 100
EndSub

Sub Menu
TextWindow.WriteLine(" Overworld Slayer")
space()
TextWindow.WriteLine(" by Dinomite07")
For i =1 To 5
space()
EndFor
TextWindow.WriteLine(" 1. New Game")
TextWindow.WriteLine(" 2. Load Game")
TextWindow.WriteLine(" 3. Exit")
For i =1 To 10
space()
EndFor
TextWindow.WriteLine(" Copyright @ 2014")
space()
menu1 = TextWindow.ReadKey()
If menu1 = 1 Then
TextWindow.Clear()
intro()
ElseIf menu1 = 2 then
TextWindow.Clear()
' The following line could be harmful and has been automatically commented.
' variables = File.ReadContents(path)
load_game()
selectlocation()
elseif menu1 = 3 then
Program.End()
Else
wrongoption()
Menu()
EndIf
EndSub

Sub space
TextWindow.WriteLine(" ")
endsub

Sub enter
TextWindow.WriteLine("Press Enter")
TextWindow.PauseWithoutMessage()
TextWindow.Clear()
endsub

Sub wrongoption
TextWindow.Clear()
TextWindow.WriteLine("You can only select the ones listed.")
space()
enter()
EndSub

Sub intro
TextWindow.WriteLine("Story: You have been reborned in Hell and vowed to slay Satan!")
space()
enter()
selectlocation()
EndSub

Sub leveling
If (50 <= playerxp) And (playerxp <= 99 * 50) And (Math.Remainder(playerxp, 50) = 0) Then
sp = sp + 1
level = level + 1
EndIf
EndSub

Sub town
If x = 1 And y = 1 then
TextWindow.Clear()
selectlocation()
EndIf
If x = 4 And y = 60 then
TextWindow.Clear()
selectlocation()
EndIf
If x = 1 And (2 <= y And y <= 6) Then
TownRandom()
endif
If x = 4 And (61 <= y And y <= 66) Then
TownRandom()
endif
EndSub

Sub townshopname
If x = 1 And y = 1 then
TextWindow.WriteLine("8. Enter Newb Town Shop")
space()
EndIf
If x = 4 And y = 60 then
TextWindow.WriteLine("8. Enter Hell Town Shop")
space()
EndIf
EndSub

Sub townshopname2
If x = 1 And y = 1 then
TextWindow.Write("Newb Town ")
EndIf
If x = 4 And y = 60 then
TextWindow.Write("Hell Town ")
EndIf
EndSub

Sub townshopenter
if selectlocation1 = 8 then
TextWindow.Clear()
shop()
EndIf
EndSub

Sub townname
If x = 1 And y = 1 then
TextWindow.WriteLine("Newb Town Shop")
space()
EndIf
If x = 1 And (2 <= y And y <= 6) Then
TextWindow.WriteLine("Newb Town")
space()
endif
If x =4 And y = 60 then
TextWindow.WriteLine("Hell Town Shop")
space()
EndIf
If x = 4 And (61 <= y And y <= 66) Then
TextWindow.WriteLine("Hell Town")
space()
endif
EndSub

sub townrandom
randomencounter1 = Math.GetRandomNumber(100)
If randomencounter1 < 3then
TextWindow.Clear()
TextWindow.WriteLine("You found a HP Potion.")
space()
enter()
hppot = hppot + 1
selectlocation()
elseIf randomencounter1 < 6 then
TextWindow.Clear()
TextWindow.WriteLine("You found a MP Potion.")
space()
enter()
mppot = mppot + 1
selectlocation()
Else
selectlocation()
EndIf
EndSub

Sub selectlocation
leveling()
townname()
TextWindow.WriteLine("Coordinates: " + "(" + x + "," + y + ")")
space()
TextWindow.WriteLine("Level: " + level + " Stat Point: " + sp)
space()
TextWindow.WriteLine("Exp: " + playerxp + " Gold: " + playergold)
space()
TextWindow.WriteLine("Player HP: " + playerhp + "/" + totalplayerhp + " Player MP: " + playermp + "/" + totalplayermp)
space()
TextWindow.WriteLine("1. North (" + x + "," + (y + 1) + ")")
TextWindow.WriteLine("2. East (" + (x + 1) + "," + y + ")")
TextWindow.WriteLine("3. West (" + (x - 1) + "," + y + ")")
TextWindow.WriteLine("4. South (" + x + "," + (y - 1) + ")")
space()
TextWindow.WriteLine("5. Inventory")
TextWindow.WriteLine("6. Stats")
TextWindow.WriteLine("7. Journal")
space()
townshopname()
TextWindow.WriteLine("9. Miscellaneous")
space()
selectlocation1 = TextWindow.ReadKey()
townshopenter()
If selectlocation1 = 1 Then
TextWindow.Clear()
y = y + 1
randomencounter()
ElseIf selectlocation1 = 2 then
TextWindow.Clear()
x = x + 1
randomencounter()
elseif selectlocation1 = 3 then
TextWindow.Clear()
x = x-1
randomencounter()
elseif selectlocation1 = 4 then
TextWindow.Clear()
y = y-1
randomencounter()
elseif selectlocation1 = 5 then
TextWindow.Clear()
selectlocationinventory()
elseif selectlocation1 = 6 then
TextWindow.Clear()
stats()
elseif selectlocation1 = 7 then
TextWindow.Clear()
journal()
elseIf selectlocation1 = 9 Then
misc()
Else
wrongoption()
selectlocation()
EndIf
EndSub

Sub journal
TextWindow.WriteLine("Journal")
space()
TextWindow.WriteLine("Table of Contents")
space()
space()
TextWindow.WriteLine("1. Mobs")
TextWindow.WriteLine("2. Bosses")
TextWindow.WriteLine("3. Weapons")
TextWindow.WriteLine("4. Armors")
TextWindow.WriteLine("5. Potions")
TextWindow.WriteLine("6. Towns")
TextWindow.WriteLine("7. Shops")
space()
TextWindow.WriteLine("8. Return")
space()
journal1 =TextWindow.ReadKey()
If journal1 = 1 then
TextWindow.Clear()
mobjournal()
elseIf journal1 = 2 then
TextWindow.Clear()
bossjournal()
elseIf journal1 = 3 then
TextWindow.Clear()
weaponjournal()
elseIf journal1 = 4 then
TextWindow.Clear()
armorjournal()
elseIf journal1 = 5 then
TextWindow.Clear()
potionjournal()
elseIf journal1 = 6 then
TextWindow.Clear()
townjournal()
elseIf journal1 = 7 then
TextWindow.Clear()
shopjournal()
elseIf journal1 = 8 Then
TextWindow.Clear()
selectLocation()
Else
TextWindow.Clear()
wrongoption()
TextWindow.Clear()
journal()
EndIf
endsub

Sub mobjournal
TextWindow.WriteLine("Mobs")
space()
space()
TextWindow.WriteLine("Skeleton: HP = 10, Str = 12, Def = 1, XP drop = 5, Gold drop = 3")
space()
TextWindow.WriteLine("Zombie: HP = 20, Str = 14, Def = 2, XP drop = 10, Gold drop = 6")
space()
TextWindow.WriteLine("Demon: HP = 30, Str = 16, Def = 3, XP drop = 15, Gold drop = 9")
space()
space()
TextWindow.WriteLine("1. Return")
space()
space()
journal1 =TextWindow.ReadKey()
If journal1 = 1 Then
TextWindow.Clear()
journal()
Else
TextWindow.Clear()
wrongoption()
TextWindow.Clear()
mobjournal()
endif
EndSub

Sub bossjournal
TextWindow.WriteLine("Bosses")
space()
space()
TextWindow.WriteLine("Skeleton King: HP = 250, Str = 25, Def = 15, XP drop = 25, Gold drop = 45")
TextWindow.WriteLine("Appears on (9,66)")
space()
TextWindow.WriteLine("Zombie Hulk: HP = 300, Str = 30, Def = 20, XP drop = 30, Gold drop = 50")
TextWindow.WriteLine("Appears on (3,66)")
space()
TextWindow.WriteLine("Demon General: HP = 500, Str = 35, Def = 25, XP drop = 40, Gold drop = 60")
TextWindow.WriteLine("Appears on (6,46)")
space()
TextWindow.WriteLine("Satan: HP = 1000, Str = 60, Def = 50, XP drop = 50, Gold drop = 100")
TextWindow.WriteLine("Appears on (6,66) and when all previous bosses are defeated")
space()
space()
TextWindow.WriteLine("1. Return")
space()
space()
journal1 =TextWindow.ReadKey()
If journal1 = 1 Then
TextWindow.Clear()
journal()
Else
TextWindow.Clear()
wrongoption()
TextWindow.Clear()
bossjournal()
endif
EndSub

Sub weaponjournal
TextWindow.WriteLine("Weapons")
space()
space()
TextWindow.WriteLine("Vampire Long Sword: Has a 40% chance to siphon the enemy hp and add it to yours")
space()
TextWindow.WriteLine("Lightning Broad Sword: Has a 30% chance to stun the enemy for 1 turn")
space()
space()
TextWindow.WriteLine("1. Return")
space()
space()
journal1 =TextWindow.ReadKey()
If journal1 = 1 Then
TextWindow.Clear()
journal()
Else
TextWindow.Clear()
wrongoption()
TextWindow.Clear()
weaponjournal()
endif
EndSub

Sub armorjournal
TextWindow.WriteLine("Armor")
space()
space()
TextWindow.WriteLine("Spiked Chain Mail: Deals damage every turn to the enemy")
space()
TextWindow.WriteLine("Electric Plate Armor: Has a 30% chance to stub the enemey for 1 turn")
space()
space()
TextWindow.WriteLine("1. Return")
space()
space()
journal1 =TextWindow.ReadKey()
If journal1 = 1 Then
TextWindow.Clear()
journal()
Else
TextWindow.Clear()
wrongoption()
TextWindow.Clear()
armorjournal()
endif
EndSub

Sub potionjournal
TextWindow.WriteLine("Potions")
space()
space()
TextWindow.WriteLine("HP Potion: Heals 15 HP")
space()
TextWindow.WriteLine("MP Potion: Gives 15 MP")
space()
space()
TextWindow.WriteLine("1. Return")
space()
space()
journal1 =TextWindow.ReadKey()
If journal1 = 1 Then
TextWindow.Clear()
journal()
Else
TextWindow.Clear()
wrongoption()
TextWindow.Clear()
potionjournal()
endif
EndSub

Sub shopjournal
TextWindow.WriteLine("Shop")
space()
space()
TextWindow.WriteLine("A place of commerce where you can buy and sell goods")
TextWindow.WriteLine("You will meet shops around the world randomly")
space()
space()
TextWindow.WriteLine("Newb Town Shop: Appears on (1,1)")
space()
TextWindow.WriteLine("Hell Town Shop: Appears on (4,60)")
space()
space()
TextWindow.WriteLine("1. Return")
space()
space()
journal1 =TextWindow.ReadKey()
If journal1 = 1 Then
TextWindow.Clear()
journal()
Else
TextWindow.Clear()
wrongoption()
TextWindow.Clear()
shopjournal()
endif
EndSub

Sub townjournal
TextWindow.WriteLine("Town")
space()
space()
TextWindow.WriteLine("Safe Zones where you will randomly find potions")
TextWindow.WriteLine("Towns will always have 1 or 2 shops")
space()
space()
TextWindow.WriteLine("Newb Town: Appears on (1,2),(1,3),(1,4),(1,5),(1,6)")
space()
TextWindow.WriteLine("Hell Town: Appears on (4,61),(4,62),(4,63),(4,64),(4,65),(4,66)")
space()
space()
TextWindow.WriteLine("1. Return")
space()
space()
journal1 =TextWindow.ReadKey()
If journal1 = 1 Then
TextWindow.Clear()
journal()
Else
TextWindow.Clear()
wrongoption()
TextWindow.Clear()
townjournal()
endif
EndSub


Sub stats
TextWindow.WriteLine("Level: " + level + " Stat Point: " + sp)
space()
TextWindow.WriteLine("Exp: " + playerxp + " Gold: " + playergold)
space()
TextWindow.WriteLine("Player HP: " + playerhp + "/" + totalplayerhp + " Player MP: " + playermp + "/" + totalplayermp)
space()
space()
TextWindow.WriteLine("1. Strength: " + playerstr + " Gives 1 dmg per point")
TextWindow.WriteLine("2. Vitality: " + playervit + " Gives 5 HP per point")
TextWindow.WriteLine("3. Endurance: " + playerdef + " Gives reduces 1 dmg per point")
TextWindow.WriteLine("4. Intelligence: " + playerint + " Gives 3 MP per point")
TextWindow.WriteLine(" ")
TextWindow.WriteLine("5. Return")
space()
staat = TextWindow.ReadKey()
If staat = 1 then
spiszero()
sp = sp - 1
playerstr = playerstr + 1
TextWindow.Clear()
stats()
elseif staat = 2 then
spiszero()
sp = sp - 1
playervit = playervit + 1
playervitinc = playervitinc + 5
TextWindow.Clear()
stats()
elseif staat = 3 then
spiszero()
sp = sp - 1
playerdef = playerdef + 1
TextWindow.Clear()
stats()
elseif staat = 4 then
spiszero()
sp = sp - 1
playerint = playerint +1
playerintinc = playerintinc + 3
TextWindow.Clear()
stats()
elseIf staat = 5 Then
TextWindow.Clear()
selectLocation()
Else
TextWindow.Clear()
wrongoption()
stats()
EndIf
endsub

Sub spiszero
If sp = 0 Then
TextWindow.Clear()
stats()
EndIf
EndSub

Sub randomencounter
town()
randomencounter1 = Math.GetRandomNumber(100)
If randomencounter1 < 5then
TextWindow.Clear()
TextWindow.WriteLine("You found a HP Potion.")
space()
enter()
hppot = hppot + 1
selectlocation()
elseIf randomencounter1 < 10 then
TextWindow.Clear()
TextWindow.WriteLine("You found a MP Potion.")
space()
enter()
mppot = mppot + 1
selectlocation()
elseIf randomencounter1 < 30 then
TextWindow.Clear()
shop()
else
enemy()
EndIf
EndSub

Sub shop
TextWindow.Clear()
townshopname2()
TextWindow.WriteLine("Shop")
space()
TextWindow.WriteLine("Gold: " + playergold)
space()
TextWindow.WriteLine("1. Weapon")
TextWindow.WriteLine("2. Armor")
TextWindow.WriteLine("3. Potion")
space()
TextWindow.WriteLine("4. Return")
space()
shop = TextWindow.ReadKey()
if shop = 1 Then
TextWindow.Clear()
weapons()
ElseIf shop = 2 then
TextWindow.Clear()
armors()
elseif shop = 3 Then
TextWindow.Clear()
potions()
elseif shop = 4 then
TextWindow.Clear()
selectlocation()
Else
wrongoption()
shop()
EndIf
EndSub

Sub potions
TextWindow.WriteLine("HP Pot: x" + hppot + " MP Pot: x" + mppot)
space()
TextWindow.WriteLine("Gold: " + playergold)
space()
TextWindow.WriteLine("1. Buy 1 HP Pot: 10 gold")
TextWindow.WriteLine("2. Buy 1 MP Pot: 10 gold")
space()
TextWindow.WriteLine("3. Sell 1 MP Pot: 5 gold")
TextWindow.WriteLine("4. Sell 1 MP Pot: 5 gold")
space()
TextWindow.WriteLine("5. Return")
space()
potion1 = TextWindow.ReadKey()
If potion1= 1 Then
If playergold < 10 Then
TextWindow.Clear()
potions()
EndIf
hppot = hppot + 1
playergold = playergold - 10
TextWindow.Clear()
potions()
ElseIf potion1= 2 then
If playergold < 10 Then
TextWindow.Clear()
potions()
EndIf
mppot = mppot + 1
playergold = playergold - 10
TextWindow.Clear()
potions()
elseif potion1= 3 then
If hppot <= 0 then
TextWindow.Clear()
potions()
EndIf
playergold = playergold + 5
hppot = hppot - 1
TextWindow.Clear()
potions()
elseif potion1= 4 then
If mppot <= 0 then
TextWindow.Clear()
potions()
EndIf
playergold = playergold + 5
mppot = mppot - 1
TextWindow.Clear()
potions()
elseif potion1 = 5 then
TextWindow.Clear()
shop()
Else
wrongoption()
potions()
EndIf
EndSub

Sub weapons
TextWindow.WriteLine("Gold: " + playergold)
space()
TextWindow.WriteLine("1. Buy Vampire Long Sword x" + activatevls + " Cost: 50 gold")
TextWindow.WriteLine("2. Buy Lightning Broad Sword x" + activatelbs + " Cost: 50 gold")
space()
TextWindow.WriteLine("3. Return")
space()
weapon1 = TextWindow.ReadKey()
If weapon1= 1 Then
If activatevls =1 Then
TextWindow.Clear()
weapons()
EndIf
If playergold < 50 Then
TextWindow.Clear()
weapons()
EndIf
TextWindow.Clear()
TextWindow.WriteLine("You bought the Vampire Long Sword!")
activatevls = 1
activatelbs = 0
playergold = playergold - 50
TextWindow.Clear()
weapons()
elseIf weapon1= 2 Then
If activatelbs = 1 Then
TextWindow.Clear()
weapons()
EndIf
If playergold < 50 Then
TextWindow.Clear()
weapons()
EndIf
TextWindow.Clear()
TextWindow.WriteLine("You bought the Lightning Broad Sword!")
activatelbs = 1
activatevls = 0
playergold = playergold - 50
TextWindow.Clear()
weapons()
elseif weapon1 = 3 then
TextWindow.Clear()
shop()
Else
wrongoption()
weapons()
EndIf
EndSub

Sub vampirelongsword
If activatevls = 1 then
vlschance = Math.GetRandomNumber(100)
If vlschance <40 Then
vlssiphon = enemyhp/10
weapon = "Vampire Long Sword"
enemyhp = enemyhp - vlssiphon
playerhp = playerhp + vlssiphon
space()
TextWindow.WriteLine("Vampire Long Sword siphons " + vlssiphon + " HP")
Else
endif
playerhpormpoverhun()
endif
EndSub

Sub playerhpormpoverhun
If playerhp > 100 Then
playerhp = totalplayerhp
EndIf
If playermp > 30 Then
playermp = totalplayermp
endif
EndSub

Sub lightningbroadsword
If activatelbs = 1 then
lbschance = Math.GetRandomNumber(100)
lbsstun()
EndIf
EndSub

Sub lbsstun
stun = 0
If lbschance <30 Then
weapon = "Lightning Broad Sword"
stun = stun + 1
Else
EndIf
if stun > 0 then
stun = stun - 1
playerattackstun()
If enemyhp <= 0 Then
TextWindow.Clear()
EndIf
Else
EndIf
EndSub

sub playerattackstun
space()
TextWindow.WriteLine(enemyname + " is stun for 1 turn.")
spikechainmail()
enemyhp = enemyhp - playerstr
space()
enter()
battle()
endsub

Sub armors
TextWindow.WriteLine("Gold: " + playergold)
space()
TextWindow.WriteLine("1. Spiked Chain Mail x" + activatescm + " Cost: 50 gold")
TextWindow.WriteLine("2. Electric Plate Armor x" + activateepa + " Cost: 50 gold")
space()
TextWindow.WriteLine("3. Return")
space()
armor1 = TextWindow.ReadKey()
If armor1= 1 Then
If activatescm =1 Then
TextWindow.Clear()
armors()
EndIf
If playergold < 50 Then
TextWindow.Clear()
armors()
EndIf
TextWindow.Clear()
TextWindow.WriteLine("You bought the Spiked Chain Mail!")
activatescm = 1
activateepa = 0
playergold = playergold - 50
TextWindow.Clear()
armors()
elseIf armor1= 2 Then
If activateepa =1 Then
TextWindow.Clear()
armors()
EndIf
If playergold < 50 Then
TextWindow.Clear()
armors()
EndIf
TextWindow.Clear()
TextWindow.WriteLine("You bought the Electric Plate Armor!")
activateepa = 1
activatescm = 0
playergold = playergold - 50
TextWindow.Clear()
armors()
elseif armor1 = 3 then
TextWindow.Clear()
shop()
Else
wrongoption()
armors()
EndIf
EndSub

Sub spikechainmail
If activatescm = 1 then
spikechainmaildmg = totalenemyhp/25
space()
TextWindow.WriteLine(armor + " deals " + spikechainmaildmg + " dmg.")
enemyhp = enemyhp - spikechainmaildmg
Else
endif
endsub

Sub electricplatearmor
If activateepa = 1 then
epachance = Math.GetRandomNumber(100)
epastun()
EndIf
EndSub

Sub epastun
stun = 0
If epachance <30 Then
armor = "Electric Plate Armor"
stun = stun + 1
Else
EndIf
if stun > 0 then
stun = stun - 1
epaarmorstun()
If enemyhp <= 0 Then
TextWindow.Clear()
EndIf
Else
EndIf
EndSub

sub epaarmorstun
space()
enemyhp = enemyhp - playerstr
TextWindow.WriteLine(enemyname + " is stun for 1 turn.")
space()
enter()
battle()
endsub

Sub weaponname
If activatevls = 1 then
weapon = "Vampire Long Sword"
EndIf
If activatelbs = 1 then
weapon = "Lightning Broad Sword"
endif
EndSub

Sub armorname
If activatescm = 1 then
armor = "Spiked Chain Mail"
EndIf
If activateepa = 1 then
armor = "Electric Plate Armor"
EndIf
EndSub

Sub selectlocationinventory
playerhpormpoverhun()
If hppot < 1 Then
TextWindow.Clear()
selectlocationinventory()
ElseIf mppot < 1 then
TextWindow.Clear()
selectlocationinventory()
EndIf
TextWindow.WriteLine("Player HP: " + playerhp + "/" + totalplayerhp+ " Player MP: " + playermp + "/" + totalplayermp)
space()
TextWindow.WriteLine("1. Use HP Pot x" + hppot)
TextWindow.WriteLine("2. Use MP Pot x" +mppot)
space()
TextWindow.WriteLine("3. Return")
space()
inventory1 = TextWindow.ReadKey()
If inventory1 = 1 Then
If playerhp = 100 Then
TextWindow.Clear()
selectlocationinventory()
endif
space()
TextWindow.WriteLine("You gain 15 HP")
space()
playerhp = playerhp + 15
hppot = hppot - 1
enter()
selectlocationinventory()
elseIf inventory1 = 2 Then
If playermp = 30 Then
TextWindow.Clear()
selectlocationinventory()
endif
space()
TextWindow.WriteLine("You gain 15 MP")
space()
playermp = playermp + 15
mppot = mppot - 1
enter()
selectlocationinventory()
elseif inventory1 = 3 then
TextWindow.Clear()
selectlocation()
EndIf
EndSub

Sub misc
TextWindow.Clear()
TextWindow.WriteLine("1. Save")
TextWindow.WriteLine("2. Load")
TextWindow.WriteLine("3. Return")
TextWindow.WriteLine("4. Exit")
space()
misc1 = TextWindow.ReadKey()
If misc1 = 1 Then
Save_game()
TextWindow.Clear()
TextWindow.WriteLine("Game has been saved")
space()
enter()
Program.End()
ElseIf misc1 = 2 then
TextWindow.Clear()
' The following line could be harmful and has been automatically commented.
' variables = File.ReadContents(path)
load_game()
selectlocation()
elseif misc1 = 4 then
Program.End()
ElseIf misc1 = 3 then
TextWindow.Clear()
selectlocation()
Else
wrongoption()
misc()
EndIf
EndSub

Sub enemy
TextWindow.Clear()
If x = 6 And y = 66 and activatedg = 1 And activatesk = 1 And activatezh = 1 Then
Satan()
TextWindow.WriteLine("You encountered " + enemyname +".")
space()
enter()
battle()
ElseIf x = 6 and y = 46 then
demongeneral()
TextWindow.WriteLine("You encountered " + enemyname +".")
space()
enter()
battle()
elseif x = 3 and y = 66 then
zombiehulk()
TextWindow.WriteLine("You encountered " + enemyname +".")
space()
enter()
battle()
elseif x = 9 and y = 66 then
skeletonking()
battle()
endif
enemy1 = Math.GetRandomNumber(100)
If enemy1 < 40 Then
skeleton()
TextWindow.WriteLine("You encountered a " + enemyname +".")
space()
enter()
battle()
ElseIf enemy1 <70 then
zombie()
TextWindow.WriteLine("You encountered a " + enemyname +".")
space()
enter()
battle()
elseif enemy1 <100 then
demon()
TextWindow.WriteLine("You encountered a " + enemyname +".")
space()
enter()
battle()
EndIf
EndSub

Sub battle
If playerhp<=0Then
defeat()
EndIf
If enemyhp <= 0 Then
mobwin()
EndIf
TextWindow.Clear()
weaponname()
armorname()
TextWindow.WriteLine(enemyname )
space()
TextWindow.WriteLine("Player HP: " + playerhp + "/" + totalplayerhp+ " Player MP: " + playermp + "/" + totalplayermp)
space()
TextWindow.WriteLine(enemyname + ": " + enemyhp +"/" + totalenemyhp)
space()
TextWindow.WriteLine("1. Use your " + weapon)
TextWindow.WriteLine("2. Inventory")
TextWindow.WriteLine("3. Skills")
TextWindow.WriteLine("4. Run Away")
TextWindow.WriteLine("5. Do Nothing")
space()
battle1 = TextWindow.ReadKey()
If battle1 = 1 Then
playerattack()
ElseIf battle1 = 2 then
TextWindow.Clear()
inventory()
elseif battle1 = 3 then
TextWindow.Clear()
skill()
elseif battle1 = 4 then
runaway1 = Math.GetRandomNumber(2)
If runaway1 =1 then
space()
TextWindow.WriteLine(enemyname + " attacked your back and dealt " + enemystr+".")
playerhp = playerhp - enemystr
space()
enter()
battle()
Else
TextWindow.Clear()
selectlocation()
EndIf
elseif battle1 = 5 then
TextWindow.WriteLine(enemyname + " attacked and dealt " + enemystr+".")
playerhp = playerhp - enemystr
space()
enter()
battle()
Else
wrongoption()
battle()
endif
EndSub

Sub inventory
playerhpormpoverhun()
If hppot < 1 Then
TextWindow.Clear()
selectlocationinventory()
ElseIf mppot < 1 then
TextWindow.Clear()
selectlocationinventory()
EndIf
TextWindow.WriteLine("Player HP: " + playerhp + "/" + totalplayerhp+ " Player MP: " + playermp + "/" + totalplayermp)
space()
TextWindow.WriteLine("1. Use HP Pot x" + hppot)
TextWindow.WriteLine("2. Use MP Pot x" + mppot)
space()
TextWindow.WriteLine("3. Return")
space()
inventory1 = TextWindow.ReadKey()
If inventory1 = 1 Then
If playerhp = 100 Then
TextWindow.Clear()
inventory()
endif
space()
TextWindow.WriteLine("You gain 15 HP")
space()
TextWindow.WriteLine(enemyname + " attacked and dealt " + enemystr+".")
playerhp = playerhp - enemystr
playerhp = playerhp + 15
hppot = hppot -1
enter()
inventory()
elseIf inventory1 = 2 Then
If playermp = 30 Then
TextWindow.Clear()
inventory()
endif
space()
TextWindow.WriteLine("You gain 15 MP")
space()
TextWindow.WriteLine(enemyname + " attacked and dealt " + enemystr+".")
playerhp = playerhp - enemystr
playermp = playermp + 15
mppot = mppot - 1
enter()
inventory()
elseif inventory1 = 3 then
TextWindow.Clear()
battle()
EndIf
EndSub

Sub skill
If playerhp<=0Then
defeat()
EndIf
If enemyhp <= 0 Then
mobwin()
EndIf
If playermp <= 0 Then
TextWindow.Clear()
battle()
EndIf
TextWindow.WriteLine("Player HP: " + playerhp + "/" + totalplayerhp+ " Player MP: " + playermp + "/" + totalplayermp)
TextWindow.WriteLine(enemyname + ": " + enemyhp +"/" + totalenemyhp)
space()
TextWindow.WriteLine("1. Insta Crit Cost: 5 MP")
TextWindow.WriteLine("2. Heal Cost: 5 MP")
space()
TextWindow.WriteLine("3. Return")
space()
skill1 = TextWindow.ReadKey()
space()
If skill1 = 1 Then
TextWindow.WriteLine("You dealt " + (playerstr *1.5))
space()
TextWindow.WriteLine(enemyname + " attacked and dealt " + enemystr+".")
space()
playerhp = playerhp - enemystr
enemyhp = enemyhp - (playerstr*1.5)
playermp = playermp - 5
enter()
skill()
ElseIf skill1 = 2 then
TextWindow.WriteLine("You healed yourself for 50 HP")
space()
TextWindow.WriteLine(enemyname + " attacked and dealt " + enemystr+".")
space()
playerhp = playerhp - enemystr
enter()
playerhp = playerhp + 50
playermp = playermp - 5
playerhpormpoverhun()
skill()
elseif skill1 = 3 then
TextWindow.Clear()
battle()
Else
wrongoption()
EndIf
EndSub

sub playerattack
space()
TextWindow.WriteLine("You attacked and dealt " +playerstr + " dmg.")
vampirelongsword()
lightningbroadsword()
spikechainmail()
electricplatearmor()
space()
TextWindow.WriteLine(enemyname + " attacked and dealt " + enemystr+" dmg.")
enemyhp = enemyhp - playerstr
playerhp = playerhp - enemystr
space()
enter()
battle()
endsub

Sub satanactivate
If x = 6 and y = 46 then
activatedg = 1
elseif x = 3 and y = 66 then
activatezh = 1
elseif x = 9 and y = 66 then
activatesk = 1
EndIf
EndSub

sub mobwin
TextWindow.Clear()
satanactivate()
TextWindow.WriteLine("You defeated " + enemyname + ".")
space()
TextWindow.WriteLine("You gain " + xpdrop + " exp.")
TextWindow.WriteLine("You gain " + golddrop + " gold.")
playerxp = playerxp + xpdrop
playergold = playergold + golddrop
space()
enter()
selectlocation()
EndSub

Sub defeat
TextWindow.Clear()
TextWindow.WriteLine("You have been defeated!")
enter()
Program.End()
EndSub