fix: 도시 관련 전투 제어

This commit is contained in:
2023-05-12 00:07:00 +09:00
parent 74b9e0b4a5
commit 2ad0c6e509
4 changed files with 51 additions and 16 deletions
+10 -4
View File
@@ -341,9 +341,13 @@ usort($defenderList, function (WarUnit $lhs, WarUnit $rhs) use ($attacker) {
return - (extractBattleOrder($lhs, $attacker) <=> extractBattleOrder($rhs, $attacker));
});
$rawDefenderList = array_map(function (WarUnit $unit) {
return $unit->getRaw();
}, $defenderList);
$rawDefenderList = [];
foreach($defenderList as $unit){
if(extractBattleOrder($unit, $attacker) <= 0){
continue;
}
$rawDefenderList[] = $unit->getRaw();
}
unset($defenderList);
$db = DB::db();
@@ -405,7 +409,9 @@ function simulateBattle(
);
}
$defenderList[] = $city;
if(count($defenderList) == 0 && extractBattleOrder($city, $attacker) > 0){
$defenderList[] = $city;
}
$iterDefender = new \ArrayIterator($defenderList);