Skip to content

Commit

Permalink
fixed 2moons
Browse files Browse the repository at this point in the history
  • Loading branch information
jstar88 committed Jan 13, 2014
1 parent 84ffee4 commit 8545065
Showing 4 changed files with 27 additions and 12 deletions.
10 changes: 7 additions & 3 deletions implementations/2Moons/1_6_1/calculateAttack.php
Original file line number Diff line number Diff line change
@@ -137,9 +137,8 @@ function calculateAttack(&$attackers, &$defenders, $FleetTF, $DefTF)
/********** ROUNDS INFOS **********/

$ROUND = array();
$i = 0;
$lastRound = $report->getLastRoundNumber();
for (; $i <= $lastRound; $i++)
for ($i = 0; $i <= $lastRound; $i++)
{
// in case of last round, ask for rebuilt defenses. to change rebuils prob see constants/battle_constants.php
$attackerGroupObj = ($lastRound == $i) ? $report->getAfterBattleAttackers() : $report->getResultAttackersFleetOnRound($i);
@@ -187,7 +186,12 @@ function calculateAttack(&$attackers, &$defenders, $FleetTF, $DefTF)
function roundInfo(BattleReport $report, $attackers, $defenders, PlayerGroup $attackerGroupObj, PlayerGroup $defenderGroupObj, $i, $attInfo, $defInfo)
{
// the last round doesn't has next round, so we not ask for fire etc
$round = $report->getRound($i);
$round = null;
// the last round doesn't has next round, so we not ask for fire etc
if($i <= $report->getLastRoundNumber())
{
$round = $report->getRound($i);
}
return array(
'attack' => ($i > $report->getLastRoundNumber()) ? 0 : $round->getAttackersFirePower(),
'defense' => ($i > $report->getLastRoundNumber()) ? 0 : $round->getDefendersFirePower(),
Original file line number Diff line number Diff line change
@@ -141,9 +141,8 @@ function calculateAttack(&$attackers, &$defenders, $FleetTF, $DefTF)
/********** ROUNDS INFOS **********/

$ROUND = array();
$i = 0;
$lastRound = $report->getLastRoundNumber();
for (; $i <= $lastRound; $i++)
for ($i = 0; $i <= $lastRound; $i++)
{
// in case of last round, ask for rebuilt defenses. to change rebuils prob see constants/battle_constants.php
$attackerGroupObj = ($lastRound == $i) ? $report->getAfterBattleAttackers() : $report->getResultAttackersFleetOnRound($i);
@@ -190,8 +189,12 @@ function calculateAttack(&$attackers, &$defenders, $FleetTF, $DefTF)
*/
function roundInfo(BattleReport $report, $attackers, $defenders, PlayerGroup $attackerGroupObj, PlayerGroup $defenderGroupObj, $i, $attInfo, $defInfo)
{
$round = null;
// the last round doesn't has next round, so we not ask for fire etc
$round = $report->getRound($i);
if($i <= $report->getLastRoundNumber())
{
$round = $report->getRound($i);
}
return array(
'attack' => ($i > $report->getLastRoundNumber()) ? 0 : $round->getAttackersFirePower(),
'defense' => ($i > $report->getLastRoundNumber()) ? 0 : $round->getDefendersFirePower(),
10 changes: 7 additions & 3 deletions implementations/2Moons/1_7_2/calculateAttack.php
Original file line number Diff line number Diff line change
@@ -137,9 +137,8 @@ function calculateAttack(&$attackers, &$defenders, $FleetTF, $DefTF)
/********** ROUNDS INFOS **********/

$ROUND = array();
$i = 0;
$lastRound = $report->getLastRoundNumber();
for (; $i <= $lastRound; $i++)
for ($i = 0; $i <= $lastRound; $i++)
{
// in case of last round, ask for rebuilt defenses. to change rebuils prob see constants/battle_constants.php
$attackerGroupObj = ($lastRound == $i) ? $report->getAfterBattleAttackers() : $report->getResultAttackersFleetOnRound($i);
@@ -186,8 +185,13 @@ function calculateAttack(&$attackers, &$defenders, $FleetTF, $DefTF)
*/
function roundInfo(BattleReport $report, $attackers, $defenders, PlayerGroup $attackerGroupObj, PlayerGroup $defenderGroupObj, $i, $attInfo, $defInfo)
{
$round = null;
// the last round doesn't has next round, so we not ask for fire etc
$round = $report->getRound($i);
if($i <= $report->getLastRoundNumber())
{
$round = $report->getRound($i);
}

return array(
'attack' => ($i > $report->getLastRoundNumber()) ? 0 : $round->getAttackersFirePower(),
'defense' => ($i > $report->getLastRoundNumber()) ? 0 : $round->getDefendersFirePower(),
10 changes: 7 additions & 3 deletions implementations/2Moons/1_7_2_injectionMode/calculateAttack.php
Original file line number Diff line number Diff line change
@@ -141,9 +141,8 @@ function calculateAttack(&$attackers, &$defenders, $FleetTF, $DefTF)
/********** ROUNDS INFOS **********/

$ROUND = array();
$i = 0;
$lastRound = $report->getLastRoundNumber();
for (; $i <= $lastRound; $i++)
for ($i = 0; $i <= $lastRound; $i++)
{
// in case of last round, ask for rebuilt defenses. to change rebuils prob see constants/battle_constants.php
$attackerGroupObj = ($lastRound == $i) ? $report->getAfterBattleAttackers() : $report->getResultAttackersFleetOnRound($i);
@@ -191,7 +190,12 @@ function calculateAttack(&$attackers, &$defenders, $FleetTF, $DefTF)
function roundInfo(BattleReport $report, $attackers, $defenders, PlayerGroup $attackerGroupObj, PlayerGroup $defenderGroupObj, $i, $attInfo, $defInfo)
{
// the last round doesn't has next round, so we not ask for fire etc
$round = $report->getRound($i);
$round = null;
// the last round doesn't has next round, so we not ask for fire etc
if($i <= $report->getLastRoundNumber())
{
$round = $report->getRound($i);
}
return array(
'attack' => ($i > $report->getLastRoundNumber()) ? 0 : $round->getAttackersFirePower(),
'defense' => ($i > $report->getLastRoundNumber()) ? 0 : $round->getDefendersFirePower(),

0 comments on commit 8545065

Please sign in to comment.