Permalink
Browse files

update

  • Loading branch information...
1 parent a85f401 commit 215a2129d24dbb01bd750cfc971f5d93e71ffe24 unknown committed Oct 9, 2012
Showing with 81 additions and 9 deletions.
  1. +79 −7 GameEngine/Automation.php
  2. +2 −2 warsim.php
@@ -91,7 +91,7 @@ function recountPop($vid){
$popTot += $this->buildingPOP($building,$lvl);
}
}
-
+ $this->recountCP($vid);
$q = "UPDATE ".TB_PREFIX."vdata set pop = $popTot where wref = $vid";
mysql_query($q);
@@ -1890,10 +1890,34 @@ private function sendunitsComplete() {
$tblevel = $bdo['f'.$rand];
$tbgid = $bdo['f'.$rand.'t'];
$tbid = $rand;
+ $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;
+ }
+ $good_effect = $bad_effect = 1;
+ $foolartefact = $database->getFoolArtefactInfo(3,$DefenderWref,$artowner);
+ if(count($foolartefact) > 0){
+ foreach($foolartefact as $arte){
+ if($arte['bad_effect'] == 1){
+ $bad_effect = $arte['effect2'];
+ }else{
+ $good_effect = $arte['effect2'];
+ }
+ }
+ }
if($stonemason==0){
- $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200))) + 0.5);
+ $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / $strongerbuildings / $good_effect * $bad_effect)) + 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) / ($bid34[$stonemason]['attri']/100) / $strongerbuildings / $good_effect * $bad_effect)) + 0.5);
}
if ($battlepart[4]>$needed_cata)
{
@@ -2021,10 +2045,34 @@ private function sendunitsComplete() {
$tblevel = $bdo['f'.$rand];
$tbgid = $bdo['f'.$rand.'t'];
$tbid = $rand;
+ $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;
+ }
+ $good_effect = $bad_effect = 1;
+ $foolartefact = $database->getFoolArtefactInfo(3,$DefenderWref,$artowner);
+ if(count($foolartefact) > 0){
+ foreach($foolartefact as $arte){
+ if($arte['bad_effect'] == 1){
+ $bad_effect = $arte['effect2'];
+ }else{
+ $good_effect = $arte['effect2'];
+ }
+ }
+ }
if($stonemason==0){
- $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200))) + 0.5);
+ $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / $strongerbuildings / $good_effect * $bad_effect)) + 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) / ($bid34[$stonemason]['attri']/100) / $strongerbuildings / $good_effect * $bad_effect)) + 0.5);
}
if (($battlepart[4]/2)>$needed_cata)
{
@@ -2151,10 +2199,34 @@ private function sendunitsComplete() {
$tblevel = $bdo['f'.$rand];
$tbgid = $bdo['f'.$rand.'t'];
$tbid = $rand;
+ $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;
+ }
+ $good_effect = $bad_effect = 1;
+ $foolartefact = $database->getFoolArtefactInfo(3,$DefenderWref,$artowner);
+ if(count($foolartefact) > 0){
+ foreach($foolartefact as $arte){
+ if($arte['bad_effect'] == 1){
+ $bad_effect = $arte['effect2'];
+ }else{
+ $good_effect = $arte['effect2'];
+ }
+ }
+ }
if($stonemason==0){
- $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200))) + 0.5);
+ $needed_cata = round((($battlepart[5] * (pow($tblevel,2) + $tblevel + 1)) / (8 * (round(200 * pow(1.0205,$battlepart[6]))/200) / $strongerbuildings / $good_effect * $bad_effect)) + 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) / ($bid34[$stonemason]['attri']/100) / $strongerbuildings / $good_effect * $bad_effect)) + 0.5);
}
if (($battlepart[4]/2)>$needed_cata)
{
View
@@ -72,9 +72,9 @@
echo "</b></p>";
if (isset($_POST['result'][3])&&isset($_POST['result'][4])){
if ($_POST['result'][4]>$_POST['result'][3]){
- echo "Building destroid";
+ echo "<p>Building destroyed</p>";
}elseif ($_POST['result'][4]==0){
- echo "The building isn't destroid";
+ echo "<p>The building isn't destroyed</p>";
}else{
$demolish=$_POST['result'][4]/$_POST['result'][3];
//$Katalife=round($_POST['result'][4]-($_POST['result'][4]*$_POST['result'][1]));

0 comments on commit 215a212

Please sign in to comment.