Reports refactor #1

-Removed 29 files from the "Templates/Notice" folder, there were a lot
of duplicated/very similar kinds of report. Now, there are only 6 kinds
of report (9.tpl isn't counted)
+Changed a lot of codes in some .tpl reports, into a foreach

Automation.php:

+Modified report data, for the refactored report system
+Some clean-up

Battle.php:

+Fixed catapults and rams, they weren't able to destroy completely a building
+Fixed a possible division by 0 error
This commit is contained in:
iopietro
2018-04-19 20:14:54 +02:00
parent 06fc62752a
commit 882215cd2a
41 changed files with 426 additions and 9017 deletions
+8 -5
View File
@@ -872,15 +872,18 @@ class Battle {
{
if($moral < 1) $moral = 1;
elseif($moral > 3) $moral = 3;
$needMax = round(($moral * (pow($actualLevel, 2) + $actualLevel + 1) / (8 * $upDown)) + 0.5);
$needMax = round(($moral * (pow($actualLevel, 2) + $actualLevel + 1) / ($upDown == 0 ? 1 : 8 * $upDown)) + 0.5);
for($i = $actualLevel-1; $i >= 1; $i--)
{
$need = ($moral * (pow($i, 2) + $i + 1) / (8 * $upDown)) + 0.5;
if(min($realAttackers, $totalAttackers)/($needMax-$need) <= 1) break;
$need = ($moral * (pow($i, 2) + $i + 1) / ($upDown == 0 ? 1 : 8 * $upDown)) + 0.5;
if(min($realAttackers, $totalAttackers) / ($needMax - $need) <= 1) {
$i++;
break;
}
}
return $i + 1;
return $i;
}
};