Fix Sevinne's Reclamation. (#6275)

This also handles the rather unique case caused by Sevinne's Reclamation where the original spell resolves before the copy of it.
Also fixes a couple typos.
This commit is contained in:
Samuel Sandeen 2020-02-10 08:18:12 -05:00 committed by GitHub
parent ae7919cd07
commit d56f6b991b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 17 deletions

View file

@ -198,7 +198,7 @@ public abstract class AbilityImpl implements Ability {
/**
* game.applyEffects() has to be done at least for every effect that
* moves cards/permanent between zones, or changes control of
* objects so Static effects work as intened if dependant from the
* objects so Static effects work as intended if dependant from the
* moved objects zone it is in Otherwise for example were static
* abilities with replacement effects deactivated too late Example:
* {@link org.mage.test.cards.replacement.DryadMilitantTest#testDiesByDestroy testDiesByDestroy}
@ -924,7 +924,7 @@ public abstract class AbilityImpl implements Ability {
} else {
parameterSourceId = getSourceId();
}
// check agains shortLKI for effects that move multiple object at the same time (e.g. destroy all)
// check against shortLKI for effects that move multiple object at the same time (e.g. destroy all)
if (game.getShortLivingLKI(getSourceId(), getZone())) {
return true;
}

View file

@ -499,21 +499,21 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
case STACK:
StackObject stackObject;
if (getSpellAbility() != null) {
stackObject = game.getStack().getSpell(getSpellAbility().getId());
stackObject = game.getStack().getSpell(getSpellAbility().getId(), false);
} else {
stackObject = game.getStack().getSpell(this.getId());
stackObject = game.getStack().getSpell(this.getId(), false);
}
if (stackObject == null && (this instanceof SplitCard)) { // handle if half of Split cast is on the stack
stackObject = game.getStack().getSpell(((SplitCard) this).getLeftHalfCard().getId());
stackObject = game.getStack().getSpell(((SplitCard) this).getLeftHalfCard().getId(), false);
if (stackObject == null) {
stackObject = game.getStack().getSpell(((SplitCard) this).getRightHalfCard().getId());
stackObject = game.getStack().getSpell(((SplitCard) this).getRightHalfCard().getId(), false);
}
}
if (stackObject == null && (this instanceof AdventureCard)) {
stackObject = game.getStack().getSpell(((AdventureCard) this).getSpellCard().getId());
stackObject = game.getStack().getSpell(((AdventureCard) this).getSpellCard().getId(), false);
}
if (stackObject == null) {
stackObject = game.getStack().getSpell(getId());
stackObject = game.getStack().getSpell(getId(), false);
}
if (stackObject != null) {
removed = game.getStack().remove(stackObject, game);

View file

@ -113,10 +113,16 @@ public class SpellStack extends ArrayDeque<StackObject> {
}
public Spell getSpell(UUID id) {
return getSpell(id, true);
}
public Spell getSpell(UUID id, boolean allowCopies) {
for (StackObject stackObject : this) {
if (stackObject instanceof Spell) {
if (stackObject.getId().equals(id) || stackObject.getSourceId().equals(id)) {
return (Spell) stackObject;
if (allowCopies || !stackObject.isCopy()) {
return (Spell) stackObject;
}
}
}
}