mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Fixed can't attack alone ability (issue #119), creature wasn't untapped when attack was reverted.
This commit is contained in:
parent
03402fd539
commit
2409e229c0
4 changed files with 9 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -177,8 +177,8 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
count += group.getAttackers().size();
|
||||
}
|
||||
if (count == 1) {
|
||||
for (CombatGroup group: groups) {
|
||||
List<UUID> tobeRemoved = new ArrayList<UUID>();
|
||||
for (CombatGroup group: groups) {
|
||||
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);
|
||||
}
|
||||
this.removeAttacker(attackingCreatureId, game);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue