diff --git a/Mage.Sets/src/mage/cards/t/TeysaKarlov.java b/Mage.Sets/src/mage/cards/t/TeysaKarlov.java new file mode 100644 index 0000000000..461fbb03a5 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TeysaKarlov.java @@ -0,0 +1,111 @@ +package mage.cards.t; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; +import mage.abilities.keyword.LifelinkAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.NumberOfTriggersEvent; +import mage.game.events.ZoneChangeEvent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TeysaKarlov extends CardImpl { + + public TeysaKarlov(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{B}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.ADVISOR); + this.power = new MageInt(2); + this.toughness = new MageInt(4); + + // If a creature dying causes a triggered ability of a permanent you control to trigger, that ability triggers an additional time. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TeysaKarlovEffect())); + + // Creature tokens you control have vigilance and lifelink. + Ability ability = new SimpleStaticAbility( + Zone.BATTLEFIELD, + new GainAbilityControlledEffect( + VigilanceAbility.getInstance(), + Duration.WhileOnBattlefield, + StaticFilters.FILTER_CREATURE_TOKENS + ).setText("creature tokens you control have vigilance") + ); + ability.addEffect(new GainAbilityControlledEffect( + LifelinkAbility.getInstance(), + Duration.WhileOnBattlefield, + StaticFilters.FILTER_CREATURE_TOKENS + ).setText("and lifelink")); + this.addAbility(ability); + } + + private TeysaKarlov(final TeysaKarlov card) { + super(card); + } + + @Override + public TeysaKarlov copy() { + return new TeysaKarlov(this); + } +} + +class TeysaKarlovEffect extends ReplacementEffectImpl { + + TeysaKarlovEffect() { + super(Duration.WhileOnBattlefield, Outcome.Benefit); + staticText = "If a creature dying causes a triggered ability of a permanent you control to trigger, " + + "that ability triggers an additional time."; + } + + private TeysaKarlovEffect(final TeysaKarlovEffect effect) { + super(effect); + } + + @Override + public TeysaKarlovEffect copy() { + return new TeysaKarlovEffect(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.NUMBER_OF_TRIGGERS; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (event instanceof NumberOfTriggersEvent) { + NumberOfTriggersEvent numberOfTriggersEvent = (NumberOfTriggersEvent) event; + if (source.isControlledBy(event.getPlayerId()) + && game.getPermanent(numberOfTriggersEvent.getSourceId()) != null + && numberOfTriggersEvent.getSourceEvent() instanceof ZoneChangeEvent) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) numberOfTriggersEvent.getSourceEvent(); + if (zEvent.getFromZone() == Zone.BATTLEFIELD + && zEvent.getToZone() == Zone.GRAVEYARD + && zEvent.getTarget() != null + && zEvent.getTarget().isCreature()) { + return true; + } + } + } + return false; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + event.setAmount(event.getAmount() + 1); + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java index d9ef573079..a206d14f27 100644 --- a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java +++ b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java @@ -86,6 +86,7 @@ public final class RavnicaAllegiance extends ExpansionSet { cards.add(new SetCardInfo("Sphinx of Foresight", 55, Rarity.RARE, mage.cards.s.SphinxOfForesight.class)); cards.add(new SetCardInfo("Sphinx's Insight", 209, Rarity.COMMON, mage.cards.s.SphinxsInsight.class)); cards.add(new SetCardInfo("Stomping Ground", 259, Rarity.RARE, mage.cards.s.StompingGround.class)); + cards.add(new SetCardInfo("Teysa Karlov", 213, Rarity.RARE, mage.cards.t.TeysaKarlov.class)); cards.add(new SetCardInfo("The Haunt of Hightower", 273, Rarity.MYTHIC, mage.cards.t.TheHauntOfHightower.class)); cards.add(new SetCardInfo("Tithe Taker", 27, Rarity.RARE, mage.cards.t.TitheTaker.class)); cards.add(new SetCardInfo("Wilderness Reclamation", 140, Rarity.UNCOMMON, mage.cards.w.WildernessReclamation.class));