diff --git a/Mage.Sets/src/mage/cards/m/MintharaMercilessSoul.java b/Mage.Sets/src/mage/cards/m/MintharaMercilessSoul.java new file mode 100644 index 0000000000..b0e2f945a1 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MintharaMercilessSoul.java @@ -0,0 +1,91 @@ +package mage.cards.m; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.RevoltCondition; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.BoostAllEffect; +import mage.abilities.effects.common.counter.AddCountersPlayersEffect; +import mage.abilities.keyword.WardAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.watchers.common.RevoltWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class MintharaMercilessSoul extends CardImpl { + + public MintharaMercilessSoul(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{B}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.ELF); + this.subtype.add(SubType.CLERIC); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Ward {X}, where X is the number of experience counters you have. + DynamicValue value = new MintharaMercilessSoulCount(); + Ability ability = new WardAbility(value, "the number of experience counters you have"); + this.addAbility(ability); + + // At the beginning of your end step, if a permanent you controlled left the battlefield this turn, you get an experience counter. + this.addAbility(new BeginningOfEndStepTriggeredAbility( + new AddCountersPlayersEffect(CounterType.EXPERIENCE.createInstance(), TargetController.YOU), + TargetController.YOU, RevoltCondition.instance, false + ), new RevoltWatcher()); + + // Creatures you control get +1/+0 for each experience counter you have. + this.addAbility(new SimpleStaticAbility(new BoostAllEffect(value, StaticValue.get(0), + Duration.WhileOnBattlefield, StaticFilters.FILTER_CONTROLLED_CREATURES, false))); + } + + private MintharaMercilessSoul(final MintharaMercilessSoul card) { + super(card); + } + + @Override + public MintharaMercilessSoul copy() { + return new MintharaMercilessSoul(this); + } +} + +class MintharaMercilessSoulCount implements DynamicValue { + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + int amount = 0; + Player player = game.getPlayer(sourceAbility.getControllerId()); + if (player != null) { + amount = player.getCounters().getCount(CounterType.EXPERIENCE); + } + return amount; + } + + @Override + public MintharaMercilessSoulCount copy() { + return new MintharaMercilessSoulCount(); + } + + @Override + public String toString() { + return "1"; + } + + @Override + public String getMessage() { + return "experience counter you have"; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index 11692f0c26..05605c74f6 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -384,6 +384,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("Mindcrank", 866, Rarity.UNCOMMON, mage.cards.m.Mindcrank.class)); cards.add(new SetCardInfo("Minimus Containment", 34, Rarity.COMMON, mage.cards.m.MinimusContainment.class)); cards.add(new SetCardInfo("Minsc & Boo, Timeless Heroes", 285, Rarity.MYTHIC, mage.cards.m.MinscBooTimelessHeroes.class)); + cards.add(new SetCardInfo("Minthara, Merciless Soul", 286, Rarity.UNCOMMON, mage.cards.m.MintharaMercilessSoul.class)); cards.add(new SetCardInfo("Mirror Entity", 701, Rarity.RARE, mage.cards.m.MirrorEntity.class)); cards.add(new SetCardInfo("Mizzium Mortars", 803, Rarity.RARE, mage.cards.m.MizziumMortars.class)); cards.add(new SetCardInfo("Mocking Doppelganger", 667, Rarity.RARE, mage.cards.m.MockingDoppelganger.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostAllEffect.java index 254b4886e2..0f37413558 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BoostAllEffect.java @@ -9,7 +9,9 @@ import mage.constants.Duration; import mage.constants.Layer; import mage.constants.Outcome; import mage.constants.SubLayer; +import mage.filter.FilterPermanent; import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; @@ -26,7 +28,7 @@ public class BoostAllEffect extends ContinuousEffectImpl { protected DynamicValue power; protected DynamicValue toughness; protected boolean excludeSource; - protected FilterCreaturePermanent filter; + protected FilterPermanent filter; public BoostAllEffect(int power, int toughness, Duration duration) { this(power, toughness, duration, false); @@ -62,6 +64,28 @@ public class BoostAllEffect extends ContinuousEffectImpl { } } + public BoostAllEffect(int power, int toughness, Duration duration, FilterControlledCreaturePermanent filter, boolean excludeSource) { + this(StaticValue.get(power), StaticValue.get(toughness), duration, filter, excludeSource); + } + + public BoostAllEffect(DynamicValue power, DynamicValue toughness, Duration duration, FilterControlledCreaturePermanent filter, boolean excludeSource) { + this(power, toughness, duration, filter, excludeSource, null); + } + + public BoostAllEffect(DynamicValue power, DynamicValue toughness, Duration duration, FilterControlledCreaturePermanent filter, boolean excludeSource, String rule) { + super(duration, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, CardUtil.getBoostOutcome(power, toughness)); + this.power = power; + this.toughness = toughness; + this.filter = filter; + this.excludeSource = excludeSource; + + if (rule == null || rule.isEmpty()) { + setText(); + } else { + this.staticText = rule; + } + } + public BoostAllEffect(final BoostAllEffect effect) { super(effect); this.power = effect.power; diff --git a/Mage/src/main/java/mage/abilities/keyword/WardAbility.java b/Mage/src/main/java/mage/abilities/keyword/WardAbility.java index acff52ce32..e65401604b 100644 --- a/Mage/src/main/java/mage/abilities/keyword/WardAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/WardAbility.java @@ -3,6 +3,7 @@ package mage.abilities.keyword; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.costs.Cost; import mage.abilities.costs.mana.ManaCost; +import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.effects.common.CounterUnlessPaysEffect; import mage.constants.Zone; import mage.game.Game; @@ -18,7 +19,10 @@ import mage.util.CardUtil; public class WardAbility extends TriggeredAbilityImpl { private final Cost cost; + private final DynamicValue genericMana; + private final boolean showAbilityHint; + private final String whereXIs; public WardAbility(Cost cost) { this(cost, true); @@ -27,13 +31,34 @@ public class WardAbility extends TriggeredAbilityImpl { public WardAbility(Cost cost, boolean showAbilityHint) { super(Zone.BATTLEFIELD, new CounterUnlessPaysEffect(cost), false); this.cost = cost; + this.genericMana = null; this.showAbilityHint = showAbilityHint; + this.whereXIs = null; + } + + public WardAbility(DynamicValue genericMana) { + this(genericMana, null); + } + + public WardAbility(DynamicValue genericMana, String whereXIs) { + super(Zone.BATTLEFIELD, new CounterUnlessPaysEffect(genericMana), false); + this.genericMana = genericMana; + this.whereXIs = whereXIs; + this.cost = null; + this.showAbilityHint = false; } private WardAbility(final WardAbility ability) { super(ability); - this.cost = ability.cost.copy(); + if (ability.cost != null) { + this.cost = ability.cost.copy(); + this.genericMana = null; + } else { + this.genericMana = ability.genericMana.copy(); + this.cost = null; + } this.showAbilityHint = ability.showAbilityHint; + this.whereXIs = ability.whereXIs; } @Override @@ -75,21 +100,36 @@ public class WardAbility extends TriggeredAbilityImpl { @Override public String getRule() { StringBuilder sb = new StringBuilder("ward"); - if (cost instanceof ManaCost) { - sb.append(' ').append(cost.getText()); + if (cost != null) { + if (cost instanceof ManaCost) { + sb.append(' ').append(cost.getText()); + } else { + sb.append("—").append(CardUtil.getTextWithFirstCharUpperCase(cost.getText())).append('.'); + } } else { - sb.append("—").append(CardUtil.getTextWithFirstCharUpperCase(cost.getText())).append('.'); + sb.append(" {X}"); + if (whereXIs != null) { + sb.append(", where X is ").append(whereXIs).append('.'); + } } if (showAbilityHint) { sb.append(" <i>(Whenever this creature becomes the target of a spell or ability an opponent controls, " + "counter it unless that player "); - if (cost instanceof ManaCost) { - sb.append("pays ").append(cost.getText()); + if (cost != null) { + if (cost instanceof ManaCost) { + sb.append("pays ").append(cost.getText()); + } else { + sb.append(cost.getText().replace("pay ", "pays ")); + } + sb.append(".)</i>"); } else { - sb.append(cost.getText().replace("pay ", "pays ")); + sb.append("pays {X}"); + if (whereXIs != null) { + sb.append(whereXIs); + } + sb.append(".)</i>"); } - sb.append(".)</i>"); } return sb.toString();