Commit a06b1c8e authored by Hanmac's avatar Hanmac

Player: DiscardToTopOfLibrary and Madness are replacement discards, that...

Player: DiscardToTopOfLibrary and Madness are replacement discards, that should not trigger other Replacement again
parent 811c8ae1
......@@ -1442,20 +1442,24 @@ public class Player extends GameEntity implements Comparable<Player> {
}*/
final Card source = sa != null ? sa.getHostCard() : null;
// Replacement effects
final HashMap<String, Object> repRunParams = new HashMap<String, Object>();
repRunParams.put("Event", "Discard");
repRunParams.put("Card", c);
repRunParams.put("Source", source);
repRunParams.put("Affected", this);
if (game.getReplacementHandler().run(repRunParams) != ReplacementResult.NotReplaced) {
return null;
}
boolean discardToTopOfLibrary = null != sa && sa.hasParam("DiscardToTopOfLibrary");
boolean discardMadness = sa != null && sa.hasParam("Madness");
// DiscardToTopOfLibrary and Madness are replacement discards,
// that should not trigger other Replacement again
if (!discardToTopOfLibrary && !discardMadness) {
// Replacement effects
final HashMap<String, Object> repRunParams = new HashMap<String, Object>();
repRunParams.put("Event", "Discard");
repRunParams.put("Card", c);
repRunParams.put("Source", source);
repRunParams.put("Affected", this);
if (game.getReplacementHandler().run(repRunParams) != ReplacementResult.NotReplaced) {
return null;
}
}
StringBuilder sb = new StringBuilder();
sb.append(this).append(" discards ").append(c);
final Card newCard;
......@@ -1482,8 +1486,8 @@ public class Player extends GameEntity implements Comparable<Player> {
if (sa.hasParam("Cause")) {
final CardCollection col = AbilityUtils.getDefinedCards(cause, sa.getParam("Cause"), sa);
if (!col.isEmpty()) {
cause = col.getFirst();
}
cause = col.getFirst();
}
}
}
final HashMap<String, Object> runParams = new HashMap<String, Object>();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment