[LTR] Implement Bill the Pony (#10506)

This commit is contained in:
Susucre 2023-06-24 02:14:48 +02:00 committed by GitHub
parent b79da551f1
commit eea44bb13e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 96 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -32,6 +32,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet {
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));