From eea44bb13eb960c14b5b2b1ed67b6a9fa5afbf61 Mon Sep 17 00:00:00 2001 From: Susucre <34709007+Susucre@users.noreply.github.com> Date: Sat, 24 Jun 2023 02:14:48 +0200 Subject: [PATCH] [LTR] Implement Bill the Pony (#10506) --- Mage.Sets/src/mage/cards/b/BillThePony.java | 95 +++++++++++++++++++ .../TheLordOfTheRingsTalesOfMiddleEarth.java | 1 + 2 files changed, 96 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/b/BillThePony.java diff --git a/Mage.Sets/src/mage/cards/b/BillThePony.java b/Mage.Sets/src/mage/cards/b/BillThePony.java new file mode 100644 index 000000000000..fe716191e383 --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BillThePony.java @@ -0,0 +1,95 @@ +package mage.cards.b; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.ruleModifying.CombatDamageByToughnessEffect; +import mage.constants.*; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.MageObjectReferencePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.FoodToken; +import mage.target.TargetPermanent; +import mage.target.common.TargetControlledPermanent; + +/** + * + * @author Susucr + */ +public final class BillThePony extends CardImpl { + + private static final FilterControlledPermanent foodFilter = new FilterControlledPermanent(SubType.FOOD, "a Food");; + + public BillThePony(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.HORSE); + this.power = new MageInt(1); + this.toughness = new MageInt(4); + + // When Bill the Pony enters the battlefield, create two Food tokens. + this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new FoodToken(), 2))); + + // Sacrifice a Food: Until end of turn, target creature you control assigns combat damage equal to its toughness rather than its power. + Ability ability = new SimpleActivatedAbility( + new BillThePonyEffect(), + new SacrificeTargetCost(new TargetControlledPermanent(foodFilter)) + ); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_CONTROLLED_CREATURE)); + + this.addAbility(ability); + } + + private BillThePony(final BillThePony card) { + super(card); + } + + @Override + public BillThePony copy() { + return new BillThePony(this); + } +} + +class BillThePonyEffect extends OneShotEffect { + + BillThePonyEffect() { + super(Outcome.Benefit); + staticText = "Until end of turn, target creature you control assigns " + + "combat damage equal to its toughness rather than its power."; + } + + private BillThePonyEffect(final BillThePonyEffect effect) { + super(effect); + } + + @Override + public BillThePonyEffect copy() { + return new BillThePonyEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (permanent == null) { + return false; + } + + FilterCreaturePermanent filter = new FilterCreaturePermanent(); + filter.add(new MageObjectReferencePredicate(permanent, game)); + game.addEffect(new CombatDamageByToughnessEffect(filter, false, Duration.EndOfTurn), source); + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java index e221f0e4bcb8..d3f8e0ce114f 100644 --- a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java +++ b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java @@ -32,6 +32,7 @@ private TheLordOfTheRingsTalesOfMiddleEarth() { cards.add(new SetCardInfo("Battle-Scarred Goblin", 115, Rarity.COMMON, mage.cards.b.BattleScarredGoblin.class)); cards.add(new SetCardInfo("Bilbo's Ring", 298, Rarity.RARE, mage.cards.b.BilbosRing.class)); cards.add(new SetCardInfo("Bilbo, Retired Burglar", 196, Rarity.UNCOMMON, mage.cards.b.BilboRetiredBurglar.class)); + cards.add(new SetCardInfo("Bill the Pony", 3, Rarity.UNCOMMON, mage.cards.b.BillThePony.class)); cards.add(new SetCardInfo("Birthday Escape", 43, Rarity.COMMON, mage.cards.b.BirthdayEscape.class)); cards.add(new SetCardInfo("Bitter Downfall", 77, Rarity.UNCOMMON, mage.cards.b.BitterDownfall.class)); cards.add(new SetCardInfo("Bombadil's Song", 154, Rarity.COMMON, mage.cards.b.BombadilsSong.class));