mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
* Fixed CAST_SPELL_LATE event (e.g. used by Reflector Mage) to only fire for cast events.
This commit is contained in:
parent
d6af2c4008
commit
ad637a2944
3 changed files with 36 additions and 34 deletions
|
@ -13,54 +13,55 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
public class ThoughtKnotSeerTest extends CardTestPlayerBase {
|
||||
|
||||
|
||||
/**
|
||||
* Reported bug
|
||||
* I bounced a Thought-Knot Seer my opponent controlled with enter the battlefield ability of a Reflector Mage.
|
||||
* I should have drawn a card since the Thought-Knot Seer left the battlefield but I didn't.
|
||||
* Reported bug I bounced a Thought-Knot Seer my opponent controlled with
|
||||
* enter the battlefield ability of a Reflector Mage. I should have drawn a
|
||||
* card since the Thought-Knot Seer left the battlefield but I didn't.
|
||||
*/
|
||||
@Test
|
||||
public void testThoughtKnotSeerBouncedReflectorMage() {
|
||||
|
||||
// {1}{W}{U} When Reflector Mage enters the battlefield, return target creature an opponent controls to its owner's hand.
|
||||
// {1}{W}{U} When Reflector Mage enters the battlefield, return target creature an opponent controls to its owner's hand.
|
||||
// That creature's owner can't cast spells with the same name as that creature until your next turn.
|
||||
addCard(Zone.HAND, playerA, "Reflector Mage"); // 2/3
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
|
||||
addCard(Zone.HAND, playerA, "Reflector Mage"); // 2/3
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
|
||||
// {3}{<>} 4/4
|
||||
// When Thought-Knot Seer enters the battlefield, target opponent reveals his or her hand. You choose a nonland card from it and exile that card.
|
||||
// When Thought-Knot Seer leaves the battlefield, target opponent draws a card.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Thought-Knot Seer");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Wastes", 4);
|
||||
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Reflector Mage");
|
||||
addTarget(playerA, "Thought-Knot Seer");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertHandCount(playerB, "Thought-Knot Seer", 1);
|
||||
Set<Card> hand = playerA.getHand().getCards(currentGame);
|
||||
assertPermanentCount(playerA, "Reflector Mage", 1);
|
||||
assertHandCount(playerB, "Thought-Knot Seer", 1);
|
||||
assertHandCount(playerA, 1); // should have drawn a card from Thought-Knot Seer leaving
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simple bounce test on Thought-Knot Seer to differentiate between this and Reflector Mage issue
|
||||
* Simple bounce test on Thought-Knot Seer to differentiate between this and
|
||||
* Reflector Mage issue
|
||||
*/
|
||||
@Test
|
||||
public void testThoughtKnotSeerBouncedUnsummon() {
|
||||
|
||||
// {U} Return target creature to its owner's hand.
|
||||
addCard(Zone.HAND, playerA, "Unsummon");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
|
||||
// {3}{<>} 4/4
|
||||
// When Thought-Knot Seer enters the battlefield, target opponent reveals his or her hand. You choose a nonland card from it and exile that card.
|
||||
// When Thought-Knot Seer leaves the battlefield, target opponent draws a card.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Thought-Knot Seer");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Wastes", 4);
|
||||
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Unsummon");
|
||||
addTarget(playerA, "Thought-Knot Seer");
|
||||
|
||||
|
@ -68,54 +69,54 @@ public class ThoughtKnotSeerTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Unsummon", 1);
|
||||
assertHandCount(playerB, "Thought-Knot Seer", 1);
|
||||
assertHandCount(playerB, "Thought-Knot Seer", 1);
|
||||
Set<Card> hand = playerA.getHand().getCards(currentGame);
|
||||
assertHandCount(playerA, 1); // should have drawn a card from Thought-Knot Seer leaving
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testThoughtKnotSeerDestroyed() {
|
||||
|
||||
// {1}{B} Destroy target nonblack creature.
|
||||
addCard(Zone.HAND, playerA, "Doom Blade");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
|
||||
addCard(Zone.HAND, playerA, "Doom Blade");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
|
||||
// {3}{<>} 4/4
|
||||
// When Thought-Knot Seer enters the battlefield, target opponent reveals his or her hand. You choose a nonland card from it and exile that card.
|
||||
// When Thought-Knot Seer leaves the battlefield, target opponent draws a card.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Thought-Knot Seer");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Wastes", 4);
|
||||
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Doom Blade");
|
||||
addTarget(playerA, "Thought-Knot Seer");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerB, "Thought-Knot Seer", 1);
|
||||
assertGraveyardCount(playerB, "Thought-Knot Seer", 1);
|
||||
Set<Card> hand = playerA.getHand().getCards(currentGame);
|
||||
assertHandCount(playerA, 1); // should have drawn a card from Thought-Knot Seer leaving
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testThoughtKnotSeerExiled() {
|
||||
|
||||
// {W} Exile target creature. Its controller may search his or her library for a basic land card, put that card onto the battlefield tapped, then shuffle his or her library.
|
||||
addCard(Zone.HAND, playerA, "Path to Exile");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
|
||||
addCard(Zone.HAND, playerA, "Path to Exile");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
|
||||
// {3}{<>} 4/4
|
||||
// When Thought-Knot Seer enters the battlefield, target opponent reveals his or her hand. You choose a nonland card from it and exile that card.
|
||||
// When Thought-Knot Seer leaves the battlefield, target opponent draws a card.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Thought-Knot Seer");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Wastes", 4);
|
||||
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Path to Exile");
|
||||
addTarget(playerA, "Thought-Knot Seer");
|
||||
|
||||
|
@ -127,4 +128,4 @@ public class ThoughtKnotSeerTest extends CardTestPlayerBase {
|
|||
Set<Card> hand = playerA.getHand().getCards(currentGame);
|
||||
assertHandCount(playerA, 1); // should have drawn a card from Thought-Knot Seer leaving
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -315,7 +315,8 @@ public abstract class AbilityImpl implements Ability {
|
|||
VariableManaCost variableManaCost = handleManaXCosts(game, noMana, controller);
|
||||
String announceString = handleOtherXCosts(game, controller);
|
||||
// For effects from cards like Void Winnower x costs have to be set
|
||||
if (game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL_LATE, getId(), getSourceId(), getControllerId()), this)) {
|
||||
if (this.getAbilityType().equals(AbilityType.SPELL)
|
||||
&& game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL_LATE, getId(), getSourceId(), getControllerId()), this)) {
|
||||
return false;
|
||||
}
|
||||
for (Mode mode : this.getModes().getSelectedModes()) {
|
||||
|
|
|
@ -40,7 +40,7 @@ import mage.game.events.ZoneChangeEvent;
|
|||
public class LeavesBattlefieldTriggeredAbility extends ZoneChangeTriggeredAbility {
|
||||
|
||||
public LeavesBattlefieldTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, null, effect, "When {this} leaves the battlefield, ", optional);
|
||||
super(Zone.ALL, Zone.BATTLEFIELD, null, effect, "When {this} leaves the battlefield, ", optional);
|
||||
}
|
||||
|
||||
public LeavesBattlefieldTriggeredAbility(LeavesBattlefieldTriggeredAbility ability) {
|
||||
|
|
Loading…
Reference in a new issue