From 9ea96094df37289cbfd01671919cb25de7345d11 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 26 Jun 2019 07:19:28 -0400 Subject: [PATCH] implemented Boreal Elemental --- .../src/mage/cards/b/BorealElemental.java | 92 +++++++++++++++++++ Mage.Sets/src/mage/cards/i/IcefallRegent.java | 22 ++--- Mage.Sets/src/mage/sets/CoreSet2020.java | 1 + 3 files changed, 99 insertions(+), 16 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/b/BorealElemental.java diff --git a/Mage.Sets/src/mage/cards/b/BorealElemental.java b/Mage.Sets/src/mage/cards/b/BorealElemental.java new file mode 100644 index 0000000000..b79e439fce --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BorealElemental.java @@ -0,0 +1,92 @@ +package mage.cards.b; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.SpellAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.cost.CostModificationEffectImpl; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class BorealElemental extends CardImpl { + + public BorealElemental(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{U}"); + + this.subtype.add(SubType.ELEMENTAL); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Spells your opponents cast that target Boreal Elemental cost {2} more to cast. + this.addAbility(new SimpleStaticAbility(new BorealElementalCostIncreaseEffect())); + } + + private BorealElemental(final BorealElemental card) { + super(card); + } + + @Override + public BorealElemental copy() { + return new BorealElemental(this); + } +} + +class BorealElementalCostIncreaseEffect extends CostModificationEffectImpl { + + + BorealElementalCostIncreaseEffect() { + super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST); + staticText = "Spells your opponents cast that target Icefall Regent cost {2} more to cast"; + } + + private BorealElementalCostIncreaseEffect(BorealElementalCostIncreaseEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source, Ability abilityToModify) { + SpellAbility spellAbility = (SpellAbility) abilityToModify; + CardUtil.adjustCost(spellAbility, -2); + return true; + } + + @Override + public boolean applies(Ability abilityToModify, Ability source, Game game) { + if (!(abilityToModify instanceof SpellAbility) + || !game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) { + return false; + } + return abilityToModify + .getModes() + .getSelectedModes() + .stream() + .map(uuid -> abilityToModify.getModes().get(uuid)) + .anyMatch(mode -> mode + .getTargets() + .stream() + .anyMatch(target -> target + .getTargets() + .stream() + .anyMatch(uuid -> uuid.equals(source.getSourceId())) + ) + ); + } + + @Override + public BorealElementalCostIncreaseEffect copy() { + return new BorealElementalCostIncreaseEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/cards/i/IcefallRegent.java b/Mage.Sets/src/mage/cards/i/IcefallRegent.java index ec71d65553..d801d62515 100644 --- a/Mage.Sets/src/mage/cards/i/IcefallRegent.java +++ b/Mage.Sets/src/mage/cards/i/IcefallRegent.java @@ -1,7 +1,5 @@ - package mage.cards.i; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.Mode; @@ -14,15 +12,7 @@ import mage.abilities.effects.common.cost.CostModificationEffectImpl; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.SubType; -import mage.constants.CostModificationType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.PhaseStep; -import mage.constants.TargetController; -import mage.constants.WatcherScope; -import mage.constants.Zone; +import mage.constants.*; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; @@ -34,8 +24,9 @@ import mage.target.common.TargetCreaturePermanent; import mage.util.CardUtil; import mage.watchers.Watcher; +import java.util.UUID; + /** - * * @author fireshoes */ public final class IcefallRegent extends CardImpl { @@ -47,7 +38,7 @@ public final class IcefallRegent extends CardImpl { } public IcefallRegent(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{U}"); this.subtype.add(SubType.DRAGON); this.power = new MageInt(4); this.toughness = new MageInt(3); @@ -179,14 +170,13 @@ class IcefallRegentWatcher extends Watcher { class IcefallRegentCostIncreaseEffect extends CostModificationEffectImpl { - private static final String effectText = "Spells your opponents cast that target Icefall Regent cost {2} more to cast"; IcefallRegentCostIncreaseEffect() { super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST); - staticText = effectText; + staticText = "Spells your opponents cast that target {this} cost {2} more to cast"; } - IcefallRegentCostIncreaseEffect(IcefallRegentCostIncreaseEffect effect) { + private IcefallRegentCostIncreaseEffect(IcefallRegentCostIncreaseEffect effect) { super(effect); } diff --git a/Mage.Sets/src/mage/sets/CoreSet2020.java b/Mage.Sets/src/mage/sets/CoreSet2020.java index de6ead635d..c265f64d1a 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2020.java +++ b/Mage.Sets/src/mage/sets/CoreSet2020.java @@ -74,6 +74,7 @@ public final class CoreSet2020 extends ExpansionSet { cards.add(new SetCardInfo("Bone Splinters", 92, Rarity.COMMON, mage.cards.b.BoneSplinters.class)); cards.add(new SetCardInfo("Bone to Ash", 48, Rarity.COMMON, mage.cards.b.BoneToAsh.class)); cards.add(new SetCardInfo("Boneclad Necromancer", 93, Rarity.COMMON, mage.cards.b.BonecladNecromancer.class)); + cards.add(new SetCardInfo("Boreal Elemental", 49, Rarity.COMMON, mage.cards.b.BorealElemental.class)); cards.add(new SetCardInfo("Brineborn Cutthroat", 50, Rarity.UNCOMMON, mage.cards.b.BrinebornCutthroat.class)); cards.add(new SetCardInfo("Brought Back", 9, Rarity.RARE, mage.cards.b.BroughtBack.class)); cards.add(new SetCardInfo("Captivating Gyre", 51, Rarity.UNCOMMON, mage.cards.c.CaptivatingGyre.class));