mirror of
https://github.com/correl/mage.git
synced 2025-04-13 09:11:06 -09:00
Combat NPE fix for mad ai
This commit is contained in:
parent
0a12e0af7e
commit
77ecea1253
1 changed files with 6 additions and 1 deletions
|
@ -186,7 +186,8 @@ public class CombatUtil {
|
||||||
List<Permanent> blockers = new ArrayList<Permanent>();
|
List<Permanent> blockers = new ArrayList<Permanent>();
|
||||||
for (Permanent blocker : possibleBlockers) {
|
for (Permanent blocker : possibleBlockers) {
|
||||||
SurviveInfo info = willItSurvive(game, attackerId, defenderId, attacker, blocker);
|
SurviveInfo info = willItSurvive(game, attackerId, defenderId, attacker, blocker);
|
||||||
if (info.isAttackerDied() && !info.isBlockerDied()) {
|
//if (info.isAttackerDied() && !info.isBlockerDied()) {
|
||||||
|
if (info.isAttackerDied()) {
|
||||||
blockers.add(blocker);
|
blockers.add(blocker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,6 +201,10 @@ public class CombatUtil {
|
||||||
combat.setAttacker(attackingPlayerId);
|
combat.setAttacker(attackingPlayerId);
|
||||||
combat.setDefenders(sim);
|
combat.setDefenders(sim);
|
||||||
|
|
||||||
|
if (blocker == null || attacker == null || sim.getPlayer(defendingPlayerId) == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
sim.getPlayer(defendingPlayerId).declareBlocker(blocker.getId(), attacker.getId(), sim);
|
sim.getPlayer(defendingPlayerId).declareBlocker(blocker.getId(), attacker.getId(), sim);
|
||||||
sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_BLOCKERS, defendingPlayerId, defendingPlayerId));
|
sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_BLOCKERS, defendingPlayerId, defendingPlayerId));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue