From 1461a875ff5a163c3bc37505c1dae642dad2594e Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 4 Apr 2021 10:19:32 -0400 Subject: [PATCH] [STX] Implemented Leyline Invocation --- .../src/mage/cards/l/LeylineInvocation.java | 36 ++++++++++++++++++ .../mage/sets/StrixhavenSchoolOfMages.java | 1 + .../common/LandsYouControlCount.java | 37 +++++++++++++++++++ .../hint/common/LandsYouControlHint.java | 26 +++++++++++++ 4 files changed, 100 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/l/LeylineInvocation.java create mode 100644 Mage/src/main/java/mage/abilities/dynamicvalue/common/LandsYouControlCount.java create mode 100644 Mage/src/main/java/mage/abilities/hint/common/LandsYouControlHint.java diff --git a/Mage.Sets/src/mage/cards/l/LeylineInvocation.java b/Mage.Sets/src/mage/cards/l/LeylineInvocation.java new file mode 100644 index 0000000000..426d3dcb80 --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LeylineInvocation.java @@ -0,0 +1,36 @@ +package mage.cards.l; + +import mage.abilities.dynamicvalue.common.LandsYouControlCount; +import mage.abilities.hint.common.LandsYouControlHint; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.game.permanent.token.QuandrixToken; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class LeylineInvocation extends CardImpl { + + public LeylineInvocation(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{5}{G}"); + + // Create a 0/0 green and blue Fractal creature token. Put X +1/+1 counters on it, where X is the number of lands you control. + this.getSpellAbility().addEffect(QuandrixToken.getEffect( + LandsYouControlCount.instance, "Put X +1/+1 counters on it, " + + "where X is the number of lands you control" + )); + this.getSpellAbility().addHint(LandsYouControlHint.instance); + } + + private LeylineInvocation(final LeylineInvocation card) { + super(card); + } + + @Override + public LeylineInvocation copy() { + return new LeylineInvocation(this); + } +} diff --git a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java index cfd07283cd..2977078c67 100644 --- a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java +++ b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java @@ -121,6 +121,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet { cards.add(new SetCardInfo("Leech Fanatic", 75, Rarity.COMMON, mage.cards.l.LeechFanatic.class)); cards.add(new SetCardInfo("Leonin Lightscribe", 20, Rarity.RARE, mage.cards.l.LeoninLightscribe.class)); cards.add(new SetCardInfo("Letter of Acceptance", 256, Rarity.COMMON, mage.cards.l.LetterOfAcceptance.class)); + cards.add(new SetCardInfo("Leyline Invocation", 136, Rarity.COMMON, mage.cards.l.LeylineInvocation.class)); cards.add(new SetCardInfo("Lorehold Apprentice", 198, Rarity.UNCOMMON, mage.cards.l.LoreholdApprentice.class)); cards.add(new SetCardInfo("Lorehold Campus", 268, Rarity.COMMON, mage.cards.l.LoreholdCampus.class)); cards.add(new SetCardInfo("Lorehold Command", 199, Rarity.RARE, mage.cards.l.LoreholdCommand.class)); diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/LandsYouControlCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/LandsYouControlCount.java new file mode 100644 index 0000000000..f2439c2c4a --- /dev/null +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/LandsYouControlCount.java @@ -0,0 +1,37 @@ +package mage.abilities.dynamicvalue.common; + +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.filter.StaticFilters; +import mage.game.Game; + +/** + * @author TheElk801 + */ +public enum LandsYouControlCount implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return game.getBattlefield().count( + StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, + sourceAbility.getSourceId(), sourceAbility.getControllerId(), game + ); + } + + @Override + public LandsYouControlCount copy() { + return instance; + } + + @Override + public String toString() { + return "X"; + } + + @Override + public String getMessage() { + return "lands you control"; + } +} diff --git a/Mage/src/main/java/mage/abilities/hint/common/LandsYouControlHint.java b/Mage/src/main/java/mage/abilities/hint/common/LandsYouControlHint.java new file mode 100644 index 0000000000..2c398cb500 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/hint/common/LandsYouControlHint.java @@ -0,0 +1,26 @@ +package mage.abilities.hint.common; + +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.common.LandsYouControlCount; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.game.Game; + +/** + * @author TheElk801 + */ +public enum LandsYouControlHint implements Hint { + + instance; + private static final Hint hint = new ValueHint("Lands you control", LandsYouControlCount.instance); + + @Override + public String getText(Game game, Ability ability) { + return hint.getText(game, ability); + } + + @Override + public Hint copy() { + return instance; + } +}