From 7d8736a6ab7c895d283e4754b1b89381fe004adc Mon Sep 17 00:00:00 2001
From: Shadow
Date: Sat, 16 Nov 2013 09:16:34 +0200
Subject: [PATCH] Update warsim.php
---
warsim.php | 57 +++++++++++++++++++++++++++++++++++-------------------
1 file changed, 37 insertions(+), 20 deletions(-)
diff --git a/warsim.php b/warsim.php
index 0092bc85..8e1c8c04 100644
--- a/warsim.php
+++ b/warsim.php
@@ -64,25 +64,42 @@ if(isset($_POST['result'])) {
$target = isset($_POST['target'])? $_POST['target'] : array();
$tribe = isset($_POST['mytribe'])? $_POST['mytribe'] : $session->tribe;
include("Templates/Simulator/res_a".$tribe.".tpl");
- foreach($target as $tar) {
- include("Templates/Simulator/res_d".$tar.".tpl");
- }
- echo "Type of attack: ";
- echo $form->getValue('ktyp') == 0? "Normal" : "Raid";
- echo "
";
- if (isset($_POST['result'][3])&&isset($_POST['result'][4])){
- if ($_POST['result'][4]>$_POST['result'][3]){
- echo "Building destroyed
";
- }elseif ($_POST['result'][4]==0){
- echo "The building isn't destroyed
";
- }else{
- $demolish=$_POST['result'][4]/$_POST['result'][3];
- //$Katalife=round($_POST['result'][4]-($_POST['result'][4]*$_POST['result'][1]));
- //$totallvl = round($form->getValue('kata')-($form->getValue('kata') * $demolish));
- $totallvl = round(sqrt(pow(($form->getValue('kata')+0.5),2)-($_POST['result'][4]*8)));
- echo "Damage done by catapult: from level ".$form->getValue('kata')." to level ".$totallvl."
";
- }
- }
+ foreach($target as $tar) {
+ include("Templates/Simulator/res_d".$tar.".tpl");
+ }
+ echo "Type of attack: ";
+ echo $form->getValue('ktyp') == 0? "Normal" : "Raid";
+ echo "
";
+ echo "";
+ if (isset($_POST['result'][7])&&isset($_POST['result'][8])){
+ if ($form->getValue('ktyp') == 1) {
+ echo "Hint: The ram does not work during a raid.
";
+ }elseif ($_POST['result'][8]>$_POST['result'][7]){
+ echo "Damage done by ram: from level ".$form->getValue('walllevel')." to level 0
";
+ }elseif ($_POST['result'][8]==0){
+ echo "Damage done by ram: from level ".$form->getValue('walllevel')." to level ".$form->getValue('walllevel')."
";
+ }else{
+ $demolish_ram=$_POST['result'][8]/$_POST['result'][7];
+ $totallvl = round(sqrt(pow(($form->getValue('kata')+0.5),2)-($_POST['result'][8]*8)));
+ echo "Damage done by ram: from level ".$form->getValue('walllevel')." to level ".$totallvl."";
+ }
+ }
+
+ if (isset($_POST['result'][3])&&isset($_POST['result'][4])){
+ if ($form->getValue('ktyp') == 1) {
+ echo "Hint: The catapult does not shoot during a raid.";
+ }elseif ($_POST['result'][4]>$_POST['result'][3]){
+ echo "Damage done by catapult: from level ".$form->getValue('kata')." to level 0";
+ }elseif ($_POST['result'][4]==0){
+ echo "Damage done by catapult: from level ".$form->getValue('kata')." to level ".$form->getValue('kata')."";
+ }else{
+ $demolish=$_POST['result'][4]/$_POST['result'][3];
+ //$Katalife=round($_POST['result'][4]-($_POST['result'][4]*$_POST['result'][1]));
+ //$totallvl = round($form->getValue('kata')-($form->getValue('kata') * $demolish));
+ $totallvl = round(sqrt(pow(($form->getValue('kata')+0.5),2)-($_POST['result'][4]*8)));
+ echo "Damage done by catapult: from level ".$form->getValue('kata')." to level ".$totallvl."";
+ }
+ }
}
$target = isset($_POST['target'])? $_POST['target'] : array();
$tribe = isset($_POST['mytribe'])? $_POST['mytribe'] : $session->tribe;
@@ -164,4 +181,4 @@ echo round(($generator->pageLoadTimeEnd()-$start)*1000);