Fixed can't attack alone ability (issue #119), creature wasn't untapped when attack was reverted.

This commit is contained in:
LevelX2 2013-03-05 22:01:01 +01:00
parent 03402fd539
commit 2409e229c0
4 changed files with 9 additions and 11 deletions

View file

@ -55,7 +55,7 @@ public class CantAttackAloneAbility extends StaticAbility<CantAttackAloneAbility
@Override
public String getRule() {
return "Can't attack alone";
return "{this} can't attack alone.";
}
@Override

View file

@ -55,7 +55,7 @@ public class CantBlockAloneAbility extends StaticAbility<CantBlockAloneAbility>
@Override
public String getRule() {
return "Can't block alone";
return "{this} can't block alone.";
}
@Override

View file

@ -177,8 +177,8 @@ public class Combat implements Serializable, Copyable<Combat> {
count += group.getAttackers().size();
}
if (count == 1) {
List<UUID> tobeRemoved = new ArrayList<UUID>();
for (CombatGroup group: groups) {
List<UUID> tobeRemoved = new ArrayList<UUID>();
for (UUID attackingCreatureId: group.getAttackers()) {
Permanent attacker = game.getPermanent(attackingCreatureId);
if (attacker != null && attacker.getAbilities().containsKey(CantAttackAloneAbility.getInstance().getId())) {
@ -186,10 +186,11 @@ public class Combat implements Serializable, Copyable<Combat> {
tobeRemoved.add(attackingCreatureId);
}
}
for (UUID attackingCreatureId : tobeRemoved) {
group.remove(attackingCreatureId);
}
}
for (UUID attackingCreatureId : tobeRemoved) {
this.removeAttacker(attackingCreatureId, game);
}
}
}

View file

@ -499,12 +499,9 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
toBeRemoved.add(blockerId);
}
}
for (UUID blockerId : toBeRemoved) {
remove(blockerId);
Permanent creature = game.getPermanent(blockerId);
if (creature != null) {
creature.setBlocking(creature.getBlocking() - 1);
}
game.getCombat().removeBlocker(blockerId, game);
}
if (blockers.isEmpty()) {
this.blocked = false;