[Y22] Implemented Obsessive Collector

This commit is contained in:
Evan Kranzler 2022-03-01 18:25:05 -05:00
parent 752243a6ad
commit e23ac4fb9f
2 changed files with 87 additions and 0 deletions

View file

@ -0,0 +1,86 @@
package mage.cards.o;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.WardAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.FilterCard;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ObsessiveCollector extends CardImpl {
public ObsessiveCollector(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}");
this.subtype.add(SubType.SPIRIT);
this.power = new MageInt(4);
this.toughness = new MageInt(3);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Ward {2}
this.addAbility(new WardAbility(new ManaCostsImpl<>("{2}")));
// Whenever Obsessive Collector deals combat damage to a player, seek a card with mana value equal to the number of cards in your hand.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new ObsessiveCollectorEffect(), false));
}
private ObsessiveCollector(final ObsessiveCollector card) {
super(card);
}
@Override
public ObsessiveCollector copy() {
return new ObsessiveCollector(this);
}
}
class ObsessiveCollectorEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard();
static {
filter.add(ObsessiveCollectorEffect::checkCard);
}
private static boolean checkCard(ObjectSourcePlayer<Card> input, Game game) {
return game.getPlayer(input.getPlayerId()).getHand().size() == input.getObject().getManaValue();
}
ObsessiveCollectorEffect() {
super(Outcome.Benefit);
staticText = "seek a card with mana value equal to the number of cards in your hand";
}
private ObsessiveCollectorEffect(final ObsessiveCollectorEffect effect) {
super(effect);
}
@Override
public ObsessiveCollectorEffect copy() {
return new ObsessiveCollectorEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
return player != null && player.seekCard(filter, source, game);
}
}

View file

@ -26,6 +26,7 @@ public final class AlchemyInnistrad extends ExpansionSet {
cards.add(new SetCardInfo("Ishkanah, Broodmother", 52, Rarity.MYTHIC, mage.cards.i.IshkanahBroodmother.class));
cards.add(new SetCardInfo("Key to the Archive", 59, Rarity.RARE, mage.cards.k.KeyToTheArchive.class));
cards.add(new SetCardInfo("Kindred Denial", 18, Rarity.UNCOMMON, mage.cards.k.KindredDenial.class));
cards.add(new SetCardInfo("Obsessive Collector", 19, Rarity.RARE, mage.cards.o.ObsessiveCollector.class));
cards.add(new SetCardInfo("Soulstealer Axe", 60, Rarity.UNCOMMON, mage.cards.s.SoulstealerAxe.class));
cards.add(new SetCardInfo("Tireless Angler", 23, Rarity.RARE, mage.cards.t.TirelessAngler.class));
}