foul-magics/Mage/src/main/java/mage/abilities/effects/common/ShuffleHandGraveyardAllEffect.java
Susucre f75b1c9f0a
Code cleanup: protect all copy constructors (#10750)
* apply regex to change public copy constructors to protected
* cleanup code using now protected constructors
* fix manaBuilder weird casting of Mana into ConditionalMana
2023-08-04 19:34:58 -04:00

45 lines
1.3 KiB
Java

package mage.abilities.effects.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
/**
* @author BetaSteward_at_googlemail.com
*/
public class ShuffleHandGraveyardAllEffect extends OneShotEffect {
public ShuffleHandGraveyardAllEffect() {
super(Outcome.Neutral);
staticText = "each player shuffles their hand and graveyard into their library";
}
protected ShuffleHandGraveyardAllEffect(final ShuffleHandGraveyardAllEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
player.moveCards(player.getHand(), Zone.LIBRARY, source, game);
player.moveCards(player.getGraveyard(), Zone.LIBRARY, source, game);
player.shuffleLibrary(source, game);
}
}
return true;
}
@Override
public ShuffleHandGraveyardAllEffect copy() {
return new ShuffleHandGraveyardAllEffect(this);
}
}