Implemented Wavebreak Hippocamp

This commit is contained in:
Evan Kranzler 2020-01-02 16:37:07 -05:00
parent e675fe4d77
commit 3076b08250
2 changed files with 79 additions and 0 deletions

View file

@ -0,0 +1,78 @@
package mage.cards.w;
import mage.MageInt;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
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;
/**
* @author TheElk801
*/
public final class WavebreakHippocamp extends CardImpl {
public WavebreakHippocamp(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{2}{U}");
this.subtype.add(SubType.HORSE);
this.subtype.add(SubType.FISH);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Whenever you cast your first spell during each opponent's turn, draw a card.
this.addAbility(new WavebreakHippocampTriggeredAbility());
}
private WavebreakHippocamp(final WavebreakHippocamp card) {
super(card);
}
@Override
public WavebreakHippocamp copy() {
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())
|| !super.checkTrigger(event, game)) {
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

@ -112,6 +112,7 @@ public final class TherosBeyondDeath extends ExpansionSet {
cards.add(new SetCardInfo("Underworld Sentinel", 293, Rarity.RARE, mage.cards.u.UnderworldSentinel.class));
cards.add(new SetCardInfo("Victory's Envoy", 289, Rarity.RARE, mage.cards.v.VictorysEnvoy.class));
cards.add(new SetCardInfo("Warden of the Chained", 230, Rarity.UNCOMMON, mage.cards.w.WardenOfTheChained.class));
cards.add(new SetCardInfo("Wavebreak Hippocamp", 80, Rarity.RARE, mage.cards.w.WavebreakHippocamp.class));
cards.add(new SetCardInfo("Woe Strider", 123, Rarity.RARE, mage.cards.w.WoeStrider.class));
}
}