foul-magics/Mage/src/main/java/mage/abilities/effects/common/LoseControlOnOtherPlayersControllerEffect.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

40 lines
1.1 KiB
Java

package mage.abilities.effects.common;
import mage.constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.game.Game;
import mage.players.Player;
/**
* @author nantuko
*/
public class LoseControlOnOtherPlayersControllerEffect extends OneShotEffect {
public LoseControlOnOtherPlayersControllerEffect(String controllingPlayerName, String controlledPlayerName) {
super(Outcome.Detriment);
staticText = controllingPlayerName + " lost control over " + controlledPlayerName;
}
protected LoseControlOnOtherPlayersControllerEffect(final LoseControlOnOtherPlayersControllerEffect effect) {
super(effect);
}
@Override
public LoseControlOnOtherPlayersControllerEffect copy() {
return new LoseControlOnOtherPlayersControllerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.resetOtherTurnsControlled();
return true;
}
return false;
}
}