use of mage.abilities.condition.common.MostCommonColorCondition in project mage by magefree.
the class CallToArmsStateTriggeredAbility method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
UUID playerId = (UUID) game.getState().getValue(source.getSourceId() + ChooseOpponentEffect.VALUE_KEY);
if (permanent != null) {
Player opponent = game.getPlayer(playerId);
if (opponent != null) {
ObjectColor color = (ObjectColor) game.getState().getValue(permanent.getId() + "_color");
Condition condition = new MostCommonColorCondition(color, true, new ControllerIdPredicate(playerId));
if (condition.apply(game, source)) {
Effect effect = new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, false);
return effect.apply(game, source);
}
}
}
return false;
}
use of mage.abilities.condition.common.MostCommonColorCondition in project mage by magefree.
the class CallToArmsStateTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(getSourceId());
UUID playerId = (UUID) game.getState().getValue(getSourceId() + ChooseOpponentEffect.VALUE_KEY);
if (permanent != null) {
Player opponent = game.getPlayer(playerId);
if (opponent != null) {
ObjectColor color = (ObjectColor) game.getState().getValue(permanent.getId() + "_color");
Condition condition = new MostCommonColorCondition(color, true, new ControllerIdPredicate(playerId));
return !condition.apply(game, this);
}
}
return false;
}
use of mage.abilities.condition.common.MostCommonColorCondition in project mage by magefree.
the class TsabosAssasinEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
Condition condition = new MostCommonColorCondition(permanent.getColor(game));
if (condition.apply(game, source)) {
Effect effect = new DestroyTargetEffect();
effect.setTargetPointer(new FixedTarget(permanent, game));
return effect.apply(game, source);
}
}
return false;
}
use of mage.abilities.condition.common.MostCommonColorCondition in project mage by magefree.
the class BarrinsUnmakingEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null) {
Condition condition = new MostCommonColorCondition(permanent.getColor(game));
if (condition.apply(game, source)) {
Effect effect = new ReturnToHandTargetEffect();
effect.setTargetPointer(new FixedTarget(permanent, game));
return effect.apply(game, source);
}
}
return false;
}
Aggregations