[SNC] Implemented Pyre-Sledge Arsonist

This commit is contained in:
Evan Kranzler 2022-04-11 21:35:43 -04:00
parent 9ac54e6f4b
commit 195c65d6b8
2 changed files with 117 additions and 0 deletions

View file

@ -0,0 +1,116 @@
package mage.cards.p;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.WatcherScope;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.common.TargetAnyTarget;
import mage.util.CardUtil;
import mage.watchers.Watcher;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class PyreSledgeArsonist extends CardImpl {
private static final Hint hint = new ValueHint(
"Permanents you've sacrificed this turn", PyreSledgeArsonistValue.instance
);
public PyreSledgeArsonist(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.subtype.add(SubType.VIASHINO);
this.subtype.add(SubType.SHAMAN);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// {1}, {T}: Pyre-Sledge Arsonist deals X damage to any target, where X is the number of permanents you sacrificed this turn.
Ability ability = new SimpleActivatedAbility(
new DamageTargetEffect(PyreSledgeArsonistValue.instance), new GenericManaCost(1)
);
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetAnyTarget());
this.addAbility(ability.addHint(hint));
}
private PyreSledgeArsonist(final PyreSledgeArsonist card) {
super(card);
}
@Override
public PyreSledgeArsonist copy() {
return new PyreSledgeArsonist(this);
}
}
enum PyreSledgeArsonistValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
return PyreSledgeArsonistWatcher.getAmount(sourceAbility.getControllerId(), game);
}
@Override
public PyreSledgeArsonistValue copy() {
return this;
}
@Override
public String getMessage() {
return "the number of permanents you sacrificed this turn";
}
@Override
public String toString() {
return "X";
}
}
class PyreSledgeArsonistWatcher extends Watcher {
private final Map<UUID, Integer> playerMap = new HashMap<>();
PyreSledgeArsonistWatcher() {
super(WatcherScope.GAME);
}
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT) {
playerMap.compute(event.getPlayerId(), CardUtil::setOrIncrementValue);
}
}
@Override
public void reset() {
super.reset();
playerMap.clear();
}
static int getAmount(UUID playerId, Game game) {
return game
.getState()
.getWatcher(PyreSledgeArsonistWatcher.class)
.playerMap
.getOrDefault(playerId, 0);
}
}

View file

@ -83,6 +83,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet {
cards.add(new SetCardInfo("Plains", 262, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Professional Face-Breaker", 116, Rarity.RARE, mage.cards.p.ProfessionalFaceBreaker.class));
cards.add(new SetCardInfo("Psychic Pickpocket", 54, Rarity.UNCOMMON, mage.cards.p.PsychicPickpocket.class));
cards.add(new SetCardInfo("Pyre-Sledge Arsonist", 118, Rarity.UNCOMMON, mage.cards.p.PyreSledgeArsonist.class));
cards.add(new SetCardInfo("Queza, Augur of Agonies", 212, Rarity.UNCOMMON, mage.cards.q.QuezaAugurOfAgonies.class));
cards.add(new SetCardInfo("Racers' Ring", 253, Rarity.COMMON, mage.cards.r.RacersRing.class));
cards.add(new SetCardInfo("Raffine's Informant", 26, Rarity.COMMON, mage.cards.r.RaffinesInformant.class));