mirror of
https://github.com/magefree/mage.git
synced 2026-01-24 20:29:19 -08:00
* Spellskite - Fixed that abilities (like the one of Wild Defiance) did not trigger if target was changed to Spellskite.
This commit is contained in:
parent
7fa7cf910e
commit
2189236284
3 changed files with 92 additions and 20 deletions
|
|
@ -27,15 +27,16 @@
|
|||
*/
|
||||
package mage.sets.avacynrestored;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continious.BoostTargetEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
|
@ -43,8 +44,6 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.stack.Spell;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
*/
|
||||
|
|
@ -54,8 +53,6 @@ public class WildDefiance extends CardImpl {
|
|||
super(ownerId, 203, "Wild Defiance", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
|
||||
this.expansionSetCode = "AVR";
|
||||
|
||||
this.color.setGreen(true);
|
||||
|
||||
// Whenever a creature you control becomes the target of an instant or sorcery spell, that creature gets +3/+3 until end of turn.
|
||||
this.addAbility(new CreaturesYouControlBecomesTargetTriggeredAbility(new BoostTargetEffect(3, 3, Duration.EndOfTurn)));
|
||||
}
|
||||
|
|
@ -85,22 +82,25 @@ class CreaturesYouControlBecomesTargetTriggeredAbility extends TriggeredAbilityI
|
|||
return new CreaturesYouControlBecomesTargetTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.TARGETED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.TARGETED) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && permanent.getControllerId().equals(this.controllerId) && permanent.getCardType().contains(CardType.CREATURE)) {
|
||||
MageObject object = game.getObject(event.getSourceId());
|
||||
if (object != null && object instanceof Spell) {
|
||||
Card c = (Spell)object;
|
||||
if (c.getCardType().contains(CardType.INSTANT) || c.getCardType().contains(CardType.SORCERY)) {
|
||||
if (getTargets().size() == 0) {
|
||||
for (Effect effect : getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
}
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && permanent.getControllerId().equals(this.controllerId) && permanent.getCardType().contains(CardType.CREATURE)) {
|
||||
MageObject object = game.getObject(event.getSourceId());
|
||||
if (object != null && object instanceof Spell) {
|
||||
Card c = (Spell)object;
|
||||
if (c.getCardType().contains(CardType.INSTANT) || c.getCardType().contains(CardType.SORCERY)) {
|
||||
if (getTargets().size() == 0) {
|
||||
for (Effect effect : getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,8 @@ class SpellskiteEffect extends OneShotEffect {
|
|||
if (target.canTarget(stackObject.getControllerId(), source.getSourceId(), sourceAbility, game)) {
|
||||
oldTarget = game.getObject(targets.getFirstTarget());
|
||||
target.clearChosen();
|
||||
target.add(source.getSourceId(), game);
|
||||
// The source is still the spell on the stack
|
||||
target.addTarget(source.getSourceId(), stackObject.getStackAbility(), game);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -137,7 +138,8 @@ class SpellskiteEffect extends OneShotEffect {
|
|||
if (target.canTarget(stackObject.getControllerId(), source.getSourceId(), sourceAbility, game)) {
|
||||
oldTarget = game.getObject(targets.getFirstTarget());
|
||||
target.remove(targetId);
|
||||
target.addTarget(source.getSourceId(), source, game);
|
||||
// The source is still the spell on the stack
|
||||
target.addTarget(source.getSourceId(), stackObject.getStackAbility(), game);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue