implement [MH3] Volatile Stormdrake ; provide source Ability to canBeTargetedBy and HexproofBaseAbility::checkObject

This commit is contained in:
Susucre 2024-06-06 16:52:53 +02:00
parent 8ec4ffd9de
commit 2d625f0364
49 changed files with 399 additions and 171 deletions

View file

@ -0,0 +1,75 @@
package org.mage.test.cards.single.mh3;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author Susucr
*/
public class VolatileStormdrakeTest extends CardTestPlayerBase {
/**
* {@link mage.cards.v.VolatileStormdrake Volatile Stormdrake} {1}{U}
* Creature Drake
* Flying, hexproof from activated and triggered abilities
* When Volatile Stormdrake enters the battlefield, exchange control of Volatile Stormdrake and target creature an opponent controls. If you do, you get {E}{E}{E}{E}, then sacrifice that creature unless you pay an amount of {E} equal to its mana value.
* 3/2
*/
private static final String drake = "Volatile Stormdrake";
@Test
public void test_Hexproof_From_Triggered() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerB, drake);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4);
addCard(Zone.HAND, playerA, "Ravenous Chupacabra");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ravenous Chupacabra");
// no trigger, as the drake has hexproof from triggered ability so there is no valid target
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerB, drake, 1);
assertPermanentCount(playerA, "Ravenous Chupacabra", 1);
}
@Test
public void test_Hexproof_From_Activated() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerB, drake);
addCard(Zone.BATTLEFIELD, playerA, "Alluring Siren");
addCard(Zone.HAND, playerB, "Memnite");
checkPlayableAbility("can not activate Siren", 1, PhaseStep.PRECOMBAT_MAIN, playerA,
"{T}: Target creature an opponent controls attacks you this turn if able.", false);
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Memnite");
checkPlayableAbility("can not activate Siren", 3, PhaseStep.PRECOMBAT_MAIN, playerA,
"{T}: Target creature an opponent controls attacks you this turn if able.", true);
setStopAt(3, PhaseStep.BEGIN_COMBAT);
execute();
}
@Test
public void test_CanBeTargetted_BySpell() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerB, drake);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Zone.HAND, playerA, "Murder");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Murder", drake);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerB, drake, 1);
}
}

View file

@ -3027,8 +3027,8 @@ public class TestPlayer implements Player {
}
@Override
public boolean canBeTargetedBy(MageObject source, UUID sourceControllerId, Game game) {
return computerPlayer.canBeTargetedBy(source, sourceControllerId, game);
public boolean canBeTargetedBy(MageObject sourceObject, UUID sourceControllerId, Ability source, Game game) {
return computerPlayer.canBeTargetedBy(sourceObject, sourceControllerId, source, game);
}
@Override