mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Added message to log if player shuffles his library. Fixed wrong calls to shuffle.
This commit is contained in:
parent
c2d923bac9
commit
5096d8b943
17 changed files with 23 additions and 15 deletions
|
@ -105,7 +105,7 @@ class StreamOfConsciousnessEffect extends OneShotEffect<StreamOfConsciousnessEff
|
|||
}
|
||||
}
|
||||
if (shuffle) {
|
||||
player.getLibrary().shuffle();
|
||||
player.shuffleLibrary(game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ class VeteranExplorerEffect extends OneShotEffect<VeteranExplorerEffect> {
|
|||
}
|
||||
}
|
||||
for (Player player: usingPlayers) {
|
||||
player.getLibrary().shuffle();
|
||||
player.shuffleLibrary(game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ class LimDulsVaultEffect extends OneShotEffect<LimDulsVaultEffect> {
|
|||
if (doAgain) {
|
||||
player.loseLife(1, game);
|
||||
} else {
|
||||
player.getLibrary().shuffle();
|
||||
player.shuffleLibrary(game);
|
||||
}
|
||||
|
||||
TargetCard target = new TargetCard(Zone.PICK, new FilterCard(doAgain ? textBottom : textTop));
|
||||
|
|
|
@ -103,7 +103,7 @@ class LoamingShamanEffect extends OneShotEffect<LoamingShamanEffect> {
|
|||
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
|
||||
}
|
||||
}
|
||||
targetPlayer.getLibrary().shuffle();
|
||||
targetPlayer.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -113,7 +113,7 @@ class UnexpectedResultEffect extends OneShotEffect<UnexpectedResultEffect> {
|
|||
return false;
|
||||
}
|
||||
if (controller.getLibrary().size() > 0) {
|
||||
controller.getLibrary().shuffle();
|
||||
controller.shuffleLibrary(game);
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
if (card == null) {
|
||||
return false;
|
||||
|
|
|
@ -109,7 +109,7 @@ class MemorysJourneyEffect extends OneShotEffect<MemorysJourneyEffect> {
|
|||
}
|
||||
}
|
||||
if (shuffle) {
|
||||
player.getLibrary().shuffle();
|
||||
player.shuffleLibrary(game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ class PrimalCommandShuffleGraveyardEffect extends OneShotEffect<PrimalCommandShu
|
|||
if (player != null) {
|
||||
player.getLibrary().addAll(player.getGraveyard().getCards(game), game);
|
||||
player.getGraveyard().clear();
|
||||
player.getLibrary().shuffle();
|
||||
player.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -119,7 +119,7 @@ class WarpWorldEffect extends OneShotEffect<WarpWorldEffect> {
|
|||
}
|
||||
|
||||
if (count > 0) {
|
||||
player.getLibrary().shuffle();
|
||||
player.shuffleLibrary(game);
|
||||
}
|
||||
|
||||
permanentsCount.put(player.getId(), count);
|
||||
|
|
|
@ -106,7 +106,7 @@ class RiftsweeperEffect extends OneShotEffect<RiftsweeperEffect> {
|
|||
card.getCounters().clear();
|
||||
// move to exile
|
||||
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
|
||||
game.getPlayer(card.getOwnerId()).getLibrary().shuffle();
|
||||
game.getPlayer(card.getOwnerId()).shuffleLibrary(game);
|
||||
game.informPlayers(new StringBuilder("Riftsweeper: Choosen card was ").append(card.getName()).toString());
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ class DeglamerShuffleIntoLibraryEffect extends OneShotEffect<DeglamerShuffleInto
|
|||
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
if (permanent.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true) ) {
|
||||
game.getPlayer(permanent.getOwnerId()).getLibrary().shuffle();
|
||||
game.getPlayer(permanent.getOwnerId()).shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ class WorldspineWurmEffect extends OneShotEffect<WorldspineWurmEffect> {
|
|||
if (c != null) {
|
||||
player.getGraveyard().remove(c);
|
||||
player.getLibrary().putOnTop(c, game);
|
||||
player.getLibrary().shuffle();
|
||||
player.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ class SerraAvatarEffect extends OneShotEffect<SerraAvatarEffect> {
|
|||
if (c != null) {
|
||||
player.getGraveyard().remove(c);
|
||||
player.getLibrary().putOnTop(c, game);
|
||||
player.getLibrary().shuffle();
|
||||
player.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ class SelectiveMemoryEffect extends OneShotEffect<SelectiveMemoryEffect> {
|
|||
}
|
||||
}
|
||||
|
||||
player.getLibrary().shuffle();
|
||||
player.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -135,7 +135,7 @@ class QuestForAncientSecretsEffect extends OneShotEffect<QuestForAncientSecretsE
|
|||
if (player != null) {
|
||||
player.getLibrary().addAll(player.getGraveyard().getCards(game), game);
|
||||
player.getGraveyard().clear();
|
||||
player.getLibrary().shuffle();
|
||||
player.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -32,6 +32,7 @@ import java.util.UUID;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
|
@ -118,9 +119,11 @@ class TributeEffect extends OneShotEffect<TributeEffect> {
|
|||
sb.append(" (add ").append(CardUtil.numberToText(tributeValue)).append(" +1/+1 counter");
|
||||
sb.append(tributeValue > 1 ? "s":"").append("to it)?");
|
||||
if (opponent.chooseUse(outcome, sb.toString(), game)) {
|
||||
sourcePermanent.addCounters(CounterType.P1P1.createInstance(tributeValue), game);
|
||||
game.informPlayers(new StringBuilder(opponent.getName()).append(" pays tribute to ").append(sourcePermanent.getName()).toString());
|
||||
game.getState().setValue(new StringBuilder("tributeValue").append(source.getSourceId()).toString(), "yes");
|
||||
return new AddCountersSourceEffect(CounterType.P1P1.createInstance(tributeValue), true).apply(game, source);
|
||||
} else {
|
||||
game.informPlayers(new StringBuilder(opponent.getName()).append(" does not pay tribute to ").append(sourcePermanent.getName()).toString());
|
||||
game.getState().setValue(new StringBuilder("tributeValue").append(source.getSourceId()).toString(), "no");
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -60,6 +60,10 @@ public class Library implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't use this directly.
|
||||
* Use <player.shuffleLibrary(game)> instead.
|
||||
*/
|
||||
public void shuffle() {
|
||||
UUID[] shuffled = library.toArray(new UUID[0]);
|
||||
for (int n = shuffled.length - 1; n > 0; n--) {
|
||||
|
|
|
@ -1004,6 +1004,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
public void shuffleLibrary(Game game) {
|
||||
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.SHUFFLE_LIBRARY, playerId, playerId))) {
|
||||
this.library.shuffle();
|
||||
game.informPlayers(new StringBuilder(this.name).append(" shuffels his or her library.").toString());
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LIBRARY_SHUFFLED, playerId, playerId));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue