mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
* Pyromancer Ascension - Fixed that the triggered ability that copies a spell also works, if the spell that was copied left the stack (e.g. countered) before the ability resolves.
This commit is contained in:
parent
c12fb572f7
commit
a0ef96e975
2 changed files with 9 additions and 14 deletions
|
@ -29,14 +29,14 @@
|
|||
package mage.sets.zendikar;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.common.CopyTargetSpellEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.Predicates;
|
||||
|
@ -46,6 +46,7 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.target.TargetSpell;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -125,17 +126,8 @@ class PyromancerAscensionQuestTriggeredAbility extends TriggeredAbilityImpl<Pyro
|
|||
|
||||
class PyromancerAscensionCopyTriggeredAbility extends TriggeredAbilityImpl<PyromancerAscensionCopyTriggeredAbility> {
|
||||
|
||||
private static final FilterSpell filter = new FilterSpell();
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
new CardTypePredicate(CardType.INSTANT),
|
||||
new CardTypePredicate(CardType.SORCERY)));
|
||||
}
|
||||
|
||||
PyromancerAscensionCopyTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new CopyTargetSpellEffect(), true);
|
||||
this.addTarget(new TargetSpell(filter));
|
||||
}
|
||||
|
||||
PyromancerAscensionCopyTriggeredAbility(final PyromancerAscensionCopyTriggeredAbility ability) {
|
||||
|
@ -154,8 +146,7 @@ class PyromancerAscensionCopyTriggeredAbility extends TriggeredAbilityImpl<Pyrom
|
|||
if (isControlledInstantOrSorcery(spell)) {
|
||||
Permanent permanent = game.getBattlefield().getPermanent(this.getSourceId());
|
||||
if (permanent != null && permanent.getCounters().getCount(CounterType.QUEST) >= 2) {
|
||||
this.getTargets().get(0).clearChosen();
|
||||
this.getTargets().get(0).add(spell.getId(), game);
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(spell.getId()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import mage.constants.Outcome;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
|
@ -54,6 +55,9 @@ public class CopyTargetSpellEffect extends OneShotEffect<CopyTargetSpellEffect>
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
|
||||
if (spell == null) {
|
||||
spell = (Spell) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.STACK);
|
||||
}
|
||||
if (spell != null) {
|
||||
Spell copy = spell.copySpell();
|
||||
copy.setControllerId(source.getControllerId());
|
||||
|
|
Loading…
Reference in a new issue