mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
[SNC] Implemented Corpse Explosion
This commit is contained in:
parent
2893d44cf7
commit
c31ea3b3d8
2 changed files with 83 additions and 0 deletions
82
Mage.Sets/src/mage/cards/c/CorpseExplosion.java
Normal file
82
Mage.Sets/src/mage/cards/c/CorpseExplosion.java
Normal file
|
@ -0,0 +1,82 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.ExileFromGraveCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author weirddan455
|
||||
*/
|
||||
public final class CorpseExplosion extends CardImpl {
|
||||
|
||||
public CorpseExplosion(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}{R}");
|
||||
|
||||
// As an additional cost to cast this spell, exile a creature card from your graveyard.
|
||||
this.getSpellAbility().addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD)));
|
||||
|
||||
// Corpse Explosion deals damage equal to the exiled card's power to each creature and each planeswalker.
|
||||
this.getSpellAbility().addEffect(new CorpseExplosionEffect());
|
||||
}
|
||||
|
||||
private CorpseExplosion(final CorpseExplosion card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CorpseExplosion copy() {
|
||||
return new CorpseExplosion(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CorpseExplosionEffect extends OneShotEffect {
|
||||
|
||||
public CorpseExplosionEffect() {
|
||||
super(Outcome.Damage);
|
||||
this.staticText = "{this} deals damage equal to the exiled card's power to each creature and each planeswalker";
|
||||
}
|
||||
|
||||
private CorpseExplosionEffect(final CorpseExplosionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CorpseExplosionEffect copy() {
|
||||
return new CorpseExplosionEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int power = 0;
|
||||
for (Cost cost : source.getCosts()) {
|
||||
if (cost instanceof ExileFromGraveCost) {
|
||||
List<Card> exiledCards = ((ExileFromGraveCost) cost).getExiledCards();
|
||||
if (!exiledCards.isEmpty()) {
|
||||
power = exiledCards.get(0).getPower().getValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (power < 1) {
|
||||
return false;
|
||||
}
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE_OR_PLANESWALKER, source.getControllerId(), source, game)) {
|
||||
permanent.damage(power, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -72,6 +72,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Cleanup Crew", 141, Rarity.UNCOMMON, mage.cards.c.CleanupCrew.class));
|
||||
cards.add(new SetCardInfo("Cormela, Glamour Thief", 177, Rarity.UNCOMMON, mage.cards.c.CormelaGlamourThief.class));
|
||||
cards.add(new SetCardInfo("Corpse Appraiser", 178, Rarity.UNCOMMON, mage.cards.c.CorpseAppraiser.class));
|
||||
cards.add(new SetCardInfo("Corpse Explosion", 179, Rarity.RARE, mage.cards.c.CorpseExplosion.class));
|
||||
cards.add(new SetCardInfo("Corrupt Court Official", 70, Rarity.COMMON, mage.cards.c.CorruptCourtOfficial.class));
|
||||
cards.add(new SetCardInfo("Courier's Briefcase", 142, Rarity.UNCOMMON, mage.cards.c.CouriersBriefcase.class));
|
||||
cards.add(new SetCardInfo("Crooked Custodian", 71, Rarity.COMMON, mage.cards.c.CrookedCustodian.class));
|
||||
|
|
Loading…
Reference in a new issue