diff --git a/Mage.Sets/src/mage/cards/s/SautekhImmortal.java b/Mage.Sets/src/mage/cards/s/SautekhImmortal.java new file mode 100644 index 0000000000..bb556adbfd --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SautekhImmortal.java @@ -0,0 +1,50 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.dynamicvalue.common.CreaturesDiedThisTurnCount; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.hint.common.CreaturesDiedThisTurnHint; +import mage.abilities.keyword.FlashAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.watchers.common.CreaturesDiedWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SautekhImmortal extends CardImpl { + + public SautekhImmortal(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}{B}"); + + this.subtype.add(SubType.NECRON); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // Elite Troops -- Sautekh Immortal enters the battlefield with a +1/+1 counter on it for each creature that died this turn. + this.addAbility(new EntersBattlefieldAbility( + new AddCountersSourceEffect( + CounterType.P1P1.createInstance(0), + CreaturesDiedThisTurnCount.instance, true + ).setText("with a +1/+1 counter on it for each creature that died this turn.") + ).withFlavorWord("Elite Troops").addHint(CreaturesDiedThisTurnHint.instance), new CreaturesDiedWatcher()); + } + + private SautekhImmortal(final SautekhImmortal card) { + super(card); + } + + @Override + public SautekhImmortal copy() { + return new SautekhImmortal(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Warhammer40000.java b/Mage.Sets/src/mage/sets/Warhammer40000.java index 0f19b71ba6..b535c2b3d3 100644 --- a/Mage.Sets/src/mage/sets/Warhammer40000.java +++ b/Mage.Sets/src/mage/sets/Warhammer40000.java @@ -122,6 +122,7 @@ public final class Warhammer40000 extends ExpansionSet { cards.add(new SetCardInfo("Reverberate", 207, Rarity.RARE, mage.cards.r.Reverberate.class)); cards.add(new SetCardInfo("Royal Warden", 52, Rarity.RARE, mage.cards.r.RoyalWarden.class)); cards.add(new SetCardInfo("Rugged Highlands", 292, Rarity.COMMON, mage.cards.r.RuggedHighlands.class)); + cards.add(new SetCardInfo("Sautekh Immortal", 54, Rarity.UNCOMMON, mage.cards.s.SautekhImmortal.class)); cards.add(new SetCardInfo("Screamer-Killer", 84, Rarity.RARE, mage.cards.s.ScreamerKiller.class)); cards.add(new SetCardInfo("Skorpekh Destroyer", 57, Rarity.UNCOMMON, mage.cards.s.SkorpekhDestroyer.class)); cards.add(new SetCardInfo("Skorpekh Lord", 58, Rarity.RARE, mage.cards.s.SkorpekhLord.class)); diff --git a/Mage/src/main/java/mage/watchers/common/CreaturesDiedWatcher.java b/Mage/src/main/java/mage/watchers/common/CreaturesDiedWatcher.java index a23aa62a44..db67353f8d 100644 --- a/Mage/src/main/java/mage/watchers/common/CreaturesDiedWatcher.java +++ b/Mage/src/main/java/mage/watchers/common/CreaturesDiedWatcher.java @@ -4,6 +4,7 @@ import mage.constants.WatcherScope; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; +import mage.util.CardUtil; import mage.watchers.Watcher; import java.util.HashMap; @@ -24,17 +25,17 @@ public class CreaturesDiedWatcher extends Watcher { @Override public void watch(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - if (zEvent.isDiesEvent() - && zEvent.getTarget() != null - && zEvent.getTarget().isCreature(game)) { - int amount = getAmountOfCreaturesDiedThisTurnByController(zEvent.getTarget().getControllerId()); - amountOfCreaturesThatDiedByController.put(zEvent.getTarget().getControllerId(), amount + 1); - amount = getAmountOfCreaturesDiedThisTurnByOwner(zEvent.getTarget().getOwnerId()); - amountOfCreaturesThatDiedByOwner.put(zEvent.getTarget().getOwnerId(), amount + 1); - } + if (event.getType() != GameEvent.EventType.ZONE_CHANGE) { + return; } + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (!zEvent.isDiesEvent() + || zEvent.getTarget() == null + || !zEvent.getTarget().isCreature(game)) { + return; + } + amountOfCreaturesThatDiedByController.compute(zEvent.getTarget().getControllerId(), CardUtil::setOrIncrementValue); + amountOfCreaturesThatDiedByOwner.compute(zEvent.getTarget().getOwnerId(), CardUtil::setOrIncrementValue); } @Override