Implemented Arena Trickster

This commit is contained in:
Evan Kranzler 2020-01-05 21:55:44 -05:00
parent a09f0f6f3d
commit 690e042b36
5 changed files with 104 additions and 98 deletions

View file

@ -0,0 +1,41 @@
package mage.cards.a;
import mage.MageInt;
import mage.abilities.common.FirstSpellOpponentsTurnTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.counters.CounterType;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ArenaTrickster extends CardImpl {
public ArenaTrickster(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SHAMAN);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Whenever you cast your first spell during each opponent's turn, put a +1/+1 counter on Arena Trickster.
this.addAbility(new FirstSpellOpponentsTurnTriggeredAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false
));
}
private ArenaTrickster(final ArenaTrickster card) {
super(card);
}
@Override
public ArenaTrickster copy() {
return new ArenaTrickster(this);
}
}

View file

@ -1,19 +1,15 @@
package mage.cards.s; package mage.cards.s;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.SpellCastControllerTriggeredAbility; import mage.abilities.Ability;
import mage.abilities.common.FirstSpellOpponentsTurnTriggeredAbility;
import mage.abilities.effects.common.MayTapOrUntapTargetEffect; import mage.abilities.effects.common.MayTapOrUntapTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.Game; import mage.target.TargetPermanent;
import mage.game.events.GameEvent;
import mage.game.stack.Spell;
import mage.target.common.TargetNonlandPermanent;
import mage.watchers.common.SpellsCastWatcher;
import java.util.List;
import java.util.UUID; import java.util.UUID;
/** /**
@ -29,7 +25,11 @@ public final class StingingLionfish extends CardImpl {
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// Whenever you cast your first spell during each opponent's turn, you may tap or untap target nonland permanent. // Whenever you cast your first spell during each opponent's turn, you may tap or untap target nonland permanent.
this.addAbility(new StingingLionfishTriggeredAbility(), new SpellsCastWatcher()); Ability ability = new FirstSpellOpponentsTurnTriggeredAbility(
new MayTapOrUntapTargetEffect(), false
);
ability.addTarget(new TargetPermanent());
this.addAbility(ability);
} }
private StingingLionfish(final StingingLionfish card) { private StingingLionfish(final StingingLionfish card) {
@ -41,45 +41,3 @@ public final class StingingLionfish extends CardImpl {
return new StingingLionfish(this); return new StingingLionfish(this);
} }
} }
class StingingLionfishTriggeredAbility extends SpellCastControllerTriggeredAbility {
StingingLionfishTriggeredAbility() {
super(new MayTapOrUntapTargetEffect(), false);
this.addTarget(new TargetNonlandPermanent());
}
private StingingLionfishTriggeredAbility(StingingLionfishTriggeredAbility ability) {
super(ability);
}
@Override
public StingingLionfishTriggeredAbility copy() {
return new StingingLionfishTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getActivePlayerId().equals(this.getControllerId()) // ignore controller turn
|| !super.checkTrigger(event, game)) {
return false;
}
if (!game.getOpponents(this.getControllerId()).contains(game.getActivePlayerId())) {
return false;
}
SpellsCastWatcher watcher = game.getState().getWatcher(SpellsCastWatcher.class);
if (watcher == null) {
return false;
}
List<Spell> spells = watcher.getSpellsCastThisTurn(event.getPlayerId());
return spells != null && spells.size() == 1;
}
@Override
public String getRule() {
return "Whenever you cast your first spell during each opponent's turn, you mat tap or untap target permanent.";
}
}

View file

@ -1,18 +1,13 @@
package mage.cards.w; package mage.cards.w;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.SpellCastControllerTriggeredAbility; import mage.abilities.common.FirstSpellOpponentsTurnTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.Spell;
import mage.watchers.common.SpellsCastWatcher;
import java.util.List;
import java.util.UUID; import java.util.UUID;
/** /**
@ -29,7 +24,9 @@ public final class WavebreakHippocamp extends CardImpl {
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
// Whenever you cast your first spell during each opponent's turn, draw a card. // Whenever you cast your first spell during each opponent's turn, draw a card.
this.addAbility(new WavebreakHippocampTriggeredAbility(), new SpellsCastWatcher()); this.addAbility(new FirstSpellOpponentsTurnTriggeredAbility(
new DrawCardSourceControllerEffect(1), false
));
} }
private WavebreakHippocamp(final WavebreakHippocamp card) { private WavebreakHippocamp(final WavebreakHippocamp card) {
@ -41,44 +38,3 @@ public final class WavebreakHippocamp extends CardImpl {
return new WavebreakHippocamp(this); return new WavebreakHippocamp(this);
} }
} }
class WavebreakHippocampTriggeredAbility extends SpellCastControllerTriggeredAbility {
WavebreakHippocampTriggeredAbility() {
super(new DrawCardSourceControllerEffect(1), false);
}
private WavebreakHippocampTriggeredAbility(WavebreakHippocampTriggeredAbility ability) {
super(ability);
}
@Override
public WavebreakHippocampTriggeredAbility copy() {
return new WavebreakHippocampTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getActivePlayerId().equals(this.getControllerId()) // ignore controller turn
|| !super.checkTrigger(event, game)) {
return false;
}
if (!game.getOpponents(this.getControllerId()).contains(game.getActivePlayerId())) {
return false;
}
SpellsCastWatcher watcher = game.getState().getWatcher(SpellsCastWatcher.class);
if (watcher == null) {
return false;
}
List<Spell> spells = watcher.getSpellsCastThisTurn(event.getPlayerId());
return spells != null && spells.size() == 1;
}
@Override
public String getRule() {
return "Whenever you cast your first spell during each opponent's turn, draw a card.";
}
}

View file

@ -30,6 +30,7 @@ public final class TherosBeyondDeath extends ExpansionSet {
cards.add(new SetCardInfo("Aphemia, the Cacophony", 84, Rarity.RARE, mage.cards.a.AphemiaTheCacophony.class)); cards.add(new SetCardInfo("Aphemia, the Cacophony", 84, Rarity.RARE, mage.cards.a.AphemiaTheCacophony.class));
cards.add(new SetCardInfo("Arasta of the Endless Web", 165, Rarity.RARE, mage.cards.a.ArastaOfTheEndlessWeb.class)); cards.add(new SetCardInfo("Arasta of the Endless Web", 165, Rarity.RARE, mage.cards.a.ArastaOfTheEndlessWeb.class));
cards.add(new SetCardInfo("Archon of Falling Stars", 2, Rarity.UNCOMMON, mage.cards.a.ArchonOfFallingStars.class)); cards.add(new SetCardInfo("Archon of Falling Stars", 2, Rarity.UNCOMMON, mage.cards.a.ArchonOfFallingStars.class));
cards.add(new SetCardInfo("Arena Trickster", 126, Rarity.COMMON, mage.cards.a.ArenaTrickster.class));
cards.add(new SetCardInfo("Ashiok's Erasure", 43, Rarity.RARE, mage.cards.a.AshioksErasure.class)); cards.add(new SetCardInfo("Ashiok's Erasure", 43, Rarity.RARE, mage.cards.a.AshioksErasure.class));
cards.add(new SetCardInfo("Ashiok, Nightmare Muse", 208, Rarity.MYTHIC, mage.cards.a.AshiokNightmareMuse.class)); cards.add(new SetCardInfo("Ashiok, Nightmare Muse", 208, Rarity.MYTHIC, mage.cards.a.AshiokNightmareMuse.class));
cards.add(new SetCardInfo("Ashiok, Sculptor of Fears", 274, Rarity.MYTHIC, mage.cards.a.AshiokSculptorOfFears.class)); cards.add(new SetCardInfo("Ashiok, Sculptor of Fears", 274, Rarity.MYTHIC, mage.cards.a.AshiokSculptorOfFears.class));

View file

@ -0,0 +1,50 @@
package mage.abilities.common;
import mage.abilities.effects.Effect;
import mage.filter.FilterSpell;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.Spell;
import mage.watchers.common.SpellsCastWatcher;
import java.util.List;
/**
* @author TheElk801
*/
public class FirstSpellOpponentsTurnTriggeredAbility extends SpellCastControllerTriggeredAbility {
private static final FilterSpell defaultFilter
= new FilterSpell("your first spell during each opponent's turn");
public FirstSpellOpponentsTurnTriggeredAbility(Effect effect, boolean optional) {
super(effect, defaultFilter, optional);
this.addWatcher(new SpellsCastWatcher());
}
private FirstSpellOpponentsTurnTriggeredAbility(final FirstSpellOpponentsTurnTriggeredAbility ability) {
super(ability);
}
@Override
public FirstSpellOpponentsTurnTriggeredAbility copy() {
return new FirstSpellOpponentsTurnTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.isActivePlayer(this.getControllerId()) // ignore controller turn
|| !super.checkTrigger(event, game)
|| !game.getOpponents(this.getControllerId()).contains(game.getActivePlayerId())) {
return false;
}
SpellsCastWatcher watcher = game.getState().getWatcher(SpellsCastWatcher.class);
if (watcher == null) {
return false;
}
List<Spell> spells = watcher.getSpellsCastThisTurn(event.getPlayerId());
return spells != null && spells.size() == 1;
}
}