mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
* Added test for Spellskite.
This commit is contained in:
parent
85d7f099bd
commit
503dad24b3
3 changed files with 57 additions and 9 deletions
|
|
@ -55,7 +55,7 @@ public class FrostTitan extends CardImpl {
|
||||||
super(ownerId, 55, "Frost Titan", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{4}{U}{U}");
|
super(ownerId, 55, "Frost Titan", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{4}{U}{U}");
|
||||||
this.expansionSetCode = "M11";
|
this.expansionSetCode = "M11";
|
||||||
this.subtype.add("Giant");
|
this.subtype.add("Giant");
|
||||||
this.color.setBlue(true);
|
|
||||||
this.power = new MageInt(6);
|
this.power = new MageInt(6);
|
||||||
this.toughness = new MageInt(6);
|
this.toughness = new MageInt(6);
|
||||||
|
|
||||||
|
|
@ -92,9 +92,14 @@ class FrostTitanAbility1 extends TriggeredAbilityImpl {
|
||||||
return new FrostTitanAbility1(this);
|
return new FrostTitanAbility1(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.TARGETED;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getType() == EventType.TARGETED && event.getTargetId().equals(this.getSourceId()) && game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
|
if (event.getTargetId().equals(this.getSourceId()) && game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
|
||||||
this.getTargets().clear();
|
this.getTargets().clear();
|
||||||
TargetStackObject target = new TargetStackObject();
|
TargetStackObject target = new TargetStackObject();
|
||||||
target.add(event.getSourceId(), game);
|
target.add(event.getSourceId(), game);
|
||||||
|
|
@ -106,7 +111,7 @@ class FrostTitanAbility1 extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRule() {
|
public String getRule() {
|
||||||
return "Whenever {this} becomes the target of a spell or ability an opponent controls, counter that spell or ability unless its controller pays {2}";
|
return "Whenever {this} becomes the target of a spell or ability an opponent controls, counter that spell or ability unless its controller pays {2}.";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -128,20 +133,22 @@ class FrostTitanAbility2 extends TriggeredAbilityImpl {
|
||||||
return new FrostTitanAbility2(this);
|
return new FrostTitanAbility2(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
|
if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()) ) {
|
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRule() {
|
public String getRule() {
|
||||||
return "Whenever {this} enters the battlefield or attacks, tap target permanent. It doesn't untap during its controller's next untap step";
|
return "Whenever {this} enters the battlefield or attacks, tap target permanent. It doesn't untap during its controller's next untap step.";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,4 +67,45 @@ public class SpellskiteTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If Spellskite changes controller, its activated ability can activate but doesn't resolve properly.
|
||||||
|
*
|
||||||
|
* The specific instance was a Spellskite controlled by Vedalken Shackles. Land was targeted by Frost Titan,
|
||||||
|
* controller (not owner) of Spellskite paid the redirection cost, ability went on the stack, seemed to resolve,
|
||||||
|
* target never changed.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testAfterChangeOfController() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
|
||||||
|
// {2}, {tap}: Gain control of target creature with power less than or equal to the number of Islands you control for as long as Vedalken Shackles remains tapped.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Vedalken Shackles", 1);
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Island", 6);
|
||||||
|
// {UP}: Change a target of target spell or ability to Spellskite.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Spellskite", 1);
|
||||||
|
// {4}{U}{U}
|
||||||
|
// Whenever Frost Titan becomes the target of a spell or ability an opponent controls, counter that spell or ability unless its controller pays 2.
|
||||||
|
// Whenever Frost Titan enters the battlefield or attacks, tap target permanent. It doesn't untap during its controller's next untap step.
|
||||||
|
addCard(Zone.HAND, playerB, "Frost Titan", 1);
|
||||||
|
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2},{T}: Gain control", "Spellskite");
|
||||||
|
|
||||||
|
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Frost Titan");
|
||||||
|
addTarget(playerB, "Mountain");
|
||||||
|
|
||||||
|
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerA, "{UP}: Change a target", "stack ability (Whenever {this} enters ");
|
||||||
|
|
||||||
|
setStopAt(2, PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Spellskite", 1);
|
||||||
|
assertPermanentCount(playerB, "Frost Titan", 1);
|
||||||
|
|
||||||
|
assertTapped("Mountain", false);
|
||||||
|
assertTapped("Spellskite", true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -664,7 +664,7 @@ public class TestPlayer extends ComputerPlayer {
|
||||||
}
|
}
|
||||||
for (UUID id: ability.getTargets().get(0).possibleTargets(ability.getSourceId(), ability.getControllerId(), game)) {
|
for (UUID id: ability.getTargets().get(0).possibleTargets(ability.getSourceId(), ability.getControllerId(), game)) {
|
||||||
MageObject object = game.getObject(id);
|
MageObject object = game.getObject(id);
|
||||||
if (object != null && object.getLogName().equals(targetName)) {
|
if (object != null && object.getLogName().startsWith(targetName)) {
|
||||||
if (index >= ability.getTargets().size()) {
|
if (index >= ability.getTargets().size()) {
|
||||||
index--;
|
index--;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue