[FIN] Implement Town Greeter

This commit is contained in:
theelk801 2025-05-11 09:52:46 -04:00
parent bdb52e9b41
commit 00408e72a9
2 changed files with 90 additions and 0 deletions

View file

@ -0,0 +1,89 @@
package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class TownGreeter extends CardImpl {
public TownGreeter(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.CITIZEN);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// When this creature enters, mill four cards. You may put a land card from among them into your hand. If you put a Town card into your hand this way, you gain 2 life.
this.addAbility(new EntersBattlefieldTriggeredAbility(new TownGreeterEffect()));
}
private TownGreeter(final TownGreeter card) {
super(card);
}
@Override
public TownGreeter copy() {
return new TownGreeter(this);
}
}
class TownGreeterEffect extends OneShotEffect {
TownGreeterEffect() {
super(Outcome.Benefit);
staticText = "mill four cards. You may put a land card from among them into your hand. " +
"If you put a Town card into your hand this way, you gain 2 life";
}
private TownGreeterEffect(final TownGreeterEffect effect) {
super(effect);
}
@Override
public TownGreeterEffect copy() {
return new TownGreeterEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards cards = player.millCards(4, source, game);
if (cards.isEmpty()) {
return false;
}
TargetCard target = new TargetCard(0, 1, Zone.ALL, StaticFilters.FILTER_CARD_LAND_A);
target.withNotTarget(true);
player.choose(Outcome.DrawCard, cards, target, source, game);
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
return true;
}
player.moveCards(card, Zone.HAND, source, game);
if (card.hasSubtype(SubType.TOWN, game)) {
player.gainLife(2, game, source);
}
return true;
}
}

View file

@ -112,6 +112,7 @@ public final class FinalFantasy extends ExpansionSet {
cards.add(new SetCardInfo("Tifa Lockhart", 473, Rarity.RARE, mage.cards.t.TifaLockhart.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Tifa Lockhart", 536, Rarity.RARE, mage.cards.t.TifaLockhart.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Tonberry", 122, Rarity.UNCOMMON, mage.cards.t.Tonberry.class));
cards.add(new SetCardInfo("Town Greeter", 209, Rarity.COMMON, mage.cards.t.TownGreeter.class));
cards.add(new SetCardInfo("Ultimecia, Omnipotent", 247, Rarity.UNCOMMON, mage.cards.u.UltimeciaOmnipotent.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Ultimecia, Omnipotent", 513, Rarity.UNCOMMON, mage.cards.u.UltimeciaOmnipotent.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Ultimecia, Time Sorceress", 247, Rarity.UNCOMMON, mage.cards.u.UltimeciaTimeSorceress.class, NON_FULL_USE_VARIOUS));