[DMU] Implemented Ertai's Scorn

This commit is contained in:
Daniel Bomar 2022-08-30 17:22:49 -05:00
parent 05a0c8818b
commit 8d75c8f256
No known key found for this signature in database
GPG key ID: C86C8658F4023918
2 changed files with 73 additions and 0 deletions

View file

@ -0,0 +1,72 @@
package mage.cards.e;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.effects.common.cost.SpellCostReductionSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.target.TargetSpell;
import mage.watchers.common.CastSpellLastTurnWatcher;
/**
*
* @author weirddan455
*/
public final class ErtaisScorn extends CardImpl {
public ErtaisScorn(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}{U}");
// This spell costs {U} less to cast if an opponent cast two or more spells this turn.
this.addAbility(new SimpleStaticAbility(
Zone.ALL,
new SpellCostReductionSourceEffect(
new ManaCostsImpl<>("{U}"),
ErtaisScornCondition.instance
)
).setRuleAtTheTop(true), new CastSpellLastTurnWatcher());
// Counter target spell.
this.getSpellAbility().addTarget(new TargetSpell());
this.getSpellAbility().addEffect(new CounterTargetEffect());
}
private ErtaisScorn(final ErtaisScorn card) {
super(card);
}
@Override
public ErtaisScorn copy() {
return new ErtaisScorn(this);
}
}
enum ErtaisScornCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
if (watcher != null) {
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
if (watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(opponentId) >= 2) {
return true;
}
}
}
return false;
}
@Override
public String toString() {
return "an opponent cast two or more spells this turn";
}
}

View file

@ -85,6 +85,7 @@ public final class DominariaUnited extends ExpansionSet {
cards.add(new SetCardInfo("Electrostatic Infantry", 122, Rarity.UNCOMMON, mage.cards.e.ElectrostaticInfantry.class)); cards.add(new SetCardInfo("Electrostatic Infantry", 122, Rarity.UNCOMMON, mage.cards.e.ElectrostaticInfantry.class));
cards.add(new SetCardInfo("Elfhame Wurm", 161, Rarity.COMMON, mage.cards.e.ElfhameWurm.class)); cards.add(new SetCardInfo("Elfhame Wurm", 161, Rarity.COMMON, mage.cards.e.ElfhameWurm.class));
cards.add(new SetCardInfo("Elvish Hydromancer", 162, Rarity.UNCOMMON, mage.cards.e.ElvishHydromancer.class)); cards.add(new SetCardInfo("Elvish Hydromancer", 162, Rarity.UNCOMMON, mage.cards.e.ElvishHydromancer.class));
cards.add(new SetCardInfo("Ertai's Scorn", 48, Rarity.UNCOMMON, mage.cards.e.ErtaisScorn.class));
cards.add(new SetCardInfo("Essence Scatter", 49, Rarity.COMMON, mage.cards.e.EssenceScatter.class)); cards.add(new SetCardInfo("Essence Scatter", 49, Rarity.COMMON, mage.cards.e.EssenceScatter.class));
cards.add(new SetCardInfo("Evolved Sleeper", 93, Rarity.RARE, mage.cards.e.EvolvedSleeper.class)); cards.add(new SetCardInfo("Evolved Sleeper", 93, Rarity.RARE, mage.cards.e.EvolvedSleeper.class));
cards.add(new SetCardInfo("Extinguish the Light", 94, Rarity.COMMON, mage.cards.e.ExtinguishTheLight.class)); cards.add(new SetCardInfo("Extinguish the Light", 94, Rarity.COMMON, mage.cards.e.ExtinguishTheLight.class));