From bdb705c69b7ebaf6a963b5fad3a2b7df5d886877 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Tue, 26 Dec 2017 16:40:50 +0100 Subject: [PATCH] fix: 2 catapults destroy a level 20 building #423 --- GameEngine/Automation.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 51af2a72..54dfccee 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -1053,6 +1053,22 @@ class Automation { // currently targeted building/field ID in the database (fdata, the fID field, e.g. f1, f2, f3...) $tbid = (int) $catapultTarget; + // recalculate data for catapults + global $bid34; + $stonemason = 0; + foreach($bdo as $key=>$b){ + if($b == 34 AND strpos($key, "t") !== false){ + $stonemason = str_replace("t", "", $key); + $stonemason = $bdo[$stonemason]; + } + } + if($stonemason > 0){ + $stonemasonEffect = $bid34[$stonemason]['attri'] / 100; + }else{ + $stonemasonEffect = 1; + } + $battlepart[3] = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[9]))/200) / $stonemasonEffect / $battlepart[10])) + 0.5); + // building/field destroyed if ($battlepart[4]>$battlepart[3]) {