mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
[DMC] Implement Shanid, Sleepers' Scourge (#9390)
This commit is contained in:
parent
84497ca4ae
commit
8aed9d473a
3 changed files with 177 additions and 0 deletions
116
Mage.Sets/src/mage/cards/s/ShanidSleepersScourge.java
Normal file
116
Mage.Sets/src/mage/cards/s/ShanidSleepersScourge.java
Normal file
|
@ -0,0 +1,116 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
|
||||
import mage.abilities.keyword.MenaceAbility;
|
||||
import mage.abilities.meta.OrTriggeredAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author freaisdead
|
||||
*/
|
||||
public final class ShanidSleepersScourge extends CardImpl {
|
||||
private static final FilterCreaturePermanent otherLegendaryCreaturesFilter = new FilterCreaturePermanent("other legendary creatures");
|
||||
private static final FilterSpell legendarySpellFilter = new FilterSpell("a legendary spell");
|
||||
private static final FilterPermanent legendaryLandFilter = new FilterPermanent("a legendary land");
|
||||
|
||||
static {
|
||||
otherLegendaryCreaturesFilter.add(SuperType.LEGENDARY.getPredicate());
|
||||
|
||||
legendarySpellFilter.add(SuperType.LEGENDARY.getPredicate());
|
||||
|
||||
legendaryLandFilter.add(CardType.LAND.getPredicate());
|
||||
legendaryLandFilter.add(SuperType.LEGENDARY.getPredicate());
|
||||
}
|
||||
|
||||
public ShanidSleepersScourge(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{W}{B}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.KNIGHT);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Menace
|
||||
this.addAbility(new MenaceAbility());
|
||||
|
||||
// Other legendary creatures you control have menace.
|
||||
this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect(
|
||||
new MenaceAbility(false),
|
||||
Duration.WhileOnBattlefield,
|
||||
otherLegendaryCreaturesFilter,
|
||||
true)));
|
||||
// Whenever you play a legendary land or cast a legendary spell, you draw a card and you lose 1 life.
|
||||
this.addAbility(new OrTriggeredAbility(Zone.BATTLEFIELD,
|
||||
new DrawAndLoseEffect(1, 1),
|
||||
false,
|
||||
"Whenever you play a legendary land or cast a legendary spell, ",
|
||||
new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, null, legendaryLandFilter, true),
|
||||
new SpellCastControllerTriggeredAbility(null, legendarySpellFilter, false)
|
||||
));
|
||||
}
|
||||
|
||||
private ShanidSleepersScourge(final ShanidSleepersScourge card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShanidSleepersScourge copy() {
|
||||
return new ShanidSleepersScourge(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class DrawAndLoseEffect extends OneShotEffect {
|
||||
|
||||
DrawAndLoseEffect(int drawAmount, int loseLifeAMount) {
|
||||
super(Outcome.Benefit);
|
||||
String cardRule = "a card";
|
||||
if (drawAmount > 1) {
|
||||
cardRule = String.format("%d cards", drawAmount);
|
||||
}
|
||||
this.staticText = String.format("draw %s and you lose %d life", cardRule, loseLifeAMount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Effect drawEffectController = new DrawCardSourceControllerEffect(1);
|
||||
drawEffectController.apply(game, source);
|
||||
Effect drawEffectOpponent = new LoseLifeSourceControllerEffect(1);
|
||||
drawEffectOpponent.apply(game, source);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private DrawAndLoseEffect(final DrawAndLoseEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DrawAndLoseEffect copy() {
|
||||
return new DrawAndLoseEffect(this);
|
||||
}
|
||||
}
|
|
@ -30,6 +30,7 @@ public final class DominariaUnitedCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Nethroi, Apex of Death", 163, Rarity.MYTHIC, mage.cards.n.NethroiApexOfDeath.class));
|
||||
cards.add(new SetCardInfo("O-Kagachi, Vengeful Kami", 164, Rarity.MYTHIC, mage.cards.o.OKagachiVengefulKami.class));
|
||||
cards.add(new SetCardInfo("Path to Exile", 104, Rarity.UNCOMMON, mage.cards.p.PathToExile.class));
|
||||
cards.add(new SetCardInfo("Shanid, Sleepers' Scourge", 4, Rarity.MYTHIC, mage.cards.s.ShanidSleepersScourge.class));
|
||||
cards.add(new SetCardInfo("Surrak Dragonclaw", 169, Rarity.MYTHIC, mage.cards.s.SurrakDragonclaw.class));
|
||||
cards.add(new SetCardInfo("Thrill of Possibility", 127, Rarity.COMMON, mage.cards.t.ThrillOfPossibility.class));
|
||||
cards.add(new SetCardInfo("Two-Headed Hellkite", 14, Rarity.RARE, mage.cards.t.TwoHeadedHellkite.class));
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
package org.mage.test.cards.abilities.activated;
|
||||
|
||||
import mage.abilities.keyword.MenaceAbility;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
public class ShanidSleepersScourgeTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testShanidSleepersScourge() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Shanid, Sleepers' Scourge");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Llanowar Elves");
|
||||
|
||||
addCard(Zone.HAND, playerA, "Academy Ruins", 1);
|
||||
addCard(Zone.HAND, playerA, "Mox Amber", 1);
|
||||
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Academy Ruins");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Mox Amber");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertLife(playerA, 20 - 2);
|
||||
assertHandCount(playerA, 2);
|
||||
assertLife(playerB, 20);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShanidSleepersScourgeNoTrigger() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Shanid, Sleepers' Scourge");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Llanowar Elves");
|
||||
|
||||
addCard(Zone.HAND, playerA, "Memnite", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Memnite");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
assertLife(playerA, 20);
|
||||
assertHandCount(playerA, 0);
|
||||
assertLife(playerB, 20);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShanidSleepersScourgeMenace() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Shanid, Sleepers' Scourge");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Gaddock Teeg");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Gaddock Teeg");
|
||||
|
||||
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
execute();
|
||||
assertLife(playerA, 20);
|
||||
assertHandCount(playerA, 0);
|
||||
assertLife(playerB, 20);
|
||||
assertAbility(playerA, "Gaddock Teeg", new MenaceAbility(), true);
|
||||
assertAbility(playerB, "Gaddock Teeg", new MenaceAbility(), false);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue