From b6f7efe5e9f7f2c3a098e907b9bf2d9a4560649e Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 30 May 2018 16:51:59 +0200 Subject: [PATCH] * Fixed a problem with Dash not giving Haste to the creature beginning with the second use of Dash (fixes #4985). --- .../cards/abilities/keywords/DashTest.java | 23 +++++++++++++++++++ .../abilities/keyword/UnearthAbility.java | 4 ++-- Mage/src/main/java/mage/game/GameImpl.java | 5 ++-- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/DashTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/DashTest.java index e5f3b6f0167..24c8b98315d 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/DashTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/DashTest.java @@ -27,6 +27,7 @@ */ package org.mage.test.cards.abilities.keywords; +import mage.abilities.keyword.HasteAbility; import mage.constants.PhaseStep; import mage.constants.Zone; import org.junit.Test; @@ -120,4 +121,26 @@ public class DashTest extends CardTestPlayerBase { assertGraveyardCount(playerB, "Geist of the Moors", 1); } + + /** + * Test that the creature got Dash again if cast again + */ + @Test + public void testDashedCreatureDiesInCombatAndIsLaterRecast() { + addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2); + addCard(Zone.HAND, playerA, "Screamreach Brawler"); // 2/3 + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Screamreach Brawler"); + setChoice(playerA, "Yes"); + attack(1, playerA, "Screamreach Brawler"); + + castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Screamreach Brawler"); + setStopAt(3, PhaseStep.BEGIN_COMBAT); + execute(); + + assertLife(playerB, 18); + assertPermanentCount(playerA, "Screamreach Brawler", 1); + assertHandCount(playerA, "Screamreach Brawler", 0); + assertAbility(playerA, "Screamreach Brawler", HasteAbility.getInstance(), true); + } } diff --git a/Mage/src/main/java/mage/abilities/keyword/UnearthAbility.java b/Mage/src/main/java/mage/abilities/keyword/UnearthAbility.java index b43eb548597..578540f2189 100644 --- a/Mage/src/main/java/mage/abilities/keyword/UnearthAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/UnearthAbility.java @@ -145,8 +145,8 @@ class UnearthLeavesBattlefieldEffect extends ReplacementEffectImpl { if (event.getTargetId().equals(source.getSourceId())) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() != Zone.EXILED) { - // started in graveyard going to battlefield so current zone change counter has to be +1 - return source.getSourceObjectZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(source.getSourceId()); + // Only move it to exile if it was this instance that was moved to battlefield with unearth + return source.getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(source.getSourceId()); } } return false; diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index e8b31da5aa0..2921ed02a7d 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -1521,8 +1521,9 @@ public abstract class GameImpl implements Game, Serializable { @Override public void addEffect(ContinuousEffect continuousEffect, Ability source) { Ability newAbility = source.copy(); - + newAbility.setSourceObject(null, this); // Update the source object to the currently existing Object ContinuousEffect newEffect = continuousEffect.copy(); + newEffect.newId(); newEffect.init(newAbility, this); @@ -2031,7 +2032,7 @@ public abstract class GameImpl implements Game, Serializable { } } } - // 704.5s If the number of lore counters on a Saga permanent is greater than or equal to its final chapter number + // 704.5s If the number of lore counters on a Saga permanent is greater than or equal to its final chapter number // and it isn’t the source of a chapter ability that has triggered but not yet left the stack, that Saga’s controller sacrifices it. if (perm.hasSubtype(SubType.SAGA, this)) { for (Ability sagaAbility : perm.getAbilities()) {