Guest User

Untitled

a guest
May 27th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.44 KB | None | 0 0
  1. <?php
  2.  
  3. function probability2($chance, $out_of = 100)
  4. {
  5. $random = mt_rand(1, $out_of);
  6. if($random <= $chance)
  7. {
  8. echo <<<RESULT
  9. <fieldset style="background-image:url(background.jpg); color:white;">
  10. <legend>
  11. Result
  12. </legend>
  13. RESULT;
  14. echo "You attacked " . $ehero . " and missed! " . $ehero . " attacked you and missed!";
  15. echo "Round 1: You attacked " . $ehero . " and missed!";
  16. echo "<br />";
  17. echo "<br />";
  18. echo "Round 2: " . $ehero . " attacked you and missed!";
  19. echo "<br />";
  20. echo "<br />";
  21. echo "Final Result: Draw!";
  22. echo <<<FIELD
  23. </fieldset>
  24. FIELD;
  25. }
  26. else
  27. {
  28. function probability3($chance, $out_of = 100)
  29. {
  30. $random = mt_rand(1, $out_of);
  31. if($random <= $chance)
  32. {
  33. $mrexp=-2*$mrHealth;
  34. $mdexp=2*$mrHealth;
  35. $mkHealth=$mHealth;
  36. $NewPlayerHealth=0;
  37. $NewEnemyHealth=$eHealth;
  38. $erexp=2*$eexp;
  39. $mWin=0;
  40. $mLoss=1;
  41. $mKill=0;
  42. $mDeath=1;
  43. $eWin=1;
  44. $eLoss=0;
  45. $eKill=1;
  46. $eDeath=0;
  47.  
  48. echo <<<RESULT2
  49. <fieldset style="background-image:url(background.jpg); color:white;">
  50. <legend>
  51. Result
  52. </legend>
  53. RESULT2;
  54. echo "Round 1: You attacked " . $ehero . " and missed!";
  55. echo "<br />";
  56. echo "<br />";
  57. echo "Round 2: " . $ehero . " attacked you and scored a death blow! You were slain and lost " . $mdexp . " experience!";
  58. echo "<br />";
  59. echo "<br />";
  60. echo "Final Result: Loss!";
  61. echo <<<FIELD2
  62. </fieldset>
  63. FIELD2;
  64. }
  65. else
  66. {
  67. function probability4($chance, $out_of = 100)
  68. {
  69. $random = mt_rand(1, $out_of);
  70. if($random <= $chance)
  71. {
  72. $battleresult2=$eascore-$mdscore;
  73.  
  74. $mrHealth=floor(3*(($battleresult2*0.05)*$mMax));
  75. $newPlayerHealth=$mHealth-$mrHealth;
  76.  
  77. if($newPlayerHealth==0||$newPlayerHealth<0)
  78. {
  79. $nmHealth=0;
  80. }
  81. else
  82. {
  83. $nmHealth=$newPlayerHealth;
  84. }
  85.  
  86. if($nmHealth==0)
  87. {
  88. $mrexp=-2*($mrHealth/3);
  89. $mdexp=2*$mrHealth;
  90. $mkHealth=$mHealth;
  91. $NewPlayerHealth=0;
  92. $NewEnemyHealth=$eHealth;
  93. $erexp=2*$eexp;
  94. $mWin=0;
  95. $mLoss=1;
  96. $mKill=0;
  97. $mDeath=1;
  98. $eWin=1;
  99. $eLoss=0;
  100. $eKill=1;
  101. $eDeath=0;
  102.  
  103. echo <<<RESULT5
  104. <fieldset style="background-image:url(background.jpg); color:white;">
  105. <legend>
  106. Result
  107. </legend>
  108. RESULT5;
  109. echo "Round 1: You attacked " . $ehero . " and missed!";
  110. echo "<br />";
  111. echo "<br />";
  112. echo "Round 2: " . $ehero . " attacked you and scored a critical hit! You were slain and lost " . $mdexp . " experience!";
  113. echo "<br />";
  114. echo "<br />";
  115. echo "Final Result: Loss!";
  116. echo <<<FIELD5
  117. </fieldset>
  118. FIELD5;
  119. }
  120. else
  121. {
  122. $mrexp=0;
  123. $mdexp=0;
  124. $mkHealth=$mrHealth;
  125. $NewPlayerHealth=$newPlayerHealth;
  126. $NewEnemyHealth=$eHealth;
  127. $erexp=$eexp;
  128. $mWin=0;
  129. $mLoss=1;
  130. $mKill=0;
  131. $mDeath=0;
  132. $eWin=1;
  133. $eLoss=0;
  134. $eKill=0;
  135. $eDeath=0;
  136.  
  137. echo <<<RESULT5
  138. <fieldset style="background-image:url(background.jpg); color:white;">
  139. <legend>
  140. Result
  141. </legend>
  142. RESULT5;
  143. echo "Round 1: You attacked " . $ehero . " and missed!";
  144. echo "<br />";
  145. echo "<br />";
  146. echo "Round 2: " . $ehero . " attacked you and scored a critical hit! You were defeated and lost " . $mdexp . " experience and " . $mkHealth . " health!";
  147. echo "<br />";
  148. echo "<br />";
  149. echo "Final Result: Loss!";
  150. echo <<<FIELD5
  151. </fieldset>
  152. FIELD5;
  153. }
  154.  
  155. }
  156. else
  157. {
  158. $battleresult2=$eascore-$mdscore;
  159.  
  160. $mrHealth=floor(($battleresult2*0.05)*$mMax);
  161. $newPlayerHealth=$mHealth-$mrHealth;
  162.  
  163. if($newPlayerHealth==0||$newPlayerHealth<0)
  164. {
  165. $nmHealth=0;
  166. }
  167. else
  168. {
  169. $nmHealth=$newPlayerHealth;
  170. }
  171.  
  172. if($nmHealth==0)
  173. {
  174. $mrexp=-2*$mrHealth;
  175. $mdexp=2*$mrHealth;
  176. $mkHealth=$mHealth;
  177. $NewPlayerHealth=0;
  178. $NewEnemyHealth=$eHealth;
  179. $erexp=2*$eexp;
  180. $mWin=0;
  181. $mLoss=1;
  182. $mKill=0;
  183. $mDeath=1;
  184. $eWin=1;
  185. $eLoss=0;
  186. $eKill=1;
  187. $eDeath=0;
  188.  
  189. echo <<<RESULT2
  190. <fieldset style="background-image:url(background.jpg); color:white;">
  191. <legend>
  192. Result
  193. </legend>
  194. RESULT2;
  195. echo "Round 1: You attacked " . $ehero . " and missed!";
  196. echo "<br />";
  197. echo "<br />";
  198. echo "Round 2: " . $ehero . " attacked you and scored a hit! You were slain and lost " . $mdexp . " experience!";
  199. echo "<br />";
  200. echo "<br />";
  201. echo "Final Result: Loss!";
  202. echo <<<FIELD2
  203. </fieldset>
  204. FIELD2;
  205. }
  206. else
  207. {
  208. $mrexp=-0;
  209. $mdexp=0;
  210. $mkHealth=$mrHealth;
  211. $NewPlayerHealth=$newPlayerHealth;
  212. $NewEnemyHealth=$eHealth;
  213. $erexp=$eexp;
  214. $mWin=0;
  215. $mLoss=1;
  216. $mKill=0;
  217. $mDeath=0;
  218. $eWin=1;
  219. $eLoss=0;
  220. $eKill=0;
  221. $eDeath=0;
  222.  
  223. echo <<<RESULT2
  224. <fieldset style="background-image:url(background.jpg); color:white;">
  225. <legend>
  226. Result
  227. </legend>
  228. RESULT2;
  229. echo "Round 1: You attacked " . $ehero . " and missed!";
  230. echo "<br />";
  231. echo "<br />";
  232. echo "Round 2: " . $ehero . " attacked you and scored a hit! You were defeated and lost " . $mdexp . " experience and " . $mkHealth . " health!";
  233. echo "<br />";
  234. echo "<br />";
  235. echo "Final Result: Loss!";
  236. echo <<<FIELD2
  237. </fieldset>
  238. FIELD2;
  239. }
  240. }
  241. }
  242.  
  243. $critchance1=(($eLuck*0.1)*$ebonus)+$ewCrit;;
  244.  
  245. if($critchance1<10)
  246. {
  247. $critchance2=round($critchance1,2);
  248. $critchance=$critchance2*100;
  249. }
  250. else
  251. {
  252. if($critchance1<1)
  253. {
  254. $critchance2=round($critchance1,1);
  255. $critchance=$critchance2*100;
  256. }
  257. else
  258. {
  259. $critchance2=round($critchance1,0);
  260. $critchance=$critchance2*100;
  261. }
  262. }
  263.  
  264. probability4($critchance,10000);
  265. }
  266. }
  267.  
  268. $deathchance1=($eFocus*0.01)+($ebonus*0.01);
  269.  
  270. if($deathchance1<10)
  271. {
  272. $deathchance2=round($deathchance1,2);
  273. $deathchance=$deathchance2*100;
  274. }
  275. else
  276. {
  277. if($deathchance1<1)
  278. {
  279. $deathchance2=round($deathchance1,1);
  280. $deathchance=$deathchance2*100;
  281. }
  282. else
  283. {
  284. $deathchance2=round($deathchance1,0);
  285. $deathchance=$deathchance2*100;
  286. }
  287. }
  288.  
  289. probability3($deathchance,10000);
  290.  
  291.  
  292.  
  293. $battleresult2=$eascore-$mdscore;
  294.  
  295. $mrHealth=*$battleresult2*0.05)*$mMax;
  296. $newPlayerHealth=$mHealth-$mrHealth;
  297.  
  298. if($newPlayerHealth==0||$newPlayerHealth<0)
  299. {
  300. $nmHealth=0;
  301. }
  302. else
  303. {
  304. $nmHealth=$newPlayerHealth;
  305. }
  306.  
  307. if($nmHealth==0)
  308. {
  309. $mrexp=-2*$mrHealth;
  310. $mkHealth=$mHealth;
  311. $NewPlayerHealth=0;
  312. $NewEnemyHealth=$eHealth;
  313. $erexp=2*$eexp;
  314. $mWin=0;
  315. $mLoss=1;
  316. $mKill=0;
  317. $mDeath=1;
  318. $eWin=1;
  319. $eLoss=0;
  320. $eKill=1;
  321. $eDeath=0;
  322.  
  323. echo <<<RESULT3
  324. <fieldset style="background-image:url(background.jpg); color:white;">
  325. <legend>
  326. Result
  327. </legend>
  328. RESULT3;
  329. echo "Round 1: You attacked " . $ehero . " and missed!";
  330. echo "<br />";
  331. echo "<br />";
  332. echo "Round 2: " . $ehero . " attacked you and scored a hit!";
  333. echo <<<FIELD3
  334. </fieldset>
  335. FIELD3;
  336. }
  337. else
  338. {
  339. if($battleresult2<1)
  340. {
  341. $outcome1="won";
  342. $outcome2="defeated";
  343. $outcome3="gained";
  344. $mrexp=-2*$mrHealth;
  345. $mkHealth=$mHealth;
  346. $NewPlayerHealth=0;
  347. $NewEnemyHealth=$eHealth;
  348. $erexp=2*$eexp;
  349. $mWin=0;
  350. $mLoss=1;
  351. $mKill=0;
  352. $mDeath=1;
  353. $eWin=1;
  354. $eLoss=0;
  355. $eKill=1;
  356. $eDeath=0;
  357.  
  358. echo <<<RESULT4
  359. <fieldset style="background-image:url(background.jpg); color:white;">
  360. <legend>
  361. Result
  362. </legend>
  363. RESULT4;
  364. 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!";
  365. echo <<<FIELD4
  366. </fieldset>
  367. FIELD4;
  368. }
  369. else
  370. {
  371. if($battleresult2>1)
  372. {
  373.  
  374. }
  375. else
  376. {
  377.  
  378. }
  379. }
  380. }
  381. }
  382. }
  383.  
  384.  
  385. $e1hitchance=$ebonus*100;
  386.  
  387. if($e1hitchance>100)
  388. {
  389. $e1hitchance=100;
  390. }
  391. else
  392. {
  393. $e1hitchance=$ebonus*100;
  394. }
  395.  
  396. $e2hitchance=$e1hitchance+(-10*$mbonus);
  397.  
  398. if($e2hitchance<10)
  399. {
  400. $e3hitchance=round($e2hitchance,2);
  401. $ehitchance=$e3hitchance*100;
  402. }
  403. else
  404. {
  405. $e3hitchance=round($e2hitchance,3);
  406. $ehitchance=$e3hitchance*100;
  407. }
  408.  
  409. probability2($mhitchance,10000);
  410.  
  411. $Fights=1;
  412.  
  413. ?>
Add Comment
Please, Sign In to add comment