[KHM] Implemented Egon, God of Death (#7377)

This commit is contained in:
Daniel Bomar 2021-01-12 19:49:06 -06:00 committed by GitHub
parent 70bf8fe31b
commit 2bd682dcbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 94 additions and 6 deletions

View file

@ -0,0 +1,80 @@
package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.ExileFromGraveCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.MillCardsControllerEffect;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.cards.ModalDoubleFacesCard;
import mage.constants.*;
import mage.abilities.keyword.DeathtouchAbility;
import mage.cards.CardSetInfo;
import mage.filter.common.FilterCreatureCard;
import mage.target.common.TargetCardInYourGraveyard;
/**
*
* @author weirddan455
*/
public final class EgonGodOfDeath extends ModalDoubleFacesCard {
private static final FilterCreatureCard filter = new FilterCreatureCard("a creature card from your graveyard");
public EgonGodOfDeath(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo,
new CardType[]{CardType.CREATURE}, new SubType[]{SubType.GOD}, "{2}{B}",
"Throne of Death", new CardType[]{CardType.ARTIFACT}, new SubType[]{}, "{B}"
);
// 1.
// Egon, God of Death
// Legendary Creature - God
this.getLeftHalfCard().addSuperType(SuperType.LEGENDARY);
this.getLeftHalfCard().setPT(new MageInt(6), new MageInt(6));
// Deathtouch
this.getLeftHalfCard().addAbility(DeathtouchAbility.getInstance());
// At the beginning of your upkeep, exile two cards from your graveyard. If you can't, sacrifice Egon and draw a card.
DoIfCostPaid effect = new DoIfCostPaid(null, new SacrificeSourceEffect(), new ExileFromGraveCost(
new TargetCardInYourGraveyard(2, 2)), false
);
effect.addOtherwiseEffect(new DrawCardSourceControllerEffect(1));
effect.setText("exile two cards from your graveyard. If you can't, sacrifice {this} and draw a card.");
this.getLeftHalfCard().addAbility(new BeginningOfUpkeepTriggeredAbility(
Zone.BATTLEFIELD, effect, TargetController.YOU, false, false
));
// 2.
// Throne of Death
// Legendary Artifact
this.getRightHalfCard().addSuperType(SuperType.LEGENDARY);
// At the beginning of your upkeep, mill a card.
this.getRightHalfCard().addAbility(new BeginningOfUpkeepTriggeredAbility(
Zone.BATTLEFIELD, new MillCardsControllerEffect(1), TargetController.YOU, false, false
));
// {2}{B}, {T}, Exile a creature card from your graveyard: Draw a card
Ability ability = new SimpleActivatedAbility(new DrawCardSourceControllerEffect(1), new ManaCostsImpl("{2}{B}"));
ability.addCost(new TapSourceCost());
ability.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(filter)));
this.getRightHalfCard().addAbility(ability);
}
private EgonGodOfDeath(final EgonGodOfDeath card) {
super(card);
}
@Override
public EgonGodOfDeath copy() {
return new EgonGodOfDeath(this);
}
}

View file

@ -73,6 +73,7 @@ public final class Kaldheim extends ExpansionSet {
cards.add(new SetCardInfo("Divine Gambit", 8, Rarity.UNCOMMON, mage.cards.d.DivineGambit.class));
cards.add(new SetCardInfo("Dogged Pursuit", 85, Rarity.COMMON, mage.cards.d.DoggedPursuit.class));
cards.add(new SetCardInfo("Doomskar Oracle", 10, Rarity.COMMON, mage.cards.d.DoomskarOracle.class));
cards.add(new SetCardInfo("Egon, God of Death", 92, Rarity.RARE, mage.cards.e.EgonGodOfDeath.class));
cards.add(new SetCardInfo("Elderfang Disciple", 93, Rarity.COMMON, mage.cards.e.ElderfangDisciple.class));
cards.add(new SetCardInfo("Elderfang Ritualist", 385, Rarity.UNCOMMON, mage.cards.e.ElderfangRitualist.class));
cards.add(new SetCardInfo("Elven Ambush", 391, Rarity.UNCOMMON, mage.cards.e.ElvenAmbush.class));

View file

@ -63,6 +63,11 @@ public class DoIfCostPaid extends OneShotEffect {
return this;
}
public DoIfCostPaid addOtherwiseEffect (Effect effect) {
otherwiseEffects.add(effect);
return this;
}
public Effects getExecutingEffects() {
return this.executingEffects;
}
@ -96,12 +101,14 @@ public class DoIfCostPaid extends OneShotEffect {
int bookmark = game.bookmarkState();
if (cost.pay(source, game, source, player.getId(), false)) {
game.informPlayers(player.getLogName() + " paid for " + mageObject.getLogName() + " - " + message);
for (Effect effect : executingEffects) {
effect.setTargetPointer(this.targetPointer);
if (effect instanceof OneShotEffect) {
result &= effect.apply(game, source);
} else {
game.addEffect((ContinuousEffect) effect, source);
if (!executingEffects.isEmpty()) {
for (Effect effect : executingEffects) {
effect.setTargetPointer(this.targetPointer);
if (effect instanceof OneShotEffect) {
result &= effect.apply(game, source);
} else {
game.addEffect((ContinuousEffect) effect, source);
}
}
}
player.resetStoredBookmark(game); // otherwise you can e.g. undo card drawn with Mentor of the Meek