* Lieutenant - Fixed that the Lieutenant effects were also applied if the commander was controlled by another player as the commander owner.

This commit is contained in:
LevelX2 2015-08-29 10:53:13 +02:00
parent 4774015343
commit 447e42409b

View file

@ -30,11 +30,11 @@ package mage.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
* Checks if the player has its commander in play
* Checks if the player has its commander in play and controls it
*
* @author LevelX2
*/
@ -42,7 +42,8 @@ public class CommanderInPlayCondition implements Condition {
private static CommanderInPlayCondition fInstance = null;
private CommanderInPlayCondition() {}
private CommanderInPlayCondition() {
}
public static Condition getInstance() {
if (fInstance == null) {
@ -55,7 +56,8 @@ public class CommanderInPlayCondition implements Condition {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
return game.getPermanent(controller.getCommanderId()) != null;
Permanent commander = game.getPermanent(controller.getCommanderId());
return commander != null && commander.getControllerId().equals(source.getControllerId());
}
return false;
}
@ -65,4 +67,4 @@ public class CommanderInPlayCondition implements Condition {
return "As long as you control your commander";
}
}
}