[MH2] Implemented Flay Essence (#7854)

This commit is contained in:
Daniel Bomar 2021-05-27 19:38:54 -05:00 committed by GitHub
parent ff53f22e20
commit af87260262
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 74 additions and 0 deletions

View file

@ -0,0 +1,73 @@
package mage.cards.f;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.counters.Counter;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreatureOrPlaneswalker;
/**
*
* @author weirddan455
*/
public final class FlayEssence extends CardImpl {
public FlayEssence(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}{B}");
// Exile target creature or planeswalker. You gain life equal to the number of counters on it.
this.getSpellAbility().addTarget(new TargetCreatureOrPlaneswalker());
this.getSpellAbility().addEffect(new FlayEssenceEffect());
}
private FlayEssence(final FlayEssence card) {
super(card);
}
@Override
public FlayEssence copy() {
return new FlayEssence(this);
}
}
class FlayEssenceEffect extends OneShotEffect {
public FlayEssenceEffect() {
super(Outcome.Exile);
this.staticText = "Exile target creature or planeswalker. You gain life equal to the number of counters on it";
}
private FlayEssenceEffect(final FlayEssenceEffect effect) {
super(effect);
}
@Override
public FlayEssenceEffect copy() {
return new FlayEssenceEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (controller != null && permanent != null) {
int life = 0;
for (Counter counter : permanent.getCounters(game).values()) {
life += counter.getCount();
}
controller.moveCards(permanent, Zone.EXILED, source, game);
controller.gainLife(life, game, source);
return true;
}
return false;
}
}

View file

@ -55,6 +55,7 @@ public final class ModernHorizons2 extends ExpansionSet {
cards.add(new SetCardInfo("Extruder", 296, Rarity.UNCOMMON, mage.cards.e.Extruder.class));
cards.add(new SetCardInfo("Flame Rift", 278, Rarity.UNCOMMON, mage.cards.f.FlameRift.class));
cards.add(new SetCardInfo("Flametongue Yearling", 125, Rarity.UNCOMMON, mage.cards.f.FlametongueYearling.class));
cards.add(new SetCardInfo("Flay Essence", 85, Rarity.UNCOMMON, mage.cards.f.FlayEssence.class));
cards.add(new SetCardInfo("Forest", 489, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Fractured Sanity", 44, Rarity.RARE, mage.cards.f.FracturedSanity.class));
cards.add(new SetCardInfo("Goblin Bombardment", 279, Rarity.RARE, mage.cards.g.GoblinBombardment.class));