fix River Song (#12727)

This commit is contained in:
xenohedron 2024-08-24 18:36:42 -04:00 committed by GitHub
parent 317f536dc9
commit 9fe5d6bd1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 100 additions and 39 deletions

View file

@ -9,8 +9,6 @@ import java.util.UUID;
*/
public class DrawCardEvent extends GameEvent {
private boolean fromBottom = false; // for replacement effects that draw from bottom of library instead
private int cardsDrawn = 0; // for replacement effects to keep track for "cards drawn this way"
public DrawCardEvent(UUID playerId, Ability source, GameEvent originalDrawEvent) {
@ -27,14 +25,6 @@ public class DrawCardEvent extends GameEvent {
}
}
public void setFromBottom(boolean fromBottom) {
this.fromBottom = fromBottom;
}
public boolean isFromBottom() {
return fromBottom;
}
public void incrementCardsDrawn(int cardsDrawn) {
this.cardsDrawn += cardsDrawn;
}

View file

@ -204,6 +204,10 @@ public interface Player extends MageItem, Copyable<Player> {
boolean canPlotFromTopOfLibrary();
void setDrawsFromBottom(boolean drawsFromBottom);
boolean isDrawsFromBottom();
void setDrawsOnOpponentsTurn(boolean drawsOnOpponentsTurn);
boolean isDrawsOnOpponentsTurn();

View file

@ -154,6 +154,7 @@ public abstract class PlayerImpl implements Player, Serializable {
protected boolean loseByZeroOrLessLife = true;
protected boolean canPlayCardsFromGraveyard = true;
protected boolean canPlotFromTopOfLibrary = false;
protected boolean drawsFromBottom = false;
protected boolean drawsOnOpponentsTurn = false;
protected FilterPermanent sacrificeCostFilter;
@ -253,6 +254,7 @@ public abstract class PlayerImpl implements Player, Serializable {
this.loseByZeroOrLessLife = player.loseByZeroOrLessLife;
this.canPlayCardsFromGraveyard = player.canPlayCardsFromGraveyard;
this.canPlotFromTopOfLibrary = player.canPlotFromTopOfLibrary;
this.drawsFromBottom = player.drawsFromBottom;
this.drawsOnOpponentsTurn = player.drawsOnOpponentsTurn;
this.attachments.addAll(player.attachments);
@ -367,6 +369,7 @@ public abstract class PlayerImpl implements Player, Serializable {
this.loseByZeroOrLessLife = player.canLoseByZeroOrLessLife();
this.canPlayCardsFromGraveyard = player.canPlayCardsFromGraveyard();
this.canPlotFromTopOfLibrary = player.canPlotFromTopOfLibrary();
this.drawsFromBottom = player.isDrawsFromBottom();
this.drawsOnOpponentsTurn = player.isDrawsOnOpponentsTurn();
this.alternativeSourceCosts = CardUtil.deepCopyObject(player.getAlternativeSourceCosts());
@ -481,6 +484,7 @@ public abstract class PlayerImpl implements Player, Serializable {
this.loseByZeroOrLessLife = true;
this.canPlayCardsFromGraveyard = true;
this.canPlotFromTopOfLibrary = false;
this.drawsFromBottom = false;
this.drawsOnOpponentsTurn = false;
this.sacrificeCostFilter = null;
@ -524,6 +528,7 @@ public abstract class PlayerImpl implements Player, Serializable {
this.loseByZeroOrLessLife = true;
this.canPlayCardsFromGraveyard = false;
this.canPlotFromTopOfLibrary = false;
this.drawsFromBottom = false;
this.drawsOnOpponentsTurn = false;
this.topCardRevealed = false;
this.alternativeSourceCosts.clear();
@ -768,7 +773,7 @@ public abstract class PlayerImpl implements Player, Serializable {
numDrawn += drawCardEvent.getCardsDrawn();
continue;
}
Card card = drawCardEvent.isFromBottom() ? getLibrary().drawFromBottom(game) : getLibrary().drawFromTop(game);
Card card = isDrawsFromBottom() ? getLibrary().drawFromBottom(game) : getLibrary().drawFromTop(game);
if (card != null) {
card.moveToZone(Zone.HAND, source, game, false); // if you want to use event.getSourceId() here then thinks x10 times
if (isTopCardRevealed()) {
@ -4661,6 +4666,16 @@ public abstract class PlayerImpl implements Player, Serializable {
this.canPlotFromTopOfLibrary = canPlotFromTopOfLibrary;
}
@Override
public void setDrawsFromBottom(boolean drawsFromBottom) {
this.drawsFromBottom = drawsFromBottom;
}
@Override
public boolean isDrawsFromBottom() {
return drawsFromBottom;
}
@Override
public void setDrawsOnOpponentsTurn(boolean drawsOnOpponentsTurn) {
this.drawsOnOpponentsTurn = drawsOnOpponentsTurn;