mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
- Fix for Spellskite in situations where it was also a target. Fixed the test for Spellskite.
This commit is contained in:
parent
3bebdd65bc
commit
209e2d13c1
3 changed files with 79 additions and 6 deletions
|
@ -46,7 +46,7 @@ public class Hex extends CardImpl {
|
|||
|
||||
// Destroy six target creatures.
|
||||
this.getSpellAbility().addEffect(new DestroyTargetEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(6, 6));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(6));
|
||||
}
|
||||
|
||||
public Hex(final Hex card) {
|
||||
|
|
|
@ -129,12 +129,14 @@ class SpellskiteEffect extends OneShotEffect {
|
|||
for (Target target : targets) {
|
||||
for (UUID targetId : target.getTargets()) {
|
||||
String name = getTargetName(targetId, game);
|
||||
if (!targetId.equals(source.getSourceId()) && target.getTargets().contains(source.getSourceId())) {
|
||||
if (targetId.equals(source.getSourceId())
|
||||
|| target.getTargets().contains(source.getSourceId())) {
|
||||
// you can't change this target to source because the source is already another targetId of that target.
|
||||
twoTimesTarget = true;
|
||||
continue;
|
||||
}
|
||||
if (target.canTarget(stackObject.getControllerId(), source.getSourceId(), sourceAbility, game)) {
|
||||
if (target.canTarget(stackObject.getControllerId(), source.getSourceId(), sourceAbility, game)
|
||||
&& !twoTimesTarget) {
|
||||
validTargets = true;
|
||||
if (name != null
|
||||
&& controller.chooseUse(Outcome.Neutral, "Change target from " + name + " to " + sourceObject.getLogName() + '?', source, game)) {
|
||||
|
|
|
@ -6,12 +6,17 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* Created by goesta on 12/02/2017.
|
||||
* Created by goesta on 12/02/2017. Modified by jeffwadsworth
|
||||
*/
|
||||
public class SpellskiteTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testThatSplitDamageCanGetRedirected() {
|
||||
public void testThatSpellSkiteCantBeTargetedTwiceOrMore() {
|
||||
/* According to rules, the same object can be a legal target only
|
||||
once for each instances of the word “target” in the text
|
||||
of a spell or ability. In this case, the target can't be changed
|
||||
due to Spellskite already being a target.
|
||||
*/
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
|
||||
|
@ -34,7 +39,73 @@ public class SpellskiteTest extends CardTestPlayerBase {
|
|||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerB, 2);
|
||||
}
|
||||
|
||||
public void testThatSplitDamageCanGetRedirected() {
|
||||
/* Standard redirect test
|
||||
The Spellskite should die from the 5 damage that was redirected to it
|
||||
*/
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Spellskite");// 0/4 creature
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Scute Mob"); // 1/1 creauture
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island");
|
||||
|
||||
addCard(Zone.HAND, playerA, "Fiery Justice");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Fiery Justice"); // 5 damage distributed to any number of targets
|
||||
addTarget(playerA, "Scute Mob");
|
||||
setChoice(playerA, "X=5");
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{UP}: Change a target of target spell or ability to {this}.", "Fiery Justice", "Fiery Justice");
|
||||
setChoice(playerA, "Yes");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerB, 1);
|
||||
assertPowerToughness(playerB, "Scute Mob", 1, 1);
|
||||
assertPermanentCount(playerB, "Scute Mob", 1);
|
||||
}
|
||||
|
||||
public void testThatSplitDamageGetsRedirectedFromTheCorrectChoice() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Spellskite");// 0/4 creature
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Memnite"); // 1/1 creauture
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Royal Assassin");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Blinking Spirit");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Pearled Unicorn");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island");
|
||||
|
||||
addCard(Zone.HAND, playerA, "Fiery Justice");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Fiery Justice"); // 5 damage distributed to any number of targets
|
||||
addTarget(playerA, "Memnite");
|
||||
setChoice(playerA, "X=1");
|
||||
addTarget(playerA, "Royal Assassin");
|
||||
setChoice(playerA, "X=1");
|
||||
addTarget(playerA, "Blinking Spirit");
|
||||
setChoice(playerA, "X=1");
|
||||
addTarget(playerA, "Pearled Unicorn");
|
||||
setChoice(playerA, "X=2");//the unicorn deserves it
|
||||
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerB, "{UP}: Change a target of target spell or ability to {this}.", "Fiery Justice", "Fiery Justice");
|
||||
setChoice(playerA, "No");
|
||||
setChoice(playerA, "No");
|
||||
setChoice(playerA, "No");
|
||||
setChoice(playerA, "Yes"); //of course
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerB, 3);
|
||||
assertPermanentCount(playerB, "Pearled Unicorn", 1);//it lives on
|
||||
assertPowerToughness(playerB, "Spellskite", 0, 2);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue