implement [MH3] Disa the Restless

This commit is contained in:
Susucre 2024-06-06 18:05:08 +02:00
parent 1cc4691607
commit 719ef1910e
3 changed files with 141 additions and 0 deletions

View file

@ -0,0 +1,81 @@
package mage.cards.d;
import mage.MageInt;
import mage.abilities.common.DealCombatDamageControlledTriggeredAbility;
import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.common.FilterPermanentCard;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.token.TarmogoyfToken;
import java.util.UUID;
/**
* @author Susucr
*/
public final class DisaTheRestless extends CardImpl {
public DisaTheRestless(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{R}{G}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SCOUT);
this.power = new MageInt(5);
this.toughness = new MageInt(6);
// Whenever a Lhurgoyf permanent card is put into your graveyard from anywhere other than the battlefield, put it onto the battlefield.
this.addAbility(new DisaTheRestlessTriggeredAbility());
// Whenever one or more creatures you control deal combat damage to a player, create a Tarmogoyf token.
this.addAbility(new DealCombatDamageControlledTriggeredAbility(
new CreateTokenEffect(new TarmogoyfToken())
));
}
private DisaTheRestless(final DisaTheRestless card) {
super(card);
}
@Override
public DisaTheRestless copy() {
return new DisaTheRestless(this);
}
}
class DisaTheRestlessTriggeredAbility extends PutCardIntoGraveFromAnywhereAllTriggeredAbility {
private static final FilterCard filter = new FilterPermanentCard("a Lhurgoyf permanent card");
static {
filter.add(SubType.LHURGOYF.getPredicate());
}
DisaTheRestlessTriggeredAbility() {
super(
new ReturnFromGraveyardToBattlefieldTargetEffect().setText("put it onto the battlefield"),
false, filter, TargetController.YOU, SetTargetPointer.CARD
);
}
private DisaTheRestlessTriggeredAbility(final DisaTheRestlessTriggeredAbility ability) {
super(ability);
}
@Override
public DisaTheRestlessTriggeredAbility copy() {
return new DisaTheRestlessTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return ((ZoneChangeEvent) event).getFromZone() != Zone.BATTLEFIELD && super.checkTrigger(event, game);
}
}

View file

@ -90,6 +90,7 @@ public final class ModernHorizons3Commander extends ExpansionSet {
cards.add(new SetCardInfo("Demolition Field", 335, Rarity.UNCOMMON, mage.cards.d.DemolitionField.class));
cards.add(new SetCardInfo("Desert of the Indomitable", 336, Rarity.COMMON, mage.cards.d.DesertOfTheIndomitable.class));
cards.add(new SetCardInfo("Desert of the Mindful", 337, Rarity.COMMON, mage.cards.d.DesertOfTheMindful.class));
cards.add(new SetCardInfo("Disa the Restless", 1, Rarity.MYTHIC, mage.cards.d.DisaTheRestless.class));
cards.add(new SetCardInfo("Dreamroot Cascade", 338, Rarity.RARE, mage.cards.d.DreamrootCascade.class));
cards.add(new SetCardInfo("Dreamstone Hedron", 289, Rarity.UNCOMMON, mage.cards.d.DreamstoneHedron.class));
cards.add(new SetCardInfo("Drown in Dreams", 181, Rarity.RARE, mage.cards.d.DrownInDreams.class));

View file

@ -0,0 +1,59 @@
package org.mage.test.cards.single.m3c;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author Susucr
*/
public class DisaTheRestlessTest extends CardTestPlayerBase {
/**
* {@link mage.cards.d.DisaTheRestless Disa the Restless} {2}{B}{R}{G}
* Legendary Creature Human Scout
* Whenever a Lhurgoyf permanent card is put into your graveyard from anywhere other than the battlefield, put it onto the battlefield.
* Whenever one or more creatures you control deal combat damage to a player, create a Tarmogoyf token.
* 5/6
*/
private static final String disa = "Disa the Restless";
@Test
public void test_Discard() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, disa);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
addCard(Zone.HAND, playerA, "Tarmogoyf", 2);
addCard(Zone.HAND, playerA, "Grizzly Bears", 2);
addCard(Zone.HAND, playerA, "One with Nothing");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "One with Nothing");
setChoice(playerA, "Whenever"); // stack triggers
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Tarmogoyf", 2);
assertGraveyardCount(playerA, "Grizzly Bears", 2);
}
@Test
public void test_Destroy() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, disa);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
addCard(Zone.BATTLEFIELD, playerA, "Tarmogoyf", 1);
addCard(Zone.HAND, playerA, "Go for the Throat");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Go for the Throat", "Tarmogoyf");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Tarmogoyf", 0);
assertGraveyardCount(playerA, "Tarmogoyf", 1);
}
}