[DMC] Implement Mana Cannons (#9494)

This commit is contained in:
PurpleCrowbar 2022-09-09 04:29:47 +01:00 committed by GitHub
parent 49a13cdcdc
commit 69c619151f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 66 additions and 0 deletions

View file

@ -0,0 +1,64 @@
package mage.cards.m;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.target.common.TargetAnyTarget;
import java.util.UUID;
/**
* @author PurpleCrowbar
*/
public final class ManaCannons extends CardImpl {
public ManaCannons(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}");
// Whenever you cast a multicolored spell, Mana Cannons deals X damage to any target, where X is the number of colors that spell is.
Ability ability = new SpellCastControllerTriggeredAbility(
new DamageTargetEffect(ManaCannonsSpellValue.instance)
.setText("{this} deals X damage to any target, where X is the number of colors that spell is"),
StaticFilters.FILTER_SPELL_A_MULTICOLORED, false
);
ability.addTarget(new TargetAnyTarget());
this.addAbility(ability);
}
private ManaCannons(final ManaCannons card) {
super(card);
}
@Override
public ManaCannons copy() {
return new ManaCannons(this);
}
}
enum ManaCannonsSpellValue implements DynamicValue {
instance();
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Spell spell = (Spell) effect.getValue("spellCast");
return spell != null ? spell.getColor(game).getColorCount() : 0;
}
@Override
public ManaCannonsSpellValue copy() {
return this;
}
@Override
public String getMessage() {
return "";
}
}

View file

@ -107,6 +107,8 @@ public final class DominariaUnitedCommander extends ExpansionSet {
cards.add(new SetCardInfo("Lavalanche", 157, Rarity.RARE, mage.cards.l.Lavalanche.class));
cards.add(new SetCardInfo("Maelstrom Archangel", 158, Rarity.MYTHIC, mage.cards.m.MaelstromArchangel.class));
cards.add(new SetCardInfo("Maelstrom Nexus", 159, Rarity.MYTHIC, mage.cards.m.MaelstromNexus.class));
cards.add(new SetCardInfo("Mana Cannons", 7, Rarity.RARE, mage.cards.m.ManaCannons.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Mana Cannons", 83, Rarity.RARE, mage.cards.m.ManaCannons.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Merciless Eviction", 160, Rarity.RARE, mage.cards.m.MercilessEviction.class));
cards.add(new SetCardInfo("Migration Path", 135, Rarity.UNCOMMON, mage.cards.m.MigrationPath.class));
cards.add(new SetCardInfo("Mikokoro, Center of the Sea", 217, Rarity.RARE, mage.cards.m.MikokoroCenterOfTheSea.class));