[LTR] Implement Meriadoc Brandybuck

This commit is contained in:
theelk801 2023-06-02 08:36:47 -04:00
parent 26f3f0b425
commit feaaa6300f
2 changed files with 78 additions and 0 deletions

View file

@ -0,0 +1,77 @@
package mage.cards.m;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.DefenderAttackedEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.token.FoodToken;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class MeriadocBrandybuck extends CardImpl {
public MeriadocBrandybuck(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.HALFLING);
this.subtype.add(SubType.CITIZEN);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Whenever one or more Halflings you control attack a player, create a Food token.
this.addAbility(new MeriadocBrandybuckTriggeredAbility());
}
private MeriadocBrandybuck(final MeriadocBrandybuck card) {
super(card);
}
@Override
public MeriadocBrandybuck copy() {
return new MeriadocBrandybuck(this);
}
}
class MeriadocBrandybuckTriggeredAbility extends TriggeredAbilityImpl {
MeriadocBrandybuckTriggeredAbility() {
super(Zone.BATTLEFIELD, new CreateTokenEffect(new FoodToken()));
setTriggerPhrase("Whenever one or more Halflings you control attack a player, ");
}
private MeriadocBrandybuckTriggeredAbility(final MeriadocBrandybuckTriggeredAbility ability) {
super(ability);
}
@Override
public MeriadocBrandybuckTriggeredAbility copy() {
return new MeriadocBrandybuckTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DEFENDER_ATTACKED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return isControlledBy(event.getPlayerId())
&& game.getPlayer(event.getTargetId()) != null
&& ((DefenderAttackedEvent) event)
.getAttackers(game)
.stream()
.anyMatch(permanent -> permanent.hasSubtype(SubType.HALFLING, game));
}
}

View file

@ -56,6 +56,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet {
cards.add(new SetCardInfo("Long List of the Ents", 174, Rarity.UNCOMMON, mage.cards.l.LongListOfTheEnts.class));
cards.add(new SetCardInfo("Many Partings", 176, Rarity.COMMON, mage.cards.m.ManyPartings.class));
cards.add(new SetCardInfo("Mauhur, Uruk-hai Captain", 214, Rarity.UNCOMMON, mage.cards.m.MauhurUrukHaiCaptain.class));
cards.add(new SetCardInfo("Meriadoc Brandybuck", 177, Rarity.UNCOMMON, mage.cards.m.MeriadocBrandybuck.class));
cards.add(new SetCardInfo("Mount Doom", 258, Rarity.MYTHIC, mage.cards.m.MountDoom.class));
cards.add(new SetCardInfo("Mountain", 268, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Nazgul", 100, Rarity.UNCOMMON, mage.cards.n.Nazgul.class));