mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Merge pull request #6012 from apetresc/syr-konrad-trigger-bug
Fix incorrect trigger for Syr Konrad (READY FOR REVIEW/MERGING)
This commit is contained in:
commit
c7084fcb3c
3 changed files with 39 additions and 3 deletions
|
@ -72,6 +72,7 @@ class SyrKonradTheGrimTriggeredAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
// Whenever another creature dies
|
||||
if (zEvent.isDiesEvent()
|
||||
&& zEvent.getTarget() != null
|
||||
&& !zEvent.getTargetId().equals(this.getSourceId())
|
||||
|
@ -79,6 +80,7 @@ class SyrKonradTheGrimTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return true;
|
||||
}
|
||||
Card card = game.getCard(zEvent.getTargetId());
|
||||
// Or a creature card is put into a graveyard from anywhere other than the battlefield
|
||||
if (card == null || !card.isCreature()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -86,7 +88,9 @@ class SyrKonradTheGrimTriggeredAbility extends TriggeredAbilityImpl {
|
|||
&& zEvent.getFromZone() != Zone.BATTLEFIELD) {
|
||||
return true;
|
||||
}
|
||||
return zEvent.getFromZone() == Zone.GRAVEYARD;
|
||||
// Or a creature card leaves your graveyard
|
||||
return zEvent.getFromZone() == Zone.GRAVEYARD
|
||||
&& zEvent.getPlayerId() == this.getControllerId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -95,4 +99,4 @@ class SyrKonradTheGrimTriggeredAbility extends TriggeredAbilityImpl {
|
|||
"from anywhere other than the battlefield, or a creature card leaves your graveyard, " +
|
||||
"{this} deals 1 damage to each opponent.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.mage.test.cards.single;
|
|||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package org.mage.test.cards.single;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
public class SyrKonradTheGrimTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void leavesOwnGraveyardTriggerTest() {
|
||||
addCard(Zone.HAND, playerA, "Rest in Peace");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Syr Konrad, the Grim");
|
||||
// These leaving the graveyard *should* cause loss of life
|
||||
addCard(Zone.GRAVEYARD, playerA, "Grizzly Bears", 2);
|
||||
// These ones *shouldn't*
|
||||
addCard(Zone.GRAVEYARD, playerB, "Grizzly Bears");
|
||||
setStopAt(1, PhaseStep.UNTAP);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 20);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rest in Peace");
|
||||
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, 0);
|
||||
assertGraveyardCount(playerB, 0);
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 18);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue