diff --git a/Mage.Sets/src/mage/cards/w/WakingTheTrolls.java b/Mage.Sets/src/mage/cards/w/WakingTheTrolls.java new file mode 100644 index 0000000000..ff1300bcee --- /dev/null +++ b/Mage.Sets/src/mage/cards/w/WakingTheTrolls.java @@ -0,0 +1,107 @@ +package mage.cards.w; + +import mage.abilities.Ability; +import mage.abilities.common.SagaAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SagaChapter; +import mage.constants.SubType; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.common.FilterLandCard; +import mage.game.Game; +import mage.game.permanent.token.TrollWarriorToken; +import mage.target.common.TargetCardInGraveyard; +import mage.target.common.TargetLandPermanent; +import mage.target.common.TargetOpponent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class WakingTheTrolls extends CardImpl { + + private static final FilterCard filter = new FilterLandCard("land card from a graveyard"); + + public WakingTheTrolls(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{R}{G}"); + + this.subtype.add(SubType.SAGA); + + SagaAbility sagaAbility = new SagaAbility(this, SagaChapter.CHAPTER_I); + + // I — Destroy target land. + sagaAbility.addChapterEffect( + this, SagaChapter.CHAPTER_I, SagaChapter.CHAPTER_I, + new DestroyTargetEffect(), new TargetLandPermanent() + ); + + // II — Put target land card from a graveyard onto the battlefield under your control. + sagaAbility.addChapterEffect( + this, SagaChapter.CHAPTER_II, SagaChapter.CHAPTER_II, + new ReturnFromGraveyardToBattlefieldTargetEffect().setText( + "put target land card from a graveyard onto the battlefield under your control" + ), new TargetCardInGraveyard(filter) + ); + + // III — Choose target opponent. If they control fewer lands than you, create a number of 4/4 green Troll Warrior creature tokens with trample equal to the difference. + sagaAbility.addChapterEffect( + this, SagaChapter.CHAPTER_III, SagaChapter.CHAPTER_III, + new WakingTheTrollsEffect(), new TargetOpponent() + ); + + this.addAbility(sagaAbility); + } + + private WakingTheTrolls(final WakingTheTrolls card) { + super(card); + } + + @Override + public WakingTheTrolls copy() { + return new WakingTheTrolls(this); + } +} + +class WakingTheTrollsEffect extends OneShotEffect { + + WakingTheTrollsEffect() { + super(Outcome.Benefit); + staticText = "choose target opponent. If they control fewer lands than you, " + + "create a number of 4/4 green Troll Warrior creature tokens with trample equal to the difference"; + } + + private WakingTheTrollsEffect(final WakingTheTrollsEffect effect) { + super(effect); + } + + @Override + public WakingTheTrollsEffect copy() { + return new WakingTheTrollsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int myLands = game.getBattlefield().count( + StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, + source.getSourceId(), source.getControllerId(), game + ); + int theirLands = game.getBattlefield().count( + StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, + source.getSourceId(), source.getFirstTarget(), game + ); + if (myLands <= theirLands) { + return false; + } + return new TrollWarriorToken().putOntoBattlefield( + myLands - theirLands, game, + source, source.getControllerId() + ); + } +} diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index 5a9196379d..c1b76fa24b 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -163,6 +163,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Vega, the Watcher", 233, Rarity.UNCOMMON, mage.cards.v.VegaTheWatcher.class)); cards.add(new SetCardInfo("Village Rites", 117, Rarity.COMMON, mage.cards.v.VillageRites.class)); cards.add(new SetCardInfo("Volatile Fjord", 273, Rarity.COMMON, mage.cards.v.VolatileFjord.class)); + cards.add(new SetCardInfo("Waking the Trolls", 234, Rarity.RARE, mage.cards.w.WakingTheTrolls.class)); cards.add(new SetCardInfo("Warchanter Skald", 381, Rarity.UNCOMMON, mage.cards.w.WarchanterSkald.class)); cards.add(new SetCardInfo("Woodland Chasm", 274, Rarity.COMMON, mage.cards.w.WoodlandChasm.class)); cards.add(new SetCardInfo("Youthful Valkyrie", 382, Rarity.UNCOMMON, mage.cards.y.YouthfulValkyrie.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/TrollWarriorToken.java b/Mage/src/main/java/mage/game/permanent/token/TrollWarriorToken.java new file mode 100644 index 0000000000..15143653ff --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/TrollWarriorToken.java @@ -0,0 +1,31 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.keyword.TrampleAbility; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * @author TheElk801 + */ +public final class TrollWarriorToken extends TokenImpl { + + public TrollWarriorToken() { + super("Troll Warrior", "4/4 green Troll Warrior creature token with trample"); + cardType.add(CardType.CREATURE); + color.setGreen(true); + subtype.add(SubType.TROLL); + subtype.add(SubType.WARRIOR); + power = new MageInt(4); + toughness = new MageInt(4); + addAbility(TrampleAbility.getInstance()); + } + + private TrollWarriorToken(final TrollWarriorToken token) { + super(token); + } + + public TrollWarriorToken copy() { + return new TrollWarriorToken(this); + } +}