http://www.perlmonks.org?node_id=358787

Battle Arena Version
---------------------------
# Errors include skipping of first battle, magic system # and possibly difficulty #!/usr/bin/perl # Coding began Monday January 26th, 2004 # Last updated 26/01/04 # Monster combat routine # This is a test to see if the "monster" routine from Syrosian Legacy # will actually work. $str = 5; $dex = 5; $con = 2; $mag = 1; # User stats # Configuration of user stats into health/mana points $vit = $con * 5; $vitstat = $con *5; $mana = $mag * 5; # Configuration of monster stats into health/mana points $vitality = $constitution * 5; $vitalitystat = 5 *2; $manapoints = $magic * 5; print "Welcome to Syrosian Legacy Arena Mode!\n"; print "\n"; print "Here is a basic run-down of how this works..\n"; print "You and your opponent fight one another obviously\n"; print "You both check for dex, which is a random number. Whoever is hi +gher gets to attack first. Nifty Eh?\n"; print "The main attacker has a strength count. Two random numbers are rolled and added together. This equals your attack damage.\n"; print "This continues till one of you is K.O. \n"; print "Fortunately, I have decided to update! So choose your difficult +y....\n"; print "a)easy b)medium c)hard (a,b,c)\n"; $diff = <STDIN>; chomp ($diff); if ($diff eq "a") { $str = 10; $dex = 10; $con = 5; $mag = 4; $fire = 5; $ice = 6; $bolt = 7; $dstrike = 4; $sdagger = 2; }elsif ($diff eq "b") { $str = 8; $dex = 8; $con = 3; $mag = 2; $fire = 5; $ice = 0; $bolt = 0; $dstrike = 4; $sdagger = 2; }else { $str = 5; $dex = 5; $con = 2; $mag = 1; $fire = 0; $ice = 0; $bolt = 0; $dstrike = 4; $sdagger = 2; } print "\n"; print "Stats have now been set based on your difficulty...\n"; print "Plus a few MAGICAL surprises..\n"; print "\n"; print "When you are ready for your first battle, hit enter to continue +\n"; $ready = <STDIN>; chomp ($ready); print "Alright, your first fight will be one-on-one versus a weak oppo +nent\n"; print "Ready.....FIGHT !\n"; $victory = 0; if ($victory = 0) { #opponent stats $strength = 5; $dexterity = 5; $constitution = 2; $magic = 0; #conversion into vitality & magic $vitality = $constitution * 5; $vitalitystat = $constitution * 5; while (($vit > 0) && ($vitality > 0)){ srand; $dex1=rand($dex); $dex2=rand($dexterity); if ($dex1 > $dex2) { print "You gain an advantage!\n"; print "Shall you...\n"; print "Attack? (attack)\n"; print "Use Magic? (magic)\n"; $choice = <STDIN>; chomp ($choice); if ($choice eq "attack") { srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $streng; $vitality -= $streng; print "You hit your opponent for "; printf ("%.1f", $streng); print " damage.\n"; print "Your opponent has "; printf ("%.1f", $vitality); print " out of $vitalitystat health\n"; }elsif ($choice eq "magic") { print "Which magical attack shall you use?\n"; print "Fire? (fire)\n"; print "Ice? (ice)\n"; print "Bolt? (bolt)\n"; print "Dark Strike? (dstrike)\n"; print "Shadow Dagger? (sdagger)\n"; $magicattack = <STDIN>; chomp ($magicattack); if ($magicattack eq "fire") { srand; $magdamage =rand($fire); $vitality -= $magdamage; print "You BURN you opponent for "; printf ("%.1f", $magdamage); print " damage.\n"; print "Your opponent has "; printf ("%.1f", $vitality); print " out of $vitalitystat health\n"; }elsif ($magicattack eq "ice") { srand; $magdamage =rand($ice); $vitality -= $magdamage; print "You FREEZE you opponent for "; printf ("%.1f", $magdamage); print " damage.\n"; print "Your opponent has "; printf ("%.1f", $vitality); print " out of $vitalitystat health\n"; }elsif ($magicattack eq "bolt") { srand; $magdamage =rand($bolt); $vitality -= $magdamage; print "You ZAP you opponent for "; printf ("%.1f", $magdamage); print " damage.\n"; print "Your opponent has "; printf ("%.1f", $vitality); print " out of $vitalitystat health\n"; }elsif ($magicattack eq "dstrike") { srand; $magdamage =rand($fire); $vitality -= $magdamage; print "You PIERCE you opponent for "; printf ("%.1f", $magdamage); print " damage.\n"; print "Your opponent has "; printf ("%.1f", $vitality); print " out of $vitalitystat health\n"; }elsif ($magicattack eq "sdagger") { srand; $magdamage =rand($fire); $vitality -= $magdamage; print "You STAB you opponent for "; printf ("%.1f", $magdamage); print " damage.\n"; print "Your opponent has "; printf ("%.1f", $vitality); print " out of $vitalitystat health\n"; }else{ print "You attempt to cast the spell, yet it fails + you.\n"; } }else{ print "You lose the opportunity to attack.\n"; } }elsif ($dex2 > $dex1) { srand; $stre =rand($strength); $stren =rand($strength); $streng = $stre + $stren; $vit -= $streng; print "You are struck for "; printf ("%.1f", $streng); print " damage.\n"; print "You now have "; printf ("%.1f", $vit); print " out of $vit remaining.\n"; }else{ print "Weapons clash together, then part again as both you + and your opponent seek an opening.\n"; } #Death if ($vit < 0) { print "You have been knocked out!\n"; print "Game Over\n"; die; } if ($vitality < 0) { print "You have knocked out your opponent!\n"; print "Your victories increase by 1\n"; $victory += 1; } } }elsif ($victory = 1) { #Battle system for the two guards in the Fishing Town #Guards' Stats $guardonestr = 8; $guardonedex = 5; $guardonecon = 3; $guardtwostr = 7; $guardtwodex = 3; $guardtwocon = 2; #Conversion into vitality $vitalityone = $guardonecon * 5; $vitalityonestat = $guardcon * 5; $vitalitytwo = $guardtwocon * 5; $vitalitytwostat = $guardtwocon * 5; print "Welcome to the second battle! You have done well to defeat +your first opponent.\n"; print "Now, as you go through the various levels, the challenge wi +ll increase.\n"; print "Seeing as how you successfully completed your last round, t +he arena gods shall grant you a boon.\n"; print "Con't (hit enter)\n"; $ready = <STDIN>; chomp ($ready); print "Well then, you have three boons to choose from...choose wis +ely..\n"; print "a)weapon (Grants you access to a weapons locker)\n"; print "b)magic (Grants you access to new spells)\n"; print "c)speed (Grants you access to an adrenaline supply)\n"; print "Choose carefully, as some may have consequences.\n"; $firstboon = <STDIN>; chomp ($firstboon); if ($firstboon eq "weapon") { print "\n"; print "Ah, I see you have wished weapons. Your attacks have in +creased in strength.\n"; $str += 2; }elsif ($firstboon eq "magic") { print "\n"; print "Ah, I see you favour the arcane magics. More spells hav +e been granted to you.\n"; if ($diff eq "a") { $fire = 5; $ice = 6; $bolt = 7; $dstrike = 4; $sdagger = 2; $bio = 10; $earth = 7; }elsif ($diff eq "b") { $fire = 5; $ice = 6; $bolt = 7; $dstrike = 4; $sdagger = 2; $bio = 0; $earth = 0; }else { $fire = 5; $ice = 6; $bolt = 0; $dstrike = 4; $sdagger = 2; $bio = 0; $earth = 0; } }elsif ($firstboon eq "speed") { print "\n"; print "Ah, I see you wish to be swifter. You have been granted + access to adrenaline.\n"; $dex += 3; } print "Are you ready for your next instructions?\n"; print "(hit enter)\n"; $ready = <STDIN>; chomp ($ready); $restore = $vitstat - vit; $vit = $restore; print "Good. Your vitality has been restored, and you are ready fo +r the next round.\n"; print "In the next round you will fight two samurai. These are eli +te warriors.\n"; print "Each will attack you together as a team, and can easily tak +e you down.\n"; print "Good luck in the next round...the arena gods are watching.\ +n"; print "\n"; print "Continue to the next round?\n"; print "(hit enter)\n"; $ready = <STDIN>; chomp ($ready); print "\n"; print "Welcome to the arena! Today we have a spectacular match!\n"; print "Today we have newcomer, $name, fighting against the Shintao + samurai. This is sure to be an amazing test of skills.\n"; print "Now, let the fight begin!\n"; } # Barrier ------------------------------------------------------------ +----------------------------- print "You draw your sword as the two guardsmen do, and prepare fo +r combat.\n"; while (($vit > 0) && ($vitalityone + $vitalitytwo > 0)){ srand; $dex1=rand($dex); $dex2=rand($guardonedex); $dex3=rand($guardtwodex); if ($dex1 > $dex2 && $dex3) { print "Shall you...\n"; print "Attack guard one?(attackone)\n"; print "Attack guard two?(attacktwo)\n"; print "Use Magic on guard one?(magicone)\n"; print "Use Magic on guard two?(magictwo)\n"; $choice = <STDIN>; chomp ($choice); if ($choice eq "attackone") { srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalityone -= $streng; print "You hit the first guard with your sword for $streng + damage!!\n"; }elsif ($choice eq "attacktwo") { srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalitytwo -= $streng; print "You hit the second guard with your sword for $stren +g damage!!\n"; }elsif ($choice eq "magicone") { print "Which magical attack shall you use?\n"; print "Dark Strike\n"; print "Shadow Dagger\n"; $magicattone = <STDIN>; chomp ($magicattone); if ($magicattone eq "Dark Strike") { srand; $magdamage=rand($dstrike); $vitalityone -= $magdamage; print "Your paw darts forward. A dark needle springs f +rom the center, piercing into the first guard for $magdamage damage.\ +n"; }elsif ($magicattone eq "Shadow Dagger") { srand; $magdamage=rand($sdagger); $vitalityone -= $magdamage; print "You summon a dagger composed of the shadows. Yo +u slash the first guard, wounding him for $magdamage damage.\n"; }else{ print "Your spell fails you and nothing happens..\n"; } }elsif ($choice eq "magictwo") { print "Which magical attack shall you use?\n"; print "Dark Strike\n"; print "Shadow Dagger\n"; $magicatttwo = <STDIN>; chomp ($magicatttwo); if ($magicatttwo eq "Dark Strike") { srand; $magdamage=rand($dstrike); $vitalitytwo -= $magdamage; print "Your paw darts forward. A dark needle springs f +rom the center, piercing into the second guard for $magdamage damage. +\n"; }elsif ($magicatttwo eq "Shadow Dagger") { srand; $magdamage=rand($sdagger); $vitalitytwo -= $magdamage; print "You summon a dagger composed of the shadows. Yo +u slash the second guard, wounding him for $magdamage damage.\n"; }else{ print "Your spell fails you and nothing happens..\n"; } }else{ print "You cannot remember a spell quick enough, you attac +k instead.\n"; srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalitytwo -= $streng; print "You hit the second guard with your sword for $stren +g damage!!\n"; } }elsif ($dex2 > $dex1 && $dex3) { #First guard attack srand; $stre=rand($guardonestr); $stren=rand($guardonestr); $streng = $stre + $stren; $vit -= $streng; print "You are hit by the first guard's pike for $streng damag +e!!\n"; }elsif ($dex3 > $dex1 && $dex2){ #Second guard attack srand; $stre=rand($guardtwostr); $stren=rand($guardtwostr); $streng = $stre + $stren; $vit -= $streng; print "You are hit by the second guard's knife for $streng dam +age!!\n"; }else{ print "A clang of metal is heard as your sword strikes against + the second guard's dagger, the pike of the first barely misses you.\ +n"; } if ($vitalityone < 0) { print "The first guard crumples, falling to the ground in a po +ol of his blood.\n"; while(($vit > 0) && ($vitalitytwo > 0)){ srand; $dex1=rand($dex); $dex3=rand($guardtwodex); if ($dex1 > $dex3) { print "Shall you...\n"; print "Attack guard two?(attacktwo)\n"; print "Use Magic on guard two?(magictwo)\n"; $choice = <STDIN>; chomp ($choice); if ($choice eq "attacktwo") { srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalitytwo -= $streng; print "You hit the second guard with your sword fo +r $streng damage!!\n"; }elsif ($choice eq "magictwo") { print "Which magical attack shall you use?\n"; print "Dark Strike\n"; print "Shadow Dagger\n"; $magicatttwo = <STDIN>; chomp ($magicatttwo); if ($magicatttwo eq "Dark Strike") { srand; $magdamage=rand($dstrike); $vitalitytwo -= $magdamage; print "Your paw darts forward. A dark needle s +prings from the center, piercing into the second guard for $magdamage + damage.\n"; }elsif ($magicatttwo eq "Shadow Dagger") { srand; $magdamage=rand($sdagger); $vitalitytwo -= $magdamage; print "You summon a dagger composed of the sha +dows. You slash the second guard, wounding him for $magdamage damage. +\n"; }else{ print "Your spell fails you and nothing happen +s..\n"; } }else{ print "You cannot remember a spell quick enough, y +ou attack instead.\n"; srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalitytwo -= $streng; print "You hit the second guard with your sword fo +r $streng damage!!\n"; } }elsif ($dex3 > $dex1){ srand; $stre=rand($guardtwostr); $stren=rand($guardtwostr); $streng = $stre + $stren; $vit -= $streng; print "You are hit by the second guard's knife for $st +reng damage!!\n"; }else{ print "Both blades strike together for a moment before + drawing back once again to attack.\n"; } if ($vit < 0){ print "You have died....\n"; } if ($vitalitytwo < 0){ print "The second guard succumbs to your attacks.\n"; } if ($vitalitytwo < 0) { print "The second guard succumbs to your attacks.\ +n"; while(($vit > 0) && ($vitvitalityone > 0)){ srand; $dex1=rand($dex); $dex2=rand($guardonedex); if ($dex1 > $dex2) { print "Shall you...\n"; print "Attack guard one?(attackone)\n" +; print "Use Magic on guard one?(magicon +e)\n"; $choice = <STDIN>; chomp ($choice); if ($choice eq "attackone") { srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalityone -= $streng; print "You hit the first guard wit +h your sword for $streng damage!!\n"; }elsif ($choice eq "magicone") { print "Which magical attack shall +you use?\n"; print "Dark Strike\n"; print "Shadow Dagger\n"; $magicattone = <STDIN>; chomp ($magicattone); if ($magicattone eq "Dark Strike") + { srand; $magdamage=rand($dstrike); $vitalityone -= $magdamage; print "Your paw darts forward. + A dark needle springs from the center, piercing into the first guard + for $magdamage damage.\n"; }elsif ($magicattone eq "Shadow Da +gger") { srand; $magdamage=rand($sdagger); $vitalityone -= $magdamage; print "You summon a dagger com +posed of the shadows. You slash the first guard, wounding him for $ma +gdamage damage.\n"; }else{ print "Your spell fails you an +d nothing happens..\n"; } }else{ print "You cannot remember a spell + quick enough, you attack instead.\n"; srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalityone -= $streng; print "You hit the first guard wit +h your sword for $streng damage!!\n"; } }elsif ($dex2 > $dex1){ srand; $stre=rand($guardonestr); $stren=rand($guardonestr); $streng = $stre + $stren; $vit -= $streng; print "You are hit by the first guard' +s pike for $streng damage!!\n"; }else{ print "Both blades strike together for + a moment before drawing back once again to attack.\n"; } if ($vit < 0){ print "You have died....\n"; } if ($vitalitytwo < 0){ print "The second guard succumbs to yo +ur attacks.\n"; } } } } } }


Syrosian Legacy version
-------------------------
#!usr/bin/perl -w #Coded by Shinwa Okami #Coded during 2003...began December print "\n"; print "\n"; print "----___- Welcome To Shinny RPG! -___----\n"; print "Please enter a name: \n"; $name = <STDIN>; chomp ($name); print "Please select a class..(war,thf,wiz)\n"; $class = <STDIN>; chomp ($class); if ($class eq "war") { $str = 8; # Used to calculate Damage $dex = 4; # Used to calculate hit Ratio $con = 7; # Used to calculate Health $mag = 2; # Used to calculate magicalness...ness... print "\n"; print "Excellent choice warrior!\n"; }elsif ($class eq "thf") { $str = 6; # Used to calculate Damage $dex = 7; # Used to calculate hit Ratio $con = 5; # Used to calculate Health $mag = 4; # Used to calculate magicalness...ness... print "\n"; print "Excellent choice thief!\n"; }elsif ($class eq "wiz") { $str = 4; # Used to calculate Damage $dex = 5; # Used to calculate hit Ratio $con = 4; # Used to calculate Health $mag = 7; # Used to calculate magicalness...ness... print "\n"; print "Excellent choice sorcerer!\n"; }elsif ($class eq "penguin") { $str = 20; # Used to calculate Damage score $dex = 20; # Used to calculate Hit Ratio $con = 20; # Used to calculate Health $mag = 20; # Used to calculate magicalness...ness... print "\n"; print "You are one with the Penguin...\n"; }else{ print "Please select one of the classes next time...\n"; die; } $mana = $mag * 5; # Mana/Magic points $vit = $con * 10; # Actual health score #Magical Database... $dstrike = 2; $sdagger = 4; print"\n"; print "So young adventurer, welcome to the lands of Syrosia!\n"; print "Your day begins outside of your home in Thet forest, to your le +ft you see your grandfather and teacher. The right contains a pathway. Wh +ere shall you journey first?(left/right) \n"; $begin = <STDIN>; chomp ($begin); if ($begin eq "left") { print "You walk over to your grandfather to begin your daily t +raining.\n"; }elsif ($begin eq "right") { print "You gaze down the path but find nothing of interest. In +stead you go over to your grandfather to begin training.\n"; }else{ print "This is not a choice! I cause death to program!\n"; die; } print "\n"; print "Grandfather: You have many lessons to learn yet young $name. Th +e time will come when you will have to use all that I have taught you to face your destiny.\n"; print"\n"; print "Grandfather: Now, what area of training shall we focus upon tod +ay? (str/dex/con/mag) \n"; $train = <STDIN>; chomp ($train); if ($train eq "str") { print " "; print "Grandfather: Strength is a key component in wounding yo +ur opponent. You may be quicker in battle, but if you cannot break pa +st an enemy's armour, you are as good as dead. \n"; print "Grandfather: Go behind the house, and carry many stones + to build your strength. \n"; print "\n"; print "For the next few hours you train...your strength increa +ses by 1! \n"; $str += 1; }elsif ($train eq "dex") { print "\n"; print "Grandfather: Dexterity is key to hitting your opponent +and dodging his attacks. Even the strongest fall to the blades of tho +se that are swifter than themselves. \n"; print "Grandfather: Go behind the house, and practice your str +etching and dodging techniques. \n"; print "\n"; print "For the next few hours you train...your dexterity incre +ases by 1! \n"; $dex += 1; }elsif ($train eq "con") { print "\n"; print "Grandfather: Being physically healthy is the best way t +o stay alive. Being able to take an attack and survive will give you +an edge in battle, as well as give you time to attack your opponent o +nce more. \n"; print "Grandfather: Go behind the house, there you will find B +arak plants. Eat the roots, after all, what doesn't kill you makes yo +u stronger. \n"; print "\n"; print "For the next few hours you train...your consitution inc +reases by 1! \n"; $con += 1; $vit -= 3; }elsif ($train eq "mag") { print "\n"; print "Grandfather: So you wish to learn of the magics of the +Syrosian people yes? Well every furre of Syros is born with Shadow ma +gic...\n"; print "Grandfather: Go behind the house, there you will find b +ooks. Read and learn. \n"; print "\n"; print "For the next few hours you train...your magicalness inc +reases by 1! \n"; $mag += 1; } else { print "This is not a choice ! I cause death to program !"; die; } print "\n"; print "Grandfather: You have trained for many years $name. From a chil +d I have teached you everything that I know in hopes of preparing you + for the future.\n"; print "\n"; print "Your Grandfather presents you with a sword made of Syrosian ste +el..\n"; print "\n"; print "Grandfather: You have learned well the lessons and skills your +parents were gifted with. As you know, your parents were the greatest + assassins of Syros. This sword is made from the blood metals mined b +y the Ku'tari. Through time it will grow stronger as it tastes the bl +ood of your opponents. I hope one day you will be strong enough to... +\n"; print "\n"; print "Cont..\n"; $cont = <STDIN>; chomp ($cont); print "A rustling nearby grabs your Grandfather's attention...\n"; print "\n"; print "Grandfather: $name be still, there are others nearby..\n"; print "\n"; print "Both you and your Grandfather listen, crouching perfectly still + outside your home. Voices can be heard nearby, and are slowly gettin +g closer.\n"; print "\n"; print "Voice1: There! In the clearing! Grab them quickly!\n"; print "\n"; print "Grandfather: $name take this with you and run! It is soldiers f +rom the army of Kuragari. I will hold them off as long as I can for y +ou to escape!\n"; print "\n"; print "You have received Pendent of Wishing!\n"; print "\n"; print "What shall you do? (stay/run)\n"; $choice = <STDIN>; chomp ($choice); if ($choice eq "stay") { print "$name: Grandfather let me stay with you ! I know we can + both defeat them..I know we can do it !n"; print " }elsif ($choice eq "run") { print "You nod to your grandfather, and run off into the woods + as he commanded.\n"; }else{ print "This is not a choice! I cause death to program!\n"; die; } print "\n"; print "You take off into the woods. Sounds of battle fade behind you, +yet you can hear the sounds of pursuit closely behind. Using your tra +ining you manage to evade, hide, and even fell one of your pursuers.\ +n"; print "\n"; print "After two long days you manage to lose your pursuers. Remaining + cautious, you venture to a nearby fishing village. You spend time lo +oking around, and generally keeping to yourself. Your path leads you +to the docks.\n"; print "\n"; print "Where shall you go?\n"; print "a) Shipping desk(desk)\n"; print "b) Local Guard Station(guard)\n"; print "c) Observe your surroundings(observe)\n"; $docks = <STDIN>; chomp ($docks); if ($docks eq "desk") { print "\n"; print "You walk over to the Shipping Desk. Behind the desk is +an old man in a worn down sailor outfit. He seems to hardly be able t +o stand, yet his voice remains crisp and loud over the noise of the d +ocks.\n"; }elsif ($docks eq "guard") { print "\n"; print "You walk over to the Local Guard Station. Standing next + to it are two guards similar to the ones who attacked you and your G +randfather. They don't seem to recongnize you for the moment.\n"; print "What shall you do?\n"; print "Check out the Shipping Desk(desk)\n"; print "State your name and challenge them to a duel(duel)\n"; $guardchoice = <STDIN>; chomp ($guardchoice); if ($guardchoice eq "desk") { print "\n"; print "You walk over to the Shipping Desk. Behind the +desk is an old man in a worn down sailor outfit. He seems to hardly b +e able to stand, yet his voice remains crisp and loud over the noise +of the docks.\n"; }elsif ($guardchoice eq "duel") { print "You step before the two guards.\n"; print "\n"; print "Guard One: What do you want kit?\n"; print "$name: I am $name and I challenge you both to a + duel!\n"; #Battle system for the two guards in the Fishing Town #Guards' Stats $guardonestr = 8; $guardonedex = 5; $guardonecon = 3; $guardtwostr = 7; $guardtwodex = 3; $guardtwocon = 2; #Conversion into vitality $vitalityone = $guardonecon * 5; $vitalitytwo = $guardtwocon * 5; print "You draw your sword as the two guardsmen do, an +d prepare for combat.\n"; while (($vit > 0) && ($vitalityone + $vitalitytwo > 0) +){ srand; $dex1=rand($dex); $dex2=rand($guardonedex); $dex3=rand($guardtwodex); if ($dex1 > $dex2 && $dex3) { print "Shall you...\n"; print "Attack guard one?(attackone)\n"; print "Attack guard two?(attacktwo)\n"; print "Use Magic on guard one?(magicone)\n"; print "Use Magic on guard two?(magictwo)\n"; $choice = <STDIN>; chomp ($choice); if ($choice eq "attackone") { srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalityone -= $streng; print "You hit the first guard with your s +word for $streng damage!!\n"; }elsif ($choice eq "attacktwo") { srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalitytwo -= $streng; print "You hit the second guard with your +sword for $streng damage!!\n"; }elsif ($choice eq "magicone") { print "Which magical attack shall you use? +\n"; print "Dark Strike\n"; print "Shadow Dagger\n"; $magicattone = <STDIN>; chomp ($magicattone); if ($magicattone eq "Dark Strike") { srand; $magdamage=rand($dstrike); $vitalityone -= $magdamage; print "Your paw darts forward. A dark +needle springs from the center, piercing into the first guard for $ma +gdamage damage.\n"; }elsif ($magicattone eq "Shadow Dagger") { srand; $magdamage=rand($sdagger); $vitalityone -= $magdamage; print "You summon a dagger composed of + the shadows. You slash the first guard, wounding him for $magdamage +damage.\n"; }else{ print "Your spell fails you and nothin +g happens..\n"; } }elsif ($choice eq "magictwo") { print "Which magical attack shall you use? +\n"; print "Dark Strike\n"; print "Shadow Dagger\n"; $magicatttwo = <STDIN>; chomp ($magicatttwo); if ($magicatttwo eq "Dark Strike") { srand; $magdamage=rand($dstrike); $vitalitytwo -= $magdamage; print "Your paw darts forward. A dark +needle springs from the center, piercing into the second guard for $m +agdamage damage.\n"; }elsif ($magicatttwo eq "Shadow Dagger") { srand; $magdamage=rand($sdagger); $vitalitytwo -= $magdamage; print "You summon a dagger composed of + the shadows. You slash the second guard, wounding him for $magdamage + damage.\n"; }else{ print "Your spell fails you and nothin +g happens..\n"; } }else{ print "You cannot remember a spell quick e +nough, you attack instead.\n"; srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalitytwo -= $streng; print "You hit the second guard with your +sword for $streng damage!!\n"; } }elsif ($dex2 > $dex1 && $dex3) { #First guard att +ack srand; $stre=rand($guardonestr); $stren=rand($guardonestr); $streng = $stre + $stren; $vit -= $streng; print "You are hit by the first guard's pike f +or $streng damage!!\n"; }elsif ($dex3 > $dex1 && $dex2){ #Second guard att +ack srand; $stre=rand($guardtwostr); $stren=rand($guardtwostr); $streng = $stre + $stren; $vit -= $streng; print "You are hit by the second guard's knife + for $streng damage!!\n"; }else{ print "A clang of metal is heard as your sword + strikes against the second guard's dagger, the pike of the first bar +ely misses you.\n"; } if ($vitalityone < 0) { print "The first guard crumples, falling to th +e ground in a pool of his blood.\n"; while(($vit > 0) && ($vitalitytwo > 0)){ srand; $dex1=rand($dex); $dex3=rand($guardtwodex); if ($dex1 > $dex3) { print "Shall you...\n"; print "Attack guard two?(attacktwo)\n" +; print "Use Magic on guard two?(magictw +o)\n"; $choice = <STDIN>; chomp ($choice); if ($choice eq "attacktwo") { srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalitytwo -= $streng; print "You hit the second guard wi +th your sword for $streng damage!!\n"; }elsif ($choice eq "magictwo") { print "Which magical attack shall +you use?\n"; print "Dark Strike\n"; print "Shadow Dagger\n"; $magicatttwo = <STDIN>; chomp ($magicatttwo); if ($magicatttwo eq "Dark Strike") + { srand; $magdamage=rand($dstrike); $vitalitytwo -= $magdamage; print "Your paw darts forward. + A dark needle springs from the center, piercing into the second guar +d for $magdamage damage.\n"; }elsif ($magicatttwo eq "Shadow Da +gger") { srand; $magdamage=rand($sdagger); $vitalitytwo -= $magdamage; print "You summon a dagger com +posed of the shadows. You slash the second guard, wounding him for $m +agdamage damage.\n"; }else{ print "Your spell fails you an +d nothing happens..\n"; } }else{ print "You cannot remember a spell + quick enough, you attack instead.\n"; srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalitytwo -= $streng; print "You hit the second guard wi +th your sword for $streng damage!!\n"; } }elsif ($dex3 > $dex1){ srand; $stre=rand($guardtwostr); $stren=rand($guardtwostr); $streng = $stre + $stren; $vit -= $streng; print "You are hit by the second guard +'s knife for $streng damage!!\n"; }else{ print "Both blades strike together for + a moment before drawing back once again to attack.\n"; } if ($vit < 0){ print "You have died....\n"; } if ($vitalitytwo < 0){ print "The second guard succumbs to yo +ur attacks.\n"; } if ($vitalitytwo < 0) { print "The second guard succumbs to your attac +ks.\n"; while(($vit > 0) && ($vitvitalityone > 0)){ srand; $dex1=rand($dex); $dex2=rand($guardonedex); if ($dex1 > $dex2) { print "Shall you...\n"; print "Attack guard one?(attackone)\n" +; print "Use Magic on guard one?(magicon +e)\n"; $choice = <STDIN>; chomp ($choice); if ($choice eq "attackone") { srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalityone -= $streng; print "You hit the first guard wit +h your sword for $streng damage!!\n"; }elsif ($choice eq "magicone") { print "Which magical attack shall +you use?\n"; print "Dark Strike\n"; print "Shadow Dagger\n"; $magicattone = <STDIN>; chomp ($magicattone); if ($magicattone eq "Dark Strike") + { srand; $magdamage=rand($dstrike); $vitalityone -= $magdamage; print "Your paw darts forward. + A dark needle springs from the center, piercing into the first guard + for $magdamage damage.\n"; }elsif ($magicattone eq "Shadow Da +gger") { srand; $magdamage=rand($sdagger); $vitalityone -= $magdamage; print "You summon a dagger com +posed of the shadows. You slash the first guard, wounding him for $ma +gdamage damage.\n"; }else{ print "Your spell fails you an +d nothing happens..\n"; } }else{ print "You cannot remember a spell + quick enough, you attack instead.\n"; srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalityone -= $streng; print "You hit the first guard wit +h your sword for $streng damage!!\n"; } }elsif ($dex2 > $dex1){ srand; $stre=rand($guardonestr); $stren=rand($guardonestr); $streng = $stre + $stren; $vit -= $streng; print "You are hit by the first guard' +s pike for $streng damage!!\n"; }else{ print "Both blades strike together for + a moment before drawing back once again to attack.\n"; } if ($vit < 0){ print "You have died....\n"; } if ($vitalitytwo < 0){ print "The second guard succumbs to yo +ur attacks.\n"; } } } print "Both guards lay at your feet, slain by your swo +rd. You feel no shame in taking the lives of these two. They hurt you +, took your Grandfather away, and for that you killed.\n"; print "\n"; print "The town is on alert now. Guards can be seen co +ming in the distance towards you. Quickly you shealth your blade, and + take off at a run for the nearby docks.\n"; print "Upon your arrival you see a ship, the Crimson J +ewel, departing from port. Running still, you unshealth your sword, a +nd leap towards the hull.\n"; }else{ print "This is not a choice!\n"; die; } }elsif ($docks eq "observe") { print "\n"; print "You take a closer look at your surroundings. You can se +e that this is a poor town under the rule of Kuragari Tenshii, the on +e who killed your family. Guards populate the town mainly, as well as + a few fishermen and their families.\n"; print "\n"; print "Where shall you go now?" print "a) Shipping desk(desk)\n"; print "b) Local Guard Station(guard)\n"; $obchoice = <STDIN>; chomp ($obchoice); if ($obchoice eq "desk") { print "\n"; print "You walk over to the Shipping Desk. Behind the desk + is an old man in a worn down sailor outfit. He seems to hardly be ab +le to stand, yet his voice remains crisp and loud over the noise of t +he docks.\n"; }elsif ($docks eq "guard") { print "\n"; print "You walk over to the Local Guard Station. Standing +next to it are two guards similar to the ones who attacked you and yo +ur Grandfather. They don't seem to recongnize you for the moment.\n"; print "What shall you do?\n"; print "Check out the Shipping Desk(desk)\n"; print "State your name and challenge them to a duel(duel)\ +n"; $guardchoice = <STDIN>; chomp ($guardchoice); if ($guardchoice eq "desk") { print "\n"; print "You walk over to the Shipping Desk. Behind the +desk is an old man in a worn down sailor outfit. He seems to hardly b +e able to stand, yet his voice remains crisp and loud over the noise +of the docks.\n"; }elsif ($guardchoice eq "duel") { print "You step before the two guards.\n"; print "\n"; print "Guard One: What do you want kit?\n"; print "$name: I am $name and I challenge you both to a + duel!\n"; #Battle system for the two guards in the Fishing Town #Guards' Stats $guardonestr = 8; $guardonedex = 5; $guardonecon = 3; $guardtwostr = 7; $guardtwodex = 3; $guardtwocon = 2; #Conversion into vitality $vitalityone = $guardonecon * 5; $vitalitytwo = $guardtwocon * 5; print "You draw your sword as the two guardsmen do, an +d prepare for combat.\n"; while (($vit > 0) && ($vitalityone + $vitalitytwo > 0) +){ srand; $dex1=rand($dex); $dex2=rand($guardonedex); $dex3=rand($guardtwodex); if ($dex1 > $dex2 && $dex3) { print "Shall you...\n"; print "Attack guard one?(attackone)\n"; print "Attack guard two?(attacktwo)\n"; print "Use Magic on guard one?(magicone)\n"; print "Use Magic on guard two?(magictwo)\n"; $choice = <STDIN>; chomp ($choice); if ($choice eq "attackone") { srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalityone -= $streng; print "You hit the first guard with your s +word for $streng damage!!\n"; }elsif ($choice eq "attacktwo") { srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalitytwo -= $streng; print "You hit the second guard with your +sword for $streng damage!!\n"; }elsif ($choice eq "magicone") { print "Which magical attack shall you use? +\n"; print "Dark Strike\n"; print "Shadow Dagger\n"; $magicattone = <STDIN>; chomp ($magicattone); if ($magicattone eq "Dark Strike") { srand; $magdamage=rand($dstrike); $vitalityone -= $magdamage; print "Your paw darts forward. A dark +needle springs from the center, piercing into the first guard for $ma +gdamage damage.\n"; }elsif ($magicattone eq "Shadow Dagger") { srand; $magdamage=rand($sdagger); $vitalityone -= $magdamage; print "You summon a dagger composed of + the shadows. You slash the first guard, wounding him for $magdamage +damage.\n"; }else{ print "Your spell fails you and nothin +g happens..\n"; } }elsif ($choice eq "magictwo") { print "Which magical attack shall you use? +\n"; print "Dark Strike\n"; print "Shadow Dagger\n"; $magicatttwo = <STDIN>; chomp ($magicatttwo); if ($magicatttwo eq "Dark Strike") { srand; $magdamage=rand($dstrike); $vitalitytwo -= $magdamage; print "Your paw darts forward. A dark +needle springs from the center, piercing into the second guard for $m +agdamage damage.\n"; }elsif ($magicatttwo eq "Shadow Dagger") { srand; $magdamage=rand($sdagger); $vitalitytwo -= $magdamage; print "You summon a dagger composed of + the shadows. You slash the second guard, wounding him for $magdamage + damage.\n"; }else{ print "Your spell fails you and nothin +g happens..\n"; } }else{ print "You cannot remember a spell quick e +nough, you attack instead.\n"; srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalitytwo -= $streng; print "You hit the second guard with your +sword for $streng damage!!\n"; } }elsif ($dex2 > $dex1 && $dex3) { #First guard att +ack srand; $stre=rand($guardonestr); $stren=rand($guardonestr); $streng = $stre + $stren; $vit -= $streng; print "You are hit by the first guard's pike f +or $streng damage!!\n"; }elsif ($dex3 > $dex1 && $dex2){ #Second guard att +ack srand; $stre=rand($guardtwostr); $stren=rand($guardtwostr); $streng = $stre + $stren; $vit -= $streng; print "You are hit by the second guard's knife + for $streng damage!!\n"; }else{ print "A clang of metal is heard as your sword + strikes against the second guard's dagger, the pike of the first bar +ely misses you.\n"; } if ($vitalityone < 0) { print "The first guard crumples, falling to th +e ground in a pool of his blood.\n"; while(($vit > 0) && ($vitalitytwo > 0)){ srand; $dex1=rand($dex); $dex3=rand($guardtwodex); if ($dex1 > $dex3) { print "Shall you...\n"; print "Attack guard two?(attacktwo)\n" +; print "Use Magic on guard two?(magictw +o)\n"; $choice = <STDIN>; chomp ($choice); if ($choice eq "attacktwo") { srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalitytwo -= $streng; print "You hit the second guard wi +th your sword for $streng damage!!\n"; }elsif ($choice eq "magictwo") { print "Which magical attack shall +you use?\n"; print "Dark Strike\n"; print "Shadow Dagger\n"; $magicatttwo = <STDIN>; chomp ($magicatttwo); if ($magicatttwo eq "Dark Strike") + { srand; $magdamage=rand($dstrike); $vitalitytwo -= $magdamage; print "Your paw darts forward. + A dark needle springs from the center, piercing into the second guar +d for $magdamage damage.\n"; }elsif ($magicatttwo eq "Shadow Da +gger") { srand; $magdamage=rand($sdagger); $vitalitytwo -= $magdamage; print "You summon a dagger com +posed of the shadows. You slash the second guard, wounding him for $m +agdamage damage.\n"; }else{ print "Your spell fails you an +d nothing happens..\n"; } }else{ print "You cannot remember a spell + quick enough, you attack instead.\n"; srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalitytwo -= $streng; print "You hit the second guard wi +th your sword for $streng damage!!\n"; } }elsif ($dex3 > $dex1){ srand; $stre=rand($guardtwostr); $stren=rand($guardtwostr); $streng = $stre + $stren; $vit -= $streng; print "You are hit by the second guard +'s knife for $streng damage!!\n"; }else{ print "Both blades strike together for + a moment before drawing back once again to attack.\n"; } if ($vit < 0){ print "You have died....\n"; } if ($vitalitytwo < 0){ print "The second guard succumbs to yo +ur attacks.\n"; } if ($vitalitytwo < 0) { print "The second guard succumbs to your attac +ks.\n"; while(($vit > 0) && ($vitvitalityone > 0)){ srand; $dex1=rand($dex); $dex2=rand($guardonedex); if ($dex1 > $dex2) { print "Shall you...\n"; print "Attack guard one?(attackone)\n" +; print "Use Magic on guard one?(magicon +e)\n"; $choice = <STDIN>; chomp ($choice); if ($choice eq "attackone") { srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalityone -= $streng; print "You hit the first guard wit +h your sword for $streng damage!!\n"; }elsif ($choice eq "magicone") { print "Which magical attack shall +you use?\n"; print "Dark Strike\n"; print "Shadow Dagger\n"; $magicattone = <STDIN>; chomp ($magicattone); if ($magicattone eq "Dark Strike") + { srand; $magdamage=rand($dstrike); $vitalityone -= $magdamage; print "Your paw darts forward. + A dark needle springs from the center, piercing into the first guard + for $magdamage damage.\n"; }elsif ($magicattone eq "Shadow Da +gger") { srand; $magdamage=rand($sdagger); $vitalityone -= $magdamage; print "You summon a dagger com +posed of the shadows. You slash the first guard, wounding him for $ma +gdamage damage.\n"; }else{ print "Your spell fails you an +d nothing happens..\n"; } }else{ print "You cannot remember a spell + quick enough, you attack instead.\n"; srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitalityone -= $streng; print "You hit the first guard wit +h your sword for $streng damage!!\n"; } }elsif ($dex2 > $dex1){ srand; $stre=rand($guardonestr); $stren=rand($guardonestr); $streng = $stre + $stren; $vit -= $streng; print "You are hit by the first guard' +s pike for $streng damage!!\n"; }else{ print "Both blades strike together for + a moment before drawing back once again to attack.\n"; } if ($vit < 0){ print "You have died....\n"; } if ($vitalitytwo < 0){ print "The second guard succumbs to yo +ur attacks.\n"; } } } print "Both guards lay at your feet, slain by your swo +rd. You feel no shame in taking the lives of these two. They hurt you +, took your Grandfather away, and for that you killed.\n"; print "\n"; print "The town is on alert now. Guards can be seen co +ming in the distance towards you. Quickly you shealth your blade, and + take off at a run for the nearby docks.\n"; print "Upon your arrival you see a ship, the Crimson J +ewel, departing from port. Running still, you unshealth your sword, a +nd leap towards the hull.\n"; }else{ print "This is not a choice!\n"; die; } sub combat { # Coding began Monday January 26th, 2004 # Last updated 26/01/04 # Monster combat routine # This is an actual working version of the "combat" routine from Syros +ian Legacy # will actually work. # version 1.8 # Fixed spell system # Added Spells # Added Spells # User stats are taken from earlier on $strength = 5; $dexterity = 5; $constitution = 2; $magic = 1; # Monster stats # Configuration of monster stats into health/mana points $vitality = $constitution * 5; $manapoints = $magic * 5; # Magic damage figures $fire = 5; $ice = 6; $bolt = 7; $quake = 8; $shadow = 9; while (($vit > 0) && ($vitality > 0)){ srand; $dex1=rand($dex); $dex2=rand($dexterity); if ($dex1 > $dex2) { print "Shall you...\n"; print "Attack?\n"; print "Use Magic?\n"; $choice = <STDIN>; chomp ($choice); if ($choice eq "attack") { srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $streng *= 1; $vitality -= $streng; print "You hit your opponent for $streng damage!!\n"; }elsif ($choice eq "magic") { if ($mana != 0) { print "Which magical attack shall you use?\n"; print "Fire\n"; print "Ice\n"; print "Bolt\n"; print "Quake\n"; print "Shadow\n"; $magchoice = <STDIN>; chomp ($magchoice); if ($magchoice eq "fire") { $mana -= 1; srand; $magdamage=rand($fire); $vitality -= $magdamage; print "You BURN your opponent for $magdamage damag +e!!\n"; }elsif ($magchoice eq "ice") { $mana -= 1; srand; $magdamage=rand($ice); $vitality -= $magdamage; print "You FREEZE your opponent for $magdamage dam +age!!\n"; }elsif ($magchoice eq "bolt") { $mana -= 2; srand; $magdamage=rand($bolt); $vitality -= $magdamage; print "You ZAP your opponent for $magdamage damage +!!\n"; }elsif ($magchoice eq "quake") { $mana -= 3; srand; $magdamage=rand($quake); $vitality -= $magdamage; print "You SHAKE your opponent for $magdamage dama +ge!!\n"; }elsif ($magchoice eq "shadow") { $mana -= 4; srand; $magdamage=rand($shadow); $vitality -= $magdamage; print "You DECAY your opponent for $magdamage dama +ge!!\n"; }else{ print "You mutter a bunch of gibberish and nothing + happens..\n"; } }else{ print "You cannot muster enough energy for a spell...you a +ttack instead\n"; srand; $stre=rand($str); $stren=rand($str); $streng = $stre + $stren; $vitality -= $streng; print "You hit your opponent for $streng; damage!!\n"; } } }else{ srand; $stre=rand($strength); $stren=rand($strength); $streng = $stre + $stren; $vit -= $streng; print "You are hit for $streng; damage!!\n"; } if ($vit <= 0) { print "You have been Knocked Out!!\n"; } if ($vitality <= 0) { print "You have Knocked Out your opponent!!\n"; } } }