Fixed a bug that could lead to endless loops if cards where moved from library to graveyard.

This commit is contained in:
LevelX2 2015-03-20 15:10:54 +01:00
parent df83621acf
commit 5af6b6ca7a
2 changed files with 8 additions and 3 deletions

View file

@ -101,10 +101,15 @@ class CorpsejackMenaceReplacementEffect extends ReplacementEffectImpl {
} }
return true; return true;
} }
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ADD_COUNTERS;
}
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.ADD_COUNTER && event.getData().equals(CounterType.P1P1.getName())) { if (event.getData().equals(CounterType.P1P1.getName())) {
Permanent target = game.getPermanent(event.getTargetId()); Permanent target = game.getPermanent(event.getTargetId());
if (target != null && target.getControllerId().equals(source.getControllerId()) if (target != null && target.getControllerId().equals(source.getControllerId())
&& target.getCardType().contains(CardType.CREATURE)) { && target.getCardType().contains(CardType.CREATURE)) {

View file

@ -2786,7 +2786,7 @@ public abstract class PlayerImpl implements Player, Serializable {
cards.add(card); cards.add(card);
} }
} }
allCards.removeAll(cards); allCards.removeAll(cards.getCards(game));
// move cards ot graveyard in order the owner decides // move cards ot graveyard in order the owner decides
if (cards.size() != 0) { if (cards.size() != 0) {
TargetCard target = new TargetCard(fromZone, new FilterCard("card to put on the top of your graveyard (last one chosen will be topmost)")); TargetCard target = new TargetCard(fromZone, new FilterCard("card to put on the top of your graveyard (last one chosen will be topmost)"));