From b54c9449efc151fe25f35cdcbec9a808b8bdda59 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 3 Sep 2020 10:08:13 -0400 Subject: [PATCH] [ZNR] Implemented Mind Carver --- Mage.Sets/src/mage/cards/i/IntoTheStory.java | 25 +------- Mage.Sets/src/mage/cards/j/JacesPhantasm.java | 12 ++-- Mage.Sets/src/mage/cards/m/MindCarver.java | 58 +++++++++++++++++++ .../mage/cards/t/ThievesGuildEnforcer.java | 24 ++------ Mage.Sets/src/mage/sets/ZendikarRising.java | 1 + .../common/CardsInOpponentGraveCondition.java | 52 ++++++++++++----- 6 files changed, 113 insertions(+), 59 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/m/MindCarver.java diff --git a/Mage.Sets/src/mage/cards/i/IntoTheStory.java b/Mage.Sets/src/mage/cards/i/IntoTheStory.java index 02d5dfded4..7110d8be71 100644 --- a/Mage.Sets/src/mage/cards/i/IntoTheStory.java +++ b/Mage.Sets/src/mage/cards/i/IntoTheStory.java @@ -3,6 +3,7 @@ package mage.cards.i; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.Condition; +import mage.abilities.condition.common.CardsInOpponentGraveCondition; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.cost.SpellCostReductionSourceEffect; import mage.abilities.hint.ConditionHint; @@ -26,8 +27,8 @@ public final class IntoTheStory extends CardImpl { // This spell costs {3} less to cast if an opponent has seven or more cards in their graveyard. this.addAbility(new SimpleStaticAbility( - Zone.ALL, new SpellCostReductionSourceEffect(3, IntoTheStoryCondition.instance) - ).setRuleAtTheTop(true).addHint(new ConditionHint(IntoTheStoryCondition.instance, "Opponent has seven or more cards in their graveyard"))); + Zone.ALL, new SpellCostReductionSourceEffect(3, CardsInOpponentGraveCondition.SEVEN) + ).setRuleAtTheTop(true).addHint(CardsInOpponentGraveCondition.SEVEN.getHint())); // Draw four cards. this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(4)); @@ -42,23 +43,3 @@ public final class IntoTheStory extends CardImpl { return new IntoTheStory(this); } } - -enum IntoTheStoryCondition implements Condition { - instance; - - @Override - public boolean apply(Game game, Ability source) { - return game - .getOpponents(source.getControllerId()) - .stream() - .map(game::getPlayer) - .map(Player::getGraveyard) - .mapToInt(Graveyard::size) - .anyMatch(i -> i >= 7); - } - - @Override - public String toString() { - return "an opponent has seven or more cards in their graveyard"; - } -} diff --git a/Mage.Sets/src/mage/cards/j/JacesPhantasm.java b/Mage.Sets/src/mage/cards/j/JacesPhantasm.java index 65b1d96514..9fef5c65ae 100644 --- a/Mage.Sets/src/mage/cards/j/JacesPhantasm.java +++ b/Mage.Sets/src/mage/cards/j/JacesPhantasm.java @@ -1,12 +1,13 @@ - package mage.cards.j; import java.util.UUID; + import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.CardsInOpponentGraveCondition; import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.abilities.hint.ConditionHint; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -16,13 +17,12 @@ import mage.constants.Duration; import mage.constants.Zone; /** - * * @author Loki */ public final class JacesPhantasm extends CardImpl { public JacesPhantasm(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}"); this.subtype.add(SubType.ILLUSION); this.power = new MageInt(1); @@ -31,7 +31,11 @@ public final class JacesPhantasm extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); // Jace's Phantasm gets +4/+4 as long as an opponent has ten or more cards in their graveyard. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostSourceEffect(4, 4, Duration.WhileOnBattlefield), new CardsInOpponentGraveCondition(10), "{this} gets +4/+4 as long as an opponent has ten or more cards in their graveyard"))); + this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect( + new BoostSourceEffect(4, 4, Duration.WhileOnBattlefield), + CardsInOpponentGraveCondition.TEN, "{this} gets +4/+4 as long as " + + "an opponent has ten or more cards in their graveyard" + )).addHint(CardsInOpponentGraveCondition.TEN.getHint())); } public JacesPhantasm(final JacesPhantasm card) { diff --git a/Mage.Sets/src/mage/cards/m/MindCarver.java b/Mage.Sets/src/mage/cards/m/MindCarver.java new file mode 100644 index 0000000000..e518564106 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MindCarver.java @@ -0,0 +1,58 @@ +package mage.cards.m; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.CardsInOpponentGraveCondition; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continuous.BoostEquippedEffect; +import mage.abilities.keyword.EquipAbility; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * @author TheElk801 + */ +public final class MindCarver extends CardImpl { + + public MindCarver(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{B}"); + + this.subtype.add(SubType.EQUIPMENT); + + // When Mind Carver enters the battlefield, attach it to target creature you control. + Ability ability = new EntersBattlefieldTriggeredAbility(new AttachEffect( + Outcome.BoostCreature, "attach it to target creature you control" + ), false); + ability.addTarget(new TargetControlledCreaturePermanent()); + this.addAbility(ability); + + // Equipped Creature gets +1/+0. It gets +3/+1 instead as long as an opponent has eight or more cards in their graveyard. + this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect( + new BoostEquippedEffect(3, 1), + new BoostEquippedEffect(1, 0), + CardsInOpponentGraveCondition.EIGHT, "Equipped creature gets +1/+0. " + + "It gets +3/+1 instead as long as an opponent has eight or more cards in their graveyard." + ))); + + // Equip {2}{B} + this.addAbility(new EquipAbility(Outcome.BoostCreature, new ManaCostsImpl<>("{2}{B}"))); + } + + private MindCarver(final MindCarver card) { + super(card); + } + + @Override + public MindCarver copy() { + return new MindCarver(this); + } +} diff --git a/Mage.Sets/src/mage/cards/t/ThievesGuildEnforcer.java b/Mage.Sets/src/mage/cards/t/ThievesGuildEnforcer.java index 40d870a3ef..981d6f1fba 100644 --- a/Mage.Sets/src/mage/cards/t/ThievesGuildEnforcer.java +++ b/Mage.Sets/src/mage/cards/t/ThievesGuildEnforcer.java @@ -5,10 +5,12 @@ import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.Condition; +import mage.abilities.condition.common.CardsInOpponentGraveCondition; import mage.abilities.decorator.ConditionalContinuousEffect; import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveEachPlayerEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; +import mage.abilities.hint.ConditionHint; import mage.abilities.keyword.DeathtouchAbility; import mage.abilities.keyword.FlashAbility; import mage.cards.CardImpl; @@ -53,13 +55,13 @@ public final class ThievesGuildEnforcer extends CardImpl { // As long as an opponent has eight or more cards in their graveyard, Thieves' Guild Enforcer gets +2/+1 and has deathtouch. Ability ability = new SimpleStaticAbility(new ConditionalContinuousEffect( new BoostSourceEffect(2, 1, Duration.WhileOnBattlefield), - ThievesGuildEnforcerCondition.instance, "as long as an opponent " + + CardsInOpponentGraveCondition.EIGHT, "as long as an opponent " + "has eight or more cards in their graveyard, {this} gets +2/+1" )); ability.addEffect(new ConditionalContinuousEffect(new GainAbilitySourceEffect( DeathtouchAbility.getInstance(), Duration.WhileOnBattlefield - ), ThievesGuildEnforcerCondition.instance, "and has deathtouch")); - this.addAbility(ability); + ), CardsInOpponentGraveCondition.EIGHT, "and has deathtouch")); + this.addAbility(ability.addHint(CardsInOpponentGraveCondition.EIGHT.getHint())); } private ThievesGuildEnforcer(final ThievesGuildEnforcer card) { @@ -71,19 +73,3 @@ public final class ThievesGuildEnforcer extends CardImpl { return new ThievesGuildEnforcer(this); } } - -enum ThievesGuildEnforcerCondition implements Condition { - instance; - - @Override - public boolean apply(Game game, Ability source) { - return game - .getOpponents(source.getControllerId()) - .stream() - .map(game::getPlayer) - .filter(Objects::nonNull) - .map(Player::getGraveyard) - .mapToInt(Graveyard::size) - .anyMatch(i -> i >= 8); - } -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ZendikarRising.java b/Mage.Sets/src/mage/sets/ZendikarRising.java index 9381962fc8..dd649c762f 100644 --- a/Mage.Sets/src/mage/sets/ZendikarRising.java +++ b/Mage.Sets/src/mage/sets/ZendikarRising.java @@ -112,6 +112,7 @@ public final class ZendikarRising extends ExpansionSet { cards.add(new SetCardInfo("Linvala, Shield of Sea Gate", 226, Rarity.RARE, mage.cards.l.LinvalaShieldOfSeaGate.class)); cards.add(new SetCardInfo("Lotus Cobra", 193, Rarity.RARE, mage.cards.l.LotusCobra.class)); cards.add(new SetCardInfo("Might of Murasa", 194, Rarity.COMMON, mage.cards.m.MightOfMurasa.class)); + cards.add(new SetCardInfo("Mind Carver", 113, Rarity.UNCOMMON, mage.cards.m.MindCarver.class)); cards.add(new SetCardInfo("Mountain", 275, Rarity.LAND, mage.cards.basiclands.Mountain.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Murasa Rootgrazer", 229, Rarity.UNCOMMON, mage.cards.m.MurasaRootgrazer.class)); cards.add(new SetCardInfo("Murkwater Pathway", 260, Rarity.RARE, mage.cards.m.MurkwaterPathway.class)); diff --git a/Mage/src/main/java/mage/abilities/condition/common/CardsInOpponentGraveCondition.java b/Mage/src/main/java/mage/abilities/condition/common/CardsInOpponentGraveCondition.java index 5a683073b8..987b013140 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/CardsInOpponentGraveCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/CardsInOpponentGraveCondition.java @@ -2,33 +2,57 @@ package mage.abilities.condition.common; import mage.abilities.Ability; import mage.abilities.condition.Condition; +import mage.abilities.hint.ConditionHint; +import mage.abilities.hint.Hint; import mage.game.Game; +import mage.game.Graveyard; import mage.players.Player; +import mage.util.CardUtil; +import java.util.Objects; import java.util.UUID; /** * Condition for - - * Any opponent has X or more cards in their graveyard - * @author Loki + * Any opponent has X or more cards in their graveyard + * + * @author TheElk801 */ -public class CardsInOpponentGraveCondition implements Condition { - private final int value; +public enum CardsInOpponentGraveCondition implements Condition { + SEVEN(7), + EIGHT(8), + TEN(10); - public CardsInOpponentGraveCondition(int value) { + private final int value; + private final Hint hint; + + CardsInOpponentGraveCondition(int value) { this.value = value; + this.hint = new ConditionHint(this, "O" + this.makeStem()); } @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player != null) { - for (UUID playerId : game.getOpponents(source.getControllerId())) { - Player opponent = game.getPlayer(playerId); - if (opponent != null && opponent.getGraveyard().size() >= value) - return true; - } - } - return false; + return game + .getOpponents(source.getControllerId()) + .stream() + .map(game::getPlayer) + .filter(Objects::nonNull) + .map(Player::getGraveyard) + .mapToInt(Graveyard::size) + .anyMatch(i -> i >= this.value); + } + + @Override + public String toString() { + return "an o" + this.makeStem(); + } + + private String makeStem() { + return "pponent has " + CardUtil.numberToText(value) + " or more cards in their graveyard"; + } + + public Hint getHint() { + return hint; } }