From 39a556f2334ad1df6d989596d4b1a2aaed114e6d Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Wed, 18 Nov 2020 12:44:58 +0400 Subject: [PATCH] * Long-Term Plans and Volrath's Dungeon - fixed that it shows card name in game logs to other players (#7179); --- Mage.Sets/src/mage/cards/a/ApproachOfTheSecondSun.java | 2 +- Mage.Sets/src/mage/cards/c/Chronostutter.java | 2 +- Mage.Sets/src/mage/cards/c/CommitMemory.java | 4 ++-- Mage.Sets/src/mage/cards/e/EnigmaSphinx.java | 2 +- Mage.Sets/src/mage/cards/l/LongTermPlans.java | 3 ++- Mage.Sets/src/mage/cards/l/LostHours.java | 2 +- Mage.Sets/src/mage/cards/o/Oust.java | 2 +- Mage.Sets/src/mage/cards/q/QuarryColossus.java | 2 +- Mage.Sets/src/mage/cards/t/TeferiHeroOfDominaria.java | 2 +- Mage.Sets/src/mage/cards/t/TimeOut.java | 2 +- Mage.Sets/src/mage/cards/u/UnexpectedlyAbsent.java | 2 +- Mage.Sets/src/mage/cards/v/VolrathsDungeon.java | 3 ++- .../src/test/java/org/mage/test/player/TestPlayer.java | 4 ++-- Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java | 2 +- .../abilities/common/GodEternalDiesTriggeredAbility.java | 2 +- Mage/src/main/java/mage/players/Player.java | 3 ++- Mage/src/main/java/mage/players/PlayerImpl.java | 6 +++--- 17 files changed, 24 insertions(+), 21 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/ApproachOfTheSecondSun.java b/Mage.Sets/src/mage/cards/a/ApproachOfTheSecondSun.java index f47ae0b081..c116f2f5e1 100644 --- a/Mage.Sets/src/mage/cards/a/ApproachOfTheSecondSun.java +++ b/Mage.Sets/src/mage/cards/a/ApproachOfTheSecondSun.java @@ -84,7 +84,7 @@ class ApproachOfTheSecondSunEffect extends OneShotEffect { } Card spellCard = game.getStack().getSpell(source.getSourceId()).getCard(); if (spellCard != null) { - controller.putCardOnTopXOfLibrary(spellCard, game, source, 7); + controller.putCardOnTopXOfLibrary(spellCard, game, source, 7, true); } } return true; diff --git a/Mage.Sets/src/mage/cards/c/Chronostutter.java b/Mage.Sets/src/mage/cards/c/Chronostutter.java index 863e6988df..edcf5f8f55 100644 --- a/Mage.Sets/src/mage/cards/c/Chronostutter.java +++ b/Mage.Sets/src/mage/cards/c/Chronostutter.java @@ -60,7 +60,7 @@ class ChronostutterEffect extends OneShotEffect { if (controller != null) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { - controller.putCardOnTopXOfLibrary(permanent, game, source, 2); + controller.putCardOnTopXOfLibrary(permanent, game, source, 2, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/c/CommitMemory.java b/Mage.Sets/src/mage/cards/c/CommitMemory.java index e5517f3d7f..b879befef2 100644 --- a/Mage.Sets/src/mage/cards/c/CommitMemory.java +++ b/Mage.Sets/src/mage/cards/c/CommitMemory.java @@ -83,11 +83,11 @@ class CommitEffect extends OneShotEffect { if (controller != null) { Permanent permanent = game.getPermanent(source.getFirstTarget()); 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()); if (spell != null) { - return controller.putCardOnTopXOfLibrary(spell, game, source, 2); + return controller.putCardOnTopXOfLibrary(spell, game, source, 2, true); } } return false; diff --git a/Mage.Sets/src/mage/cards/e/EnigmaSphinx.java b/Mage.Sets/src/mage/cards/e/EnigmaSphinx.java index ddeb27ac4e..cfc5ec283e 100644 --- a/Mage.Sets/src/mage/cards/e/EnigmaSphinx.java +++ b/Mage.Sets/src/mage/cards/e/EnigmaSphinx.java @@ -126,7 +126,7 @@ class EnigmaSphinxEffect extends OneShotEffect { } Card card = (Card) source.getSourceObjectIfItStillExists(game); if (card != null) { - controller.putCardOnTopXOfLibrary(card, game, source, 3); + controller.putCardOnTopXOfLibrary(card, game, source, 3, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/l/LongTermPlans.java b/Mage.Sets/src/mage/cards/l/LongTermPlans.java index 3f2b2b33e7..1ab310a5ef 100644 --- a/Mage.Sets/src/mage/cards/l/LongTermPlans.java +++ b/Mage.Sets/src/mage/cards/l/LongTermPlans.java @@ -61,7 +61,8 @@ class LongTermPlansEffect extends OneShotEffect { Card card = player.getLibrary().remove(target.getFirstTarget(), game); if (card != null) { 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; diff --git a/Mage.Sets/src/mage/cards/l/LostHours.java b/Mage.Sets/src/mage/cards/l/LostHours.java index dcf114cb93..9602b84229 100644 --- a/Mage.Sets/src/mage/cards/l/LostHours.java +++ b/Mage.Sets/src/mage/cards/l/LostHours.java @@ -68,7 +68,7 @@ class LostHoursEffect extends OneShotEffect { if (controller.choose(Outcome.Discard, targetPlayer.getHand(), target, game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { - targetPlayer.putCardOnTopXOfLibrary(card, game, source, 3); + targetPlayer.putCardOnTopXOfLibrary(card, game, source, 3, true); } } } diff --git a/Mage.Sets/src/mage/cards/o/Oust.java b/Mage.Sets/src/mage/cards/o/Oust.java index 9500d98b4d..80ff066099 100644 --- a/Mage.Sets/src/mage/cards/o/Oust.java +++ b/Mage.Sets/src/mage/cards/o/Oust.java @@ -61,7 +61,7 @@ class OustEffect extends OneShotEffect { if (owner == null || controller == null) { return false; } - owner.putCardOnTopXOfLibrary(permanent, game, source, 2); + owner.putCardOnTopXOfLibrary(permanent, game, source, 2, true); controller.gainLife(3, game, source); } return true; diff --git a/Mage.Sets/src/mage/cards/q/QuarryColossus.java b/Mage.Sets/src/mage/cards/q/QuarryColossus.java index 7d16f1c30e..08ba61de0a 100644 --- a/Mage.Sets/src/mage/cards/q/QuarryColossus.java +++ b/Mage.Sets/src/mage/cards/q/QuarryColossus.java @@ -72,7 +72,7 @@ class QuarryColossusReturnLibraryEffect extends OneShotEffect { if (owner != null) { int plains = game.getBattlefield().countAll(new FilterPermanent( SubType.PLAINS, "Plains you control"), source.getControllerId(), game); - controller.putCardOnTopXOfLibrary(permanent, game, source, plains); + controller.putCardOnTopXOfLibrary(permanent, game, source, plains, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/t/TeferiHeroOfDominaria.java b/Mage.Sets/src/mage/cards/t/TeferiHeroOfDominaria.java index 572aee3ed2..c615648686 100644 --- a/Mage.Sets/src/mage/cards/t/TeferiHeroOfDominaria.java +++ b/Mage.Sets/src/mage/cards/t/TeferiHeroOfDominaria.java @@ -87,7 +87,7 @@ class TeferiHeroOfDominariaSecondEffect extends OneShotEffect { if (controller != null) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); if (permanent != null) { - controller.putCardOnTopXOfLibrary(permanent, game, source, 3); + controller.putCardOnTopXOfLibrary(permanent, game, source, 3, true); } return true; } diff --git a/Mage.Sets/src/mage/cards/t/TimeOut.java b/Mage.Sets/src/mage/cards/t/TimeOut.java index 5a3aedad66..430b5556f6 100644 --- a/Mage.Sets/src/mage/cards/t/TimeOut.java +++ b/Mage.Sets/src/mage/cards/t/TimeOut.java @@ -73,7 +73,7 @@ class TimeOutEffect extends OneShotEffect { return false; } int amount = controller.rollDice(game, 6); - controller.putCardOnTopXOfLibrary(permanent, game, source, amount); + controller.putCardOnTopXOfLibrary(permanent, game, source, amount, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/u/UnexpectedlyAbsent.java b/Mage.Sets/src/mage/cards/u/UnexpectedlyAbsent.java index 2fadc33bd9..6fd75022f9 100644 --- a/Mage.Sets/src/mage/cards/u/UnexpectedlyAbsent.java +++ b/Mage.Sets/src/mage/cards/u/UnexpectedlyAbsent.java @@ -60,7 +60,7 @@ class UnexpectedlyAbsentEffect extends OneShotEffect { if (controller != null) { Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); if (permanent != null) { - controller.putCardOnTopXOfLibrary(permanent, game, source, source.getManaCostsToPay().getX() + 1); + controller.putCardOnTopXOfLibrary(permanent, game, source, source.getManaCostsToPay().getX() + 1, true); return true; } } diff --git a/Mage.Sets/src/mage/cards/v/VolrathsDungeon.java b/Mage.Sets/src/mage/cards/v/VolrathsDungeon.java index c3fe5e8e00..d4730a4938 100644 --- a/Mage.Sets/src/mage/cards/v/VolrathsDungeon.java +++ b/Mage.Sets/src/mage/cards/v/VolrathsDungeon.java @@ -127,7 +127,8 @@ class VolrathsDungeonEffect extends OneShotEffect { TargetCardInHand target = new TargetCardInHand(); if (targetedPlayer.choose(Outcome.Detriment, targetedPlayer.getHand(), target, game)) { 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; diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index 35b1475c08..80052a4776 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -2804,8 +2804,8 @@ public class TestPlayer implements Player { } @Override - public boolean putCardOnTopXOfLibrary(Card card, Game game, Ability source, int xFromTheTop) { - return computerPlayer.putCardOnTopXOfLibrary(card, game, source, xFromTheTop); + public boolean putCardOnTopXOfLibrary(Card card, Game game, Ability source, int xFromTheTop, boolean withName) { + return computerPlayer.putCardOnTopXOfLibrary(card, game, source, xFromTheTop, withName); } @Override diff --git a/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java b/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java index f66037936a..b6338f0012 100644 --- a/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java +++ b/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java @@ -904,7 +904,7 @@ public class PlayerStub implements Player { } @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; } diff --git a/Mage/src/main/java/mage/abilities/common/GodEternalDiesTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/GodEternalDiesTriggeredAbility.java index 79138205b4..3bf545cd5b 100644 --- a/Mage/src/main/java/mage/abilities/common/GodEternalDiesTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/GodEternalDiesTriggeredAbility.java @@ -106,6 +106,6 @@ class GodEternalEffect extends OneShotEffect { if (card == null || card.getZoneChangeCounter(game) - 1 != mor.getZoneChangeCounter()) { return false; } - return player.putCardOnTopXOfLibrary(card, game, source, 3); + return player.putCardOnTopXOfLibrary(card, game, source, 3, true); } } diff --git a/Mage/src/main/java/mage/players/Player.java b/Mage/src/main/java/mage/players/Player.java index 5e06145e97..534fba5821 100644 --- a/Mage/src/main/java/mage/players/Player.java +++ b/Mage/src/main/java/mage/players/Player.java @@ -570,9 +570,10 @@ public interface Player extends MageItem, Copyable { * @param game * @param source * @param xFromTheTop + * @param withName - show card name in game logs for all players * @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. diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index d595afee7f..c30717eaa0 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -1002,7 +1002,7 @@ public abstract class PlayerImpl implements Player, Serializable { } @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 (library.size() + 1 < xFromTheTop) { 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 cardInLib = getLibrary().removeFromTop(game); getLibrary().putCardToTopXPos(cardInLib, xFromTheTop, game); - game.informPlayers(cardInLib.getLogName() + game.informPlayers(withName ? cardInLib.getLogName() : "A card" + " is put into " + getLogName() + "'s library " @@ -1025,7 +1025,7 @@ public abstract class PlayerImpl implements Player, Serializable { } } } else { - return game.getPlayer(card.getOwnerId()).putCardOnTopXOfLibrary(card, game, source, xFromTheTop); + return game.getPlayer(card.getOwnerId()).putCardOnTopXOfLibrary(card, game, source, xFromTheTop, withName); } return true; }