Skip to content

Commit

Permalink
[LTR] Implement Bill the Pony (#10506)
Browse files Browse the repository at this point in the history
  • Loading branch information
Susucre authored Jun 24, 2023
1 parent b79da55 commit eea44bb
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
95 changes: 95 additions & 0 deletions Mage.Sets/src/mage/cards/b/BillThePony.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit eea44bb

Please sign in to comment.