Fixed missing watchers

This commit is contained in:
Oleg Agafonov 2020-01-03 12:18:19 +04:00
parent 6e5494c022
commit 65d914ffe7
5 changed files with 24 additions and 40 deletions

View file

@ -1,8 +1,5 @@
package mage.cards.p;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
@ -14,16 +11,8 @@ import mage.abilities.effects.AsThoughEffect;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ReturnFromExileEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.AsThoughEffectType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.cards.*;
import mage.constants.*;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;
@ -31,8 +20,10 @@ import mage.target.common.TargetOpponent;
import mage.target.targetpointer.FixedTarget;
import mage.watchers.common.SpellsCastWatcher;
import java.util.List;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public final class PlaneswalkersMischief extends CardImpl {
@ -94,6 +85,7 @@ class PlaneswalkersMischiefEffect extends OneShotEffect {
Condition condition = new PlaneswalkersMischiefCondition(source.getSourceId(), revealedCard.getId());
ConditionalOneShotEffect effect3 = new ConditionalOneShotEffect(effect2, condition, "if you haven't cast it, return it to its owner's hand.");
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect3);
delayedAbility.addWatcher(new SpellsCastWatcher());
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}

View file

@ -1,8 +1,5 @@
package mage.cards.p;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
@ -16,12 +13,8 @@ import mage.abilities.effects.common.ReturnFromExileEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterInstantOrSorceryCard;
import mage.constants.AsThoughEffectType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;
@ -30,8 +23,10 @@ import mage.target.TargetPlayer;
import mage.target.targetpointer.FixedTarget;
import mage.watchers.common.SpellsCastWatcher;
import java.util.List;
import java.util.UUID;
/**
*
* @author L_J (significantly based on code by jeffwadsworth and Styxo)
*/
public final class PsychicTheft extends CardImpl {
@ -102,6 +97,7 @@ class PsychicTheftEffect extends OneShotEffect {
ConditionalOneShotEffect effect3 = new ConditionalOneShotEffect(effect2, condition, "if you haven't cast it, return it to its owner's hand.");
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect3);
delayedAbility.addWatcher(new SpellsCastWatcher());
game.addDelayedTriggeredAbility(delayedAbility, source);
return true;
}
@ -138,10 +134,8 @@ class PsychicTheftCastFromExileEffect extends AsThoughEffectImpl {
&& game.getState().getZone(objectId) == Zone.EXILED) {
Player player = game.getPlayer(source.getControllerId());
Card card = game.getCard(objectId);
if (player != null
&& card != null) {
return true;
}
return player != null
&& card != null;
}
return false;
}

View file

@ -1,4 +1,3 @@
package mage.cards.r;
import mage.abilities.Ability;
@ -36,13 +35,11 @@ public final class RicochetTrap extends CardImpl {
this.subtype.add(SubType.TRAP);
// If an opponent cast a blue spell this turn, you may pay {R} rather than pay Ricochet Trap's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{R}"), RicochetTrapCondition.instance));
this.addAbility(new AlternativeCostSourceAbility(new ManaCostsImpl("{R}"), RicochetTrapCondition.instance), new SpellsCastWatcher());
// Change the target of target spell with a single target.
this.getSpellAbility().addEffect(new ChooseNewTargetsTargetEffect(true, true));
this.getSpellAbility().addTarget(new TargetSpell(filter));
this.getSpellAbility().addWatcher(new SpellsCastWatcher());
}
public RicochetTrap(final RicochetTrap card) {

View file

@ -1,7 +1,5 @@
package mage.cards.t;
import java.util.List;
import java.util.UUID;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -25,8 +23,10 @@ import mage.players.Player;
import mage.target.common.TargetCardInHand;
import mage.watchers.common.SpellsCastWatcher;
import java.util.List;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public final class TwinningGlass extends CardImpl {
@ -38,9 +38,8 @@ public final class TwinningGlass extends CardImpl {
// its mana cost if it has the same name as a spell that was cast this turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new TwinningGlassEffect(), new ManaCostsImpl("{1}"));
ability.addWatcher(new SpellsCastWatcher());
ability.addCost(new TapSourceCost());
this.addAbility(ability);
this.addAbility(ability, new SpellsCastWatcher());
}

View file

@ -1,7 +1,6 @@
package mage.game.command.emblems;
import java.util.List;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CounterTargetEffect;
@ -14,8 +13,9 @@ import mage.game.stack.Spell;
import mage.target.targetpointer.FixedTarget;
import mage.watchers.common.SpellsCastWatcher;
import java.util.List;
/**
*
* @author spjspj
*/
public final class JaceUnravelerOfSecretsEmblem extends Emblem {
@ -29,7 +29,9 @@ public final class JaceUnravelerOfSecretsEmblem extends Emblem {
setExpansionSetCodeForImage("SOI");
Effect effect = new CounterTargetEffect();
effect.setText("counter that spell");
this.getAbilities().add(new JaceUnravelerOfSecretsTriggeredAbility(effect, false));
Ability ability = new JaceUnravelerOfSecretsTriggeredAbility(effect, false);
ability.addWatcher(new SpellsCastWatcher());
this.getAbilities().add(ability);
}
}