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
+1 -1
View File
@@ -312,7 +312,7 @@ $end = $tribe * 10;
$to = ['x' => $coor['x'], 'y' => $coor['y']];
$troopsTime = $generator->procDistanceTime($from, $to, min($speeds), 1);
$time = $database->getTroopsWalkingTime($session->uid, $village->wid, 2, $troopsTime);
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
?>
<td colspan="<?php echo !empty($process['t11']) ? 11 : 10; ?>">
+6 -29
View File
@@ -8,36 +8,13 @@ $newvillage = $database->getMInfo($_GET['id']);
$eigen = $database->getCoor($village->wid);
$from = array('x'=>$eigen['x'], 'y'=>$eigen['y']);
$to = array('x'=>$newvillage['x'], 'y'=>$newvillage['y']);
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,2,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,2,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,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($from,$to,300,0)/$fastertroops);
$foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$session->uid);
if(count($foolartefact) > 0){
foreach($foolartefact as $arte){
if($arte['bad_effect'] == 1){
$time *= $arte['effect2'];
}else{
$time /= $arte['effect2'];
$time = round($time);
}
}
}
$troopsTime = $generator->procDistanceTime($from, $to, 300, 0);
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
//-- Prevent user from founding a new village if there are not enough settlers
//-- fix by AL-Kateb
$tempunits = $database->getUnit($village->coor['id']);
$settler_key = "u" . $session->userinfo['tribe'] . "0";
$settlers = (int)$tempunits[$settler_key];
if($settlers < 3){
//-- fix by AL-Kateb - Semplified by iopietro
if($village->unitarray['u'.$session->tribe.'0'] < 3){
header("location: dorf1.php");
exit;
}
+1 -1
View File
@@ -146,7 +146,7 @@ $end = $att_tribe * 10;
}
$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);
?>
<td colspan="10">
+6 -37
View File
@@ -85,44 +85,13 @@
}
}
}
$troopsTime = $generator->procDistanceTime($from, $to, min($speeds), 1);
$time = $database->getArtifactsValueInfluence($getFLData['owner'], $getFLData['wref'], 2, $troopsTime);
$artefact = count( $database->getOwnUniqueArtefactInfo2( $getFLData['owner'], 2, 3, 0 ) );
$artefact1 = count( $database->getOwnUniqueArtefactInfo2( $getFLData['wref'], 2, 1, 1 ) );
$artefact2 = count( $database->getOwnUniqueArtefactInfo2( $getFLData['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( $from, $to, min( $speeds ), 1 ) / $fastertroops );
$foolartefact = $database->getFoolArtefactInfo( 2, $village->wid, $session->uid );
if ( count( $foolartefact ) > 0 ) {
foreach ( $foolartefact as $arte ) {
if ( $arte['bad_effect'] == 1 ) {
$time *= $arte['effect2'];
} else {
$time /= $arte['effect2'];
$time = round( $time );
}
}
}
if ( $data['u7'] > 0 ) {
$ctar1 = 99;
} else {
$ctar1 = 0;
}
$ctar2 = 0;
$abdata = $database->getABTech( $getFLData['wref'] );
$reference = $database->addAttack( ( $getFLData['wref'] ), $data['u1'], $data['u2'], $data['u3'], $data['u4'], $data['u5'], $data['u6'], $data['u7'], $data['u8'], $data['u9'], $data['u10'], $data['u11'], $data['type'], $ctar1, $ctar2, 0, $abdata['b1'], $abdata['b2'], $abdata['b3'], $abdata['b4'], $abdata['b5'], $abdata['b6'], $abdata['b7'], $abdata['b8'] );
$ctar1 = $ctar2 = 0;
$abdata = $database->getABTech( $getFLData['wref'] );
$reference = $database->addAttack( ( $getFLData['wref'] ), $data['u1'], $data['u2'], $data['u3'], $data['u4'], $data['u5'], $data['u6'], $data['u7'], $data['u8'], $data['u9'], $data['u10'], $data['u11'], $data['type'], $ctar1, $ctar2, 0, $abdata['b1'], $abdata['b2'], $abdata['b3'], $abdata['b4'], $abdata['b5'], $abdata['b6'], $abdata['b7'], $abdata['b8'] );
$totalunits = $data['u1'] + $data['u2'] + $data['u3'] + $data['u4'] + $data['u5'] + $data['u6'] + $data['u7'] + $data['u8'] + $data['u9'] + $data['u10'] + $data['u11'];
$units = [];