Guest User

Untitled

a guest
May 27th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.88 KB | None | 0 0
  1. <?php
  2. // comm
  3. function probability2a($chance, $out_of = 100)
  4. {
  5. $random = mt_rand(1, $out_of);
  6. if($random <= $chance)
  7. {
  8. function probability3a($chance, $out_of = 100)
  9. {
  10. $random = mt_rand(1, $out_of);
  11. if($random <= $chance)
  12. {
  13. $mrexp=-2*$mHealth;
  14. $mdexp=2*$mHealth;
  15. $mkHealth=$mHealth;
  16. $NewPlayerHealth=0;
  17. $NewEnemyHealth=$eHealth;
  18. $erexp=2*$eexp;
  19. $mWin=0;
  20. $mLoss=1;
  21. $mKill=0;
  22. $mDeath=1;
  23. $eWin=1;
  24. $eLoss=0;
  25. $eKill=1;
  26. $eDeath=0;
  27.  
  28. echo <<<RESULT2
  29. <fieldset style="background-image:url(background.jpg); color:white;">
  30. <legend>
  31. Result
  32. </legend>
  33. RESULT2;
  34. echo "Round 1: You attacked " . $ehero . " and scored a critical hit!";
  35. echo "<br />";
  36. echo "<br />";
  37. echo "Round 2: " . $ehero . " attacked you and scored a death blow! You were slain and lost " . $mdexp . " experience!";
  38. echo "<br />";
  39. echo "<br />";
  40. echo "Final Result: Defeat!";
  41. echo <<<FIELD2
  42. </fieldset>
  43. FIELD2;
  44. }
  45. else
  46. {
  47. function probability4a($chance, $out_of = 100)
  48. {
  49. $random = mt_rand(1, $out_of);
  50. if($random <= $chance)
  51. {
  52. $battleresult2=(3*$eascore)-$mdscore;
  53.  
  54. $mrHealth=floor(($battleresult2*0.05)*$mMax);
  55. $anewPlayerHealth=$mHealth-$mrHealth;
  56.  
  57. if($anewPlayerHealth==0||$anewPlayerHealth<0)
  58. {
  59. $nmHealth=0;
  60. }
  61. else
  62. {
  63. $nmHealth=$anewPlayerHealth;
  64. }
  65.  
  66. if($nmHealth==0)
  67. {
  68. $mrexp=-2*$mHealth;
  69. $mdexp=2*$mHealth;
  70. $mkHealth=$mHealth;
  71. $NewPlayerHealth=0;
  72. $NewEnemyHealth=$eHealth;
  73. $erexp=2*$eexp;
  74. $mWin=0;
  75. $mLoss=1;
  76. $mKill=0;
  77. $mDeath=1;
  78. $eWin=1;
  79. $eLoss=0;
  80. $eKill=1;
  81. $eDeath=0;
  82.  
  83. echo <<<RESULT5
  84. <fieldset style="background-image:url(background.jpg); color:white;">
  85. <legend>
  86. Result
  87. </legend>
  88. RESULT5;
  89. echo "Round 1: You attacked " . $ehero . " and scored a critical hit!";
  90. echo "<br />";
  91. echo "<br />";
  92. echo "Round 2: " . $ehero . " attacked you and scored a critical hit! You were slain and lost " . $mdexp . " experience!";
  93. echo "<br />";
  94. echo "<br />";
  95. echo "Final Result: Defeat!";
  96. echo <<<FIELD5
  97. </fieldset>
  98. FIELD5;
  99. }
  100. else
  101. {
  102. if($battlresult2>0)
  103. {
  104. if($battleresult1>$battleresult2)
  105. {
  106. $mrexp=0.5*$mexp;
  107. $mkHealth=$mrHealth;
  108. $NewPlayerHealth=$nmHealth;
  109. $NewEnemyHealth=$eHealth;
  110. $erexp=0;
  111. $mWin=1;
  112. $mLoss=0;
  113. $mKill=0;
  114. $mDeath=0;
  115. $eWin=0;
  116. $eLoss=1;
  117. $eKill=0;
  118. $eDeath=0;
  119.  
  120. echo <<<RESULT5
  121. <fieldset style="background-image:url(background.jpg); color:white;">
  122. <legend>
  123. Result
  124. </legend>
  125. RESULT5;
  126. echo "Round 1: You attacked " . $ehero . " and scored a critical hit!";
  127. echo "<br />";
  128. echo "<br />";
  129. 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!";
  130. echo "<br />";
  131. echo "<br />";
  132. echo "Final Result: victory!";
  133. echo <<<FIELD5
  134. </fieldset>
  135. FIELD5;
  136. }
  137. else
  138. {
  139. if($battleresult1<$battleresult2)
  140. {
  141. $mrexp=0;
  142. $mkHealth=$mrHealth;
  143. $NewPlayerHealth=$nmHealth;
  144. $NewEnemyHealth=$eHealth;
  145. $erexp=ceil(0.5*$eexp);
  146. $mWin=1;
  147. $mLoss=0;
  148. $mKill=0;
  149. $mDeath=0;
  150. $eWin=0;
  151. $eLoss=1;
  152. $eKill=0;
  153. $eDeath=0;
  154.  
  155. echo <<<RESULT5
  156. <fieldset style="background-image:url(background.jpg); color:white;">
  157. <legend>
  158. Result
  159. </legend>
  160. RESULT5;
  161. echo "Round 1: You attacked " . $ehero . " and scored a critical hit!";
  162. echo "<br />";
  163. echo "<br />";
  164. echo "Round 2: " . $ehero . " attacked you, scored a critical hit and prevailed! You were defeated by " . $ehero . " and lost " . $mkHealth . " health!";
  165. echo "<br />";
  166. echo "<br />";
  167. echo "Final Result: Defeat!";
  168. echo <<<FIELD5
  169. </fieldset>
  170. FIELD5;
  171. }
  172. else
  173. {
  174. $mrexp=0;
  175. $mkHealth=$mrHealth;
  176. $NewPlayerHealth=$nmHealth;
  177. $NewEnemyHealth=$eHealth;
  178. $erexp=0;
  179. $mWin=0;
  180. $mLoss=0;
  181. $mKill=0;
  182. $mDeath=0;
  183. $eWin=0;
  184. $eLoss=0;
  185. $eKill=0;
  186. $eDeath=0;
  187.  
  188. echo <<<RESULT5
  189. <fieldset style="background-image:url(background.jpg); color:white;">
  190. <legend>
  191. Result
  192. </legend>
  193. RESULT5;
  194. echo "Round 1: You attacked " . $ehero . " and scored a critical hit!";
  195. echo "<br />";
  196. echo "<br />";
  197. echo "Round 2: " . $ehero . " attacked you and scored a critical hit, but there was no clear victor! You lost " . $mkHealth . " in the duel!";
  198. echo "<br />";
  199. echo "<br />";
  200. echo "Final Result: Draw!";
  201. echo <<<FIELD5
  202. </fieldset>
  203. FIELD5;
  204. }
  205. }
  206. }
  207. else
  208. {
  209. $mrexp=$mexp;
  210. $mkHealth=0;
  211. $NewPlayerHealth=$mHealth;
  212. $NewEnemyHealth=$eHealth;
  213. $erexp=0;
  214. $mWin=1;
  215. $mLoss=0;
  216. $mKill=0;
  217. $mDeath=0;
  218. $eWin=0;
  219. $eLoss=1;
  220. $eKill=0;
  221. $eDeath=0;
  222.  
  223. echo <<<RESULT5
  224. <fieldset style="background-image:url(background.jpg); color:white;">
  225. <legend>
  226. Result
  227. </legend>
  228. RESULT5;
  229. echo "Round 1: You attacked " . $ehero . " and scored a critical hit!";
  230. echo "<br />";
  231. echo "<br />";
  232. echo "Round 2: " . $ehero . " attacked you and scored a hit, however, you took no damage! You defeated " . $ehero . " and gained " . $mrexp . " experience!";
  233. echo "<br />";
  234. echo "<br />";
  235. echo "Final Result: Victory!";
  236. echo <<<FIELD5
  237. </fieldset>
  238. FIELD5;
  239. }
  240. }
  241. }
  242. else
  243. {
  244. $battleresult2=$eascore-$mdscore;
  245.  
  246. $mrHealth=floor(($battleresult2*0.05)*$mMax);
  247. $anewPlayerHealth=$mHealth-$mrHealth;
  248.  
  249. if($anewPlayerHealth==0||$anewPlayerHealth<0)
  250. {
  251. $nmHealth=0;
  252. }
  253. else
  254. {
  255. $nmHealth=$anewPlayerHealth;
  256. }
  257.  
  258. if($nmHealth==0)
  259. {
  260. $mrexp=-2*$mHealth;
  261. $mdexp=2*$mHealth;
  262. $mkHealth=$mHealth;
  263. $NewPlayerHealth=0;
  264. $NewEnemyHealth=$eHealth;
  265. $erexp=2*$eexp;
  266. $mWin=0;
  267. $mLoss=1;
  268. $mKill=0;
  269. $mDeath=1;
  270. $eWin=1;
  271. $eLoss=0;
  272. $eKill=1;
  273. $eDeath=0;
  274.  
  275. echo <<<RESULT2
  276. <fieldset style="background-image:url(background.jpg); color:white;">
  277. <legend>
  278. Result
  279. </legend>
  280. RESULT2;
  281. echo "Round 1: You attacked " . $ehero . " and scored a critical hit!";
  282. echo "<br />";
  283. echo "<br />";
  284. echo "Round 2: " . $ehero . " attacked you and scored a hit! You were slain and lost " . $mdexp . " experience!";
  285. echo "<br />";
  286. echo "<br />";
  287. echo "Final Result: Defeat!";
  288. echo <<<FIELD2
  289. </fieldset>
  290. FIELD2;
  291. }
  292. else
  293. {
  294. if($battleresult2>0)
  295. {
  296. if($battleresult1>$battleresult2)
  297. {
  298. $mrexp=ceil(0.5*$mexp);
  299. $mkHealth=$mrHealth;
  300. $NewPlayerHealth=$nmHealth;
  301. $NewEnemyHealth=$eHealth;
  302. $erexp=0;
  303. $mWin=1;
  304. $mLoss=0;
  305. $mKill=0;
  306. $mDeath=0;
  307. $eWin=0;
  308. $eLoss=1;
  309. $eKill=0;
  310. $eDeath=0;
  311.  
  312. echo <<<RESULT5
  313. <fieldset style="background-image:url(background.jpg); color:white;">
  314. <legend>
  315. Result
  316. </legend>
  317. RESULT5;
  318. echo "Round 1: You attacked " . $ehero . " and scored a critical hit!";
  319. echo "<br />";
  320. echo "<br />";
  321. echo "Round 2: " . $ehero . " attacked you and scored a hit, but you prevailed! You defeated " . $ehero . " and gained " . $mrexp . " experience and lost " . $mkHealth . " health!";
  322. echo "<br />";
  323. echo "<br />";
  324. echo "Final Result: Victory!";
  325. echo <<<FIELD5
  326. </fieldset>
  327. FIELD5;
  328. }
  329. else
  330. {
  331. if($battleresult1<$battleresult2)
  332. {
  333. $mrexp=0;
  334. $mkHealth=$mrHealth;
  335. $NewPlayerHealth=$nmHealth;
  336. $NewEnemyHealth=$eHealth;
  337. $erexp=ceil(0.5*$eexp);
  338. $mWin=0;
  339. $mLoss=1;
  340. $mKill=0;
  341. $mDeath=0;
  342. $eWin=1;
  343. $eLoss=0;
  344. $eKill=0;
  345. $eDeath=0;
  346.  
  347. echo <<<RESULT5
  348. <fieldset style="background-image:url(background.jpg); color:white;">
  349. <legend>
  350. Result
  351. </legend>
  352. RESULT5;
  353. echo "Round 1: You attacked " . $ehero . " and scored a critical hit!";
  354. echo "<br />";
  355. echo "<br />";
  356. echo "Round 2: " . $ehero . " attacked you, scored a hit and prevailed! You were defeated by " . $ehero . " and lost " . $mkHealth . " health!";
  357. echo "<br />";
  358. echo "<br />";
  359. echo "Final Result: Defeat!";
  360. echo <<<FIELD5
  361. </fieldset>
  362. FIELD5;
  363. }
  364. else
  365. {
  366. $mrexp=0;
  367. $mkHealth=$mrHealth;
  368. $NewPlayerHealth=$nmHealth;
  369. $NewEnemyHealth=$eHealth;
  370. $erexp=0;
  371. $mWin=0;
  372. $mLoss=0;
  373. $mKill=0;
  374. $mDeath=0;
  375. $eWin=0;
  376. $eLoss=0;
  377. $eKill=0;
  378. $eDeath=0;
  379.  
  380. echo <<<RESULT5
  381. <fieldset style="background-image:url(background.jpg); color:white;">
  382. <legend>
  383. Result
  384. </legend>
  385. RESULT5;
  386. echo "Round 1: You attacked " . $ehero . " and scored a critical hit!";
  387. echo "<br />";
  388. echo "<br />";
  389. echo "Round 2: " . $ehero . " attacked you and scored a hit, but there was no clear victor! You lost " . $mkHealth . " in the duel!";
  390. echo "<br />";
  391. echo "<br />";
  392. echo "Final Result: Draw!";
  393. echo <<<FIELD5
  394. </fieldset>
  395. FIELD5;
  396. }
  397. }
  398. }
  399. else
  400. {
  401. $mrexp=$mexp;
  402. $mkHealth=0;
  403. $NewPlayerHealth=$mHealth;
  404. $NewEnemyHealth=$eHealth;
  405. $erexp=0;
  406. $mWin=1;
  407. $mLoss=0;
  408. $mKill=0;
  409. $mDeath=0;
  410. $eWin=0;
  411. $eLoss=1;
  412. $eKill=0;
  413. $eDeath=0;
  414.  
  415. echo <<<RESULT2
  416. <fieldset style="background-image:url(background.jpg); color:white;">
  417. <legend>
  418. Result
  419. </legend>
  420. RESULT2;
  421. echo "Round 1: You attacked " . $ehero . " and scored a critical hit!";
  422. echo "<br />";
  423. echo "<br />";
  424. echo "Round 2: " . $ehero . " attacked you and scored a hit, however, you took no damage! You defeated " . $ehero . " and gained " . $mrexp . " experience!";
  425. echo "<br />";
  426. echo "<br />";
  427. echo "Final Result: Victory!";
  428. echo <<<FIELD2
  429. </fieldset>
  430. FIELD2;
  431. }
  432. }
  433. }
  434. }
  435.  
  436. $ecritchance1=(($eLuck*0.1)*$ebonus)+$ewCrit;;
  437.  
  438. if($ecritchance1<10)
  439. {
  440. $ecritchance2=round($ecritchance1,2);
  441. $ecritchance=$ecritchance2*100;
  442. }
  443. else
  444. {
  445. if($ecritchance1<1)
  446. {
  447. $ecritchance2=round($ecritchance1,1);
  448. $ecritchance=$ecritchance2*100;
  449. }
  450. else
  451. {
  452. if($ecritchance1<0.1)
  453. {
  454. $ecritchance2=round($ecritchance1,0);
  455. $ecritchance=$ecritchance2*100;
  456. }
  457. else
  458. {
  459. $ecritchance2=round($ecritchance1,3);
  460. $ecritchance=$ecritchance2*100;
  461. }
  462. }
  463. }
  464.  
  465. probability4a($ecritchance,10000);
  466. }
  467. }
  468.  
  469. $edeathchance1=($eFocus*0.01)+($ebonus*0.01);
  470.  
  471. if($edeathchance1<10)
  472. {
  473. $edeathchance2=round($edeathchance1,2);
  474. $edeathchance=$edeathchance2*100;
  475. }
  476. else
  477. {
  478. if($edeathchance1<1)
  479. {
  480. $edeathchance2=round($edeathchance1,1);
  481. $edeathchance=$edeathchance2*100;
  482. }
  483. else
  484. {
  485. if($edeathchance1<0.1)
  486. {
  487. $edeathchance2=round($edeathchance1,0);
  488. $edeathchance=$edeathchance2*100;
  489. }
  490. else
  491. {
  492. $edeathchance2=round($edeathchance1,3);
  493. $edeathchance=$edeathchance2*100;
  494. }
  495. }
  496. }
  497.  
  498. probability3a($edeathchance,10000);
  499. }
  500. else
  501. {
  502. $mrexp=$mexp;
  503. $mkHealth=0;
  504. $NewPlayerHealth=$mHealth;
  505. $NewEnemyHealth=$eHealth;
  506. $erexp=0;
  507. $mWin=1;
  508. $mLoss=0;
  509. $mKill=0;
  510. $mDeath=0;
  511. $eWin=0;
  512. $eLoss=1;
  513. $eKill=0;
  514. $eDeath=0;
  515.  
  516. echo <<<RESULT
  517. <fieldset style="background-image:url(background.jpg); color:white;">
  518. <legend>
  519. Result
  520. </legend>
  521. RESULT;
  522. echo "Round 1: You attacked " . $ehero . " and scored a critical hit!";
  523. echo "<br />";
  524. echo "<br />";
  525. echo "Round 2: " . $ehero . " attacked you and missed! You defeated " . $ehero . " and gained " . $mrexp . " experience!";
  526. echo "<br />";
  527. echo "<br />";
  528. echo "Final Result: Victory!";
  529. echo <<<FIELD
  530. </fieldset>
  531. FIELD;
  532. }
  533. }
  534.  
  535. $e1hitchance=$ebonus*100;
  536.  
  537. if($e1hitchance>100)
  538. {
  539. $e1hitchance=100;
  540. }
  541. else
  542. {
  543. $e1hitchance=$ebonus*100;
  544. }
  545.  
  546. $e2hitchance=$e1hitchance+(-10*$mbonus);
  547.  
  548. if($e2hitchance<10)
  549. {
  550. $e3hitchance=round($e2hitchance,2);
  551. $ehitchance=$e3hitchance*100;
  552. }
  553. else
  554. {
  555. if($e2hitchance<1)
  556. {
  557. $e3hitchance=round($e2hitchance,2);
  558. $ehitchance=$e3hitchance*100;
  559. }
  560. else
  561. {
  562. if($e2hitchance<0.1)
  563. {
  564. $e3hitchance=round($e2hitchance,0);
  565. $ehitchance=$e3hitchance*100;
  566. }
  567. else
  568. {
  569. $e3hitchance=round($e2hitchance,3);
  570. $ehitchance=$e3hitchance*100;
  571. }
  572. }
  573. }
  574.  
  575. probability2a($mhitchance,10000);
  576.  
  577. ?>
Add Comment
Please, Sign In to add comment