* Fixed CAST_SPELL_LATE event (e.g. used by Reflector Mage) to only fire for cast events.

This commit is contained in:
LevelX2 2016-03-14 13:41:12 +01:00
parent d6af2c4008
commit ad637a2944
3 changed files with 36 additions and 34 deletions

View file

@ -15,9 +15,9 @@ 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() {
@ -40,13 +40,14 @@ public class ThoughtKnotSeerTest extends CardTestPlayerBase {
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Reflector Mage", 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
}
/**
* 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() {

View file

@ -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()) {

View file

@ -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) {