* Long-Term Plans and Volrath's Dungeon - fixed that it shows card name in game logs to other players (#7179);

This commit is contained in:
Oleg Agafonov 2020-11-18 12:44:58 +04:00
parent d1abfb9255
commit 39a556f233
17 changed files with 24 additions and 21 deletions

View file

@ -84,7 +84,7 @@ class ApproachOfTheSecondSunEffect extends OneShotEffect {
} }
Card spellCard = game.getStack().getSpell(source.getSourceId()).getCard(); Card spellCard = game.getStack().getSpell(source.getSourceId()).getCard();
if (spellCard != null) { if (spellCard != null) {
controller.putCardOnTopXOfLibrary(spellCard, game, source, 7); controller.putCardOnTopXOfLibrary(spellCard, game, source, 7, true);
} }
} }
return true; return true;

View file

@ -60,7 +60,7 @@ class ChronostutterEffect extends OneShotEffect {
if (controller != null) { if (controller != null) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null) { if (permanent != null) {
controller.putCardOnTopXOfLibrary(permanent, game, source, 2); controller.putCardOnTopXOfLibrary(permanent, game, source, 2, true);
} }
return true; return true;
} }

View file

@ -83,11 +83,11 @@ class CommitEffect extends OneShotEffect {
if (controller != null) { if (controller != null) {
Permanent permanent = game.getPermanent(source.getFirstTarget()); Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) { if (permanent != null) {
return controller.putCardOnTopXOfLibrary(permanent, game, source, 2); return controller.putCardOnTopXOfLibrary(permanent, game, source, 2, true);
} }
Spell spell = game.getStack().getSpell(source.getFirstTarget()); Spell spell = game.getStack().getSpell(source.getFirstTarget());
if (spell != null) { if (spell != null) {
return controller.putCardOnTopXOfLibrary(spell, game, source, 2); return controller.putCardOnTopXOfLibrary(spell, game, source, 2, true);
} }
} }
return false; return false;

View file

@ -126,7 +126,7 @@ class EnigmaSphinxEffect extends OneShotEffect {
} }
Card card = (Card) source.getSourceObjectIfItStillExists(game); Card card = (Card) source.getSourceObjectIfItStillExists(game);
if (card != null) { if (card != null) {
controller.putCardOnTopXOfLibrary(card, game, source, 3); controller.putCardOnTopXOfLibrary(card, game, source, 3, true);
} }
return true; return true;
} }

View file

@ -61,7 +61,8 @@ class LongTermPlansEffect extends OneShotEffect {
Card card = player.getLibrary().remove(target.getFirstTarget(), game); Card card = player.getLibrary().remove(target.getFirstTarget(), game);
if (card != null) { if (card != null) {
player.shuffleLibrary(source, game); player.shuffleLibrary(source, game);
player.putCardOnTopXOfLibrary(card, game, source, 3); // must hides the card name from other players
player.putCardOnTopXOfLibrary(card, game, source, 3, false);
} }
} }
return true; return true;

View file

@ -68,7 +68,7 @@ class LostHoursEffect extends OneShotEffect {
if (controller.choose(Outcome.Discard, targetPlayer.getHand(), target, game)) { if (controller.choose(Outcome.Discard, targetPlayer.getHand(), target, game)) {
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
if (card != null) { if (card != null) {
targetPlayer.putCardOnTopXOfLibrary(card, game, source, 3); targetPlayer.putCardOnTopXOfLibrary(card, game, source, 3, true);
} }
} }
} }

View file

@ -61,7 +61,7 @@ class OustEffect extends OneShotEffect {
if (owner == null || controller == null) { if (owner == null || controller == null) {
return false; return false;
} }
owner.putCardOnTopXOfLibrary(permanent, game, source, 2); owner.putCardOnTopXOfLibrary(permanent, game, source, 2, true);
controller.gainLife(3, game, source); controller.gainLife(3, game, source);
} }
return true; return true;

View file

@ -72,7 +72,7 @@ class QuarryColossusReturnLibraryEffect extends OneShotEffect {
if (owner != null) { if (owner != null) {
int plains = game.getBattlefield().countAll(new FilterPermanent( int plains = game.getBattlefield().countAll(new FilterPermanent(
SubType.PLAINS, "Plains you control"), source.getControllerId(), game); SubType.PLAINS, "Plains you control"), source.getControllerId(), game);
controller.putCardOnTopXOfLibrary(permanent, game, source, plains); controller.putCardOnTopXOfLibrary(permanent, game, source, plains, true);
return true; return true;
} }
} }

View file

@ -87,7 +87,7 @@ class TeferiHeroOfDominariaSecondEffect extends OneShotEffect {
if (controller != null) { if (controller != null) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null) { if (permanent != null) {
controller.putCardOnTopXOfLibrary(permanent, game, source, 3); controller.putCardOnTopXOfLibrary(permanent, game, source, 3, true);
} }
return true; return true;
} }

View file

@ -73,7 +73,7 @@ class TimeOutEffect extends OneShotEffect {
return false; return false;
} }
int amount = controller.rollDice(game, 6); int amount = controller.rollDice(game, 6);
controller.putCardOnTopXOfLibrary(permanent, game, source, amount); controller.putCardOnTopXOfLibrary(permanent, game, source, amount, true);
return true; return true;
} }
} }

View file

@ -60,7 +60,7 @@ class UnexpectedlyAbsentEffect extends OneShotEffect {
if (controller != null) { if (controller != null) {
Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (permanent != null) { if (permanent != null) {
controller.putCardOnTopXOfLibrary(permanent, game, source, source.getManaCostsToPay().getX() + 1); controller.putCardOnTopXOfLibrary(permanent, game, source, source.getManaCostsToPay().getX() + 1, true);
return true; return true;
} }
} }

View file

@ -127,7 +127,8 @@ class VolrathsDungeonEffect extends OneShotEffect {
TargetCardInHand target = new TargetCardInHand(); TargetCardInHand target = new TargetCardInHand();
if (targetedPlayer.choose(Outcome.Detriment, targetedPlayer.getHand(), target, game)) { if (targetedPlayer.choose(Outcome.Detriment, targetedPlayer.getHand(), target, game)) {
Card card = game.getCard(target.getFirstTarget()); Card card = game.getCard(target.getFirstTarget());
return card != null && targetedPlayer.putCardOnTopXOfLibrary(card, game, source, 0); // must hides the card name from other players
return card != null && targetedPlayer.putCardOnTopXOfLibrary(card, game, source, 0, false);
} }
} }
return false; return false;

View file

@ -2804,8 +2804,8 @@ public class TestPlayer implements Player {
} }
@Override @Override
public boolean putCardOnTopXOfLibrary(Card card, Game game, Ability source, int xFromTheTop) { public boolean putCardOnTopXOfLibrary(Card card, Game game, Ability source, int xFromTheTop, boolean withName) {
return computerPlayer.putCardOnTopXOfLibrary(card, game, source, xFromTheTop); return computerPlayer.putCardOnTopXOfLibrary(card, game, source, xFromTheTop, withName);
} }
@Override @Override

View file

@ -904,7 +904,7 @@ public class PlayerStub implements Player {
} }
@Override @Override
public boolean putCardOnTopXOfLibrary(Card card, Game game, Ability source, int xFromTheTop) { public boolean putCardOnTopXOfLibrary(Card card, Game game, Ability source, int xFromTheTop, boolean withName) {
return true; return true;
} }

View file

@ -106,6 +106,6 @@ class GodEternalEffect extends OneShotEffect {
if (card == null || card.getZoneChangeCounter(game) - 1 != mor.getZoneChangeCounter()) { if (card == null || card.getZoneChangeCounter(game) - 1 != mor.getZoneChangeCounter()) {
return false; return false;
} }
return player.putCardOnTopXOfLibrary(card, game, source, 3); return player.putCardOnTopXOfLibrary(card, game, source, 3, true);
} }
} }

View file

@ -570,9 +570,10 @@ public interface Player extends MageItem, Copyable<Player> {
* @param game * @param game
* @param source * @param source
* @param xFromTheTop * @param xFromTheTop
* @param withName - show card name in game logs for all players
* @return * @return
*/ */
boolean putCardOnTopXOfLibrary(Card card, Game game, Ability source, int xFromTheTop); boolean putCardOnTopXOfLibrary(Card card, Game game, Ability source, int xFromTheTop, boolean withName);
/** /**
* Moves the cards from cards to the top of players library. * Moves the cards from cards to the top of players library.

View file

@ -1002,7 +1002,7 @@ public abstract class PlayerImpl implements Player, Serializable {
} }
@Override @Override
public boolean putCardOnTopXOfLibrary(Card card, Game game, Ability source, int xFromTheTop) { public boolean putCardOnTopXOfLibrary(Card card, Game game, Ability source, int xFromTheTop, boolean withName) {
if (card.isOwnedBy(getId())) { if (card.isOwnedBy(getId())) {
if (library.size() + 1 < xFromTheTop) { if (library.size() + 1 < xFromTheTop) {
putCardsOnBottomOfLibrary(new CardsImpl(card), game, source, true); putCardsOnBottomOfLibrary(new CardsImpl(card), game, source, true);
@ -1013,7 +1013,7 @@ public abstract class PlayerImpl implements Player, Serializable {
if (cardInLib != null && cardInLib.getId().equals(card.getId())) { // check needed because e.g. commander can go to command zone if (cardInLib != null && cardInLib.getId().equals(card.getId())) { // check needed because e.g. commander can go to command zone
cardInLib = getLibrary().removeFromTop(game); cardInLib = getLibrary().removeFromTop(game);
getLibrary().putCardToTopXPos(cardInLib, xFromTheTop, game); getLibrary().putCardToTopXPos(cardInLib, xFromTheTop, game);
game.informPlayers(cardInLib.getLogName() game.informPlayers(withName ? cardInLib.getLogName() : "A card"
+ " is put into " + " is put into "
+ getLogName() + getLogName()
+ "'s library " + "'s library "
@ -1025,7 +1025,7 @@ public abstract class PlayerImpl implements Player, Serializable {
} }
} }
} else { } else {
return game.getPlayer(card.getOwnerId()).putCardOnTopXOfLibrary(card, game, source, xFromTheTop); return game.getPlayer(card.getOwnerId()).putCardOnTopXOfLibrary(card, game, source, xFromTheTop, withName);
} }
return true; return true;
} }