diff --git a/Mage.Sets/src/mage/cards/b/BloodthirstyAdversary.java b/Mage.Sets/src/mage/cards/b/BloodthirstyAdversary.java index 116baea872..b9f6b392eb 100644 --- a/Mage.Sets/src/mage/cards/b/BloodthirstyAdversary.java +++ b/Mage.Sets/src/mage/cards/b/BloodthirstyAdversary.java @@ -87,10 +87,6 @@ class BloodthirstyAdversaryEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller == null) { - return false; - } Integer timesPaid = (Integer) getValue("timesPaid"); if (timesPaid == null || timesPaid <= 0) { return false; diff --git a/Mage.Sets/src/mage/cards/i/IntrepidAdversary.java b/Mage.Sets/src/mage/cards/i/IntrepidAdversary.java new file mode 100644 index 0000000000..1ae7784058 --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/IntrepidAdversary.java @@ -0,0 +1,123 @@ +package mage.cards.i; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.common.delayed.ReflexiveTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DoIfAnyNumberCostPaid; +import mage.abilities.effects.common.continuous.BoostControlledEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.abilities.keyword.LifelinkAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author weirddan455 + */ +public final class IntrepidAdversary extends CardImpl { + + public IntrepidAdversary(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.SCOUT); + this.power = new MageInt(3); + this.toughness = new MageInt(1); + + // Lifelink + this.addAbility(LifelinkAbility.getInstance()); + + // When Intrepid Adversary enters the battlefield, you may pay {1}{W} any number of times. + // When you pay this cost once or more times, put that many valor counters on Intrepid Adversary. + this.addAbility(new EntersBattlefieldTriggeredAbility(new DoIfAnyNumberCostPaid( + new IntrepidAdversaryEffect(), new ManaCostsImpl<>("{1}{W}") + ))); + + // Creatures you control get +1/+1 for each valor counter on Intrepid Adversary. + this.addAbility(new SimpleStaticAbility(new BoostControlledEffect( + IntrepidAdversaryValue.instance, IntrepidAdversaryValue.instance, Duration.WhileOnBattlefield + ))); + } + + private IntrepidAdversary(final IntrepidAdversary card) { + super(card); + } + + @Override + public IntrepidAdversary copy() { + return new IntrepidAdversary(this); + } +} + +class IntrepidAdversaryEffect extends OneShotEffect { + + public IntrepidAdversaryEffect() { + super(Outcome.Benefit); + staticText = "put that many valor counters on {this}"; + } + + private IntrepidAdversaryEffect(final IntrepidAdversaryEffect effect) { + super(effect); + } + + @Override + public IntrepidAdversaryEffect copy() { + return new IntrepidAdversaryEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Integer timesPaid = (Integer) getValue("timesPaid"); + if (timesPaid == null || timesPaid <= 0) { + return false; + } + ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility( + new AddCountersSourceEffect(CounterType.VALOR.createInstance(timesPaid)), + false, staticText + ); + game.fireReflexiveTriggeredAbility(ability, source); + return true; + } +} + +enum IntrepidAdversaryValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Permanent permanent = sourceAbility.getSourcePermanentIfItStillExists(game); + if (permanent == null) { + return 0; + } + return permanent.getCounters(game).getCount(CounterType.VALOR); + } + + @Override + public IntrepidAdversaryValue copy() { + return instance; + } + + @Override + public String getMessage() { + return "valor counter on {this}"; + } + + @Override + public String toString() { + return "1"; + } +} diff --git a/Mage.Sets/src/mage/cards/s/SpectralAdversary.java b/Mage.Sets/src/mage/cards/s/SpectralAdversary.java index b0b20ece2a..413a01b534 100644 --- a/Mage.Sets/src/mage/cards/s/SpectralAdversary.java +++ b/Mage.Sets/src/mage/cards/s/SpectralAdversary.java @@ -92,10 +92,6 @@ class SpectralAdversaryEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player == null) { - return false; - } Integer timesPaid = (Integer) getValue("timesPaid"); if (timesPaid == null || timesPaid <= 0) { return false; diff --git a/Mage.Sets/src/mage/cards/t/TaintedAdversary.java b/Mage.Sets/src/mage/cards/t/TaintedAdversary.java index 82f8bf9100..f8c4be0515 100644 --- a/Mage.Sets/src/mage/cards/t/TaintedAdversary.java +++ b/Mage.Sets/src/mage/cards/t/TaintedAdversary.java @@ -73,10 +73,6 @@ class TaintedAdversaryEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player == null) { - return false; - } Integer timesPaid = (Integer) getValue("timesPaid"); if (timesPaid == null || timesPaid <= 0) { return false; diff --git a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java index f4f8dc9158..c83f186362 100644 --- a/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java +++ b/Mage.Sets/src/mage/sets/InnistradMidnightHunt.java @@ -116,6 +116,7 @@ public final class InnistradMidnightHunt extends ExpansionSet { cards.add(new SetCardInfo("Infernal Grasp", 107, Rarity.UNCOMMON, mage.cards.i.InfernalGrasp.class)); cards.add(new SetCardInfo("Inherited Fiend", 105, Rarity.UNCOMMON, mage.cards.i.InheritedFiend.class)); cards.add(new SetCardInfo("Insectile Aberration", 47, Rarity.UNCOMMON, mage.cards.i.InsectileAberration.class)); + cards.add(new SetCardInfo("Intrepid Adversary", 25, Rarity.MYTHIC, mage.cards.i.IntrepidAdversary.class)); cards.add(new SetCardInfo("Island", 270, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Jack-o'-Lantern", 254, Rarity.COMMON, mage.cards.j.JackOLantern.class)); cards.add(new SetCardInfo("Jadar, Ghoulcaller of Nephalia", 108, Rarity.RARE, mage.cards.j.JadarGhoulcallerOfNephalia.class)); diff --git a/Mage/src/main/java/mage/counters/CounterType.java b/Mage/src/main/java/mage/counters/CounterType.java index 6bdc7a3726..2c426b9a40 100644 --- a/Mage/src/main/java/mage/counters/CounterType.java +++ b/Mage/src/main/java/mage/counters/CounterType.java @@ -169,6 +169,7 @@ public enum CounterType { TRAP("trap"), TREASURE("treasure"), UNITY("unity", "a"), + VALOR("valor"), VELOCITY("velocity"), VERSE("verse"), VIGILANCE("vigilance"),