forked from External/mage
tests: fixed wrong permanent structure for battlefield cards (addCard command); tests: added docs and additional runtime checks; game: Modal double-faced cards - improved support, no more other side effects on battlefield; game: Copy abilities - improved stability and cards support; game: Player under control - improved stability and related cards support (possible NPE errors, additional runtime checks); server: fixed bloated logs with game timer; AI: fixed wrong timer in computer games;
41 lines
1.2 KiB
Java
41 lines
1.2 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;
|
|
|
|
/**
|
|
* TODO: delete, there are already end turn code with control reset
|
|
* @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;
|
|
}
|
|
|
|
}
|