forked from External/mage
Some changes related to #4893.
This commit is contained in:
parent
9919a3403d
commit
cddd81123b
37 changed files with 245 additions and 137 deletions
|
|
@ -410,7 +410,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
}
|
||||
} else {
|
||||
// Copied spell, only remove from stack
|
||||
game.getStack().remove(this);
|
||||
game.getStack().remove(this, game);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -772,7 +772,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
@Override
|
||||
public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, List<UUID> appliedEffects) {
|
||||
if (this.isCopiedSpell()) {
|
||||
game.getStack().remove(this);
|
||||
game.getStack().remove(this, game);
|
||||
return true;
|
||||
}
|
||||
return this.card.moveToExile(exileId, name, sourceId, game, appliedEffects);
|
||||
|
|
|
|||
|
|
@ -67,15 +67,16 @@ public class SpellStack extends ArrayDeque<StackObject> {
|
|||
if (top != null) {
|
||||
if (contains(top)) {
|
||||
logger.warn("StackObject was still on the stack after resoving" + top.getName());
|
||||
this.remove(top);
|
||||
this.remove(top, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean remove(StackObject object) {
|
||||
public boolean remove(StackObject object, Game game) {
|
||||
for (StackObject spell : this) {
|
||||
if (spell.getId().equals(object.getId())) {
|
||||
game.getState().setZone(spell.getId(), null);
|
||||
return super.remove(spell);
|
||||
}
|
||||
}
|
||||
|
|
@ -107,7 +108,7 @@ public class SpellStack extends ArrayDeque<StackObject> {
|
|||
}
|
||||
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER, objectId, sourceId, stackObject.getControllerId()))) {
|
||||
if (!(stackObject instanceof Spell)) { // spells are removed from stack by the card movement
|
||||
this.remove(stackObject);
|
||||
this.remove(stackObject, game);
|
||||
}
|
||||
stackObject.counter(sourceId, game, zone, owner, zoneDetail);
|
||||
if (!game.isSimulation()) {
|
||||
|
|
|
|||
|
|
@ -101,14 +101,14 @@ public class StackAbility extends StackObjImpl implements Ability {
|
|||
public boolean resolve(Game game) {
|
||||
if (ability.getTargets().stillLegal(ability, game) || !canFizzle()) {
|
||||
boolean result = ability.resolve(game);
|
||||
game.getStack().remove(this);
|
||||
game.getStack().remove(this, game);
|
||||
return result;
|
||||
}
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers("Ability has been fizzled: " + getRule());
|
||||
}
|
||||
counter(null, game);
|
||||
game.getStack().remove(this);
|
||||
game.getStack().remove(this, game);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue