diff --git a/Mage.Sets/src/mage/cards/h/HeideggerShinraExecutive.java b/Mage.Sets/src/mage/cards/h/HeideggerShinraExecutive.java new file mode 100644 index 00000000000..7a0b6ecc1fd --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HeideggerShinraExecutive.java @@ -0,0 +1,114 @@ +package mage.cards.h; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.abilities.triggers.BeginningOfCombatTriggeredAbility; +import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledPermanent; +import mage.game.Controllable; +import mage.game.Game; +import mage.game.permanent.token.SoldierToken; +import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.Map; +import java.util.UUID; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * @author TheElk801 + */ +public final class HeideggerShinraExecutive extends CardImpl { + + private static final DynamicValue xValue = new PermanentsOnBattlefieldCount( + new FilterControlledPermanent(SubType.SOLDIER, "Soldiers you control"), null + ); + private static final Hint hint = new ValueHint("Soldiers you control", xValue); + + public HeideggerShinraExecutive(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.SOLDIER); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // At the beginning of combat on your turn, target creature you control gets +X/+0 until end of turn, where X is the number of Soldiers you control. + Ability ability = new BeginningOfCombatTriggeredAbility(new BoostTargetEffect(xValue, StaticValue.get(0))); + ability.addTarget(new TargetControlledCreaturePermanent()); + this.addAbility(ability); + + // At the beginning of your end step, create a number of 1/1 white Soldier creature tokens equal to the number of opponents who control more creatures than you. + this.addAbility(new BeginningOfEndStepTriggeredAbility( + new CreateTokenEffect(new SoldierToken(), HeideggerShinraExecutiveValue.instance) + .setText("create a number of 1/1 white Soldier creature tokens equal " + + "to the number of opponents who control more creatures than you") + ).addHint(HeideggerShinraExecutiveValue.getHint())); + } + + private HeideggerShinraExecutive(final HeideggerShinraExecutive card) { + super(card); + } + + @Override + public HeideggerShinraExecutive copy() { + return new HeideggerShinraExecutive(this); + } +} + +enum HeideggerShinraExecutiveValue implements DynamicValue { + instance; + private static final Hint hint = new ValueHint("Opponents with more creatures than you", instance); + + public static Hint getHint() { + return hint; + } + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Map map = game + .getBattlefield() + .getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, sourceAbility.getControllerId(), sourceAbility, game) + .stream() + .map(Controllable::getControllerId) + .collect(Collectors.toMap(Function.identity(), x -> 1, Integer::sum)); + int amount = map.getOrDefault(sourceAbility.getControllerId(), 0); + return game + .getOpponents(sourceAbility.getControllerId()) + .stream() + .mapToInt(uuid -> map.getOrDefault(uuid, 0)) + .filter(x -> x > amount) + .map(x -> 1) + .sum(); + } + + @Override + public HeideggerShinraExecutiveValue copy() { + return this; + } + + @Override + public String getMessage() { + return ""; + } + + @Override + public String toString() { + return "1"; + } +} diff --git a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java index 010208eec3a..d66fbf2b271 100644 --- a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java +++ b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java @@ -159,6 +159,8 @@ public final class FinalFantasyCommander extends ExpansionSet { cards.add(new SetCardInfo("Gyre Sage", 306, Rarity.RARE, mage.cards.g.GyreSage.class)); cards.add(new SetCardInfo("Hardened Scales", 307, Rarity.RARE, mage.cards.h.HardenedScales.class)); cards.add(new SetCardInfo("Harmonize", 308, Rarity.UNCOMMON, mage.cards.h.Harmonize.class)); + cards.add(new SetCardInfo("Heidegger, Shinra Executive", 136, Rarity.RARE, mage.cards.h.HeideggerShinraExecutive.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Heidegger, Shinra Executive", 21, Rarity.RARE, mage.cards.h.HeideggerShinraExecutive.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Hellkite Tyrant", 295, Rarity.RARE, mage.cards.h.HellkiteTyrant.class)); cards.add(new SetCardInfo("Herald's Horn", 228, Rarity.RARE, mage.cards.h.HeraldsHorn.class)); cards.add(new SetCardInfo("Hermes, Overseer of Elpis", 141, Rarity.RARE, mage.cards.h.HermesOverseerOfElpis.class, NON_FULL_USE_VARIOUS));