From c1d5a310d5280a35de8aeb5e933229a4d923f5f4 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 7 Feb 2022 08:48:58 -0500 Subject: [PATCH] [NEO] Implemented Tatsunari, Toad Rider --- .../src/mage/cards/t/TatsunariToadRider.java | 90 +++++++++++++++++++ .../src/mage/sets/KamigawaNeonDynasty.java | 1 + .../main/java/mage/filter/StaticFilters.java | 7 ++ .../mage/game/permanent/token/KeimiToken.java | 47 ++++++++++ 4 files changed, 145 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/TatsunariToadRider.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/KeimiToken.java diff --git a/Mage.Sets/src/mage/cards/t/TatsunariToadRider.java b/Mage.Sets/src/mage/cards/t/TatsunariToadRider.java new file mode 100644 index 0000000000..e536f6e306 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TatsunariToadRider.java @@ -0,0 +1,90 @@ +package mage.cards.t; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.combat.CantBeBlockedByAllTargetEffect; +import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.ReachAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.AbilityPredicate; +import mage.filter.predicate.mageobject.NamePredicate; +import mage.game.permanent.token.KeimiToken; +import mage.target.TargetPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TatsunariToadRider extends CardImpl { + + private static final FilterPermanent filter = new FilterControlledCreaturePermanent(); + private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent(); + private static final FilterPermanent filter3 = new FilterControlledPermanent(SubType.FROG); + + static { + filter.add(new NamePredicate("Keimi")); + filter2.add(Predicates.or( + new AbilityPredicate(FlyingAbility.class), + new AbilityPredicate(ReachAbility.class) + )); + } + + private static final Condition condition = new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.EQUAL_TO, 0); + + public TatsunariToadRider(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.NINJA); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Whenever you cast an enchantment spell, if you don't control a creature named Keimi, create Keimi, a legendary 3/3 black and green Frog creature token with "Whenever you cast an enchantment spell, each opponent loses 1 life and you gain 1 life." + this.addAbility(new ConditionalInterveningIfTriggeredAbility( + new SpellCastControllerTriggeredAbility( + new CreateTokenEffect(new KeimiToken()), + StaticFilters.FILTER_SPELL_AN_ENCHANTMENT, false + ), condition, "Whenever you cast an enchantment spell, if you don't control " + + "a creature named Keimi, create Keimi, a legendary 3/3 black and green Frog creature token with " + + "\"Whenever you cast an enchantment spell, each opponent loses 1 life and you gain 1 life.\"" + )); + + // {1}{G/U}: Tatsunari, Toad Rider and target Frog you control can't be blocked this turn except by creatures with flying or reach. + Ability ability = new SimpleActivatedAbility( + new CantBeBlockedByCreaturesSourceEffect( + filter2, Duration.EndOfTurn + ).setText("{this}"), new ManaCostsImpl<>("{1}{G/U}") + ); + ability.addEffect(new CantBeBlockedByAllTargetEffect(filter2, Duration.EndOfTurn) + .setText("and target Frog you control can't be blocked this turn except by creatures with flying or reach")); + ability.addTarget(new TargetPermanent(filter3)); + this.addAbility(ability); + } + + private TatsunariToadRider(final TatsunariToadRider card) { + super(card); + } + + @Override + public TatsunariToadRider copy() { + return new TatsunariToadRider(this); + } +} diff --git a/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java b/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java index d191591433..30d4604141 100644 --- a/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java +++ b/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java @@ -265,6 +265,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet { cards.add(new SetCardInfo("Tameshi, Reality Architect", 82, Rarity.RARE, mage.cards.t.TameshiRealityArchitect.class)); cards.add(new SetCardInfo("Tamiyo's Compleation", 83, Rarity.COMMON, mage.cards.t.TamiyosCompleation.class)); cards.add(new SetCardInfo("Tamiyo's Safekeeping", 211, Rarity.COMMON, mage.cards.t.TamiyosSafekeeping.class)); + cards.add(new SetCardInfo("Tatsunari, Toad Rider", 123, Rarity.RARE, mage.cards.t.TatsunariToadRider.class)); cards.add(new SetCardInfo("Teachings of the Kirin", 212, Rarity.RARE, mage.cards.t.TeachingsOfTheKirin.class)); cards.add(new SetCardInfo("Tempered in Solitude", 165, Rarity.UNCOMMON, mage.cards.t.TemperedInSolitude.class)); cards.add(new SetCardInfo("The Fall of Lord Konda", 12, Rarity.UNCOMMON, mage.cards.t.TheFallOfLordKonda.class)); diff --git a/Mage/src/main/java/mage/filter/StaticFilters.java b/Mage/src/main/java/mage/filter/StaticFilters.java index 70ce960cf5..fbc038bb4d 100644 --- a/Mage/src/main/java/mage/filter/StaticFilters.java +++ b/Mage/src/main/java/mage/filter/StaticFilters.java @@ -780,6 +780,13 @@ public final class StaticFilters { FILTER_SPELL_INSTANT_SORCERY_WIZARD.setLockedFilter(true); } + public static final FilterSpell FILTER_SPELL_AN_ENCHANTMENT = new FilterSpell("an enchantment spell"); + + static { + FILTER_SPELL_AN_ENCHANTMENT.add(CardType.ENCHANTMENT.getPredicate()); + FILTER_SPELL_AN_ENCHANTMENT.setLockedFilter(true); + } + public static final FilterSpell FILTER_SPELL_KICKED_A = new FilterSpell("a kicked spell"); static { diff --git a/Mage/src/main/java/mage/game/permanent/token/KeimiToken.java b/Mage/src/main/java/mage/game/permanent/token/KeimiToken.java new file mode 100644 index 0000000000..fb154e2d99 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/KeimiToken.java @@ -0,0 +1,47 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.LoseLifeOpponentsEffect; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.filter.StaticFilters; + +import java.util.Arrays; + +/** + * @author TheElk801 + */ +public final class KeimiToken extends TokenImpl { + + public KeimiToken() { + super("Keimi", "Keimi, a legendary 3/3 black and green Frog creature token with \"Whenever you cast an enchantment spell, each opponent loses 1 life and you gain 1 life.\""); + supertype.add(SuperType.LEGENDARY); + cardType.add(CardType.CREATURE); + color.setBlack(true); + color.setGreen(true); + subtype.add(SubType.FROG); + power = new MageInt(3); + toughness = new MageInt(3); + + Ability ability = new SpellCastControllerTriggeredAbility( + new LoseLifeOpponentsEffect(1), + StaticFilters.FILTER_SPELL_AN_ENCHANTMENT, false + ); + ability.addEffect(new GainLifeEffect(1).concatBy("and")); + this.addAbility(ability); + + availableImageSetCodes = Arrays.asList("NEO"); + } + + private KeimiToken(final KeimiToken token) { + super(token); + } + + public KeimiToken copy() { + return new KeimiToken(this); + } +}