[MID] Implemented Intrepid Adversary

This commit is contained in:
Daniel Bomar 2021-09-10 18:10:44 -05:00
parent 44c6c15c4f
commit a001b91ea6
No known key found for this signature in database
GPG key ID: C86C8658F4023918
6 changed files with 125 additions and 12 deletions

View file

@ -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;

View file

@ -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";
}
}

View file

@ -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;

View file

@ -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;

View file

@ -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));

View file

@ -169,6 +169,7 @@ public enum CounterType {
TRAP("trap"),
TREASURE("treasure"),
UNITY("unity", "a"),
VALOR("valor"),
VELOCITY("velocity"),
VERSE("verse"),
VIGILANCE("vigilance"),