From 61435e7fc5b2b95ff9ac9946cecaf1eed2a50302 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 4 Oct 2022 20:37:30 -0400 Subject: [PATCH] [40K] Implemented Sceptre of Eternal Glory --- .../mage/cards/s/SceptreOfEternalGlory.java | 79 +++++++++++++++++++ Mage.Sets/src/mage/sets/Warhammer40000.java | 1 + 2 files changed, 80 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/SceptreOfEternalGlory.java diff --git a/Mage.Sets/src/mage/cards/s/SceptreOfEternalGlory.java b/Mage.Sets/src/mage/cards/s/SceptreOfEternalGlory.java new file mode 100644 index 0000000000..25bd847f4b --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SceptreOfEternalGlory.java @@ -0,0 +1,79 @@ +package mage.cards.s; + +import com.google.common.base.Functions; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.mana.AddManaOfAnyColorEffect; +import mage.abilities.mana.ActivateIfConditionManaAbility; +import mage.abilities.mana.AnyColorManaAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SuperType; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; + +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * @author TheElk801 + */ +public final class SceptreOfEternalGlory extends CardImpl { + + public SceptreOfEternalGlory(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}"); + + this.addSuperType(SuperType.LEGENDARY); + + // {T}: Add one mana of any color. + this.addAbility(new AnyColorManaAbility()); + + // {T}: Add three mana of any one color. Activate only if you control three or more lands with the same name. + this.addAbility(new ActivateIfConditionManaAbility( + Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(3), + new TapSourceCost(), SceptreOfEternalGloryCondition.instance + )); + } + + private SceptreOfEternalGlory(final SceptreOfEternalGlory card) { + super(card); + } + + @Override + public SceptreOfEternalGlory copy() { + return new SceptreOfEternalGlory(this); + } +} + +enum SceptreOfEternalGloryCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + return game + .getBattlefield() + .getActivePermanents( + StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, + source.getControllerId(), source, game + ) + .stream() + .map(MageObject::getName) + .filter(s -> !s.isEmpty()) + .collect(Collectors.toMap( + Functions.identity(), + x -> 1, Integer::sum + )) + .values() + .stream() + .anyMatch(x -> x >= 3); + } + + @Override + public String toString() { + return "you control three or more lands with the same name"; + } +} diff --git a/Mage.Sets/src/mage/sets/Warhammer40000.java b/Mage.Sets/src/mage/sets/Warhammer40000.java index b5d386f729..9de22c5e5b 100644 --- a/Mage.Sets/src/mage/sets/Warhammer40000.java +++ b/Mage.Sets/src/mage/sets/Warhammer40000.java @@ -182,6 +182,7 @@ public final class Warhammer40000 extends ExpansionSet { cards.add(new SetCardInfo("Rugged Highlands", 292, Rarity.COMMON, mage.cards.r.RuggedHighlands.class)); cards.add(new SetCardInfo("Sanguinary Priest", 53, Rarity.UNCOMMON, mage.cards.s.SanguinaryPriest.class)); cards.add(new SetCardInfo("Sautekh Immortal", 54, Rarity.UNCOMMON, mage.cards.s.SautekhImmortal.class)); + cards.add(new SetCardInfo("Sceptre of Eternal Glory", 166, Rarity.RARE, mage.cards.s.SceptreOfEternalGlory.class)); cards.add(new SetCardInfo("Scoured Barrens", 293, Rarity.COMMON, mage.cards.s.ScouredBarrens.class)); cards.add(new SetCardInfo("Screamer-Killer", 84, Rarity.RARE, mage.cards.s.ScreamerKiller.class)); cards.add(new SetCardInfo("Sculpting Steel", 247, Rarity.RARE, mage.cards.s.SculptingSteel.class));