mirror of
https://github.com/correl/mage.git
synced 2024-12-27 03:00:13 +00:00
* Commander - Fixed that sacrificing a commander as cost was not possible. Added game log message if creature was removed from combat.
This commit is contained in:
parent
9000b4480c
commit
6d0f30178d
3 changed files with 23 additions and 12 deletions
|
@ -773,15 +773,17 @@ public class Combat implements Serializable, Copyable<Combat> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeFromCombat(UUID creatureId, Game game) {
|
public boolean removeFromCombat(UUID creatureId, Game game) {
|
||||||
|
boolean result = false;
|
||||||
Permanent creature = game.getPermanent(creatureId);
|
Permanent creature = game.getPermanent(creatureId);
|
||||||
if (creature != null) {
|
if (creature != null) {
|
||||||
creature.setAttacking(false);
|
creature.setAttacking(false);
|
||||||
creature.setBlocking(0);
|
creature.setBlocking(0);
|
||||||
for (CombatGroup group : groups) {
|
for (CombatGroup group : groups) {
|
||||||
group.remove(creatureId);
|
result |= group.remove(creatureId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void endCombat(Game game) {
|
public void endCombat(Game game) {
|
||||||
|
|
|
@ -492,18 +492,22 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
||||||
return defenderIsPlaneswalker;
|
return defenderIsPlaneswalker;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(UUID creatureId) {
|
public boolean remove(UUID creatureId) {
|
||||||
|
boolean result = false;
|
||||||
if (attackers.contains(creatureId)) {
|
if (attackers.contains(creatureId)) {
|
||||||
attackers.remove(creatureId);
|
attackers.remove(creatureId);
|
||||||
}
|
result = true;
|
||||||
if (blockers.contains(creatureId)) {
|
} else {
|
||||||
blockers.remove(creatureId);
|
if (blockers.contains(creatureId)) {
|
||||||
|
blockers.remove(creatureId);
|
||||||
//20100423 - 509.2a
|
result = true;
|
||||||
if (blockerOrder.contains(creatureId)) {
|
//20100423 - 509.2a
|
||||||
blockerOrder.remove(creatureId);
|
if (blockerOrder.contains(creatureId)) {
|
||||||
|
blockerOrder.remove(creatureId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void acceptBlockers(Game game) {
|
public void acceptBlockers(Game game) {
|
||||||
|
|
|
@ -817,7 +817,8 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
|
||||||
public boolean sacrifice(UUID sourceId, Game game) {
|
public boolean sacrifice(UUID sourceId, Game game) {
|
||||||
//20091005 - 701.13
|
//20091005 - 701.13
|
||||||
if (!game.replaceEvent(GameEvent.getEvent(EventType.SACRIFICE_PERMANENT, objectId, sourceId, controllerId))) {
|
if (!game.replaceEvent(GameEvent.getEvent(EventType.SACRIFICE_PERMANENT, objectId, sourceId, controllerId))) {
|
||||||
if (moveToZone(Zone.GRAVEYARD, sourceId, game, true)) {
|
// Commander replacement effect does not prevent successful sacrifice
|
||||||
|
if (moveToZone(Zone.GRAVEYARD, sourceId, game, true) || game.getState().getZone(this.getId()).equals(Zone.COMMAND)) {
|
||||||
Player player = game.getPlayer(getControllerId());
|
Player player = game.getPlayer(getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
game.informPlayers(new StringBuilder(player.getName()).append(" sacrificed ").append(this.getName()).toString());
|
game.informPlayers(new StringBuilder(player.getName()).append(" sacrificed ").append(this.getName()).toString());
|
||||||
|
@ -976,7 +977,11 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removeFromCombat(Game game) {
|
public boolean removeFromCombat(Game game) {
|
||||||
game.getCombat().removeFromCombat(objectId, game);
|
if (this.isAttacking() || this.blocking > 0) {
|
||||||
|
if (game.getCombat().removeFromCombat(objectId, game)) {
|
||||||
|
game.informPlayers(new StringBuilder(this.getName()).append(" removed from combat").toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue