Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function probability2($chance, $out_of = 100)
- {
- $random = mt_rand(1, $out_of);
- if($random <= $chance)
- {
- echo <<<RESULT
- <fieldset style="background-image:url(background.jpg); color:white;">
- <legend>
- Result
- </legend>
- RESULT;
- echo "You attacked " . $ehero . " and missed! " . $ehero . " attacked you and missed!";
- echo "Round 1: You attacked " . $ehero . " and missed!";
- echo "<br />";
- echo "<br />";
- echo "Round 2: " . $ehero . " attacked you and missed!";
- echo "<br />";
- echo "<br />";
- echo "Final Result: Draw!";
- echo <<<FIELD
- </fieldset>
- FIELD;
- }
- else
- {
- function probability3($chance, $out_of = 100)
- {
- $random = mt_rand(1, $out_of);
- if($random <= $chance)
- {
- $mrexp=-2*$mrHealth;
- $mdexp=2*$mrHealth;
- $mkHealth=$mHealth;
- $NewPlayerHealth=0;
- $NewEnemyHealth=$eHealth;
- $erexp=2*$eexp;
- $mWin=0;
- $mLoss=1;
- $mKill=0;
- $mDeath=1;
- $eWin=1;
- $eLoss=0;
- $eKill=1;
- $eDeath=0;
- echo <<<RESULT2
- <fieldset style="background-image:url(background.jpg); color:white;">
- <legend>
- Result
- </legend>
- RESULT2;
- echo "Round 1: You attacked " . $ehero . " and missed!";
- echo "<br />";
- echo "<br />";
- echo "Round 2: " . $ehero . " attacked you and scored a death blow! You were slain and lost " . $mdexp . " experience!";
- echo "<br />";
- echo "<br />";
- echo "Final Result: Loss!";
- echo <<<FIELD2
- </fieldset>
- FIELD2;
- }
- else
- {
- function probability4($chance, $out_of = 100)
- {
- $random = mt_rand(1, $out_of);
- if($random <= $chance)
- {
- $battleresult2=$eascore-$mdscore;
- $mrHealth=floor(3*(($battleresult2*0.05)*$mMax));
- $newPlayerHealth=$mHealth-$mrHealth;
- if($newPlayerHealth==0||$newPlayerHealth<0)
- {
- $nmHealth=0;
- }
- else
- {
- $nmHealth=$newPlayerHealth;
- }
- if($nmHealth==0)
- {
- $mrexp=-2*($mrHealth/3);
- $mdexp=2*$mrHealth;
- $mkHealth=$mHealth;
- $NewPlayerHealth=0;
- $NewEnemyHealth=$eHealth;
- $erexp=2*$eexp;
- $mWin=0;
- $mLoss=1;
- $mKill=0;
- $mDeath=1;
- $eWin=1;
- $eLoss=0;
- $eKill=1;
- $eDeath=0;
- echo <<<RESULT5
- <fieldset style="background-image:url(background.jpg); color:white;">
- <legend>
- Result
- </legend>
- RESULT5;
- echo "Round 1: You attacked " . $ehero . " and missed!";
- echo "<br />";
- echo "<br />";
- echo "Round 2: " . $ehero . " attacked you and scored a critical hit! You were slain and lost " . $mdexp . " experience!";
- echo "<br />";
- echo "<br />";
- echo "Final Result: Loss!";
- echo <<<FIELD5
- </fieldset>
- FIELD5;
- }
- else
- {
- $mrexp=0;
- $mdexp=0;
- $mkHealth=$mrHealth;
- $NewPlayerHealth=$newPlayerHealth;
- $NewEnemyHealth=$eHealth;
- $erexp=$eexp;
- $mWin=0;
- $mLoss=1;
- $mKill=0;
- $mDeath=0;
- $eWin=1;
- $eLoss=0;
- $eKill=0;
- $eDeath=0;
- echo <<<RESULT5
- <fieldset style="background-image:url(background.jpg); color:white;">
- <legend>
- Result
- </legend>
- RESULT5;
- echo "Round 1: You attacked " . $ehero . " and missed!";
- echo "<br />";
- echo "<br />";
- echo "Round 2: " . $ehero . " attacked you and scored a critical hit! You were defeated and lost " . $mdexp . " experience and " . $mkHealth . " health!";
- echo "<br />";
- echo "<br />";
- echo "Final Result: Loss!";
- echo <<<FIELD5
- </fieldset>
- FIELD5;
- }
- }
- else
- {
- $battleresult2=$eascore-$mdscore;
- $mrHealth=floor(($battleresult2*0.05)*$mMax);
- $newPlayerHealth=$mHealth-$mrHealth;
- if($newPlayerHealth==0||$newPlayerHealth<0)
- {
- $nmHealth=0;
- }
- else
- {
- $nmHealth=$newPlayerHealth;
- }
- if($nmHealth==0)
- {
- $mrexp=-2*$mrHealth;
- $mdexp=2*$mrHealth;
- $mkHealth=$mHealth;
- $NewPlayerHealth=0;
- $NewEnemyHealth=$eHealth;
- $erexp=2*$eexp;
- $mWin=0;
- $mLoss=1;
- $mKill=0;
- $mDeath=1;
- $eWin=1;
- $eLoss=0;
- $eKill=1;
- $eDeath=0;
- echo <<<RESULT2
- <fieldset style="background-image:url(background.jpg); color:white;">
- <legend>
- Result
- </legend>
- RESULT2;
- echo "Round 1: You attacked " . $ehero . " and missed!";
- echo "<br />";
- echo "<br />";
- echo "Round 2: " . $ehero . " attacked you and scored a hit! You were slain and lost " . $mdexp . " experience!";
- echo "<br />";
- echo "<br />";
- echo "Final Result: Loss!";
- echo <<<FIELD2
- </fieldset>
- FIELD2;
- }
- else
- {
- $mrexp=-0;
- $mdexp=0;
- $mkHealth=$mrHealth;
- $NewPlayerHealth=$newPlayerHealth;
- $NewEnemyHealth=$eHealth;
- $erexp=$eexp;
- $mWin=0;
- $mLoss=1;
- $mKill=0;
- $mDeath=0;
- $eWin=1;
- $eLoss=0;
- $eKill=0;
- $eDeath=0;
- echo <<<RESULT2
- <fieldset style="background-image:url(background.jpg); color:white;">
- <legend>
- Result
- </legend>
- RESULT2;
- echo "Round 1: You attacked " . $ehero . " and missed!";
- echo "<br />";
- echo "<br />";
- echo "Round 2: " . $ehero . " attacked you and scored a hit! You were defeated and lost " . $mdexp . " experience and " . $mkHealth . " health!";
- echo "<br />";
- echo "<br />";
- echo "Final Result: Loss!";
- echo <<<FIELD2
- </fieldset>
- FIELD2;
- }
- }
- }
- $critchance1=(($eLuck*0.1)*$ebonus)+$ewCrit;;
- if($critchance1<10)
- {
- $critchance2=round($critchance1,2);
- $critchance=$critchance2*100;
- }
- else
- {
- if($critchance1<1)
- {
- $critchance2=round($critchance1,1);
- $critchance=$critchance2*100;
- }
- else
- {
- $critchance2=round($critchance1,0);
- $critchance=$critchance2*100;
- }
- }
- probability4($critchance,10000);
- }
- }
- $deathchance1=($eFocus*0.01)+($ebonus*0.01);
- if($deathchance1<10)
- {
- $deathchance2=round($deathchance1,2);
- $deathchance=$deathchance2*100;
- }
- else
- {
- if($deathchance1<1)
- {
- $deathchance2=round($deathchance1,1);
- $deathchance=$deathchance2*100;
- }
- else
- {
- $deathchance2=round($deathchance1,0);
- $deathchance=$deathchance2*100;
- }
- }
- probability3($deathchance,10000);
- $battleresult2=$eascore-$mdscore;
- $mrHealth=*$battleresult2*0.05)*$mMax;
- $newPlayerHealth=$mHealth-$mrHealth;
- if($newPlayerHealth==0||$newPlayerHealth<0)
- {
- $nmHealth=0;
- }
- else
- {
- $nmHealth=$newPlayerHealth;
- }
- if($nmHealth==0)
- {
- $mrexp=-2*$mrHealth;
- $mkHealth=$mHealth;
- $NewPlayerHealth=0;
- $NewEnemyHealth=$eHealth;
- $erexp=2*$eexp;
- $mWin=0;
- $mLoss=1;
- $mKill=0;
- $mDeath=1;
- $eWin=1;
- $eLoss=0;
- $eKill=1;
- $eDeath=0;
- echo <<<RESULT3
- <fieldset style="background-image:url(background.jpg); color:white;">
- <legend>
- Result
- </legend>
- RESULT3;
- echo "Round 1: You attacked " . $ehero . " and missed!";
- echo "<br />";
- echo "<br />";
- echo "Round 2: " . $ehero . " attacked you and scored a hit!";
- echo <<<FIELD3
- </fieldset>
- FIELD3;
- }
- else
- {
- if($battleresult2<1)
- {
- $outcome1="won";
- $outcome2="defeated";
- $outcome3="gained";
- $mrexp=-2*$mrHealth;
- $mkHealth=$mHealth;
- $NewPlayerHealth=0;
- $NewEnemyHealth=$eHealth;
- $erexp=2*$eexp;
- $mWin=0;
- $mLoss=1;
- $mKill=0;
- $mDeath=1;
- $eWin=1;
- $eLoss=0;
- $eKill=1;
- $eDeath=0;
- echo <<<RESULT4
- <fieldset style="background-image:url(background.jpg); color:white;">
- <legend>
- Result
- </legend>
- RESULT4;
- echo "You attacked " . $ehero . " and missed! " . $ehero . " attacked you and you " . $outcome1 . "! You were the overall winner! You " . $outcome2 . " " . $ehero . " in the fight and " . $outcome3 . " " . -$mrexp . " experience and " . $outcome3 . " " . $mkHealth . " health!";
- echo <<<FIELD4
- </fieldset>
- FIELD4;
- }
- else
- {
- if($battleresult2>1)
- {
- }
- else
- {
- }
- }
- }
- }
- }
- $e1hitchance=$ebonus*100;
- if($e1hitchance>100)
- {
- $e1hitchance=100;
- }
- else
- {
- $e1hitchance=$ebonus*100;
- }
- $e2hitchance=$e1hitchance+(-10*$mbonus);
- if($e2hitchance<10)
- {
- $e3hitchance=round($e2hitchance,2);
- $ehitchance=$e3hitchance*100;
- }
- else
- {
- $e3hitchance=round($e2hitchance,3);
- $ehitchance=$e3hitchance*100;
- }
- probability2($mhitchance,10000);
- $Fights=1;
- ?>
Add Comment
Please, Sign In to add comment