use of mage.abilities.condition.Condition in project mage by magefree.
the class ChaosLordEffect method checkInterveningIfClause.
@Override
public boolean checkInterveningIfClause(Game game) {
Condition condition = new ControlsPermanentsComparedToOpponentsCondition(ComparisonType.EQUAL_TO, new FilterPermanent());
Player controller = game.getPlayer(controllerId);
if (controller != null && condition.apply(game, this)) {
return super.checkInterveningIfClause(game);
}
return false;
}
use of mage.abilities.condition.Condition 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.Condition 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.Condition in project mage by magefree.
the class SanctuaryInterveningIfTriggeredAbility method makeAndCondition.
private static Condition makeAndCondition(ObjectColor color1, ObjectColor color2) {
FilterPermanent filter1 = new FilterPermanent();
filter1.add(new ColorPredicate(color1));
Condition condition1 = new PermanentsOnTheBattlefieldCondition(filter1);
FilterPermanent filter2 = new FilterPermanent();
filter2.add(new ColorPredicate(color2));
Condition condition2 = new PermanentsOnTheBattlefieldCondition(filter2);
return new CompoundCondition(condition1, condition2);
}
use of mage.abilities.condition.Condition 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;
}
Aggregations