Fixed trap bugs

+Traps are now repaired (built) in the trapper building, instead of
instantly given after a successful normal attack or a dismiss/releasing
from the rally point
+1/4 of trapped troops are now lost after a successful normal attack
+Traps are now released when troops die from starvation
+If you'll dismiss your trapped troops from the rally point, the gaul
player will be able to only repair 1/3 of the total used traps
+Created a new method to delete some redundant and duplicated code
starvation related
+The effect of WW building plans will be displayed correctly, when
they're active
+Troops related artifacts are now counted when building traps
+Some minor improovements and bug fixing
+Some clean-up
This commit is contained in:
iopietro
2018-05-02 21:17:20 +02:00
parent 8a760b0aec
commit 9e2d2b6842
8 changed files with 485 additions and 584 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ switch($kind){
$betterorbadder = $artefactBadEffect ? SPIES_INCREASE : SPIES_DECRESE;
break;
}
$bonus = isset($betterorbadder) ? $betterorbadder." (<b>".str_replace(["(", ")"], "" , $effecty)."</b>)" : "<b>Not yet active</b>";
$bonus = isset($betterorbadder) ? $betterorbadder." (<b>".str_replace(["(", ")"], "" , $effecty)."</b>)" : (($kind == 11 && $artefact['active']) ? "<b>".WW_BUILDING_PLAN."</b>" : "<b>Not yet active</b>");
?>
+29 -35
View File
@@ -13,8 +13,7 @@ include("next.tpl");
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo CURRENT_TRAPS; ?></th>
<td><b><?php echo $bid36[$village->resarray['f'.$id]]['attri']*TRAPPER_CAPACITY; ?></b> <?php echo TRAPS; ?></td>
<td><b><?php echo $bid36[$village->resarray['f'.$id]]['attri'] * TRAPPER_CAPACITY; ?></b> <?php echo TRAPS; ?></td>
</tr>
<tr>
<?php
@@ -23,12 +22,12 @@ include("next.tpl");
if($next<=20){
?>
<th><?php echo TRAPS_LEVEL; ?> <?php echo $next; ?>:</th>
<td><b><?php echo $bid36[$next]['attri']*TRAPPER_CAPACITY; ?></b> <?php echo TRAPS; ?></td>
<td><b><?php echo $bid36[$next]['attri'] * TRAPPER_CAPACITY; ?></b> <?php echo TRAPS; ?></td>
<?php
}else{
?>
<th><?php echo TRAPS_LEVEL; ?> 20:</th>
<td><b><?php echo $bid36[20]['attri']*TRAPPER_CAPACITY; ?></b> <?php echo TRAPS; ?></td>
<td><b><?php echo $bid36[20]['attri'] * TRAPPER_CAPACITY; ?></b> <?php echo TRAPS; ?></td>
<?php
}
}
@@ -66,34 +65,31 @@ include("next.tpl");
alt="Iron" title="<?php echo IRON; ?>" />10|</span><span><img class="r4" src="img/x.gif"
alt="Crop" title="<?php echo CROP; ?>" />20|</span><span><img class="r5" src="img/x.gif" alt="Crop consumption"
title="<?php echo CROP_COM; ?>" />0|<img class="clock" src="img/x.gif"
alt="Duration" title="<?php echo DURATION; ?>" /><?php echo $generator->getTimeFormat(round(($bid19[$village->resarray['f'.$id]]['attri'] / 100) * ${'u99'}['time'] / SPEED)); ?></span>
alt="Duration" title="<?php echo DURATION; ?>" />
<?php echo $generator->getTimeFormat($database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(($bid19[$village->resarray['f'.$id]]['attri'] / 100) * ${'u99'}['time'] / SPEED))); ?>
</span>
</div>
</td>
<?php
$trainlist = $technology->getTrainingList(8);
foreach($trainlist as $train) {
$train_amt += $train['amt'];
foreach($trainlist as $train) $train_amt += $train['amt'];
$max = $technology->maxUnit(99, false);
$max1 = 0;
for($i = 19; $i < 41; $i++){
if($village->resarray['f'.$i.'t'] == 36){
$max1 += $bid36[$village->resarray['f'.$i]]['attri'] * TRAPPER_CAPACITY;
}
}
if (!isset($train_amt)) $train_amt = 0;
if($max > $max1 - ($village->unitarray['u99'] + $train_amt)){
$max = $max1 - ($village->unitarray['u99'] + $train_amt);
}
$max = $technology->maxUnit(99,false);
$max1 = 0;
for($i=19;$i<41;$i++){
if($village->resarray['f'.$i.'t'] == 36){
$max1 += $bid36[$village->resarray['f'.$i]]['attri']*TRAPPER_CAPACITY;
}
}
if (!isset($train_amt)) {
$train_amt = 0;
}
if($max > $max1 - ($village->unitarray['u99'] + $train_amt)){
$max = $max1 - ($village->unitarray['u99'] + $train_amt);
}
if($max < 0){
$max = 0;
}
if($max < 0) $max = 0;
?>
<td class="val"><input type="text" class="text" name="t99" value="0" maxlength="4"></td>
<td class="max"><a href="#" onClick="document.snd.t99.value=<?php echo $max; ?>">(<?php echo $max; ?>)</a></td>
@@ -105,7 +101,7 @@ include("next.tpl");
} else {
echo "<b>".TRAINING_COMMENCE_TRAPPER."</b><br>\n";
}
if(count($trainlist) > 0) {
if(!empty($trainlist)) {
echo "
<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\">
<thead><tr>
@@ -120,17 +116,15 @@ include("next.tpl");
echo "<tr><td class=\"desc\">";
echo "<img class=\"unit u".$train['unit']."\" src=\"img/x.gif\" alt=\"".U99."\" title=\"".U99."\" />";
echo $train['amt']." ".U99."</td><td class=\"dur\">";
if ($TrainCount == 1 ) {
$NextFinished = $generator->getTimeFormat(($train['timestamp']-time())-($train['amt']-1)*$train['eachtime']);
echo "<span id=timer1>".$generator->getTimeFormat($train['timestamp']-time())."</span>";
} else {
echo $generator->getTimeFormat($train['eachtime']*$train['amt']);
}
if ($TrainCount == 1) {
$NextFinished = $generator->getTimeFormat(($train['timestamp'] - time()) - ($train['amt'] - 1) * $train['eachtime']);
echo "<span id=timer1>".$generator->getTimeFormat($train['timestamp'] - time())."</span>";
}
else echo $generator->getTimeFormat($train['eachtime'] * $train['amt']);
echo "</td><td class=\"fin\">";
$time = $generator->procMTime($train['timestamp']);
if($time[0] != "today") {
echo "on ".$time[0]." at ";
}
if($time[0] != "today") echo "on ".$time[0]." at ";
echo $time[1];
} ?>
</tr><tr class="next"><td colspan="3"><?php echo UNIT_FINISHED; ?> <span id="timer2"><?php echo $NextFinished; ?></span></td></tr>