Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // comm
- function probability2a($chance, $out_of = 100)
- {
- $random = mt_rand(1, $out_of);
- if($random <= $chance)
- {
- function probability3a($chance, $out_of = 100)
- {
- $random = mt_rand(1, $out_of);
- if($random <= $chance)
- {
- $mrexp=-2*$mHealth;
- $mdexp=2*$mHealth;
- $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 scored a critical hit!";
- 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: Defeat!";
- echo <<<FIELD2
- </fieldset>
- FIELD2;
- }
- else
- {
- function probability4a($chance, $out_of = 100)
- {
- $random = mt_rand(1, $out_of);
- if($random <= $chance)
- {
- $battleresult2=(3*$eascore)-$mdscore;
- $mrHealth=floor(($battleresult2*0.05)*$mMax);
- $anewPlayerHealth=$mHealth-$mrHealth;
- if($anewPlayerHealth==0||$anewPlayerHealth<0)
- {
- $nmHealth=0;
- }
- else
- {
- $nmHealth=$anewPlayerHealth;
- }
- if($nmHealth==0)
- {
- $mrexp=-2*$mHealth;
- $mdexp=2*$mHealth;
- $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 scored a critical hit!";
- 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: Defeat!";
- echo <<<FIELD5
- </fieldset>
- FIELD5;
- }
- else
- {
- if($battlresult2>0)
- {
- if($battleresult1>$battleresult2)
- {
- $mrexp=0.5*$mexp;
- $mkHealth=$mrHealth;
- $NewPlayerHealth=$nmHealth;
- $NewEnemyHealth=$eHealth;
- $erexp=0;
- $mWin=1;
- $mLoss=0;
- $mKill=0;
- $mDeath=0;
- $eWin=0;
- $eLoss=1;
- $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 scored a critical hit!";
- echo "<br />";
- echo "<br />";
- echo "Round 2: " . $ehero . " attacked you and scored a critical hit, but you prevailed! You defeated " . $ehero . " and gained " . $mrexp . " experience and lost " . $mkHealth . " health!";
- echo "<br />";
- echo "<br />";
- echo "Final Result: victory!";
- echo <<<FIELD5
- </fieldset>
- FIELD5;
- }
- else
- {
- if($battleresult1<$battleresult2)
- {
- $mrexp=0;
- $mkHealth=$mrHealth;
- $NewPlayerHealth=$nmHealth;
- $NewEnemyHealth=$eHealth;
- $erexp=ceil(0.5*$eexp);
- $mWin=1;
- $mLoss=0;
- $mKill=0;
- $mDeath=0;
- $eWin=0;
- $eLoss=1;
- $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 scored a critical hit!";
- echo "<br />";
- echo "<br />";
- echo "Round 2: " . $ehero . " attacked you, scored a critical hit and prevailed! You were defeated by " . $ehero . " and lost " . $mkHealth . " health!";
- echo "<br />";
- echo "<br />";
- echo "Final Result: Defeat!";
- echo <<<FIELD5
- </fieldset>
- FIELD5;
- }
- else
- {
- $mrexp=0;
- $mkHealth=$mrHealth;
- $NewPlayerHealth=$nmHealth;
- $NewEnemyHealth=$eHealth;
- $erexp=0;
- $mWin=0;
- $mLoss=0;
- $mKill=0;
- $mDeath=0;
- $eWin=0;
- $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 scored a critical hit!";
- echo "<br />";
- echo "<br />";
- echo "Round 2: " . $ehero . " attacked you and scored a critical hit, but there was no clear victor! You lost " . $mkHealth . " in the duel!";
- echo "<br />";
- echo "<br />";
- echo "Final Result: Draw!";
- echo <<<FIELD5
- </fieldset>
- FIELD5;
- }
- }
- }
- else
- {
- $mrexp=$mexp;
- $mkHealth=0;
- $NewPlayerHealth=$mHealth;
- $NewEnemyHealth=$eHealth;
- $erexp=0;
- $mWin=1;
- $mLoss=0;
- $mKill=0;
- $mDeath=0;
- $eWin=0;
- $eLoss=1;
- $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 scored a critical hit!";
- echo "<br />";
- echo "<br />";
- echo "Round 2: " . $ehero . " attacked you and scored a hit, however, you took no damage! You defeated " . $ehero . " and gained " . $mrexp . " experience!";
- echo "<br />";
- echo "<br />";
- echo "Final Result: Victory!";
- echo <<<FIELD5
- </fieldset>
- FIELD5;
- }
- }
- }
- else
- {
- $battleresult2=$eascore-$mdscore;
- $mrHealth=floor(($battleresult2*0.05)*$mMax);
- $anewPlayerHealth=$mHealth-$mrHealth;
- if($anewPlayerHealth==0||$anewPlayerHealth<0)
- {
- $nmHealth=0;
- }
- else
- {
- $nmHealth=$anewPlayerHealth;
- }
- if($nmHealth==0)
- {
- $mrexp=-2*$mHealth;
- $mdexp=2*$mHealth;
- $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 scored a critical hit!";
- 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: Defeat!";
- echo <<<FIELD2
- </fieldset>
- FIELD2;
- }
- else
- {
- if($battleresult2>0)
- {
- if($battleresult1>$battleresult2)
- {
- $mrexp=ceil(0.5*$mexp);
- $mkHealth=$mrHealth;
- $NewPlayerHealth=$nmHealth;
- $NewEnemyHealth=$eHealth;
- $erexp=0;
- $mWin=1;
- $mLoss=0;
- $mKill=0;
- $mDeath=0;
- $eWin=0;
- $eLoss=1;
- $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 scored a critical hit!";
- echo "<br />";
- echo "<br />";
- echo "Round 2: " . $ehero . " attacked you and scored a hit, but you prevailed! You defeated " . $ehero . " and gained " . $mrexp . " experience and lost " . $mkHealth . " health!";
- echo "<br />";
- echo "<br />";
- echo "Final Result: Victory!";
- echo <<<FIELD5
- </fieldset>
- FIELD5;
- }
- else
- {
- if($battleresult1<$battleresult2)
- {
- $mrexp=0;
- $mkHealth=$mrHealth;
- $NewPlayerHealth=$nmHealth;
- $NewEnemyHealth=$eHealth;
- $erexp=ceil(0.5*$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 scored a critical hit!";
- echo "<br />";
- echo "<br />";
- echo "Round 2: " . $ehero . " attacked you, scored a hit and prevailed! You were defeated by " . $ehero . " and lost " . $mkHealth . " health!";
- echo "<br />";
- echo "<br />";
- echo "Final Result: Defeat!";
- echo <<<FIELD5
- </fieldset>
- FIELD5;
- }
- else
- {
- $mrexp=0;
- $mkHealth=$mrHealth;
- $NewPlayerHealth=$nmHealth;
- $NewEnemyHealth=$eHealth;
- $erexp=0;
- $mWin=0;
- $mLoss=0;
- $mKill=0;
- $mDeath=0;
- $eWin=0;
- $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 scored a critical hit!";
- echo "<br />";
- echo "<br />";
- echo "Round 2: " . $ehero . " attacked you and scored a hit, but there was no clear victor! You lost " . $mkHealth . " in the duel!";
- echo "<br />";
- echo "<br />";
- echo "Final Result: Draw!";
- echo <<<FIELD5
- </fieldset>
- FIELD5;
- }
- }
- }
- else
- {
- $mrexp=$mexp;
- $mkHealth=0;
- $NewPlayerHealth=$mHealth;
- $NewEnemyHealth=$eHealth;
- $erexp=0;
- $mWin=1;
- $mLoss=0;
- $mKill=0;
- $mDeath=0;
- $eWin=0;
- $eLoss=1;
- $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 scored a critical hit!";
- echo "<br />";
- echo "<br />";
- echo "Round 2: " . $ehero . " attacked you and scored a hit, however, you took no damage! You defeated " . $ehero . " and gained " . $mrexp . " experience!";
- echo "<br />";
- echo "<br />";
- echo "Final Result: Victory!";
- echo <<<FIELD2
- </fieldset>
- FIELD2;
- }
- }
- }
- }
- $ecritchance1=(($eLuck*0.1)*$ebonus)+$ewCrit;;
- if($ecritchance1<10)
- {
- $ecritchance2=round($ecritchance1,2);
- $ecritchance=$ecritchance2*100;
- }
- else
- {
- if($ecritchance1<1)
- {
- $ecritchance2=round($ecritchance1,1);
- $ecritchance=$ecritchance2*100;
- }
- else
- {
- if($ecritchance1<0.1)
- {
- $ecritchance2=round($ecritchance1,0);
- $ecritchance=$ecritchance2*100;
- }
- else
- {
- $ecritchance2=round($ecritchance1,3);
- $ecritchance=$ecritchance2*100;
- }
- }
- }
- probability4a($ecritchance,10000);
- }
- }
- $edeathchance1=($eFocus*0.01)+($ebonus*0.01);
- if($edeathchance1<10)
- {
- $edeathchance2=round($edeathchance1,2);
- $edeathchance=$edeathchance2*100;
- }
- else
- {
- if($edeathchance1<1)
- {
- $edeathchance2=round($edeathchance1,1);
- $edeathchance=$edeathchance2*100;
- }
- else
- {
- if($edeathchance1<0.1)
- {
- $edeathchance2=round($edeathchance1,0);
- $edeathchance=$edeathchance2*100;
- }
- else
- {
- $edeathchance2=round($edeathchance1,3);
- $edeathchance=$edeathchance2*100;
- }
- }
- }
- probability3a($edeathchance,10000);
- }
- else
- {
- $mrexp=$mexp;
- $mkHealth=0;
- $NewPlayerHealth=$mHealth;
- $NewEnemyHealth=$eHealth;
- $erexp=0;
- $mWin=1;
- $mLoss=0;
- $mKill=0;
- $mDeath=0;
- $eWin=0;
- $eLoss=1;
- $eKill=0;
- $eDeath=0;
- echo <<<RESULT
- <fieldset style="background-image:url(background.jpg); color:white;">
- <legend>
- Result
- </legend>
- RESULT;
- echo "Round 1: You attacked " . $ehero . " and scored a critical hit!";
- echo "<br />";
- echo "<br />";
- echo "Round 2: " . $ehero . " attacked you and missed! You defeated " . $ehero . " and gained " . $mrexp . " experience!";
- echo "<br />";
- echo "<br />";
- echo "Final Result: Victory!";
- echo <<<FIELD
- </fieldset>
- FIELD;
- }
- }
- $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
- {
- if($e2hitchance<1)
- {
- $e3hitchance=round($e2hitchance,2);
- $ehitchance=$e3hitchance*100;
- }
- else
- {
- if($e2hitchance<0.1)
- {
- $e3hitchance=round($e2hitchance,0);
- $ehitchance=$e3hitchance*100;
- }
- else
- {
- $e3hitchance=round($e2hitchance,3);
- $ehitchance=$e3hitchance*100;
- }
- }
- }
- probability2a($mhitchance,10000);
- ?>
Add Comment
Please, Sign In to add comment