General fixes

+Fixed a bug that didn't permit to display the bonus of some buildings
at level 0
+The cavalry training percentage bonus, provided by the horsedrinking
trough, is now displayed correctly
This commit is contained in:
iopietro
2018-05-18 17:23:54 +02:00
parent 0322a0ae49
commit b91e27381b
16 changed files with 56 additions and 33 deletions
+1 -1
View File
@@ -464,7 +464,7 @@ class Battle {
$winner = ($rap > $rdp);
// Formula for calculating the Moral
// WW villages aren't affected by this moral bonus
// WW villages aren't affected by this bonus
if($attpop > $defpop && !$isWWVillage) {
$moralbonus = 1 / round(max(0.667, pow($defpop / $attpop, 0.2 * min(1, $rap / ($rdp > 0 ? $rdp : 1)))), 3);
}
+1
View File
@@ -1113,6 +1113,7 @@ define("WORLD_WONDER_NOTCHANGE_NAME","You can not change the name of the World W
define("WORLD_WONDER_NAME_CHANGED","Name changed");
define("HORSEDRINKING","Horse Drinking Trough");
define("EXTRA_BONUS","Extra bonus");
define("HORSEDRINKING_DESC","The horse drinking trough of the Romans decreases the training time of cavalry and the upkeep of these troops as well.");
define("GREATWORKSHOP","Great Workshop");
+2 -2
View File
@@ -11,13 +11,13 @@ include("next.tpl");
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo CURRENT_SPEED; ?></th>
<td><b><?php echo $bid14[$village->resarray['f'.$id]]['attri']; ?></b> <?php echo PERCENT; ?></td>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid14[$village->resarray['f'.$id]]['attri'] : 100; ?></b> <?php echo PERCENT; ?></td>
</tr>
<tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master;
if($next<=20){
if($next <= 20){
?>
<th><?php echo SPEED_LEVEL; ?> <?php echo $next; ?>:</th>
<td><b><?php echo $bid14[$next]['attri']; ?></b> <?php echo PERCENT; ?></td>
+3 -3
View File
@@ -11,13 +11,13 @@ include("next.tpl");
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo CURRENT_CONSTRUCTION_TIME; ?></th>
<td><b><?php echo round($bid15[$village->resarray['f'.$id]]['attri']); ?></b> <?php echo PERCENT; ?></td>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? round($bid15[$village->resarray['f'.$id]]['attri']) : 300; ?></b> <?php echo PERCENT; ?></td>
</tr>
<tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master;
if($next<=20){
$next = $village->resarray['f'.$id] + 1 + $loopsame + $doublebuild + $master;
if($next <= 20){
?>
<th><?php echo CONSTRUCTION_TIME_LEVEL; ?> <?php echo $next; ?>:</th>
<td><b><?php echo round($bid15[$next]['attri']); ?></b> <?php echo PERCENT; ?></td>
+2 -2
View File
@@ -11,12 +11,12 @@ include("next.tpl");
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo CURRENT_MERCHANT; ?></th>
<td><b><?php echo $bid28[$village->resarray['f'.$id]]['attri']; ?></b> <?php echo PERCENT; ?></td>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid28[$village->resarray['f'.$id]]['attri'] : 100; ?></b> <?php echo PERCENT; ?></td>
</tr>
<tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master;
$next = $village->resarray['f'.$id] + 1 + $loopsame + $doublebuild + $master;
if($next<=20){
?>
<th><?php echo MERCHANT_LEVEL; ?> <?php echo $next; ?>:</th>
+3 -3
View File
@@ -8,12 +8,12 @@ include("next.tpl");
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo DEFENCE_NOW; ?></th>
<td><b><?php echo $bid31[$village->resarray['f'.$id]]['attri']; ?></b> <?php echo PERCENT; ?></td>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid31[$village->resarray['f'.$id]]['attri'] : 0; ?></b> <?php echo PERCENT; ?></td>
</tr><tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master;
if($next<=20){
$next = $village->resarray['f'.$id] + 1 + $loopsame + $doublebuild + $master;
if($next <= 20){
?>
<th><?php echo DEFENCE_LEVEL; ?> <?php echo $next; ?>:</th>
+3 -3
View File
@@ -8,12 +8,12 @@ include("next.tpl");
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo DEFENCE_NOW; ?></th>
<td><b><?php echo $bid32[$village->resarray['f'.$id]]['attri']; ?></b> <?php echo PERCENT; ?></td>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid32[$village->resarray['f'.$id]]['attri'] : 0; ?></b> <?php echo PERCENT; ?></td>
</tr><tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master;
if($next<=20){
$next = $village->resarray['f'.$id] + 1 + $loopsame + $doublebuild + $master;
if($next <= 20){
?>
<th><?php echo DEFENCE_LEVEL; ?> <?php echo $next; ?>:</th>
+3 -3
View File
@@ -8,12 +8,12 @@ include("next.tpl");
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo DEFENCE_NOW; ?></th>
<td><b><?php echo $bid33[$village->resarray['f'.$id]]['attri']; ?></b> <?php echo PERCENT; ?></td>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid33[$village->resarray['f'.$id]]['attri'] : 0; ?></b> <?php echo PERCENT; ?></td>
</tr><tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master;
if($next<=20){
$next = $village->resarray['f'.$id] + 1 + $loopsame + $doublebuild + $master;
if($next <= 20){
?>
<th><?php echo DEFENCE_LEVEL; ?> <?php echo $next; ?>:</th>
+3 -3
View File
@@ -11,13 +11,13 @@ include("next.tpl");
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo CURRENT_STABILITY; ?></th>
<td><b><?php echo $bid34[$village->resarray['f'.$id]]['attri']; ?></b> <?php echo PERCENT; ?></td>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid34[$village->resarray['f'.$id]]['attri'] : 100; ?></b> <?php echo PERCENT; ?></td>
</tr>
<tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master;
if($next<=20){
$next = $village->resarray['f'.$id] + 1 + $loopsame + $doublebuild + $master;
if($next <= 20){
?>
<th><?php echo STABILITY_LEVEL; ?> <?php echo $next; ?>:</th>
<td><b><?php echo $bid34[$next]['attri']; ?></b> <?php echo PERCENT; ?></td>
+3 -3
View File
@@ -11,13 +11,13 @@ include("next.tpl");
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo CURRENT_BONUS; ?></th>
<td><b><?php echo $bid35[$village->resarray['f'.$id]]['attri']; ?></b> <?php echo PERCENT; ?></td>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid35[$village->resarray['f'.$id]]['attri'] : 0; ?></b> <?php echo PERCENT; ?></td>
</tr>
<tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master;
if($next<=10){
$next = $village->resarray['f'.$id] + 1 + $loopsame + $doublebuild + $master;
if($next <= 10){
?>
<th><?php echo BONUS_LEVEL; ?> <?php echo $next; ?>:</th>
<td><b><?php echo $bid35[$next]['attri']; ?></b> <?php echo PERCENT; ?></td>
+23 -1
View File
@@ -3,7 +3,29 @@
</a>
<h1><?php echo HORSEDRINKING; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo HORSEDRINKING_DESC; ?></p>
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo CURRENT_BONUS; ?></th>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid41[$village->resarray['f'.$id]]['attri'] * 100 - 100 : 0; ?></b> <?php echo PERCENT; ?></td>
</tr>
<tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id] + 1 + $loopsame + $doublebuild + $master;
if($next <= 20){
?>
<th><?php echo BONUS_LEVEL; ?> <?php echo $next; ?>:</th>
<td><b><?php echo $bid41[$next]['attri'] * 100 - 100; ?></b> <?php echo PERCENT; ?></td>
<?php
}else{
?>
<th><?php echo BONUS_LEVEL; ?> 20:</th>
<td><b><?php echo $bid41[20]['attri']; ?></b> <?php echo PERCENT; ?></td>
<?php
}}
?>
</tr>
</table>
<?php
include("upgrade.tpl");
?>
+1 -1
View File
@@ -11,7 +11,7 @@ include("next.tpl");
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo CURRENT_WOOD_BONUS; ?></th>
<td><b><?php echo $bid5[$village->resarray['f'.$id]]['attri']; ?></b> <?php echo PERCENT; ?></td>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid5[$village->resarray['f'.$id]]['attri'] : 0; ?></b> <?php echo PERCENT; ?></td>
</tr>
<tr>
<?php
+3 -3
View File
@@ -10,14 +10,14 @@ include("next.tpl");
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo CURRENT_WOOD_BONUS; ?></th>
<td><b><?php echo $bid6[$village->resarray['f'.$id]]['attri']; ?></b> <?php echo PERCENT; ?></td>
<th><?php echo CURRENT_CLAY_BONUS; ?></th>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid6[$village->resarray['f'.$id]]['attri'] : 0; ?></b> <?php echo PERCENT; ?></td>
</tr>
<tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master;
if($next<=5){
if($next <= 5){
?>
<th><?php echo CLAY_BONUS_LEVEL; ?> <?php echo $next; ?>:</th>
<td><b><?php echo $bid6[$next]['attri']; ?></b> <?php echo PERCENT; ?></td>
+1 -1
View File
@@ -11,7 +11,7 @@ include("next.tpl");
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo CURRENT_IRON_BONUS; ?></th>
<td><b><?php echo $bid7[$village->resarray['f'.$id]]['attri']; ?></b> <?php echo PERCENT; ?></td>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid7[$village->resarray['f'.$id]]['attri'] : 0; ?></b> <?php echo PERCENT; ?></td>
</tr>
<tr>
<?php
+2 -2
View File
@@ -11,13 +11,13 @@ include("next.tpl");
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo CURRENT_CROP_BONUS; ?></th>
<td><b><?php echo $bid8[$village->resarray['f'.$id]]['attri']; ?></b> <?php echo PERCENT; ?></td>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid8[$village->resarray['f'.$id]]['attri'] : 0; ?></b> <?php echo PERCENT; ?></td>
</tr>
<tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master;
if($next<=5){
if($next <= 5){
?>
<th><?php echo CROP_BONUS_LEVEL; ?> <?php echo $next; ?>:</th>
<td><b><?php echo $bid8[$next]['attri']; ?></b> <?php echo PERCENT; ?></td>
+2 -2
View File
@@ -11,13 +11,13 @@ include("next.tpl");
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo CURRENT_CROP_BONUS; ?></th>
<td><b><?php echo $bid9[$village->resarray['f'.$id]]['attri']; ?></b> <?php echo PERCENT; ?></td>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid9[$village->resarray['f'.$id]]['attri'] : 0; ?></b> <?php echo PERCENT; ?></td>
</tr>
<tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master;
if($next<=5){
if($next <= 5){
?>
<th><?php echo CROP_BONUS_LEVEL; ?> <?php echo $next; ?>:</th>
<td><b><?php echo $bid9[$next]['attri']; ?></b> <?php echo PERCENT; ?></td>