# 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 higher 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 difficulty....\n"; print "a)easy b)medium c)hard (a,b,c)\n"; $diff = ; 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 = ; chomp ($ready); print "Alright, your first fight will be one-on-one versus a weak opponent\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 = ; 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 = ; 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 will increase.\n"; print "Seeing as how you successfully completed your last round, the arena gods shall grant you a boon.\n"; print "Con't (hit enter)\n"; $ready = ; chomp ($ready); print "Well then, you have three boons to choose from...choose wisely..\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 = ; chomp ($firstboon); if ($firstboon eq "weapon") { print "\n"; print "Ah, I see you have wished weapons. Your attacks have increased in strength.\n"; $str += 2; }elsif ($firstboon eq "magic") { print "\n"; print "Ah, I see you favour the arcane magics. More spells have 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 = ; chomp ($ready); $restore = $vitstat - vit; $vit = $restore; print "Good. Your vitality has been restored, and you are ready for the next round.\n"; print "In the next round you will fight two samurai. These are elite warriors.\n"; print "Each will attack you together as a team, and can easily take 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 = ; 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 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 = ; 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 $streng damage!!\n"; }elsif ($choice eq "magicone") { print "Which magical attack shall you use?\n"; print "Dark Strike\n"; print "Shadow Dagger\n"; $magicattone = ; 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 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 nothing happens..\n"; } }elsif ($choice eq "magictwo") { print "Which magical attack shall you use?\n"; print "Dark Strike\n"; print "Shadow Dagger\n"; $magicatttwo = ; 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 $magdamage 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 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 with your sword for $streng 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 damage!!\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 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 barely misses you.\n"; } if ($vitalityone < 0) { print "The first guard crumples, falling to the 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?(magictwo)\n"; $choice = ; 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 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 = ; 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 $magdamage 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 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 with 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 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?(magicone)\n"; $choice = ; 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 "magicone") { print "Which magical attack shall you use?\n"; print "Dark Strike\n"; print "Shadow Dagger\n"; $magicattone = ; 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 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 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 with 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 your attacks.\n"; } } } } } }