From d903ba56e1177c697c7c539796d1587bd8a85874 Mon Sep 17 00:00:00 2001 From: BetaSteward Date: Sun, 28 Aug 2011 22:24:13 -0400 Subject: [PATCH] fixed issue 225 --- Mage.Sets/src/mage/sets/magic2011/ElixirOfImmortality.java | 2 +- Mage.Sets/src/mage/sets/magic2011/MassPolymorph.java | 2 +- Mage.Sets/src/mage/sets/magic2011/TimeReversal.java | 2 +- .../src/mage/sets/riseoftheeldrazi/EmrakultheAeonsTorn.java | 2 +- .../mage/sets/riseoftheeldrazi/KozilekButcherOfTruth.java | 2 +- Mage.Sets/src/mage/sets/riseoftheeldrazi/SeeBeyond.java | 2 +- .../mage/sets/riseoftheeldrazi/UlamogTheInfiniteGyre.java | 2 +- Mage.Sets/src/mage/sets/scarsofmirrodin/MoltenPsyche.java | 2 +- Mage.Sets/src/mage/sets/scarsofmirrodin/ShapeAnew.java | 2 +- Mage/src/mage/game/events/GameEvent.java | 1 + Mage/src/mage/players/PlayerImpl.java | 5 ++++- 11 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Mage.Sets/src/mage/sets/magic2011/ElixirOfImmortality.java b/Mage.Sets/src/mage/sets/magic2011/ElixirOfImmortality.java index a54c8d12f0..a818e4df89 100644 --- a/Mage.Sets/src/mage/sets/magic2011/ElixirOfImmortality.java +++ b/Mage.Sets/src/mage/sets/magic2011/ElixirOfImmortality.java @@ -95,7 +95,7 @@ class ElixerOfImmortalityEffect extends OneShotEffect } player.getLibrary().addAll(player.getGraveyard().getCards(game), game); player.getGraveyard().clear(); - player.getLibrary().shuffle(); + player.shuffleLibrary(game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/magic2011/MassPolymorph.java b/Mage.Sets/src/mage/sets/magic2011/MassPolymorph.java index 9b46181bb1..80b7fc1df1 100644 --- a/Mage.Sets/src/mage/sets/magic2011/MassPolymorph.java +++ b/Mage.Sets/src/mage/sets/magic2011/MassPolymorph.java @@ -104,7 +104,7 @@ class MassPolymorphEffect extends OneShotEffect { creatureCard.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId()); } player.getLibrary().addAll(nonCreatureCards.getCards(game), game); - player.getLibrary().shuffle(); + player.shuffleLibrary(game); return true; } diff --git a/Mage.Sets/src/mage/sets/magic2011/TimeReversal.java b/Mage.Sets/src/mage/sets/magic2011/TimeReversal.java index 973b2394af..cc67637668 100644 --- a/Mage.Sets/src/mage/sets/magic2011/TimeReversal.java +++ b/Mage.Sets/src/mage/sets/magic2011/TimeReversal.java @@ -82,7 +82,7 @@ class TimeReversalEffect extends OneShotEffect { if (player != null) { player.getLibrary().addAll(player.getHand().getCards(game), game); player.getLibrary().addAll(player.getGraveyard().getCards(game), game); - player.getLibrary().shuffle(); + player.shuffleLibrary(game); player.getHand().clear(); player.getGraveyard().clear(); player.drawCards(7, game); diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/EmrakultheAeonsTorn.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/EmrakultheAeonsTorn.java index 712ea6f244..bd58a38d1a 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/EmrakultheAeonsTorn.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/EmrakultheAeonsTorn.java @@ -139,7 +139,7 @@ class EmrakultheAeonsTornEffect extends OneShotEffect /*permanent.moveToZone(Zone.LIBRARY, source.getId(), game, true);*/ player.getLibrary().addAll(player.getGraveyard().getCards(game), game); player.getGraveyard().clear(); - player.getLibrary().shuffle(); + player.shuffleLibrary(game); return true; } return false; diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/KozilekButcherOfTruth.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/KozilekButcherOfTruth.java index c788db59f3..8981f87c57 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/KozilekButcherOfTruth.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/KozilekButcherOfTruth.java @@ -128,7 +128,7 @@ class KozilekButcherOfTruthEffect extends OneShotEffect { if (card != null) { player.removeFromHand(card, game); card.moveToZone(Zone.LIBRARY, source.getId(), game, true); - player.getLibrary().shuffle(); + player.shuffleLibrary(game); return true; } } diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/UlamogTheInfiniteGyre.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/UlamogTheInfiniteGyre.java index 5f8a30b1fa..b2c50c1d49 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/UlamogTheInfiniteGyre.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/UlamogTheInfiniteGyre.java @@ -132,7 +132,7 @@ class UlamogTheInfiniteGyreEnterGraveyardEffect extends OneShotEffect { if (player != null) { int count = player.getHand().size(); player.getLibrary().addAll(player.getHand().getCards(game), game); - player.getLibrary().shuffle(); + player.shuffleLibrary(game); player.getHand().clear(); player.drawCards(count, game); if (MetalcraftCondition.getInstance().apply(game, source) && !playerId.equals(source.getControllerId())) { diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/ShapeAnew.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/ShapeAnew.java index 19ec1ccedb..807181d68b 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/ShapeAnew.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/ShapeAnew.java @@ -106,7 +106,7 @@ public class ShapeAnew extends CardImpl { player.revealCards("Shape Anew", revealed, game); artifactCard.putOntoBattlefield(game, Constants.Zone.LIBRARY, source.getId(), controller.getId()); player.getLibrary().addAll(nonArtifactCards.getCards(game), game); - player.getLibrary().shuffle(); + player.shuffleLibrary(game); return true; } diff --git a/Mage/src/mage/game/events/GameEvent.java b/Mage/src/mage/game/events/GameEvent.java index 9c8bc02228..377ebd58cc 100644 --- a/Mage/src/mage/game/events/GameEvent.java +++ b/Mage/src/mage/game/events/GameEvent.java @@ -93,6 +93,7 @@ public class GameEvent { DECLARING_BLOCKERS, DECLARED_BLOCKERS, DECLARE_BLOCKER, BLOCKER_DECLARED, SEARCH_LIBRARY, LIBRARY_SEARCHED, + SHUFFLE_LIBRARY, LIBRARY_SHUFFLED, //permanent events ENTERS_THE_BATTLEFIELD, diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java index 5a7a2a1f6b..f284befe21 100644 --- a/Mage/src/mage/players/PlayerImpl.java +++ b/Mage/src/mage/players/PlayerImpl.java @@ -612,7 +612,10 @@ public abstract class PlayerImpl> implements Player, Ser @Override public void shuffleLibrary(Game game) { - this.library.shuffle(); + if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.SHUFFLE_LIBRARY, playerId, playerId))) { + this.library.shuffle(); + game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LIBRARY_SHUFFLED, playerId, playerId)); + } } @Override