/*
Mihail Kurbako
D&D: Turing edition
Nov, 11, 2009
This is D&D Turing edition, version 1.1 patch E.
*/
%Variable declaration
import GUI
var monHp : int %Monster HP
var monAc : int %Monster AC
var monDmg : int %Monster's damage rolls
%var enc1 : string %Unused
var yourHealth : int %Player health
var ac : int %Player armor class
var attackBonus : int %Player attack bonus
var roll : int %Dice roll
var dmg : int %Damage roll
var acc : int %Armor class compatibility
var tutorial : string %Tutorial display prompt
var race : string %Player race
var name : string %Player name
var charClass : string %Player class
var story : string %Skip the story
var wizSpell : int %Wether player can use spells
var spellSelect : string %Spell selction
var heal : int %Healing after battle
var story2 : string %Second dialogue prompt
var dead : string %If the character is dead, quit.
var level : int %Character level
var charExp : int %Expirience points
%var enc2 : int %Unused
var story3 : string %Story line prompt 3
var monRoll : int %Monster rolls
var winPrim : int %Opens the primary window
var winSecn : int %Opens the secondary window
var winMap : int %Opens the map window
var command : string %The game control console
var loadNum : int %File number
var titleSelect : int %Create new or load previous character
var charHPGain : int %How much HP a character gains at level up
%Saving variables
var loadName : string := "CharName"
var loadClass : string := "CharClass"
var loadLevel : string := "CharLevel"
var loadRace : string := "CharRace"
var loadDead : string := "CharDead"
var loadCharExp : string := "CharExp"
var loadWizSpell : string := "CharWizSpell"
var loadAC : string := "CharAC"
var loadACC : string := "CharACC"
var loadHP : string := "CharHealth"
var loadAttackBonus : string := "CharAtkBns"
%Preset variables
dead := "1"
level := 1
charExp := 0
process charSheet
Window.SetActive (winSecn)
cls
put "D&D : Character Sheet"
put " "
put "Dungeons and Dragons : Turing edition."
put "By : Mihail Kurbako"
put " "
put "Name : ", name
put " "
put "Level ", level, " ", race, " ", charClass
put "You have ", charExp, " expirience."
put " "
put "Items :"
put "You have no items."
put " "
if wizSpell = 1 then
put "Spell list :"
put " "
put "Magic Missile. (1d4 + Caster level; auto hit)"
put "Ice Ray. (1d10 + Caster level)"
else
put "Spell list :"
put " "
put "You have no spells."
end if
Window.SetActive (winPrim)
end charSheet
%Window Control
winPrim := Window.Open ("position:top;right,graphics:800;450")
winSecn := Window.Open ("position:top;left,graphics:400;450")
winMap := Window.Open ("position:bottom;center,graphics:400;160")
%Quit game process
proc gameQuit
Window.Close (winPrim)
Window.Close (winSecn)
Window.Close (winMap)
end gameQuit
%Game saving
process saveGame
%Save objects
open : loadNum, loadName, write
write : loadNum, name
open : loadNum, loadLevel, write
write : loadNum, level
open : loadNum, loadRace, write
write : loadNum, race
open : loadNum, loadClass, write
write : loadNum, charClass
open : loadNum, loadCharExp, write
write : loadNum, charExp
open : loadNum, loadHP, write
write : loadNum, yourHealth
open : loadNum, loadWizSpell, write
write : loadNum, wizSpell
open : loadNum, loadAC, write
write : loadNum, ac
open : loadNum, loadACC, write
write : loadNum, acc
open : loadNum, loadDead, write
write : loadNum, dead
open : loadNum, loadAttackBonus, write
write : loadNum, attackBonus
%Put objects
put "Name : ", name
put "Level : ", level
put "Race : ", race
put "Class : ", charClass
put "HP : ", yourHealth
put "AC : ", ac
put "EXP : ", charExp
put "Attack Bonus : ", attackBonus
close : loadNum
end saveGame
process loadGame
%Load game
open : loadNum, loadName, seek, read
read : loadNum, name
open : loadNum, loadLevel, seek, read
read : loadNum, level
open : loadNum, loadRace, seek, read
read : loadNum, race
open : loadNum, loadClass, seek, read
read : loadNum, charClass
open : loadNum, loadCharExp, seek, read
read : loadNum, charExp
open : loadNum, loadHP, seek, read
read : loadNum, yourHealth
open : loadNum, loadWizSpell, seek, read
read : loadNum, wizSpell
open : loadNum, loadAC, seek, read
read : loadNum, ac
open : loadNum, loadACC, seek, read
read : loadNum, acc
open : loadNum, loadDead, seek, read
read : loadNum, dead
open : loadNum, loadAttackBonus, seek, read
read : loadNum, attackBonus
put "Name : ", name
put "Level : ", level
put "Race : ", race
put "Class : ", charClass
put "HP : ", yourHealth
put "AC : ", ac
put "EXP : ", charExp
put "Attack Bonus : ", attackBonus
close : loadNum
end loadGame
procedure save
fork saveGame
end save
process saveButton
% Create the button. The number returned is the ID number of the button.
var b : int := GUI.CreateButton (100, 10, 0, "Save", save)
var c : int := GUI.CreateButton (250, 10, 0, "Quit", gameQuit)
% Now process events until the user aborts the program.
loop
exit when GUI.ProcessEvent
end loop
end saveButton
%Game control console
process gameConsole
loop
fork saveButton
get command:*
if command = "quit" then
gameQuit
elsif command = "save" then
put "Enter a slot number (1 - 99)."
get loadNum
put name, " has been saved under slot ", loadNum, "."
fork saveGame
end if
end loop
end gameConsole
%Title screen
proc title
fork gameConsole
Window.SetActive (winPrim)
put "Dungeons and Dragons: Turing Edition."
put "By: Mihail Kurbako."
put " "
put "Would you like to load a game or start a new one?"
put "Load ( 1 ) or Create ( 2 )"
put " "
get titleSelect
cls
end title
%Load screen
proc loadScreen
put "Enter the save slot number."
get loadNum
fork loadGame
end loadScreen
%Main game
proc charCreate
loop
Window.SetActive (winSecn)
put "D&D : Character Sheet"
put " "
put "Dungeons and Dragons : Turing edition."
put "By : Mihail Kurbako"
Window.SetActive (winMap)
locate (1, 17)
put "Control console"
put " "
fork gameConsole
Window.SetActive (winPrim)
loop
if dead = "1" then
dead := "0"
cls
put "Welcome to: D&D Turing Edition."
put "By Mihail Kurbako"
put "Would you like to read the beginer's tutorial? (yes, no)"
get tutorial
if tutorial = "yes" then
put "Before we begin, you must make a charcter."
delay (1500)
put "There are 3 possible races and classes for you to choose from."
delay (1500)
put "Classes: Fighter, Wizard, Ranger."
delay (1500)
put "The Fighter excels at close quarters combat, and is a strong defensive class."
delay (1500)
put "Fighers have the most hit points (health), and highest AC (armor class)."
delay (1500)
put "Thus they are hard to hit and kill. They can dish out a moderate amount damage."
delay (1500)
put "This is the best class for beginers to start with."
delay (1500)
put " "
put "Wizards focus on magic to aid them in combat, they are a powerful support class."
delay (1500)
put "Wizards have the fewest hitpoints, and lowest AC, as they cannot wear armor."
delay (1500)
put "Wizards know a variety of spells and can dish out heavy damage."
delay (1500)
put "Wizards are a class for more expirienced players."
delay (1500)
put " "
put "The Ranger is at home in the wood and the wild, and is a good offencive class."
delay (1500)
put "Rangers have a moderate amount af hitpoints and a good AC."
delay (1500)
put "Rangers are highly proficient with bows and crossbows and other ranged weapons."
delay (1500)
put "Rangers are a fairly easy class to master."
delay (1500)
put " "
put "Races: Human, Elf, Dwarf."
delay (1500)
put "Humans are adaptable and can easily be any class."
delay (1500)
put "Weapon Focus (+ 1 to attack bonus)"
delay (1500)
put " "
put "Elves love nature and magic, and are thus good rangers and wizards."
delay (1500)
put "Dodge (+ 1 bonus to Armor Class.)"
delay (1500)
put " "
put "Dwarves are a hardy folk and are great fighters."
delay (1500)
put "Toughness (+ 3 bonus to Hit Points)."
delay (1500)
else
end if
put " "
put "Choose your class. Fighter, Wizard, or Ranger?"
put " "
loop
get charClass
if charClass = "Fighter" then
yourHealth := Rand.Int (26, 34)
ac := Rand.Int (15, 17)
attackBonus := Rand.Int (1, 4)
acc := 1
wizSpell := 0
put "As a fighter you have ", yourHealth, " hitpoints."
put "Your AC is ", ac, "."
put " "
exit
end if
if charClass = "Wizard" then
yourHealth := Rand.Int (15, 22)
ac := Rand.Int (12, 15)
attackBonus := Rand.Int (2, 3)
acc := 2
wizSpell := 1
put "As a Wizard you have ", yourHealth, " hitpoints."
put "Your AC is ", ac, "."
put " "
exit
end if
if charClass = "Ranger" then
yourHealth := Rand.Int (22, 27)
ac := Rand.Int (14, 16)
attackBonus := Rand.Int (3, 6)
acc := 3
wizSpell := 0
put "As a Ranger you have ", yourHealth, " hitpoints."
put "Your AC is ", ac, "."
put " "
exit
end if
end loop
put " "
put "Choose your race. Human, Elf, or Dwarf?"
put " "
loop
get race
if race = "Human" then
attackBonus := attackBonus + 1
exit
end if
if race = "Elf" then
ac := ac + 1
exit
end if
if race = "Dwarf" then
yourHealth := yourHealth + 3
exit
end if
end loop
put " "
put "You are now a ", race, " ", charClass, ". Your AC is ", ac, ", your attack bonus is +", attackBonus
put "And you have ", yourHealth, " total health. Now you need a name."
put " "
%Name prompt
put "Please enter your new character's name."
get name
delay (1000)
put " "
put "You are ", name, " the mighty ", race, " ", charClass, "!"
put "Congratulations, ", name, " you are now ready to begin your journey!"
put " "
fork charSheet
if wizSpell = 1 then
put "As a first level wizard you get theese spells."
put " 1 = Magic Missle (1d4 + Caster Level; auto hit)"
put " 2 = Ice Ray (1d10 + Caster Level)"
put " "
end if
delay (1600)
put "Would you like to play the dialogue? (yes, no)"
get story
if story = "yes" then
put "A group of group of goblins has been harrasing the village of Curbury."
delay (1500)
put "You embark upon a voyage to this small village to offer assistance."
delay (1500)
put "Due to the long journey to the village you are exhuasted when you finally reach it."
delay (1500)
put "You and your best friend Chansan the cleric head for the local tavern."
delay (1500)
put "On your way there, you can't help but notice a poster offering a reward to who ever"
delay (1500)
put "kills the trouble some goblins."
delay (1500)
put "As you proceed to the tavern, as you book a room, you are aproached by a group of"
delay (1500)
put "adventurers, who ask for your help, for they too, strive to stop the foul goblins"
delay (1500)
put "After consulting Chansan you agree to help these adventures; tomorrow you will"
delay (1500)
put "set out to kill the goblins and save the village and it's inhabitants."
delay (1500)
put "After a good nights sleep you wake up with an early start, and together with you"
delay (1500)
put "new friends; whos names are Warrik (a paladin), Narv (the rogue), and Veronica "
delay (1500)
put "(the Monk), you set out to the lair of the goblins. However as you advance toward"
delay (1500)
put "their lair on the road roughly halfway to your destination, you are ambushed by"
delay (1500)
put "a group of five goblins one of whom rushes towards you!"
delay (1500)
exit
else
exit
end if
end if
exit
end loop
exit
end loop
end charCreate
%Backstory
proc mainGame
%Activate processes
fork charSheet
fork gameConsole
%Tutorial Encouter
put " "
put "You are attacked by a goblin! Defend yourself!"
delay (2000)
put " "
%Calculate monster health
if charClass = "Fighter" then
monHp := Rand.Int (15, 25)
monAc := Rand.Int (9, 14)
monDmg := Rand.Int (1, 6)
elsif charClass = "Wizard" then
monHp := Rand.Int (13, 20)
monAc := Rand.Int (12, 13)
monDmg := Rand.Int (1, 4)
else
monHp := Rand.Int (12, 18)
monAc := Rand.Int (11, 14)
monDmg := Rand.Int (1, 6)
end if
loop
loop
put "Attacking goblin"
roll := Rand.Int (1, 20)
monRoll := Rand.Int (1, 20)
if charClass = "Fighter" then
dmg := Rand.Int (2, 8)
elsif charClass = "Ranger" then
dmg := Rand.Int (1, 6)
end if
if wizSpell >= 1 then
put "Choose a spell to cast."
get spellSelect
if spellSelect = "1" then
dmg := Rand.Int (1, 4) + level
play (">2b<")
monHp := monHp - (dmg + level)
delay (150)
put "You did ", (dmg + level), " damage to the goblin."
delay (150)
put "The goblin has ", monHp, " hp left."
if monHp < 1 then
put "You killed the goblin!"
put "You have ", yourHealth, " hp remaining."
exit
end if
elsif spellSelect = "2" then
if roll + attackBonus > monAc then
delay (150)
put "You rolled ", roll, " + ", attackBonus
delay (150)
put "You hit!"
delay (150)
dmg := Rand.Int (1, 10) + level
if roll = 20 then
put "Critical Hit!"
play (">>2a<<")
delay (150)
monHp := monHp - (dmg + level) * 2
put "You did ", (dmg + level) * 2, " to the goblin."
delay (150)
put "The goblin has ", monHp, " hp left."
if monHp < 1 then
exit
end if
else
play (">2b<")
monHp := monHp - (dmg + level)
delay (150)
put "You did ", (dmg + level), " damage to the goblin."
delay (150)
put "The goblin has ", monHp, " hp left."
if monHp < 1 then
put "You killed the goblin!"
put "You have ", yourHealth, " hp remaining."
exit
end if
end if
if monHp < 1 then
put "You killed the goblin!"
put "You have ", yourHealth, " hp remaining."
exit
end if
else
delay (150)
put "You rolled ", roll, " + ", attackBonus
delay (150)
put "You missed."
end if
if yourHealth < 1 then
put "You died."
delay (2500)
dead := "1"
exit
else
end if
if monHp < 1 then
exit
else
end if
elsif spellSelect = "3" then
if wizSpell = 2 then
if roll + attackBonus + level > monAc then
delay (150)
put "You rolled ", roll, " + ", attackBonus, " + ", level
delay (150)
put "You hit!"
delay (150)
dmg := Rand.Int (1, 10) + level
if roll = 20 then
put "Critical Hit!"
play (">>2a<<")
delay (150)
monHp := monHp - (dmg + level) * 2
put "You did ", (dmg + level) * 2, " to the goblin."
delay (150)
put "The goblin has ", monHp, " hp left."
if monHp < 1 then
put "You killed the goblin!"
put "You have ", yourHealth, " hp remaining."
exit
end if
else
play (">2b<")
monHp := monHp - (dmg + level)
delay (150)
put "You did ", (dmg + level), " damage to the goblin."
delay (150)
put "The goblin has ", monHp, " hp left."
if monHp < 1 then
put "You killed the goblin!"
put "You have ", yourHealth, " hp remaining."
exit
end if
end if
if monHp < 1 then
exit
end if
else
delay (150)
put "You rolled ", roll, " + ", attackBonus, " + ", level
delay (150)
put "You missed."
end if
if yourHealth < 1 then
put "You died."
delay (2500)
dead := "1"
exit
else
end if
if monHp < 1 then
exit
else
end if
else
end if
end if
delay (800)
put "Goblin Attacks."
delay (150)
if monRoll + 2 > ac then
put "The goblin rolled ", monRoll, " + 2"
delay (150)
put "The goblin hit!"
delay (150)
if monRoll = 20 then
put "Goblin critcally hit you!"
yourHealth := yourHealth - (monDmg) * 2
delay (150)
put "The goblin did ", (monDmg) * 2, " damage to you!"
delay (150)
put "You have ", yourHealth, " hp left."
else
yourHealth := yourHealth - monDmg
put "The goblin did ", monDmg, " damage to you."
delay (150)
put "You have ", yourHealth, " hp left."
end if
else
delay (150)
put "The goblin rolled ", monRoll, " + 2"
delay (150)
put "The goblin missed."
end if
else
if roll + attackBonus > monAc then
delay (150)
put "You rolled ", roll, " + ", attackBonus
delay (150)
put "You hit!"
delay (150)
if roll = 20 then
put "Critical Hit!"
play (">>2a<<")
delay (150)
monHp := monHp - (dmg + attackBonus) * 2
put "You did ", (dmg + attackBonus) * 2, " to the goblin."
delay (150)
put "The goblin has ", monHp, " hp left."
else
play (">2b<")
monHp := monHp - (dmg + attackBonus)
delay (150)
put "You did ", (dmg + attackBonus), " damage to the goblin."
delay (150)
put "The goblin has ", monHp, " hp left."
end if
else
delay (150)
put "You rolled ", roll, " + ", attackBonus
delay (150)
put "You missed."
end if
delay (800)
if monHp < 1 then
exit
else
end if
delay (800)
put "Goblin Attacks."
delay (150)
if monRoll + 2 > ac then
put "The goblin rolled ", monRoll, " + 2"
delay (150)
put "The goblin hit!"
delay (150)
if monRoll = 20 then
put "Goblin critcally hit you!"
yourHealth := yourHealth - (monDmg) * 2
delay (150)
put "The goblin did ", (monDmg) * 2, " damage to you!"
delay (150)
put "You have ", yourHealth, " hp left."
else
yourHealth := yourHealth - monDmg
put "The goblin did ", monDmg, " damage to you."
delay (150)
put "You have ", yourHealth, " hp left."
end if
else
delay (150)
put "The goblin rolled ", monRoll, " + 2"
delay (150)
put "The goblin missed."
end if
end if
if monHp < 1 then
exit
else
end if
end loop
if yourHealth < 1 then
put "You died."
delay (2500)
dead := "1"
exit
else
end if
if dead = "1" then
exit
else
end if
if monHp < 1 then
put "You killed the goblin!"
put "You have ", yourHealth, " hp remaining."
exit
else
end if
end loop
%After the battle
if yourHealth < 11 then
heal := Rand.Int (4, 8) + (level * 2)
yourHealth := yourHealth + heal
put " "
put "Chanson notices that you are wounded and heals you by uttering a short prayer."
put "You now have ", yourHealth, " hp left."
end if
delay (1000)
charExp := charExp + 200
%Level up script
if charExp >= 1000 and charExp < 2500 then
level := level + 1
put " "
put " "
put "You have gain a level! You are now level ", level, "!"
attackBonus := attackBonus + 1
put "Your attack bonus has increased by 1, it is now ", attackBonus, "!"
put " "
charHPGain := 3
yourHealth := yourHealth + charHPGain
put "You have gained ", charHPGain, " HP and now have ", yourHealth, " total HP."
if wizSpell = 1 then
wizSpell := 2
put "You have gained a new spell."
put " "
put "Spell gained : Burning Hands (1d6 + Caster level ; Bonus to hit)"
end if
end if
fork charSheet
%Level info
put " "
put "You are now level ", level, " and have ", charExp, " experience points."
put "Would you like to play the dialogue? (yes, no)"
get story2
%Second backstory
loop
if story2 = "yes" then
put "Conratulating each other with you great success, you continue"
delay (1500)
put "On your way, leaving your enemies bodies dead on the road."
delay (1500)
put "As you continue, the sky begins to darken, thus you deside to"
delay (1500)
put "set up camp, and call it a day."
delay (1500)
put " "
delay (1500)
put "Late in the night you are roused to arms, as you rush to get up,"
delay (1500)
put "You releise you are under attack by a group of men each wearing"
delay (1500)
put "red bandanas, however it seems that the strongest of the men is"
delay (1500)
put "planning to attack Chansan from behind! Yelling a warning to him"
delay (1500)
put "You charge at the brute. The thug looks at you and says, we will"
delay (1500)
put "no longer tolerate your presence, these lands belong to us!"
delay (1500)
exit
elsif story2 = "no" then
exit
end if
end loop
%Second encounter
put " "
put "The thug charges towards you. Prepare to fight!"
%Monster HP calculations
if charClass = "Fighter" then
monHp := Rand.Int (17, 31)
monAc := Rand.Int (10, 15)
monDmg := Rand.Int (1, 6)
elsif charClass = "Wizard" then
monHp := Rand.Int (15, 25)
monAc := Rand.Int (11, 15)
monDmg := Rand.Int (0, 5)
else
monHp := Rand.Int (16, 27)
monAc := Rand.Int (10, 15)
monDmg := Rand.Int (1, 6)
end if
put " "
loop
put "Attacking thug"
roll := Rand.Int (1, 20)
monRoll := Rand.Int (1, 20)
if charClass = "Fighter" then
dmg := Rand.Int (2, 8)
elsif charClass = "Ranger" then
dmg := Rand.Int (1, 6)
end if
if wizSpell = 1 then
put "Choose a spell to cast."
get spellSelect
if spellSelect = "1" then
dmg := Rand.Int (1, 4) + level
play (">2b<")
monHp := monHp - (dmg + level)
delay (150)
put "You did ", (dmg + level), " damage to the thug."
delay (150)
put "The thug has ", monHp, " hp left."
if monHp < 1 then
put "You killed the thug!"
put "You have ", yourHealth, " hp remaining."
exit
end if
elsif spellSelect = "2" then
if roll + attackBonus > monAc then
delay (150)
put "You rolled ", roll, " + ", attackBonus
delay (150)
put "You hit!"
delay (150)
dmg := Rand.Int (1, 10) + level
if roll = 20 then
put "Critical Hit!"
play (">>2a<<")
delay (150)
monHp := monHp - (dmg + level) * 2
put "You did ", (dmg + level) * 2, " to the thug."
delay (150)
put "The thug has ", monHp, " hp left."
if monHp < 1 then
put "You killed the thug!"
put "You have ", yourHealth, " hp remaining."
exit
end if
else
play (">2b<")
monHp := monHp - (dmg + level)
delay (150)
put "You did ", (dmg + level), " damage to the thug."
delay (150)
put "The thug has ", monHp, " hp left."
if monHp < 1 then
put "You killed the thug!"
put "You have ", yourHealth, " hp remaining."
exit
end if
end if
if monHp < 1 then
put "You killed the thug!"
put "You have ", yourHealth, " hp remaining."
exit
end if
else
delay (150)
put "You rolled ", roll, " + ", attackBonus
delay (150)
put "You missed."
end if
elsif spellSelect = "3" then
if wizSpell = 2 then
if roll + attackBonus + level > monAc then
delay (150)
put "You rolled ", roll, " + ", attackBonus, " + ", level
delay (150)
put "You hit!"
delay (150)
dmg := Rand.Int (1, 10) + level
if roll = 20 then
put "Critical Hit!"
play (">>2a<<")
delay (150)
monHp := monHp - (dmg + level) * 2
put "You did ", (dmg + level) * 2, " to the thug."
delay (150)
put "The thug has ", monHp, " hp left."
if monHp < 1 then
put "You killed the thug!"
put "You have ", yourHealth, " hp remaining."
exit
end if
else
play (">2b<")
monHp := monHp - (dmg + level)
delay (150)
put "You did ", (dmg + level), " damage to the thug."
delay (150)
put "The thug has ", monHp, " hp left."
if monHp < 1 then
exit
end if
end if
if monHp < 1 then
exit
end if
else
delay (150)
put "You rolled ", roll, " + ", attackBonus, " + ", level
delay (150)
put "You missed."
end if
if yourHealth < 1 then
put "You died."
delay (2500)
dead := "1"
exit
else
end if
if monHp < 1 then
exit
else
end if
else
end if
end if
if yourHealth < 1 then
put "You died."
delay (2500)
dead := "1"
exit
else
end if
delay (800)
put "The thug Attacks."
delay (150)
if monRoll + 2 > ac then
put "The thug rolled ", monRoll, " + 2"
delay (150)
put "The thug hit!"
delay (150)
if monRoll = 20 then
put "The thug critcally hit you!"
yourHealth := yourHealth - (monDmg) * 2
delay (150)
put "The thug did ", (monDmg) * 2, " damage to you!"
delay (150)
put "You have ", yourHealth, " hp left."
else
yourHealth := yourHealth - monDmg
put "The thug did ", monDmg, " damage to you."
delay (150)
put "You have ", yourHealth, " hp left."
end if
else
delay (150)
put "The thug rolled ", monRoll, " + 2"
delay (150)
put "The thug missed."
end if
else
if roll + attackBonus > monAc then
delay (150)
put "You rolled ", roll, " + ", attackBonus
delay (150)
put "You hit!"
delay (150)
if roll = 20 then
put "Critical Hit!"
play (">>2a<<")
delay (150)
monHp := monHp - (dmg + attackBonus) * 2
put "You did ", (dmg + attackBonus) * 2, " to the thug."
delay (150)
put "The thug has ", monHp, " hp left."
else
play (">2b<")
monHp := monHp - (dmg + attackBonus)
delay (150)
put "You did ", (dmg + attackBonus), " damage to the thug."
delay (150)
put "The thug has ", monHp, " hp left."
end if
else
delay (150)
put "You rolled ", roll
delay (150)
put "You missed."
end if
delay (800)
if monHp < 1 then
exit
else
end if
delay (800)
put "The thug Attacks."
delay (150)
if monRoll + 2 > ac then
put "The thug rolled ", monRoll, " + 2"
delay (150)
put "The thug hit!"
delay (150)
if monRoll = 20 then
put "The thug critcally hit you!"
yourHealth := yourHealth - (monDmg) * 2
delay (150)
put "The thug did ", (monDmg) * 2, " damage to you!"
delay (150)
put "You have ", yourHealth, " hp left."
else
yourHealth := yourHealth - monDmg
put "The thug did ", monDmg, " damage to you."
delay (150)
put "You have ", yourHealth, " hp left."
end if
else
delay (150)
put "The thug rolled ", monRoll, " + 2"
delay (150)
put "The thug missed."
end if
end if
if monHp < 1 then
exit
else
end if
if yourHealth < 1 then
put "You died."
delay (2500)
dead := "1"
exit
else
end if
if dead = "1" then
exit
else
end if
if monHp < 1 then
put "You killed the goblin!"
put "You have ", yourHealth, " hp remaining."
exit
else
end if
end loop
charExp := charExp + 250
%Level up script
if charExp >= 1000 and charExp < 2500 then
level := level + 1
put " "
put " "
put "You have gain a level! You are now level ", level, "!"
attackBonus := attackBonus + 1
put "Your attack bonus has increased by 1, it is now ", attackBonus, "!"
put " "
charHPGain := 3
yourHealth := yourHealth + charHPGain
put "You have gained ", charHPGain, " HP and now have ", yourHealth, " total HP."
end if
fork charSheet
%End of second encounter
if yourHealth < 11 then
heal := Rand.Int (4, 8) + (level * 2)
yourHealth := yourHealth + heal
put " "
put "Chanson notices that you are wounded and heals you by uttering a short prayer."
put "You now have ", yourHealth, " hp left."
end if
put "You are now level ", level, " and have ", charExp, " experience points."
put "Would you like to play the story line? (yes, no)"
get story3
%Continue game from here
end mainGame
proc endOfGame
put "You have reached the current end of this game."
put " "
put "Thank you for playing : D&D : Turing Edition."
put "By : Mihail Kurbako."
end endOfGame
%Main program
title
if titleSelect = 2 then
charCreate
mainGame
endOfGame
else
loadScreen
mainGame
endOfGame
end if
%End of main program
%Credits: Mihail Kurbako
%This is all I have so far.
%Update Version 1.1c
/*Version 1.0 problems:
No spells
No backstory or plot line
No races
No names
No tutorialorial
*/
/*Update 1.05a features:
Spells
Races
Chacter name
Improved incounter
Plot Line and background info
Tutorial
Dialogue prompts
Fixed problem with repeating critical hits
*/
/*Update 1.05b features:
Fixed mage spells
Fixed Ranger and Figher attacks
Fixed spelling mistakes
Increased combat dificulty
Improved dwarf hitpoint bonus
Death
Exp
Levels
*/
/*Update 1.1a features:
Fixed Ranger attacking
Fixed combat style selection
Patch a couple of typos
Fixed damage
Toughened up goblin
Fixed thug not being able to hit Wizard
*/
/*Update 1.1b features:
Fixed dying for wizards
Fixed problem with wizard spells
Fixed character sheet update after first encounter
Fixed wizard spell casting
Added healing after secound encouter (if you have < 11 hp remaining)
*/
/*Update 1.1c features:
Minor bug fixes
Saving and loading characters
Title screen
Game control console
Quit function
*/
/*Update 1.1d features:
Fixed spelling mistakes
Minor bug fixes
Ending screen
Placed character sheet into process
Improving saving and loading functions
Saving function patch
*/
/*Update 1.1e features:
Updated save script
Minor bug fixes
Monster HP/AC/Damage depends on class
Level up script
Improved stats for classes
Damage roll re-design
*/
/*Future plans:
Better noises when attacks hit and miss.
More spells
Saving - complete
Loading - complete
Title screen - complete
Levels - complete
EXP - complete
More encouters
Continued plot line
More monsters
Visual Update
*/ |