* Widespread Panic - Fixed that it also triggered if the library was shuffled by an ability controlled by another player (e.g. Knowledge Exploitation).

This commit is contained in:
LevelX2 2016-03-07 16:16:59 +01:00
parent f95921cc73
commit b86dd17c54
201 changed files with 340 additions and 247 deletions

View file

@ -186,7 +186,7 @@ public class LookLibraryControllerEffect extends OneShotEffect {
*/
protected void mayShuffle(Player player, Ability source, Game game) {
if (this.mayShuffleAfter && player.chooseUse(Outcome.Benefit, "Shuffle your library?", source, game)) {
player.shuffleLibrary(game);
player.shuffleLibrary(source, game);
}
}

View file

@ -71,7 +71,7 @@ public class RecruiterEffect extends OneShotEffect {
cards.addAll(targetCards.getTargets());
}
controller.revealCards(staticText, cards, game);
controller.shuffleLibrary(game);
controller.shuffleLibrary(source, game);
if(cards.size() > 0) {
controller.putCardsOnTopOfLibrary(cards, game, source, true);

View file

@ -90,7 +90,7 @@ public class RevealAndShuffleIntoLibrarySourceEffect extends OneShotEffect {
controller.moveCardToLibraryWithInfo((Card)sourceObject, source.getSourceId(), game, fromZone, true, true);
}
if (!cards.isEmpty()) {
controller.shuffleLibrary(game);
controller.shuffleLibrary(source, game);
}
}
return true;

View file

@ -61,7 +61,7 @@ public class ShuffleHandIntoLibraryDrawThatManySourceEffect extends OneShotEffec
int cardsHand = controller.getHand().size();
if (cardsHand > 0) {
controller.moveCards(controller.getHand(), Zone.LIBRARY, source, game);
controller.shuffleLibrary(game);
controller.shuffleLibrary(source, game);
game.applyEffects(); // then
controller.drawCards(cardsHand, game);
}

View file

@ -59,7 +59,7 @@ public class ShuffleIntoLibraryGraveOfSourceOwnerEffect extends OneShotEffect {
Player owner = game.getPlayer(ownerId);
if (owner != null) {
owner.moveCards(owner.getGraveyard(), null, Zone.LIBRARY, source, game);
owner.shuffleLibrary(game);
owner.shuffleLibrary(source, game);
return true;
}
return false;

View file

@ -64,14 +64,14 @@ public class ShuffleIntoLibrarySourceEffect extends OneShotEffect {
owner = game.getPlayer(((Permanent) mageObject).getOwnerId());
if (owner != null) {
owner.moveCardToLibraryWithInfo((Permanent)mageObject, source.getSourceId(), game, fromZone, true, true);
owner.shuffleLibrary(game);
owner.shuffleLibrary(source, game);
return true;
}
} else if (mageObject instanceof Card) {
owner = game.getPlayer(((Card) mageObject).getOwnerId());
if (owner != null) {
owner.moveCardToLibraryWithInfo((Card)mageObject, source.getSourceId(), game, fromZone, true, true);
owner.shuffleLibrary(game);
owner.shuffleLibrary(source, game);
return true;
}
}

View file

@ -58,7 +58,7 @@ public class ShuffleLibrarySourceEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.shuffleLibrary(game);
player.shuffleLibrary(source, game);
return true;
}
return false;

View file

@ -58,7 +58,7 @@ public class ShuffleLibraryTargetEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(targetPointer.getFirst(game, source));
if (player != null) {
player.shuffleLibrary(game);
player.shuffleLibrary(source, game);
return true;
}
return false;

View file

@ -63,7 +63,7 @@ public class ShuffleSpellEffect extends OneShotEffect implements MageSingleton {
if (controller.moveCards(spell, Zone.LIBRARY, source, game) && !spell.isCopy()) {
Player owner = game.getPlayer(spell.getCard().getOwnerId());
if (owner != null) {
owner.shuffleLibrary(game);
owner.shuffleLibrary(source, game);
}
}

View file

@ -108,11 +108,11 @@ public class SearchLibraryPutInHandEffect extends SearchEffect {
controller.revealCards(name, cards, game);
}
}
controller.shuffleLibrary(game);
controller.shuffleLibrary(source, game);
return true;
}
if (forceShuffle) {
controller.shuffleLibrary(game);
controller.shuffleLibrary(source, game);
}
return false;
}

View file

@ -92,11 +92,11 @@ public class SearchLibraryPutInPlayEffect extends SearchEffect {
player.moveCards(new CardsImpl(target.getTargets()).getCards(game),
Zone.BATTLEFIELD, source, game, tapped, false, false, null);
}
player.shuffleLibrary(game);
player.shuffleLibrary(source, game);
return true;
}
if (forceShuffle) {
player.shuffleLibrary(game);
player.shuffleLibrary(source, game);
}
return false;
}

View file

@ -75,12 +75,12 @@ public class SearchLibraryPutInPlayTargetPlayerEffect extends SearchEffect {
player.moveCards(new CardsImpl(target.getTargets()).getCards(game),
Zone.BATTLEFIELD, source, game, tapped, false, ownerIsController, null);
}
player.shuffleLibrary(game);
player.shuffleLibrary(source, game);
return true;
}
if (forceShuffle) {
player.shuffleLibrary(game);
player.shuffleLibrary(source, game);
}
}

View file

@ -82,14 +82,14 @@ public class SearchLibraryPutOnLibraryEffect extends SearchEffect {
controller.revealCards(sourceObject.getIdName(), foundCards, game);
}
if (forceShuffle) {
controller.shuffleLibrary(game);
controller.shuffleLibrary(source, game);
}
controller.putCardsOnTopOfLibrary(foundCards, game, source, reveal);
return true;
}
// shuffle
if (forceShuffle) {
controller.shuffleLibrary(game);
controller.shuffleLibrary(source, game);
}
return false;
}

View file

@ -117,7 +117,7 @@ public abstract class SearchTargetGraveyardHandLibraryForCardNameAndExileEffect
if (controller.choose(Outcome.Exile, cardsInLibrary, targetLib, game)) {
controller.moveCards(new CardsImpl(targetLib.getTargets()), Zone.EXILED, source, game);
}
targetPlayer.shuffleLibrary(game);
targetPlayer.shuffleLibrary(source, game);
}
return true;

View file

@ -88,7 +88,7 @@ class TransmuteEffect extends OneShotEffect {
controller.moveCards(revealed, null, Zone.HAND, source, game);
}
}
controller.shuffleLibrary(game);
controller.shuffleLibrary(source, game);
return true;
}

View file

@ -176,7 +176,7 @@ public abstract class GameCommanderImpl extends GameImpl {
}
}
if (mulliganedCards.get(playerId).size() > 0) {
player.shuffleLibrary(this);
player.shuffleLibrary(null, this);
}
}
}

View file

@ -881,7 +881,7 @@ public abstract class GameImpl implements Game, Serializable {
//20091005 - 103.1
if (!gameOptions.skipInitShuffling) { //don't shuffle in test mode for card injection on top of player's libraries
for (Player player : state.getPlayers().values()) {
player.shuffleLibrary(this);
player.shuffleLibrary(null, this);
}
}
@ -1147,7 +1147,7 @@ public abstract class GameImpl implements Game, Serializable {
int numCards = player.getHand().size();
player.getLibrary().addAll(player.getHand().getCards(this), this);
player.getHand().clear();
player.shuffleLibrary(this);
player.shuffleLibrary(null, this);
int deduction = 1;
if (freeMulligans > 0) {
if (usedFreeMulligans != null && usedFreeMulligans.containsKey(player.getId())) {

View file

@ -333,7 +333,7 @@ public interface Player extends MageItem, Copyable<Player> {
*/
void reset();
void shuffleLibrary(Game game);
void shuffleLibrary(Ability source, Game game);
int drawCards(int num, Game game);

View file

@ -1403,13 +1403,13 @@ public abstract class PlayerImpl implements Player, Serializable {
}
@Override
public void shuffleLibrary(Game game) {
public void shuffleLibrary(Ability source, Game game) {
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.SHUFFLE_LIBRARY, playerId, playerId))) {
this.library.shuffle();
if (!game.isSimulation()) {
game.informPlayers(getLogName() + " shuffles his or her library.");
game.informPlayers(getLogName() + "'s library is shuffled");
}
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LIBRARY_SHUFFLED, playerId, playerId));
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LIBRARY_SHUFFLED, playerId, (source == null ? null : source.getSourceId()), playerId));
}
}