use of mage.filter.predicate.permanent.ControllerIdPredicate in project mage by magefree.
the class VaevictisAsmadiTheDireEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!game.getCombat().getAttackers().contains(this.getSourceId())) {
return false;
}
this.getTargets().clear();
for (UUID playerId : game.getState().getPlayerList(this.getControllerId())) {
Player player = game.getPlayer(playerId);
if (player == null) {
continue;
}
FilterPermanent filter = new FilterPermanent("permanent controlled by " + player.getName());
filter.add(new ControllerIdPredicate(playerId));
TargetPermanent target = new TargetPermanent(filter);
this.addTarget(target);
}
return true;
}
use of mage.filter.predicate.permanent.ControllerIdPredicate in project mage by magefree.
the class ZilorthaStrengthIncarnateEffect method apply.
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
// Change the rule
FilterCreaturePermanent filter = StaticFilters.FILTER_PERMANENT_CREATURE.copy();
filter.add(new ControllerIdPredicate(source.getControllerId()));
game.getState().addPowerInsteadOfToughnessForDamageLethalityFilter(source.getSourceId(), filter);
return true;
}
use of mage.filter.predicate.permanent.ControllerIdPredicate in project mage by magefree.
the class PermanentsOnTheBattlefieldCondition method apply.
@Override
public boolean apply(Game game, Ability source) {
FilterPermanent localFilter;
if (onlyControlled) {
localFilter = filter.copy();
localFilter.add(new ControllerIdPredicate(source.getControllerId()));
} else {
localFilter = filter;
}
return ComparisonType.compare(game.getBattlefield().count(localFilter, source.getSourceId(), source.getControllerId(), game), type, count);
}
use of mage.filter.predicate.permanent.ControllerIdPredicate in project mage by magefree.
the class CephalidConstableTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getSourceId().equals(this.sourceId) && ((DamagedPlayerEvent) event).isCombatDamage()) {
FilterPermanent filter = new FilterPermanent("permanent" + (event.getAmount() > 1 ? "s" : "") + " damaged player control");
filter.add(new ControllerIdPredicate(event.getPlayerId()));
Target target = new TargetPermanent(0, event.getAmount(), filter, false);
this.getTargets().clear();
this.getTargets().add(target);
return true;
}
return false;
}
use of mage.filter.predicate.permanent.ControllerIdPredicate in project mage by magefree.
the class CommandoRaidEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
Player opponent = game.getPlayer(event.getPlayerId());
if (!damageEvent.isCombatDamage() || !event.getSourceId().equals(this.getSourceId()) || opponent == null) {
return false;
}
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls");
filter.add(new ControllerIdPredicate(opponent.getId()));
this.getTargets().clear();
this.addTarget(new TargetCreaturePermanent(filter));
for (Effect effect : this.getAllEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
effect.setValue("damage", event.getAmount());
}
return true;
}
Aggregations