diff --git a/Mage.Sets/src/mage/cards/g/GaeasBalance.java b/Mage.Sets/src/mage/cards/g/GaeasBalance.java new file mode 100644 index 0000000000..178cdcee8f --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GaeasBalance.java @@ -0,0 +1,104 @@ +package mage.cards.g; + +import mage.abilities.Ability; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.common.FilterLandCard; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInLibrary; +import mage.target.common.TargetControlledPermanent; + +import java.util.Arrays; +import java.util.List; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class GaeasBalance extends CardImpl { + + public GaeasBalance(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{G}"); + + // As an additional cost to cast Gaea's Balance, sacrifice five lands. + this.getSpellAbility().addCost(new SacrificeTargetCost( + new TargetControlledPermanent(5, StaticFilters.FILTER_CONTROLLED_LAND_SHORT_TEXT) + )); + + // Search your library for a land card of each basic land type and put them onto the battlefield. Then shuffle your library. + this.getSpellAbility().addEffect(new GaeasBalanceEffect()); + } + + private GaeasBalance(final GaeasBalance card) { + super(card); + } + + @Override + public GaeasBalance copy() { + return new GaeasBalance(this); + } +} + +class GaeasBalanceEffect extends OneShotEffect { + + private static final FilterCard plainsFilter = new FilterLandCard("a Plains land card"); + private static final FilterCard islandFilter = new FilterLandCard("an Island land card"); + private static final FilterCard swampFilter = new FilterLandCard("a Swamp land card"); + private static final FilterCard mountainFilter = new FilterLandCard("a Mountain land card"); + private static final FilterCard forestFilter = new FilterLandCard("a Forest land card"); + + static { + plainsFilter.add(new SubtypePredicate(SubType.PLAINS)); + islandFilter.add(new SubtypePredicate(SubType.ISLAND)); + swampFilter.add(new SubtypePredicate(SubType.SWAMP)); + mountainFilter.add(new SubtypePredicate(SubType.MOUNTAIN)); + forestFilter.add(new SubtypePredicate(SubType.FOREST)); + } + + private static final List filterList = Arrays.asList( + plainsFilter, islandFilter, swampFilter, mountainFilter, forestFilter + ); + + GaeasBalanceEffect() { + super(Outcome.Benefit); + staticText = "Search your library for a land card of each basic land type " + + "and put them onto the battlefield. Then shuffle your library."; + } + + private GaeasBalanceEffect(final GaeasBalanceEffect effect) { + super(effect); + } + + @Override + public GaeasBalanceEffect copy() { + return new GaeasBalanceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Cards cards = new CardsImpl(); + filterList.stream().map(TargetCardInLibrary::new).forEachOrdered(target -> { + player.searchLibrary(target, source, game, target.getFilter().getMessage().contains("Forest")); + cards.add(target.getFirstTarget()); + }); + player.moveCards(cards, Zone.BATTLEFIELD, source, game); + player.shuffleLibrary(source, game); + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Apocalypse.java b/Mage.Sets/src/mage/sets/Apocalypse.java index e327b2f80c..787c55c20a 100644 --- a/Mage.Sets/src/mage/sets/Apocalypse.java +++ b/Mage.Sets/src/mage/sets/Apocalypse.java @@ -66,6 +66,7 @@ public final class Apocalypse extends ExpansionSet { cards.add(new SetCardInfo("Flowstone Charger", 99, Rarity.UNCOMMON, mage.cards.f.FlowstoneCharger.class)); cards.add(new SetCardInfo("Foul Presence", 39, Rarity.UNCOMMON, mage.cards.f.FoulPresence.class)); cards.add(new SetCardInfo("Fungal Shambler", 100, Rarity.RARE, mage.cards.f.FungalShambler.class)); + cards.add(new SetCardInfo("Gaea's Balance", 77, Rarity.UNCOMMON, mage.cards.g.GaeasBalance.class)); cards.add(new SetCardInfo("Gaea's Skyfolk", 101, Rarity.COMMON, mage.cards.g.GaeasSkyfolk.class)); cards.add(new SetCardInfo("Gerrard Capashen", 11, Rarity.RARE, mage.cards.g.GerrardCapashen.class)); cards.add(new SetCardInfo("Gerrard's Verdict", 102, Rarity.UNCOMMON, mage.cards.g.GerrardsVerdict.class)); diff --git a/Mage.Sets/src/mage/sets/IceAge.java b/Mage.Sets/src/mage/sets/IceAge.java index a31cc9790a..061733516b 100644 --- a/Mage.Sets/src/mage/sets/IceAge.java +++ b/Mage.Sets/src/mage/sets/IceAge.java @@ -32,7 +32,7 @@ public final class IceAge extends ExpansionSet { cards.add(new SetCardInfo("Aggression", 169, Rarity.UNCOMMON, mage.cards.a.Aggression.class)); cards.add(new SetCardInfo("Altar of Bone", 281, Rarity.RARE, mage.cards.a.AltarOfBone.class)); cards.add(new SetCardInfo("Anarchy", 170, Rarity.UNCOMMON, mage.cards.a.Anarchy.class)); - cards.add(new SetCardInfo("Arctic Foxes", 226, Rarity.COMMON, mage.cards.a.ArcticFoxes.class)); + cards.add(new SetCardInfo("Arctic Foxes", 2, Rarity.COMMON, mage.cards.a.ArcticFoxes.class)); cards.add(new SetCardInfo("Arenson's Aura", 3, Rarity.COMMON, mage.cards.a.ArensonsAura.class)); cards.add(new SetCardInfo("Armor of Faith", 4, Rarity.COMMON, mage.cards.a.ArmorOfFaith.class)); cards.add(new SetCardInfo("Arnjlot's Ascent", 57, Rarity.COMMON, mage.cards.a.ArnjlotsAscent.class));