Another watcher fix
@@ -71,14 +71,15 @@ public class AttackedLastTurnWatcher extends Watcher {
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.BEGINNING_PHASE_PRE) {
UUID activePlayer = game.getActivePlayerId();
- if (attackedLastTurnCreatures.containsKey(activePlayer)) {
if (attackedThisTurnCreatures.containsKey(activePlayer)) {
+ if (attackedThisTurnCreatures.get(activePlayer) != null) {
+ attackedLastTurnCreatures.put(activePlayer, getAttackedThisTurnCreatures(activePlayer));
+ }
attackedThisTurnCreatures.remove(activePlayer);
- } else {
+ } else { // } else if (attackedLastTurnCreatures.containsKey(activePlayer)) {
attackedLastTurnCreatures.remove(activePlayer);
}
}
- }
if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED) {
UUID attackingPlayer = game.getCombat().getAttackingPlayerId();
Set<MageObjectReference> attackingCreatures = getAttackedThisTurnCreatures(attackingPlayer);
@@ -88,7 +89,6 @@ public class AttackedLastTurnWatcher extends Watcher {
attackingCreatures.add(new MageObjectReference(attacker, game));
}
}
- attackedLastTurnCreatures.put(attackingPlayer, attackingCreatures);
attackedThisTurnCreatures.put(attackingPlayer, attackingCreatures);
}
}
