mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
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:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user