mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Implemented Volcanic Salvo
This commit is contained in:
parent
a383bffc9b
commit
f7173459b9
2 changed files with 84 additions and 0 deletions
83
Mage.Sets/src/mage/cards/v/VolcanicSalvo.java
Normal file
83
Mage.Sets/src/mage/cards/v/VolcanicSalvo.java
Normal file
|
@ -0,0 +1,83 @@
|
|||
package mage.cards.v;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreatureOrPlaneswalker;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class VolcanicSalvo extends CardImpl {
|
||||
|
||||
public VolcanicSalvo(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{10}{R}{R}");
|
||||
|
||||
// This spell costs {X} less to cast, where X is the total power of creatures you control.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new VolcanicSalvoCostReductionEffect()));
|
||||
|
||||
// Volcanic Salvo deals 6 damage to each of up to two target creatures and/or planeswalkers.
|
||||
this.getSpellAbility().addEffect(new DamageTargetEffect(6)
|
||||
.setText("{this} deals 6 damage to each of up to two target creatures and/or planeswalkers")
|
||||
);
|
||||
this.getSpellAbility().addTarget(new TargetCreatureOrPlaneswalker(0, 2));
|
||||
}
|
||||
|
||||
private VolcanicSalvo(final VolcanicSalvo card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VolcanicSalvo copy() {
|
||||
return new VolcanicSalvo(this);
|
||||
}
|
||||
}
|
||||
|
||||
class VolcanicSalvoCostReductionEffect extends CostModificationEffectImpl {
|
||||
|
||||
VolcanicSalvoCostReductionEffect() {
|
||||
super(Duration.WhileOnStack, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||
staticText = "This spell costs {X} less to cast, where X is the total power of creatures you control";
|
||||
}
|
||||
|
||||
private VolcanicSalvoCostReductionEffect(final VolcanicSalvoCostReductionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
int reductionAmount = game.getBattlefield()
|
||||
.getAllActivePermanents(
|
||||
StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game
|
||||
).stream()
|
||||
.map(Permanent::getPower)
|
||||
.mapToInt(MageInt::getValue)
|
||||
.sum();
|
||||
CardUtil.reduceCost(abilityToModify, Math.max(0, reductionAmount));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
return abilityToModify instanceof SpellAbility
|
||||
&& abilityToModify.getSourceId().equals(source.getSourceId())
|
||||
&& game.getCard(abilityToModify.getSourceId()) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VolcanicSalvoCostReductionEffect copy() {
|
||||
return new VolcanicSalvoCostReductionEffect(this);
|
||||
}
|
||||
}
|
|
@ -144,6 +144,7 @@ public final class CoreSet2021 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Valorous Steed", 42, Rarity.COMMON, mage.cards.v.ValorousSteed.class));
|
||||
cards.add(new SetCardInfo("Village Rites", 126, Rarity.COMMON, mage.cards.v.VillageRites.class));
|
||||
cards.add(new SetCardInfo("Vito, Thorn of the Dusk Rose", 127, Rarity.RARE, mage.cards.v.VitoThornOfTheDuskRose.class));
|
||||
cards.add(new SetCardInfo("Volcanic Salvo", 172, Rarity.RARE, mage.cards.v.VolcanicSalvo.class));
|
||||
cards.add(new SetCardInfo("Vryn Wingmare", 43, Rarity.UNCOMMON, mage.cards.v.VrynWingmare.class));
|
||||
cards.add(new SetCardInfo("Warden of the Woods", 213, Rarity.UNCOMMON, mage.cards.w.WardenOfTheWoods.class));
|
||||
cards.add(new SetCardInfo("Wildwood Patrol", 339, Rarity.COMMON, mage.cards.w.WildwoodPatrol.class));
|
||||
|
|
Loading…
Reference in a new issue