forked from External/mage
[MH3] Implement Wrath of the Skies (#12289)
This commit is contained in:
parent
024291e057
commit
a02259db82
2 changed files with 86 additions and 0 deletions
85
Mage.Sets/src/mage/cards/w/WrathOfTheSkies.java
Normal file
85
Mage.Sets/src/mage/cards/w/WrathOfTheSkies.java
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
package mage.cards.w;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.PayEnergyCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.counter.GetEnergyCountersControllerEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author DominionSpy
|
||||
*/
|
||||
public final class WrathOfTheSkies extends CardImpl {
|
||||
|
||||
public WrathOfTheSkies(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{W}{W}");
|
||||
|
||||
// You get X {E}, then you may pay any amount of {E}. Destroy each artifact, creature, and enchantment with mana value less than or equal to the amount of {E} paid this way.
|
||||
this.getSpellAbility().addEffect(new WrathOfTheSkiesEffect());
|
||||
}
|
||||
|
||||
private WrathOfTheSkies(final WrathOfTheSkies card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WrathOfTheSkies copy() {
|
||||
return new WrathOfTheSkies(this);
|
||||
}
|
||||
}
|
||||
|
||||
class WrathOfTheSkiesEffect extends OneShotEffect {
|
||||
|
||||
WrathOfTheSkiesEffect() {
|
||||
super(Outcome.DestroyPermanent);
|
||||
this.staticText = "You get X {E}, then you may pay any amount of {E}. " +
|
||||
"Destroy each artifact, creature, and enchantment with mana value " +
|
||||
"less than or equal to the amount of {E} paid this way.";
|
||||
}
|
||||
|
||||
private WrathOfTheSkiesEffect(final WrathOfTheSkiesEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WrathOfTheSkiesEffect copy() {
|
||||
return new WrathOfTheSkiesEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
int xValue = source.getManaCostsToPay().getX();
|
||||
if (xValue > 0) {
|
||||
new GetEnergyCountersControllerEffect(xValue).apply(game, source);
|
||||
}
|
||||
|
||||
int numberToPay = controller.getAmount(0, controller.getCounters().getCount(CounterType.ENERGY),
|
||||
"Pay any amount of {E}", game);
|
||||
Cost cost = new PayEnergyCost(numberToPay);
|
||||
if (cost.pay(source, game, source, source.getControllerId(), true)) {
|
||||
game.getBattlefield()
|
||||
.getActivePermanents(controller.getId(), game)
|
||||
.stream()
|
||||
.filter(permanent -> permanent.isArtifact(game)
|
||||
|| permanent.isCreature(game)
|
||||
|| permanent.isEnchantment(game))
|
||||
.filter(permanent -> permanent.getManaValue() <= numberToPay)
|
||||
.forEach(permanent -> permanent.destroy(source, game, false));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -168,6 +168,7 @@ public final class ModernHorizons3 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Witch Enchanter", 239, Rarity.UNCOMMON, mage.cards.w.WitchEnchanter.class));
|
||||
cards.add(new SetCardInfo("Wooded Foothills", 236, Rarity.RARE, mage.cards.w.WoodedFoothills.class));
|
||||
cards.add(new SetCardInfo("Worn Powerstone", 298, Rarity.UNCOMMON, mage.cards.w.WornPowerstone.class));
|
||||
cards.add(new SetCardInfo("Wrath of the Skies", 49, Rarity.RARE, mage.cards.w.WrathOfTheSkies.class));
|
||||
cards.add(new SetCardInfo("Writhing Chrysalis", 208, Rarity.COMMON, mage.cards.w.WrithingChrysalis.class));
|
||||
cards.add(new SetCardInfo("Wumpus Aberration", 176, Rarity.UNCOMMON, mage.cards.w.WumpusAberration.class));
|
||||
cards.add(new SetCardInfo("Wurmcoil Larva", 112, Rarity.UNCOMMON, mage.cards.w.WurmcoilLarva.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue