foul-magics/Mage/src/main/java/mage/abilities/effects/common/WinGameSourceControllerEffect.java
2018-06-02 17:59:49 +02:00

42 lines
No EOL
929 B
Java

package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author plopman
*/
public class WinGameSourceControllerEffect extends OneShotEffect {
public WinGameSourceControllerEffect() {
super(Outcome.Win);
this.staticText = "you win the game";
}
public WinGameSourceControllerEffect(final WinGameSourceControllerEffect effect) {
super(effect);
}
@Override
public WinGameSourceControllerEffect copy() {
return new WinGameSourceControllerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.won(game);
return true;
}
return false;
}
}