From 16056c768fbc978d06404a9bf7d3d1962f40d312 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 8 Jun 2012 17:37:39 +0300 Subject: [PATCH] fix stronger buildings artefact + minor battle fixes --- GameEngine/Automation.php | 57 ++++++++++++++++++++++++++++++++------- GameEngine/Battle.php | 42 +++++++++++++++++++++++++---- 2 files changed, 85 insertions(+), 14 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 3ff9ab6a..6df61b30 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -1547,10 +1547,23 @@ class Automation { $tblevel = $bdo['f'.$rand]; $tbgid = $bdo['f'.$rand.'t']; $tbid = $rand; - if($bid34[$stonemason]==0){ - $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200))) + 0.5); + $artowner = $database->getVillageField($data['to'],"owner"); + $bartefact = count($database->getOwnUniqueArtefactInfo2($artowner,1,3,0)); + $bartefact1 = count($database->getOwnUniqueArtefactInfo2($data['to'],1,1,1)); + $bartefact2 = count($database->getOwnUniqueArtefactInfo2($artowner,1,2,0)); + if($bartefact > 0){ + $strongerbuildings = 5; + }else if($bartefact1 > 0){ + $strongerbuildings = 4; + }else if($bartefact2 > 0){ + $strongerbuildings = 3; + }else{ + $strongerbuildings = 1; + } + if($stonemason==0){ + $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / $strongerbuildings)) + 0.5); }else{ - $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / (1 * $bid34[$stonemason]['attri']/100))) + 0.5); + $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / (1 * $bid34[$stonemason]['attri']/100) / $strongerbuildings)) + 0.5); } if ($battlepart[4]>$needed_cata) { @@ -1671,10 +1684,23 @@ class Automation { $tblevel = $bdo['f'.$rand]; $tbgid = $bdo['f'.$rand.'t']; $tbid = $rand; - if($bid34[$stonemason]==0){ - $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200))) + 0.5); + $artowner = $database->getVillageField($data['to'],"owner"); + $bartefact = count($database->getOwnUniqueArtefactInfo2($artowner,1,3,0)); + $bartefact1 = count($database->getOwnUniqueArtefactInfo2($data['to'],1,1,1)); + $bartefact2 = count($database->getOwnUniqueArtefactInfo2($artowner,1,2,0)); + if($bartefact > 0){ + $strongerbuildings = 5; + }else if($bartefact1 > 0){ + $strongerbuildings = 4; + }else if($bartefact2 > 0){ + $strongerbuildings = 3; + }else{ + $strongerbuildings = 1; + } + if($stonemason==0){ + $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / $strongerbuildings)) + 0.5); }else{ - $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / (1 * $bid34[$stonemason]['attri']/100))) + 0.5); + $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / (1 * $bid34[$stonemason]['attri']/100) / $strongerbuildings)) + 0.5); } if (($battlepart[4]/2)>$needed_cata) { @@ -1795,10 +1821,23 @@ class Automation { $tblevel = $bdo['f'.$rand]; $tbgid = $bdo['f'.$rand.'t']; $tbid = $rand; - if($bid34[$stonemason]==0){ - $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200))) + 0.5); + $artowner = $database->getVillageField($data['to'],"owner"); + $bartefact = count($database->getOwnUniqueArtefactInfo2($artowner,1,3,0)); + $bartefact1 = count($database->getOwnUniqueArtefactInfo2($data['to'],1,1,1)); + $bartefact2 = count($database->getOwnUniqueArtefactInfo2($artowner,1,2,0)); + if($bartefact > 0){ + $strongerbuildings = 5; + }else if($bartefact1 > 0){ + $strongerbuildings = 4; + }else if($bartefact2 > 0){ + $strongerbuildings = 3; + }else{ + $strongerbuildings = 1; + } + if($stonemason==0){ + $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / $strongerbuildings)) + 0.5); }else{ - $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / (1 * $bid34[$stonemason]['attri']/100))) + 0.5); + $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / (1 * $bid34[$stonemason]['attri']/100) / $strongerbuildings)) + 0.5); } if (($battlepart[4]/2)>$needed_cata) { diff --git a/GameEngine/Battle.php b/GameEngine/Battle.php index 50fddd0c..befda4e0 100644 --- a/GameEngine/Battle.php +++ b/GameEngine/Battle.php @@ -506,8 +506,24 @@ class Battle { $wctp = pow(($rap/$rdp),1.5); $wctp = ($wctp >= 1)? 1-0.5/$wctp : 0.5*$wctp; $wctp *= $catp; - - $need = round((($moralbonus * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$att_ab['a8']))/200) / (1 * $bid34[$stonemason]['attri']/100))) + 0.5); + $artowner = $database->getVillageField($DefenderWref,"owner"); + $bartefact = count($database->getOwnUniqueArtefactInfo2($artowner,1,3,0)); + $bartefact1 = count($database->getOwnUniqueArtefactInfo2($DefenderWref,1,1,1)); + $bartefact2 = count($database->getOwnUniqueArtefactInfo2($artowner,1,2,0)); + if($bartefact > 0){ + $strongerbuildings = 5; + }else if($bartefact1 > 0){ + $strongerbuildings = 4; + }else if($bartefact2 > 0){ + $strongerbuildings = 3; + }else{ + $strongerbuildings = 1; + } + if($stonemason==0){ + $need = round((($moralbonus * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$att_ab['a8']))/200) / $strongerbuildings)) + 0.5); + }else{ + $need = round((($moralbonus * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$att_ab['a8']))/200) / ($bid34[$stonemason]['attri']/100) / $strongerbuildings)) + 0.5); + } // Aantal katapulten om het gebouw neer te halen $result[3] = $need; // Aantal Katapulten die handeling @@ -519,9 +535,25 @@ class Battle { $wctp = pow(($rap/$rdp),1.5); $wctp = ($wctp >= 1)? 1-0.5/$wctp : 0.5*$wctp; $wctp *= $ram; - - $need = round((($moralbonus * (pow($walllevel,2) + $walllevel + 1)) / (8 * (round(200 * pow(1.0205,$att_ab['a7']))/200) / (1 * $bid34[$stonemason]['attri']/100))) + 0.5); - // Aantal katapulten om het gebouw neer te halen + $artowner = $database->getVillageField($DefenderWref,"owner"); + $bartefact = count($database->getOwnUniqueArtefactInfo2($artowner,1,3,0)); + $bartefact1 = count($database->getOwnUniqueArtefactInfo2($DefenderWref,1,1,1)); + $bartefact2 = count($database->getOwnUniqueArtefactInfo2($artowner,1,2,0)); + if($bartefact > 0){ + $strongerbuildings = 5; + }else if($bartefact1 > 0){ + $strongerbuildings = 4; + }else if($bartefact2 > 0){ + $strongerbuildings = 3; + }else{ + $strongerbuildings = 1; + } + if($stonemason==0){ + $need = round((($moralbonus * (pow($walllevel,2) + $walllevel + 1)) / (8 * (round(200 * pow(1.0205,$att_ab['a7']))/200) / $strongerbuildings)) + 0.5); + }else{ + $need = round((($moralbonus * (pow($walllevel,2) + $walllevel + 1)) / (8 * (round(200 * pow(1.0205,$att_ab['a7']))/200) / ($bid34[$stonemason]['attri']/100) / $strongerbuildings)) + 0.5); + } + // Aantal katapulten om het gebouw neer te halen $result[7] = $need; // Aantal Katapulten die handeling