From b91e27381b6754df285922e85fa96c15dee424b8 Mon Sep 17 00:00:00 2001 From: iopietro Date: Fri, 18 May 2018 17:23:54 +0200 Subject: [PATCH] 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 --- GameEngine/Battle.php | 2 +- GameEngine/Lang/en.php | 1 + Templates/Build/14.tpl | 4 ++-- Templates/Build/15.tpl | 6 +++--- Templates/Build/28.tpl | 4 ++-- Templates/Build/31.tpl | 6 +++--- Templates/Build/32.tpl | 6 +++--- Templates/Build/33.tpl | 6 +++--- Templates/Build/34.tpl | 6 +++--- Templates/Build/35.tpl | 6 +++--- Templates/Build/41.tpl | 24 +++++++++++++++++++++++- Templates/Build/5.tpl | 2 +- Templates/Build/6.tpl | 6 +++--- Templates/Build/7.tpl | 2 +- Templates/Build/8.tpl | 4 ++-- Templates/Build/9.tpl | 4 ++-- 16 files changed, 56 insertions(+), 33 deletions(-) diff --git a/GameEngine/Battle.php b/GameEngine/Battle.php index 6984b133..a21b01b0 100755 --- a/GameEngine/Battle.php +++ b/GameEngine/Battle.php @@ -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); } diff --git a/GameEngine/Lang/en.php b/GameEngine/Lang/en.php index e4ea08d6..f28aa055 100755 --- a/GameEngine/Lang/en.php +++ b/GameEngine/Lang/en.php @@ -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"); diff --git a/Templates/Build/14.tpl b/Templates/Build/14.tpl index 336fbd40..52e2ff77 100644 --- a/Templates/Build/14.tpl +++ b/Templates/Build/14.tpl @@ -11,13 +11,13 @@ include("next.tpl"); - + isMax($village->resarray['f'.$id.'t'],$id)) { $next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master; - if($next<=20){ + if($next <= 20){ ?> diff --git a/Templates/Build/15.tpl b/Templates/Build/15.tpl index cc5c0818..279fa6de 100644 --- a/Templates/Build/15.tpl +++ b/Templates/Build/15.tpl @@ -11,13 +11,13 @@ include("next.tpl");
resarray['f'.$id]]['attri']; ?> resarray['f'.$id] > 0 ? $bid14[$village->resarray['f'.$id]]['attri'] : 100; ?>
:
- + 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){ ?> diff --git a/Templates/Build/28.tpl b/Templates/Build/28.tpl index 260db4f8..c58e4624 100644 --- a/Templates/Build/28.tpl +++ b/Templates/Build/28.tpl @@ -11,12 +11,12 @@ include("next.tpl");
resarray['f'.$id]]['attri']); ?> resarray['f'.$id] > 0 ? round($bid15[$village->resarray['f'.$id]]['attri']) : 300; ?>
:
- + 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){ ?> diff --git a/Templates/Build/31.tpl b/Templates/Build/31.tpl index bdc7e790..08aa4c9a 100644 --- a/Templates/Build/31.tpl +++ b/Templates/Build/31.tpl @@ -8,12 +8,12 @@ include("next.tpl");
resarray['f'.$id]]['attri']; ?> resarray['f'.$id] > 0 ? $bid28[$village->resarray['f'.$id]]['attri'] : 100; ?>
:
- + 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){ ?> diff --git a/Templates/Build/32.tpl b/Templates/Build/32.tpl index b1b3fc5c..653c981f 100644 --- a/Templates/Build/32.tpl +++ b/Templates/Build/32.tpl @@ -8,12 +8,12 @@ include("next.tpl");
resarray['f'.$id]]['attri']; ?> resarray['f'.$id] > 0 ? $bid31[$village->resarray['f'.$id]]['attri'] : 0; ?>
:
- + 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){ ?> diff --git a/Templates/Build/33.tpl b/Templates/Build/33.tpl index a6a1a4c1..13c7dce3 100644 --- a/Templates/Build/33.tpl +++ b/Templates/Build/33.tpl @@ -8,12 +8,12 @@ include("next.tpl");
resarray['f'.$id]]['attri']; ?> resarray['f'.$id] > 0 ? $bid32[$village->resarray['f'.$id]]['attri'] : 0; ?>
:
- + 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){ ?> diff --git a/Templates/Build/34.tpl b/Templates/Build/34.tpl index 42de6503..b53a6c2c 100644 --- a/Templates/Build/34.tpl +++ b/Templates/Build/34.tpl @@ -11,13 +11,13 @@ include("next.tpl");
resarray['f'.$id]]['attri']; ?> resarray['f'.$id] > 0 ? $bid33[$village->resarray['f'.$id]]['attri'] : 0; ?>
:
- + 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){ ?> diff --git a/Templates/Build/35.tpl b/Templates/Build/35.tpl index f1f0c9ff..afe96f30 100644 --- a/Templates/Build/35.tpl +++ b/Templates/Build/35.tpl @@ -11,13 +11,13 @@ include("next.tpl");
resarray['f'.$id]]['attri']; ?> resarray['f'.$id] > 0 ? $bid34[$village->resarray['f'.$id]]['attri'] : 100; ?>
:
- + 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){ ?> diff --git a/Templates/Build/41.tpl b/Templates/Build/41.tpl index 87683133..6232e02c 100644 --- a/Templates/Build/41.tpl +++ b/Templates/Build/41.tpl @@ -3,7 +3,29 @@

resarray['f'.$id]; ?>

- +
resarray['f'.$id]]['attri']; ?> resarray['f'.$id] > 0 ? $bid35[$village->resarray['f'.$id]]['attri'] : 0; ?>
:
+ + + + + + isMax($village->resarray['f'.$id.'t'],$id)) { + $next = $village->resarray['f'.$id] + 1 + $loopsame + $doublebuild + $master; + if($next <= 20){ + ?> + + + + + + + +
resarray['f'.$id] > 0 ? $bid41[$village->resarray['f'.$id]]['attri'] * 100 - 100 : 0; ?>
: 20:
diff --git a/Templates/Build/5.tpl b/Templates/Build/5.tpl index ebf3d033..9a9e1c57 100644 --- a/Templates/Build/5.tpl +++ b/Templates/Build/5.tpl @@ -11,7 +11,7 @@ include("next.tpl"); - + - - + + isMax($village->resarray['f'.$id.'t'],$id)) { $next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master; - if($next<=5){ + if($next <= 5){ ?> diff --git a/Templates/Build/7.tpl b/Templates/Build/7.tpl index 40dbfa21..604d968c 100644 --- a/Templates/Build/7.tpl +++ b/Templates/Build/7.tpl @@ -11,7 +11,7 @@ include("next.tpl");
resarray['f'.$id]]['attri']; ?> resarray['f'.$id] > 0 ? $bid5[$village->resarray['f'.$id]]['attri'] : 0; ?>
resarray['f'.$id]]['attri']; ?> resarray['f'.$id] > 0 ? $bid6[$village->resarray['f'.$id]]['attri'] : 0; ?>
:
- + - + isMax($village->resarray['f'.$id.'t'],$id)) { $next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master; - if($next<=5){ + if($next <= 5){ ?> diff --git a/Templates/Build/9.tpl b/Templates/Build/9.tpl index 39e88b63..329d01ce 100644 --- a/Templates/Build/9.tpl +++ b/Templates/Build/9.tpl @@ -11,13 +11,13 @@ include("next.tpl");
resarray['f'.$id]]['attri']; ?> resarray['f'.$id] > 0 ? $bid7[$village->resarray['f'.$id]]['attri'] : 0; ?>
resarray['f'.$id]]['attri']; ?> resarray['f'.$id] > 0 ? $bid8[$village->resarray['f'.$id]]['attri'] : 0; ?>
:
- + isMax($village->resarray['f'.$id.'t'],$id)) { $next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master; - if($next<=5){ + if($next <= 5){ ?>
resarray['f'.$id]]['attri']; ?> resarray['f'.$id] > 0 ? $bid9[$village->resarray['f'.$id]]['attri'] : 0; ?>
: