mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
[J21] Implemented Sarkhan's Scorn
This commit is contained in:
parent
6fbec78835
commit
7e66182974
2 changed files with 94 additions and 0 deletions
93
Mage.Sets/src/mage/cards/s/SarkhansScorn.java
Normal file
93
Mage.Sets/src/mage/cards/s/SarkhansScorn.java
Normal file
|
@ -0,0 +1,93 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
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.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.common.TargetCreatureOrPlaneswalker;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class SarkhansScorn extends CardImpl {
|
||||
|
||||
public SarkhansScorn(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}");
|
||||
|
||||
// Sarkhan's Scorn deals damage equal to the number of turns you have begun to target creature or planeswalker.
|
||||
this.getSpellAbility().addEffect(new DamageTargetEffect(SarkhansScornValue.instance)
|
||||
.setText("{this} deals damage equal to the number of turns " +
|
||||
"you have begun to target creature or planeswalker"));
|
||||
this.getSpellAbility().addTarget(new TargetCreatureOrPlaneswalker());
|
||||
this.getSpellAbility().addWatcher(new SarkhansScornWatcher());
|
||||
}
|
||||
|
||||
private SarkhansScorn(final SarkhansScorn card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SarkhansScorn copy() {
|
||||
return new SarkhansScorn(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum SarkhansScornValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return SarkhansScornWatcher.getCount(sourceAbility.getControllerId(), game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SarkhansScornValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
class SarkhansScornWatcher extends Watcher {
|
||||
|
||||
private final Map<UUID, Set<Integer>> playerMap = new HashMap<>();
|
||||
private static final Set<Integer> emptySet = Collections.unmodifiableSet(new HashSet<>());
|
||||
|
||||
SarkhansScornWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() != GameEvent.EventType.BEGINNING_PHASE_PRE) {
|
||||
return;
|
||||
}
|
||||
if (game.getTurnNum() == 1) {
|
||||
playerMap.clear();
|
||||
}
|
||||
playerMap
|
||||
.computeIfAbsent(game.getActivePlayerId(), x -> new HashSet<>())
|
||||
.add(game.getTurnNum());
|
||||
}
|
||||
|
||||
static int getCount(UUID playerId, Game game) {
|
||||
return game
|
||||
.getState()
|
||||
.getWatcher(SarkhansScornWatcher.class)
|
||||
.playerMap
|
||||
.getOrDefault(playerId, emptySet)
|
||||
.size();
|
||||
}
|
||||
}
|
|
@ -23,6 +23,7 @@ public final class JumpstartHistoricHorizons extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Bounty of the Deep", 7, Rarity.UNCOMMON, mage.cards.b.BountyOfTheDeep.class));
|
||||
cards.add(new SetCardInfo("Faceless Agent", 31, Rarity.COMMON, mage.cards.f.FacelessAgent.class));
|
||||
cards.add(new SetCardInfo("Manor Guardian", 16, Rarity.UNCOMMON, mage.cards.m.ManorGuardian.class));
|
||||
cards.add(new SetCardInfo("Sarkhan's Scorn", 21, Rarity.COMMON, mage.cards.s.SarkhansScorn.class));
|
||||
cards.add(new SetCardInfo("Shoreline Scout", 11, Rarity.UNCOMMON, mage.cards.s.ShorelineScout.class));
|
||||
cards.add(new SetCardInfo("Skyshroud Lookout", 29, Rarity.UNCOMMON, mage.cards.s.SkyshroudLookout.class));
|
||||
cards.add(new SetCardInfo("Wingsteed Trainer", 6, Rarity.UNCOMMON, mage.cards.w.WingsteedTrainer.class));
|
||||
|
|
Loading…
Reference in a new issue