fix broke shadowOfTheGrave + watcher

This commit is contained in:
igoudt 2017-05-01 17:31:51 +02:00
parent f0a83c4689
commit 576ccdb34a
2 changed files with 21 additions and 2 deletions

View file

@ -164,4 +164,20 @@ public class CyclingTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Akroma's Vengeance", 1);
assertHandCount(playerA, 7);
}
@Test
public void cycleShadowOfTheGrave(){
addCard(Zone.HAND, playerA, "Darkwatch Elves", 1 );
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 20);
addCard(Zone.HAND, playerA, "Shadow of the Grave", 1);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cycling");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Shadow of the Grave");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Darkwatch Elves", 0);
assertHandCount(playerA, "Darkwatch Elves", 1);
}
}

View file

@ -31,6 +31,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
import mage.cards.Card;
import mage.cards.Cards;
import mage.cards.CardsImpl;
@ -61,12 +62,14 @@ public class CardsCycledOrDiscardedThisTurnWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.CYCLED_CARD
if (event.getType() == GameEvent.EventType.PAY_CYCLE_COST
|| event.getType() == GameEvent.EventType.DISCARDED_CARD) {
if (event.getPlayerId() != null) {
Card card = game.getCard(event.getTargetId());
if (card != null) {
getCardsCycledOrDiscardedThisTurn(event.getPlayerId()).add(card);
Cards c = getCardsCycledOrDiscardedThisTurn(event.getPlayerId());
c.add(card);
cycledOrDiscardedCardsThisTurn.put(event.getPlayerId(), c);
}
}
}