Artifacts fixes part 4

Completely fixed the artifact of the fool and fixed all kind of
artifact:

+Deleted some useless .tpl files and merged into one (Stable)
+The artifact of the fool effect won't be displayed if not active
+Fixed a bug that permitted to have a great and a unique artefacts
active at the same moment
+Big reductions of code in a lot of files
+Created some new methods to support artifacts
+Fixed a bug that prevented the effect of the "Rivals confusion" to work
correctly
+Fixed a bug that prevented "The eagles eyes" artifact to work correctly
for the attacker
+Fixed the artifact of the fool of every kind, now it's calculated with
a new method
+Fixed the cranny capacity when a "Rivals confusion" artifact is active
+Some minor bug fixing , improovements and optimization
This commit is contained in:
iopietro
2018-04-26 20:37:47 +02:00
parent 42eda2f935
commit 56e280f436
32 changed files with 275 additions and 1194 deletions
+11 -56
View File
@@ -652,28 +652,10 @@ class adm_DB {
$artefact = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($enforce['from'],2,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,2,0));
if($artefact > 0){
$fastertroops = 3;
}else if($artefact1 > 0){
$fastertroops = 2;
}else if($artefact2 > 0){
$fastertroops = 1.5;
}else{
$fastertroops = 1;
}
$time = round($this->procDistanceTime($fromCor,$toCor,min($speeds),$enforce['from'])/$fastertroops);
$foolartefact2 = $database->getFoolArtefactInfo(2,$enforce['from'],$from['owner']);
if(count($foolartefact2) > 0){
foreach($foolartefact2 as $arte){
if($arte['bad_effect'] == 1){
$time *= $arte['effect2'];
}else{
$time /= $arte['effect2'];
$time = round($time);
}
}
}
$troopsTime = $this->procDistanceTime($fromCor, $toCor, min($speeds), $enforce['from']);
$time = $database->getArtifactsValueInfluence($from['owner'], $enforce['from'], 2, $troopsTime);
$reference = $database->addAttack($enforce['from'],$enforce['u'.$start],$enforce['u'.($start+1)],$enforce['u'.($start+2)],$enforce['u'.($start+3)],$enforce['u'.($start+4)],$enforce['u'.($start+5)],$enforce['u'.($start+6)],$enforce['u'.($start+7)],$enforce['u'.($start+8)],$enforce['u'.($start+9)],$enforce['hero'],2,0,0,0,0);
$database->addMovement(4,$wref,$enforce['from'],$reference,time(),($time+time()));
$database->deleteReinf($enforce['id']);
@@ -937,40 +919,13 @@ class adm_DB {
}
}
}
// $unit = "hero";
// global $$unit;
// $dataarray = $$unit;
if($prisoners == 0){
$upkeep += (isset($array['hero'])? $array['hero'] * 6:0);
}else{
$upkeep += (isset($array['t11'])? $array['t11'] * 6:0);
}
$artefact = count($database->getOwnUniqueArtefactInfo2($uid,4,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($vid,4,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($uid,4,2,0));
if($artefact > 0){
$upkeep /= 2;
$upkeep = round($upkeep);
}else if($artefact1 > 0){
$upkeep /= 2;
$upkeep = round($upkeep);
}else if($artefact2 > 0){
$upkeep /= 4;
$upkeep = round($upkeep);
$upkeep *= 3;
}
$foolartefact = $database->getFoolArtefactInfo(4,$vid,$uid);
if(count($foolartefact) > 0){
foreach($foolartefact as $arte){
if($arte['bad_effect'] == 1){
$upkeep *= $arte['effect2'];
}else{
$upkeep /= $arte['effect2'];
$upkeep = round($upkeep);
}
}
}
return $upkeep;
$unit = ($prisoners > 0) ? 't11' : 'hero';
if(!isset($array[$unit])) $array[$unit] = 0;
$upkeep += $array[$unit] * 6;
return $database->getArtifactsValueInfluence($uid, $vid, 4, $upkeep);
}
};
+24 -121
View File
@@ -2063,34 +2063,11 @@ class Automation {
}
//cranny efficiency
//TODO: Needs to be connected to a function
$atk_bonus = ($owntribe == 2)? (4/5) : 1;
$def_bonus = ($targettribe == 3)? 2 : 1;
$to_owner = $database->getVillageField($data['to'],"owner");
$artefact_2 = count($database->getOwnUniqueArtefactInfo2($to_owner,7,3,0));
$artefact1_2 = count($database->getOwnUniqueArtefactInfo2($data['to'],7,1,1));
$artefact2_2 = count($database->getOwnUniqueArtefactInfo2($to_owner,7,2,0));
if($artefact_2 > 0){
$artefact_bouns = 6;
}else if($artefact1_2 > 0){
$artefact_bouns = 3;
}else if($artefact2_2 > 0){
$artefact_bouns = 2;
}else{
$artefact_bouns = 1;
}
$foolartefact = $database->getFoolArtefactInfo(7, (isset($vid) ? $vid : 0), $DefenderID);
if(count($foolartefact) > 0){
foreach($foolartefact as $arte){
if($arte['bad_effect'] == 1){
$cranny_eff *= $arte['effect2'];
}else{
$cranny_eff /= $arte['effect2'];
$cranny_eff = round($cranny_eff);
}
}
}
$crannySpy = $cranny * $def_bonus * $artefact_bouns;
$to_owner = $database->getVillageField($data['to'], "owner");
$crannySpy = $database->getArtifactsValueInfluence($to_owner, $data['to'], 7, $cranny * $def_bonus);
$cranny_eff = $crannySpy * $atk_bonus;
// work out available resources.
@@ -2840,30 +2817,9 @@ class Automation {
$p_speeds[] = $GLOBALS['u'.$p_hero_unit]['speed'];
}
$p_artefact = count($database->getOwnUniqueArtefactInfo2($p_owner,2,3,0));
$p_artefact1 = count($database->getOwnUniqueArtefactInfo2($prisoner['from'],2,1,1));
$p_artefact2 = count($database->getOwnUniqueArtefactInfo2($p_owner,2,2,0));
if($p_artefact > 0){
$p_fastertroops = 3;
}else if($p_artefact1 > 0){
$p_fastertroops = 2;
}else if($p_artefact2 > 0){
$p_fastertroops = 1.5;
}else{
$p_fastertroops = 1;
}
$p_time = round($this->procDistanceTime($p_to,$p_from,min($p_speeds),1)/$p_fastertroops);
$foolartefact1 = $database->getFoolArtefactInfo(2,$prisoner['from'],$p_owner);
if(count($foolartefact1) > 0){
foreach($foolartefact1 as $arte){
if($arte['bad_effect'] == 1){
$p_time *= $arte['effect2'];
}else{
$p_time /= $arte['effect2'];
$p_time = round($p_time);
}
}
}
$troopsTime = $this->procDistanceTime($p_to, $p_from, min($p_speeds), 1);
$p_time = $database->getArtifactsValueInfluence($p_owner, $prisoner['from'], 2, $troopsTime);
$p_reference = $database->addAttack($prisoner['from'],$prisoner['t1'],$prisoner['t2'],$prisoner['t3'],$prisoner['t4'],$prisoner['t5'],$prisoner['t6'],$prisoner['t7'],$prisoner['t8'],$prisoner['t9'],$prisoner['t10'],$prisoner['t11'],3,0,0,0,0,0,0,0,0,0,0,0);
$movementType[] = 4;
$movementFrom[] = $prisoner['wref'];
@@ -2925,7 +2881,7 @@ class Automation {
if($totalsend_att - ($totaldead_att + (isset($totaltraped_att) ? $totaltraped_att : 0)) > 0)
{
$troopsTime = $this->procDistanceTime($from, $to, min($speeds), 1);
$endtime = $database->getTroopsWalkingTime($from['owner'], $from['wref'], 2, $troopsTime);
$endtime = $database->getArtifactsValueInfluence($from['owner'], $from['wref'], 2, $troopsTime);
$endtime += $AttackArrivalTime;
if($type == 1) {
if($from['owner'] == 3) { //fix natar report by ronix
@@ -3023,7 +2979,7 @@ class Automation {
}
$troopsTime = $this->procDistanceTime($from, $to, min($speeds), 1);
$endtime = $database->getTroopsWalkingTime($from['owner'], $from['wref'], 2, $troopsTime);
$endtime = $database->getArtifactsValueInfluence($from['owner'], $from['wref'], 2, $troopsTime);
$endtime += $AttackArrivalTime;
$database->setMovementProc($data['moveid']);
@@ -3696,11 +3652,11 @@ class Automation {
$database->activateArtifact($artifact['id']);
$ownArtifacts['totals']++;
$ownArtifacts['small']++;
}elseif($artifact['size'] == 2 && !$ownArtifacts['great']){ //Account effect
}elseif($artifact['size'] == 2 && !$ownArtifacts['unique'] && !$ownArtifacts['great']){ //Account effect
$database->activateArtifact($artifact['id']);
$ownArtifacts['totals']++;
$ownArtifacts['great']++;
}elseif($artifact['size'] == 3 && !$ownArtifacts['unique']){ //Unique effect
}elseif($artifact['size'] == 3 && !$ownArtifacts['unique'] && !$ownArtifacts['great']){ //Unique effect
$database->activateArtifact($artifact['id']);
$ownArtifacts['totals']++;
$ownArtifacts['unique']++;
@@ -4005,52 +3961,14 @@ class Automation {
}
}
// $unit = "hero";
// global $$unit;
// $dataarray = $$unit;
if ( $prisoners == 0 ) {
if ( ! isset( $array['hero'] ) ) {
$array['hero'] = 0;
}
$upkeep += $array['hero'] * 6;
} else {
if ( ! isset( $array['t11'] ) ) {
$array['t11'] = 0;
}
$upkeep += $array['t11'] * 6;
}
$unit = ($prisoners > 0) ? 't11' : 'hero';
if(!isset($array[$unit])) $array[$unit] = 0;
$upkeep += $array[$unit] * 6;
$who = $database->getVillageField( $vid, "owner" );
$artefact = count( $database->getOwnUniqueArtefactInfo2( $who, 4, 3, 0 ) );
$artefact1 = count( $database->getOwnUniqueArtefactInfo2( $vid, 4, 1, 1 ) );
$artefact2 = count( $database->getOwnUniqueArtefactInfo2( $who, 4, 2, 0 ) );
if ( $artefact > 0 ) {
$upkeep /= 2;
$upkeep = round( $upkeep );
} else if ( $artefact1 > 0 ) {
$upkeep /= 2;
$upkeep = round( $upkeep );
} else if ( $artefact2 > 0 ) {
$upkeep /= 4;
$upkeep = round( $upkeep );
$upkeep *= 3;
}
$foolartefact = $database->getFoolArtefactInfo( 4, $vid, $who );
if ( count( $foolartefact ) > 0 ) {
foreach ( $foolartefact as $arte ) {
if ( $arte['bad_effect'] == 1 ) {
$upkeep *= $arte['effect2'];
} else {
$upkeep /= $arte['effect2'];
$upkeep = round( $upkeep );
}
}
}
return $upkeep;
$who = $database->getVillageField($vid, "owner");
return $database->getArtifactsValueInfluence($who, $vid, 4, $upkeep);
}
private function bountycalculateOProduction($bountywid) {
@@ -4060,27 +3978,12 @@ class Automation {
$this->bountyOproduction['crop'] = $this->bountyGetOCropProd();
}
private function bountycalculateProduction($bountywid,$uid) {
global $technology,$database;
$normalA = $database->getOwnArtefactInfoByType($bountywid,4);
$largeA = $database->getOwnUniqueArtefactInfo($uid,4,2);
$uniqueA = $database->getOwnUniqueArtefactInfo($uid,4,3);
$upkeep = $this->getUpkeep($this->getAllUnits($bountywid),0);
private function bountycalculateProduction($bountywid, $uid) {
$upkeep = $this->getUpkeep($this->getAllUnits($bountywid), 0);
$this->bountyproduction['wood'] = $this->bountyGetWoodProd();
$this->bountyproduction['clay'] = $this->bountyGetClayProd();
$this->bountyproduction['iron'] = $this->bountyGetIronProd();
if ($uniqueA['size']==3 && $uniqueA['owner']==$uid){
$this->bountyproduction['crop'] = $this->bountyGetCropProd()-$this->bountypop-(($upkeep)-round($upkeep*0.50));
}else if ($normalA['type']==4 && $normalA['size']==1 && $normalA['owner']==$uid){
$this->bountyproduction['crop'] = $this->bountyGetCropProd()-$this->bountypop-(($upkeep)-round($upkeep*0.25));
}else if ($largeA['size']==2 && $largeA['owner']==$uid){
$this->bountyproduction['crop'] = $this->bountyGetCropProd()-$this->bountypop-(($upkeep)-round($upkeep*0.25));
}else{
$this->bountyproduction['crop'] = $this->bountyGetCropProd()-$this->bountypop-$upkeep;
}
$this->bountyproduction['crop'] = $this->bountyGetCropProd() - $this->bountypop - $upkeep;
}
private function bountyprocessProduction($bountywid) {
@@ -4280,7 +4183,7 @@ class Automation {
$database->updateTraining($train['id'], $trained, $trained * $train['eachtime']);
if($train['amt'] - $trained <= 0) $database->trainUnit($train['id'], 0, 0, 0, 0, 1, 1);
if($train['amt'] - $trained <= 0) $database->trainUnit($train['id'], 0, 0, 0, 0, 1);
}
if ($valuesUpdated) {
@@ -5822,9 +5725,9 @@ class Automation {
if ($array) {
foreach($array as $artefact) {
$kind = rand(1, 7);
while($kind == 6){
$kind = rand(1, 7);
}
while($kind == 6) $kind = rand(1, 7);
if($artefact['size'] != 3) $bad_effect = rand(0, 1);
else $bad_effect = 0;
+34 -137
View File
@@ -268,31 +268,12 @@ class Battle {
//rap = Result attack points
//rdp = Result defense points
$cap = $ap = $dp = $cdp = $rap = $rdp = 0;
$att_artefact = count($database->getOwnUniqueArtefactInfo2($AttackerID,3,3,0));
$att_artefact1 = count($database->getOwnUniqueArtefactInfo2($AttackerWref,3,1,1));
$att_artefact2 = count($database->getOwnUniqueArtefactInfo2($AttackerID,3,2,0));
if($att_artefact > 0){
$attacker_artefact = 10;
}else if($att_artefact1 > 0){
$attacker_artefact = 5;
}else if($att_artefact2 > 0){
$attacker_artefact = 3;
}else{
$attacker_artefact = 1;
}
$def_artefact = count($database->getOwnUniqueArtefactInfo2($DefenderID,3,3,0));
$def_artefact1 = count($database->getOwnUniqueArtefactInfo2($DefenderWref,3,1,1));
$def_artefact2 = count($database->getOwnUniqueArtefactInfo2($DefenderID,3,2,0));
if($def_artefact > 0){
$defender_artefact = 10;
}else if($att_artefact1 > 0){
$defender_artefact = 5;
}else if($def_artefact2 > 0){
$defender_artefact = 3;
}else{
$defender_artefact = 1;
}
//Get involved artifacts
$attacker_artefact = $database->getArtifactsValueInfluence($AttackerID, $AttackerWref, 3, 1);
$defender_artefact = $database->getArtifactsValueInfluence($DefenderID, $DefenderWref, 3, 1);
$strongerbuildings = $database->getArtifactsValueInfluence($DefenderID, $DefenderWref, 1, 1);
if(isset($Attacker['uhero']) && $Attacker['uhero'] != 0){
$atkhero = $this->getBattleHero($AttackerID);
}
@@ -383,32 +364,20 @@ class Battle {
}
if($type == 1) {//scout
for($i=$start;$i<=$end;$i++) {
for($i = $start;$i <= $end; $i++) {
global ${'u'.$i};
$j = $i-$start+1;
if($Attacker['u'.$i]>0 && ($i == 4 || $i == 14 || $i == 23 || $i == 44)){
$j = $i - $start + 1;
if($Attacker['u'.$i] > 0 && ($i == 4 || $i == 14 || $i == 23 || $i == 44)){
if(${'att_ab'.$abcount} > 0) {
$ap += round(35 + (35 + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${'att_ab'.$abcount}) - 1), 4) * $Attacker['u'.$i];
}else{
$ap += $Attacker['u'.$i]*35;
$ap += round(35 + (35 + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${'att_ab'.$abcount}) - 1), 4) * $Attacker['u'.$i];
}
else $ap += $Attacker['u'.$i] * 35;
}
$involve += $Attacker['u'.$i];
$units['Att_unit'][$i] = $Attacker['u'.$i];
}
$att_foolartefact = $database->getFoolArtefactInfo(3,$AttackerWref,$AttackerID);
if(count($att_foolartefact) > 0){
foreach($att_foolartefact as $arte){
if($arte['bad_effect'] == 1){
$ap *= $arte['effect2'];
}else{
$ap /= $arte['effect2'];
$ap = round($ap);
}
}
}
$ap *= $attacker_artefact;
}else{ //type=3 normal 4=raid
$abcount = 1;
@@ -598,33 +567,8 @@ class Battle {
$wctp = ($wctp >= 1) ? 1 - 0.5 / $wctp : 0.5 * $wctp;
$wctp *= ($catp + $upgrades);
$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;
}elseif($bartefact1 > 0){
$strongerbuildings = 4;
}elseif($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'];
}
}
}
//catapults downgrades
$downgrades = ($stonemason > 0 ? $bid34[$stonemason]['attri'] / 100 : 1) / $strongerbuildings / $good_effect * $bad_effect;
$downgrades = ($stonemason > 0 ? $bid34[$stonemason]['attri'] / 100 : 1) / $strongerbuildings;
//catapults moral
$catpMoral = pow($attpop / ($defpop > 0 ? $defpop : 1) , 0.3);
@@ -645,32 +589,7 @@ class Battle {
$wctp = pow(($rap / $rdp), 1.5);
$wctp = ($wctp >= 1) ? 1 - 0.5 / $wctp : 0.5 * $wctp;
$wctp *= ($ram ) + $upgrades;
$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'];
}
}
}
$wctp *= ($ram) + $upgrades;
$downgrades = ($stonemason > 0 ? $bid34[$stonemason]['attri'] / 100 : 1) / $strongerbuildings / $good_effect * $bad_effect;
@@ -779,82 +698,60 @@ class Battle {
return $result;
}
public function getDataDefScout($defenders,$def_ab,$defender_artefact,$AttackerWref,$AttackerID) {
global $database;
$abcount=1;
$invol=0;
$dp=0;
$cdp=0;
$detected=0;
public function getDataDefScout($defenders, $def_ab, $defender_artefact, $AttackerWref, $AttackerID) {
$abcount = 1;
$invol = $dp = $cdp = $detected = 0;
for($y=4;$y<=54;$y++) {
for($y = 4; $y <= 54; $y++) {
if($y == 4 || $y == 14 || $y == 23 || $y == 44){
global ${'u'.$y};
if($defenders['u'.$y]>0 && $def_ab[$y] > 0) {
if($defenders['u'.$y] > 0 && $def_ab[$y] > 0) {
$dp += round(20 + (20 + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, $def_ab[$y]) - 1), 4) * $defenders['u'.$y] * $defender_artefact;
$def_foolartefact = $database->getFoolArtefactInfo(3,$AttackerWref,$AttackerID);
if(count($def_foolartefact) > 0){
foreach($def_foolartefact as $arte){
if($arte['bad_effect'] == 1){
$dp *= $arte['effect2'];
}else{
$dp /= $arte['effect2'];
$dp = round($dp);
}
}
}
}else {
if($defenders['u'.$y]>0) {
if($defenders['u'.$y] > 0) {
$dp += $defenders['u'.$y]* 20 * $defender_artefact;
}
$units['Def_unit'][$y] = $defenders['u'.$y];
if($units['Def_unit'][$y] > 0){
$detected = 1;
}
if($units['Def_unit'][$y] > 0) $detected = 1;
}
$invol += $defenders['u'.$y]; //total troops
$units['Def_unit'][$y] = $defenders['u'.$y];
}
}
$datadef['dp']=$dp;
$datadef['cdp']=$cdp;
$datadef['detect']=($detected==1)? 1:0;
$datadef['involve']=$invol;
$datadef['dp'] = $dp;
$datadef['cdp'] = $cdp;
$datadef['detect'] = $detected;
$datadef['involve'] = $invol;
return $datadef;
}
public function getDataDef($defenders,$def_ab) {
$dp=0;
$cdp=0;
$invol=0;
for($y=1;$y<=50;$y++) {
$dp = $cdp = $invol = 0;
for($y = 1;$y <= 50; $y++) {
global ${'u'.$y};
if ($defenders['u'.$y]>0) {
if ($defenders['u'.$y] > 0) {
if (!isset($def_ab[$y])) {
$def_ab[$y] = 0;
}
if ($def_ab[$y]>0) {
if ($def_ab[$y] > 0) {
$dp += round(${'u'.$y}['di'] + (${'u'.$y}['di'] + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, $def_ab[$y]) - 1), 4) * $defenders['u'.$y];
$cdp += round(${'u'.$y}['dc'] + (${'u'.$y}['dc'] + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, $def_ab[$y]) - 1), 4) * $defenders['u'.$y];
}else{
$dp += $defenders['u'.$y]*${'u'.$y}['di'];
$cdp += $defenders['u'.$y]*${'u'.$y}['dc'];
$dp += $defenders['u'.$y] * ${'u'.$y}['di'];
$cdp += $defenders['u'.$y] * ${'u'.$y}['dc'];
}
}
$invol += $defenders['u'.$y]; //total troops
$units['Def_unit'][$y] = $defenders['u'.$y];
}
$datadef['dp']=$dp;
$datadef['cdp']=$cdp;
$datadef['involve']=$invol;
$datadef['dp'] = $dp;
$datadef['cdp'] = $cdp;
$datadef['involve'] = $invol;
return $datadef;
}
/**
+16 -17
View File
@@ -676,30 +676,29 @@ class Building {
case 40:
$wwlevel = $village->resarray['f99'];
if ( $wwlevel > 50 ) {
$needed_plan = 1;
} else {
$needed_plan = 0;
}
if($wwlevel > 50) $needed_plan = 1;
else $needed_plan = 0;
$wwbuildingplan = 0;
$villages = $database->getVillagesID( $session->uid );
foreach ( $villages as $village1 ) {
$plan = count( $database->getOwnArtefactInfoByType2( $village1, 11 ) );
if ( $plan > 0 ) {
$villages = $database->getVillagesID( $session->uid );
foreach($villages as $village1) {
$plan = count($database->getOwnArtefactInfoByType2($village1, 11));
if($plan > 0){
$wwbuildingplan = 1;
break;
}
}
if ( $session->alliance != 0 ) {
$alli_users = $database->getUserByAlliance( $session->alliance );
foreach ( $alli_users as $users ) {
$villages = $database->getVillagesID( $users['id'] );
if ( $users['id'] != $session->uid ) {
foreach ( $villages as $village1 ) {
$plan = count( $database->getOwnArtefactInfoByType2( $village1, 11 ) );
if ( $plan > 0 ) {
if($session->alliance != 0) {
$alli_users = $database->getUserByAlliance($session->alliance);
foreach($alli_users as $users) {
$villages = $database->getVillagesID($users['id']);
if($users['id'] != $session->uid) {
foreach($villages as $village1) {
$plan = count($database->getOwnArtefactInfoByType2($village1, 11 ));
if($plan > 0) {
$wwbuildingplan += 1;
break;
}
}
}
+82 -109
View File
@@ -6029,87 +6029,46 @@ References: User ID/Message ID, Mode
return $this->mysqli_fetch_all($result);
}
function trainUnit($vid, $unit, $amt, $pop, $each, $time, $mode) {
list($vid, $unit, $amt, $pop, $each, $time, $mode) = $this->escape_input((int) $vid, (int) $unit, (int) $amt, (int) $pop, (int) $each, (int) $time, $mode);
function trainUnit($vid, $unit, $amt, $pop, $each, $mode) {
list($vid, $unit, $amt, $pop, $each, $mode) = $this->escape_input((int) $vid, (int) $unit, (int) $amt, (int) $pop, (int) $each, $mode);
global $village, $building, $session, $technology;
if(!$mode) {
$barracks = array(1,2,3,11,12,13,14,21,22,31,32,33,34,35,36,37,38,39,40,41,42,43,44);
$barracks = [1, 2, 3, 11, 12, 13, 14, 21, 22, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44];
// fix by brainiac - THANK YOU
$greatbarracks = array(61,62,63,71,72,73,74,81,82,91,92,93,94,95,96,97,98,99,100,101,102,103,104);
$stables = array(4,5,6,15,16,23,24,25,26,45,46);
$greatstables = array(64,65,66,75,76,83,84,85,86,105,106);
$workshop = array(7,8,17,18,27,28,47,48);
$greatworkshop = array(67,68,77,78,87,88,107,108);
$residence = array(9,10,19,20,29,30,49,50);
$trapper = array(99);
$greatbarracks = [61, 62, 63, 71, 72, 73, 74, 81, 82, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104];
$stables = [4, 5, 6, 15, 16, 23, 24, 25, 26, 45, 46];
$greatstables = [64, 65, 66, 75, 76, 83, 84, 85, 86, 105, 106];
$workshop = [7, 8, 17, 18, 27, 28, 47, 48];
$greatworkshop = [67, 68, 77, 78, 87, 88, 107, 108];
$residence = [9, 10, 19, 20, 29, 30, 49, 50];
$trapper = [99];
if(in_array($unit, $barracks)) {
$queued = $technology->getTrainingList(1);
} elseif(in_array($unit, $stables)) {
$queued = $technology->getTrainingList(2);
} elseif(in_array($unit, $workshop)) {
$queued = $technology->getTrainingList(3);
} elseif(in_array($unit, $residence)) {
$queued = $technology->getTrainingList(4);
} elseif(in_array($unit, $greatstables)) {
$queued = $technology->getTrainingList(6);
} elseif(in_array($unit, $greatbarracks)) {
$queued = $technology->getTrainingList(5);
} elseif(in_array($unit, $greatworkshop)) {
$queued = $technology->getTrainingList(7);
} elseif(in_array($unit, $trapper)) {
$queued = $technology->getTrainingList(8);
}
if(in_array($unit, $barracks)) $queued = $technology->getTrainingList(1);
elseif(in_array($unit, $stables)) $queued = $technology->getTrainingList(2);
elseif(in_array($unit, $workshop)) $queued = $technology->getTrainingList(3);
elseif(in_array($unit, $residence)) $queued = $technology->getTrainingList(4);
elseif(in_array($unit, $greatbarracks)) $queued = $technology->getTrainingList(5);
elseif(in_array($unit, $greatstables)) $queued = $technology->getTrainingList(6);
elseif(in_array($unit, $greatworkshop)) $queued = $technology->getTrainingList(7);
elseif(in_array($unit, $trapper)) $queued = $technology->getTrainingList(8);
$now = time();
$uid = $this->getVillageField( $vid, "owner" );
$artefact = count( $this->getOwnUniqueArtefactInfo2( $uid, 5, 3, 0 ) );
$artefact1 = count( $this->getOwnUniqueArtefactInfo2( $vid, 5, 1, 1 ) );
$artefact2 = count( $this->getOwnUniqueArtefactInfo2( $uid, 5, 2, 0 ) );
if ( $artefact > 0 ) {
$time = $now + round( ( $time - $now ) / 2 );
$each /= 2;
$each = round( $each );
} else if ( $artefact1 > 0 ) {
$time = $now + round( ( $time - $now ) / 2 );
$each /= 2;
$each = round( $each );
} else if ( $artefact2 > 0 ) {
$time = $now + round( ( $time - $now ) / 4 * 3 );
$each /= 4;
$each = round( $each );
$each *= 3;
$each = round( $each );
}
$foolartefact = $this->getFoolArtefactInfo( 5, $vid, $uid );
if ( count( $foolartefact ) > 0 ) {
foreach ( $foolartefact as $arte ) {
if ( $arte['bad_effect'] == 1 ) {
$each *= $arte['effect2'];
} else {
$each /= $arte['effect2'];
$each = round( $each );
}
}
}
$uid = $this->getVillageField($vid, "owner");
$each = $this->getArtifactsValueInfluence($uid, $vid, 5, $each);
$time2 = $now + $each;
if ( count( $queued ) > 0 ) {
$time += $queued[ count( $queued ) - 1 ]['timestamp'] - $now;
$time2 += $queued[ count( $queued ) - 1 ]['timestamp'] - $now;
}
// TROOPS MAKE SUM IN BARAKS , ETC
//if($queued[count($queued) - 1]['unit'] == $unit){
//$time = $amt*$queued[count($queued) - 1]['eachtime'];
//$q = "UPDATE " . TB_PREFIX . "training SET amt = amt + $amt, timestamp = timestamp + $time WHERE id = ".$queued[count($queued) - 1]['id']."";
//}else{
$q = "INSERT INTO " . TB_PREFIX . "training values (0,$vid,$unit,$amt,$pop,$time,$each,$time2)";
//}
} else {
$q = "DELETE FROM " . TB_PREFIX . "training where id = $vid";
}
$time = $now + ($each * $amt);
if(count($queued) > 0){
$time += $queued[count($queued) - 1]['timestamp'] - $now;
$time2 += $queued[count($queued) - 1]['timestamp'] - $now;
}
$q = "INSERT INTO " . TB_PREFIX . "training values (0, $vid, $unit, $amt, $pop, $time, $each, $time2)";
}
else $q = "DELETE FROM " . TB_PREFIX . "training where id = $vid";
return mysqli_query($this->dblink,$q);
}
@@ -6947,29 +6906,30 @@ References: User ID/Message ID, Mode
}
/**
* Calculates how much time troops spend to walk from a village to another, counting artifacts
* Calculates how much artifacts affect troops speed, cranny efficency, etc.
*
* @param int $uid The User ID
* @param int $vid The village ID
* @param int $time The old time, without multipliers
* @return int Returns the new time, multiplied or divided by artifacts bonus or malus
* @param int $kind The kind of the artifact
* @param float $multiplicand The value which needs to be multiplied
* @return int Returns the new value, multiplied or divided by artifacts bonus or malus
*/
function getTroopsWalkingTime($uid, $vid, $kind, $time){
list($uid, $vid, $time) = $this->escape_input((int) $uid,(int) $vid, $time);
function getArtifactsValueInfluence($uid, $vid, $kind, $multiplicand){
list($uid, $vid, $kind, $multiplicand) = $this->escape_input((int) $uid,(int) $vid, $kind, $multiplicand);
$artefacts = $foolArefacts = [];
$multiplier = [2, 3, 1.5];
$multipliers = [1 => [4, 5, 3], 2 => [1/2, 1/3, 2/3], 3 => [5, 10, 3], 4 => [1/2, 1/2, 3/4], 5 => [1/2, 1/2, 3/4], 7 => [3, 6, 2]];
$artefacts[] = count($this->getOwnUniqueArtefactInfo2($vid, $kind, 1, 1)); //Village effect
$artefacts[] = count($this->getOwnUniqueArtefactInfo2($uid, $kind, 3, 0)); //Unique effect
$artefacts[] = count($this->getOwnUniqueArtefactInfo2($uid, $kind, 2, 0)); //Account effect
$fasterTroops = 1;
$multiplier = 1;
for($i = 0; $i < count($artefacts); $i++)
{
if($artefacts[$i] > 0) {
$fasterTroops = $multiplier[$i];
$multiplier = $multipliers[$kind][$i];
break;
}
}
@@ -6982,12 +6942,35 @@ References: User ID/Message ID, Mode
{
if(count($foolArefacts[$i]) > 0 && $foolArefacts[$i]['kind'] == $kind)
{
$foolEffect = $foolArefacts[$i]['bad_effect'] == 1 ? $foolArefacts[$i]['effect2'] : 1 / $foolArefacts[$i]['effect2'];
$foolEffect = $foolArefacts[$i]['bad_effect'] == 1 ? 1 / $foolArefacts[$i]['effect2'] : $foolArefacts[$i]['effect2'];
break;
}
}
return round(($time / $fasterTroops) * $foolEffect);
if(in_array($kind, [2, 4, 5])) $foolEffect = 1 / $foolEffect;
return ($multiplicand == 1 ) ? $multiplicand * $multiplier * $foolEffect : round($multiplicand * $multiplier * $foolEffect);
}
/**
* Get the total artifacts sum, divided by small, great and unique, by kind
*
* @param int $uid The User ID
* @param int $vid The Village ID
* @param int $kind The kind of the artifact
* @return array Returns the total artifacts sum divided by size
*/
function getArtifactsSumByKind($uid, $vid, $kind){
list($uid, $vid, $kind) = $this->escape_input((int) $uid, (int) $vid, (int) $kind);
$q = "SELECT SUM(IF((size = '1' AND vref = $vid) OR size > '1', 1, 0)) totals,
SUM(IF(size = '1' AND vref = $vid, 1, 0)) small,
SUM(IF(size = '2', 1, 0)) great,
SUM(IF(size = '3', 1, 0)) `unique`
FROM " . TB_PREFIX . "artefacts WHERE owner = ".(int) $uid." AND active = 1 AND (type = $kind OR kind = $kind)";
$result = mysqli_query($this->dblink, $q);
return $this->mysqli_fetch_all($result)[0];
}
function addArtefact($vref, $owner, $type, $size, $name, $desc, $effect, $img) {
@@ -7276,6 +7259,7 @@ References: User ID/Message ID, Mode
* Activate an artifact by his id
*
* @param int $id The id of the artifact
* @param int $mode 1 for activating an artifact, 0 for deactivating it
* @return bool Returns true if the query was successful, false otherwise
*/
@@ -7307,12 +7291,11 @@ References: User ID/Message ID, Mode
list($size,$type) = $this->escape_input((int) $size,(int) $type);
//fix by Ronix
global $session, $form;
$size1 = $size2 = $size3 = 0;
global $form;
$artifact = $this->getOwnArtefactInfo($from);
if (!empty($artifact)) {
$form->addError( "error", "Treasury is full. Your hero could not claim the artefact" );
$form->addError("error", "Treasury is full. Your hero could not claim the artefact");
return false;
}
@@ -7325,51 +7308,41 @@ References: User ID/Message ID, Mode
$DefenderFields = $this->getResourceLevel( $vref );
$defcanclaim = true;
for ( $i = 19; $i <= 38; $i ++ ) {
if ( $DefenderFields[ 'f' . $i . 't' ] == 27 ) {
$defTresuaryLevel = $DefenderFields[ 'f' . $i ];
if ( $defTresuaryLevel > 0 ) {
for ($i = 19; $i <= 38; $i++) {
if ($DefenderFields['f'.$i.'t'] == 27) {
$defTresuaryLevel = $DefenderFields['f'.$i];
if ($defTresuaryLevel > 0) {
$defcanclaim = false;
$form->addError( "error", "Treasury has not been destroyed. Your hero could not claim the artefact" );
$form->addError("error", "Treasury has not been destroyed. Your hero could not claim the artefact");
return false;
} else {
$defcanclaim = true;
}
else $defcanclaim = true;
}
}
$AttackerFields = $this->getResourceLevel( $from, 2 );
for ( $i = 19; $i <= 38; $i ++ ) {
if ( $AttackerFields[ 'f' . $i . 't' ] == 27 ) {
$attTresuaryLevel = $AttackerFields[ 'f' . $i ];
for($i = 19; $i <= 38; $i++) {
if($AttackerFields['f'.$i.'t'] == 27) {
$attTresuaryLevel = $AttackerFields['f'.$i];
$villageartifact = $attTresuaryLevel >= 10;
$accountartifact = $attTresuaryLevel >= 20;
}
}
if (($artifact['great'] > 0 || $artifact['unique'] > 0) && $size > 1 && $uid != $vuid) {
if(($artifact['great'] > 0 || $artifact['unique'] > 0) && $size > 1 && $uid != $vuid) {
$form->addError( "error", "Max num. of great/unique artefacts. Your hero could not claim the artefact" );
return false;
}
if ( ( $size == 1 && ( $villageartifact || $accountartifact ) ) || ( ( $size == 2 || $size == 3 ) && $accountartifact ) ) {
if(($size == 1 && ($villageartifact || $accountartifact)) || (($size == 2 || $size == 3) && $accountartifact)) {
return true;
/*
if($this->getVillageField($from,"capital")==1 && $type==11) {
$form->addError("error","Ancient Construction Plan cannot kept in capital village");
return FALSE;
}else{
return TRUE;
}
*/
} else {
$form->addError( "error", "Your level treasury is low. Your hero could not claim the artefact" );
$form->addError("error", "Your level treasury is low. Your hero could not claim the artefact");
return false;
}
} else {
$form->addError( "error", "Max num. of artefacts. Your hero could not claim the artefact" );
$form->addError("error", "Max num. of artefacts. Your hero could not claim the artefact");
return false;
}
}
+1 -1
View File
@@ -992,7 +992,7 @@ define("OWN_ARTIFACTS","Own artefacts");
define("CONQUERED","Conquered");
define("DISTANCE","Distance");
define("EFFECT","Effect");
define("ACCOUNT","account");
define("ACCOUNT","Account");
define("SMALL_ARTIFACTS","Small artefacts");
define("LARGE_ARTIFACTS","Large artefacts");
define("NO_ARTIFACTS","There is no artefacts.");
+9 -49
View File
@@ -499,52 +499,12 @@ class Technology {
}
}
// $unit = "hero";
// global $$unit;
// $dataarray = $$unit;
if ( $prisoners == 0 ) {
if ( ! isset( $array['hero'] ) ) {
$array['hero'] = 0;
}
$upkeep += $array['hero'] * 6;
} else {
if ( ! isset( $array['t11'] ) ) {
$array['t11'] = 0;
}
$upkeep += $array['t11'] * 6;
}
$artefact = count( $database->getOwnUniqueArtefactInfo2( $session->uid, 4, 3, 0 ) );
$artefact1 = count( $database->getOwnUniqueArtefactInfo2( $vid, 4, 1, 1 ) );
$artefact2 = count( $database->getOwnUniqueArtefactInfo2( $session->uid, 4, 2, 0 ) );
if ( $artefact > 0 ) {
$upkeep /= 2;
$upkeep = round( $upkeep );
} else if ( $artefact1 > 0 ) {
$upkeep /= 2;
$upkeep = round( $upkeep );
} else if ( $artefact2 > 0 ) {
$upkeep /= 4;
$upkeep = round( $upkeep );
$upkeep *= 3;
}
$foolartefact = $database->getFoolArtefactInfo( 4, $vid, $session->uid );
if ( count( $foolartefact ) > 0 ) {
var_dump($foolartefact);
foreach ( $foolartefact as $arte ) {
if ( $arte['bad_effect'] == 1 ) {
$upkeep *= $arte['effect2'];
} else {
$upkeep /= $arte['effect2'];
$upkeep = round( $upkeep );
}
}
}
return $upkeep;
$unit = ($prisoners > 0) ? 't11' : 'hero';
if(!isset($array[$unit])) $array[$unit] = 0;
$upkeep += $array[$unit] * 6;
return $database->getArtifactsValueInfluence($session->uid, $vid, 4, $upkeep);
}
private function trainUnit($unit,$amt,$great=false) {
@@ -627,9 +587,9 @@ class Technology {
$clay = ${'u'.$unit}['clay'] * $amt * ($great?3:1);
$iron = ${'u'.$unit}['iron'] * $amt * ($great?3:1);
$crop = ${'u'.$unit}['crop'] * $amt * ($great?3:1);
$time = $each*$amt;
if($database->modifyResource($village->wid,$wood,$clay,$iron,$crop,0) && $amt > 0) {
$database->trainUnit($village->wid,$unit+($great?60:0),$amt,${'u'.$unit}['pop'],$each,time()+$time,0);
if($database->modifyResource($village->wid, $wood , $clay, $iron, $crop, 0) && $amt > 0) {
$database->trainUnit($village->wid, $unit + ($great ? 60 : 0), $amt, ${'u'.$unit}['pop'], $each, 0);
}
}
}
+28 -74
View File
@@ -263,68 +263,42 @@ class Units {
private function processReturnTroops($enforce) {
global $database, $generator;
$to = $database->getVillage($enforce['from']);
$Gtribe = "";
if ($database->getUserField($to['owner'],'tribe',0) == '2'){ $Gtribe = "1"; }
else if ($database->getUserField($to['owner'],'tribe',0) == '3'){ $Gtribe = "2"; }
else if ($database->getUserField($to['owner'],'tribe',0) == '4'){ $Gtribe = "3"; }
else if ($database->getUserField($to['owner'],'tribe',0) == '5'){ $Gtribe = "4"; }
$Gtribe = ($tribe = $database->getUserField($to['owner'], 'tribe',0)) == 1 ? "" : $tribe - 1;
$start = ($database->getUserField($to['owner'],'tribe',0)-1)*10+1;
$end = ($database->getUserField($to['owner'],'tribe',0)*10);
$start = ($database->getUserField($to['owner'], 'tribe', 0) - 1) * 10 + 1;
$end = ($database->getUserField($to['owner'] ,'tribe', 0) * 10);
$from = $database->getVillage($enforce['from']);
$fromcoor = $database->getCoor($enforce['from']);
$tocoor = $database->getCoor($enforce['vref']);
$fromCor = array('x'=>$tocoor['x'], 'y'=>$tocoor['y']);
$toCor = array('x'=>$fromcoor['x'], 'y'=>$fromcoor['y']);
$fromCor = ['x' => $tocoor['x'], 'y' => $tocoor['y']];
$toCor = ['x' => $fromcoor['x'], 'y' => $fromcoor['y']];
$speeds = array();
$speeds = [];
//find slowest unit.
for($i=$start;$i<=$end;$i++){
for($i = $start; $i <= $end; $i++){
if(intval($enforce['u'.$i]) > 0){
if($unitarray) { reset($unitarray); }
$unitarray = $GLOBALS["u".$i];
$speeds[] = $unitarray['speed'];
}else{
$enforce['u'.$i]='0';
$enforce['u'.$i] = 0;
}
}
if( intval($enforce['hero']) > 0){
if(intval($enforce['hero']) > 0){
$hero_unit = $database->getHeroField($from['owner'], 'unit');
$speeds[] = $GLOBALS['u'.$hero_unit]['speed'];
}else{
$enforce['hero']='0';
}
$artefact = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($enforce['from'],2,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,2,0));
if($artefact > 0){
$fastertroops = 3;
}else if($artefact1 > 0){
$fastertroops = 2;
}else if($artefact2 > 0){
$fastertroops = 1.5;
}else{
$fastertroops = 1;
}
$time = round($generator->procDistanceTime($fromCor,$toCor,min($speeds),$enforce['from'])/$fastertroops);
$foolartefact2 = $database->getFoolArtefactInfo(2,$enforce['from'],$from['owner']);
if(count($foolartefact2) > 0){
foreach($foolartefact2 as $arte){
if($arte['bad_effect'] == 1){
$time *= $arte['effect2'];
}else{
$time /= $arte['effect2'];
$time = round($time);
}
}
}
$reference = $database->addAttack($enforce['from'],$enforce['u'.$start],$enforce['u'.($start+1)],$enforce['u'.($start+2)],$enforce['u'.($start+3)],$enforce['u'.($start+4)],$enforce['u'.($start+5)],$enforce['u'.($start+6)],$enforce['u'.($start+7)],$enforce['u'.($start+8)],$enforce['u'.($start+9)],$enforce['hero'],2,0,0,0,0);
$database->addMovement(4,$enforce['vref'],$enforce['from'],$reference,time(),($time+time()));
else $enforce['hero'] = 0;
$troopsTime = $generator->procDistanceTime($fromCor, $toCor, min($speeds), $enforce['from']);
$time = $database->getArtifactsValueInfluence($from['owner'], $enforce['from'], 2, $troopsTime);
$reference = $database->addAttack($enforce['from'], $enforce['u'.$start], $enforce['u'.($start + 1)], $enforce['u'.($start + 2)], $enforce['u'.($start + 3)], $enforce['u'.($start + 4)], $enforce['u'.($start + 5)], $enforce['u'.($start + 6)], $enforce['u'.($start + 7)], $enforce['u'.($start + 8)], $enforce['u'.($start + 9)], $enforce['hero'], 2, 0, 0, 0, 0);
$database->addMovement(4, $enforce['vref'], $enforce['from'], $reference, time(), ($time + time()));
$database->deleteReinf($enforce['id']);
}
@@ -427,29 +401,15 @@ class Units {
}
$troopsTime = $generator->procDistanceTime($from, $to, min($speeds), 1);
$time = $database->getTroopsWalkingTime($session->uid, $village->wid, 2, $troopsTime);
$to_owner = $database->getVillageField($data['to_vid'], "owner");
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
// Check if have WW owner have artefact Rivals great confusion or Artefact of the unique fool with that effect
// If is a WW village you can target on WW , if is not a WW village catapults will target randomly.
// Like it says : Exceptions are the WW which can always be targeted and the treasure chamber which can always be targeted, except with the unique artifact.
// Fixed by Advocaite and Shadow - Optimized by iopietro
$isThere = $database->getFieldLevelInVillage($data['to_vid'], 40);
$iswwvilla = $isThere > 0 ? 1 : 0;
$good_artefact = 0;
$artefact_2 = count($database->getOwnUniqueArtefactInfo2($to_owner, 7, 3, 0));
$artefact1_2 = count($database->getOwnUniqueArtefactInfo2($data['to_vid'], 7, 1, 1));
$artefact2_2 = count($database->getOwnUniqueArtefactInfo2($to_owner, 7, 2, 0));
$foolartefact2 = $database->getFoolArtefactInfo(7, $data['to_vid'], $to_owner);
if(count($foolartefact2) > 0) {
foreach ($foolartefact2 as $arte) {
if ($arte['bad_effect'] == 0) {
$good_artefact = 1;
}
}
}
$to_owner = $database->getVillageField($data['to_vid'], "owner");
$rivalsGreatConfusion = $database->getArtifactsSumByKind($to_owner, $data['to_vid'], 7);
$rallyPointLevel = ($village->resarray)['f39'];
$invalidBuildings = [];
@@ -486,24 +446,18 @@ class Units {
}
}
//TODO: Check those strings I do think they're wrong
if (isset($post['ctar1'])) {
if ($artefact_2 > 0 || $artefact1_2 > 0 || $artefact2_2 > 0 || $good_artefact == 1) {
if ($post['ctar1'] != 40 || $post['ctar1'] != 27 && $iswwvilla == 1) {
$post['ctar1'] = 99;
} else {
$post['ctar1'] = 99;
if(isset($post['ctar1'])) {
if($rivalsGreatConfusion['totals'] > 0) {
if($post['ctar1'] != 40 && ($post['ctar1'] != 27 || ($post['ctar1'] == 27 && $rivalsGreatConfusion['unique'] > 0))) {
$post['ctar1'] = 0;
}
}
}
else $post['ctar1'] = 0;
if(isset( $post['ctar2'])) {
if ($artefact_2 > 0 || $artefact1_2 > 0 || $artefact2_2 > 0 || $good_artefact == 1) {
if ($post['ctar2'] != 40 || $post['ctar2'] != 27 && $iswwvilla == 1) {
$post['ctar2'] = 99;
} else {
if(isset($post['ctar2']) && $post['ctar2'] > 0) {
if($rivalsGreatConfusion['totals'] > 0) {
if ($post['ctar2'] != 40 && ($post['ctar2'] != 27 || ($post['ctar2'] == 27 && $rivalsGreatConfusion['unique'] > 0))) {
$post['ctar2'] = 99;
}
}
@@ -645,7 +599,7 @@ class Units {
else $post['t11'] = 0;
$troopsTime = $generator->procDistanceTime($fromCor, $toCor, min($speeds), 1);
$time = $database->getTroopsWalkingTime($session->uid, $village->wid, 2, $troopsTime);
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
$reference = $database->addAttack( $enforce['from'], $post['t1'], $post['t2'], $post['t3'], $post['t4'], $post['t5'], $post['t6'], $post['t7'], $post['t8'], $post['t9'], $post['t10'], $post['t11'], 2, 0, 0, 0, 0 );
$database->addMovement( 4, $village->wid, $enforce['from'], $reference, time(), ( $time + time() ) );
+1 -1
View File
@@ -139,7 +139,7 @@ class Village {
$normalA = $database->getOwnArtefactInfoByType($_SESSION['wid'],4);
$largeA = $database->getOwnUniqueArtefactInfo($session->uid,4,2);
$uniqueA = $database->getOwnUniqueArtefactInfo($session->uid,4,3);
$upkeep = $technology->getUpkeep($this->unitall,0,$this->wid);
$upkeep = $technology->getUpkeep($this->unitall, 0, $this->wid);
$this->production['wood'] = $this->getWoodProd();
$this->production['clay'] = $this->getClayProd();
$this->production['iron'] = $this->getIronProd();