[OTJ] Implement Thunder Salvo

This commit is contained in:
Susucre 2024-04-03 23:04:45 +02:00
parent 6d318080c8
commit d6efb5d7cd
2 changed files with 76 additions and 0 deletions

View file

@ -0,0 +1,75 @@
package mage.cards.t;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.IntPlusDynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.hint.ValueHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.target.common.TargetCreaturePermanent;
import mage.watchers.common.SpellsCastWatcher;
import java.util.UUID;
/**
* @author Susucr
*/
public final class ThunderSalvo extends CardImpl {
public ThunderSalvo(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{R}");
// Thunder Salvo deals X damage to target creature, where X is 2 plus the number of other spells you've cast this turn.
this.getSpellAbility().addEffect(new DamageTargetEffect(new IntPlusDynamicValue(2, ThunderSalvoValue.instance))
.setText("{this} deals X damage to target creature, where X is 2 plus the number of other spells you've cast this turn."));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addHint(new ValueHint("Number of other spells you've cast this turn", ThunderSalvoValue.instance));
}
private ThunderSalvo(final ThunderSalvo card) {
super(card);
}
@Override
public ThunderSalvo copy() {
return new ThunderSalvo(this);
}
}
enum ThunderSalvoValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
SpellsCastWatcher watcher = game.getState().getWatcher(SpellsCastWatcher.class);
if (watcher == null) {
return 0;
}
Spell spell = game.getSpell(sourceAbility.getSourceId());
return watcher.getSpellsCastThisTurn(sourceAbility.getControllerId())
.stream()
.filter(s -> spell == null || !spell.getId().equals(s.getId()))
.mapToInt(k -> 1)
.sum();
}
@Override
public ThunderSalvoValue copy() {
return instance;
}
@Override
public String getMessage() {
return "Number of other spells you've cast this turn";
}
@Override
public String toString() {
return "1";
}
}

View file

@ -268,6 +268,7 @@ public final class OutlawsOfThunderJunction extends ExpansionSet {
cards.add(new SetCardInfo("Three Steps Ahead", 75, Rarity.RARE, mage.cards.t.ThreeStepsAhead.class));
cards.add(new SetCardInfo("Throw from the Saddle", 185, Rarity.COMMON, mage.cards.t.ThrowFromTheSaddle.class));
cards.add(new SetCardInfo("Thunder Lasso", 35, Rarity.UNCOMMON, mage.cards.t.ThunderLasso.class));
cards.add(new SetCardInfo("Thunder Salvo", 150, Rarity.COMMON, mage.cards.t.ThunderSalvo.class));
cards.add(new SetCardInfo("Tinybones Joins Up", 108, Rarity.RARE, mage.cards.t.TinybonesJoinsUp.class));
cards.add(new SetCardInfo("Tomb Trawler", 250, Rarity.UNCOMMON, mage.cards.t.TombTrawler.class));
cards.add(new SetCardInfo("Trained Arynx", 36, Rarity.COMMON, mage.cards.t.TrainedArynx.class));