use of mage.filter.predicate.permanent.ControllerIdPredicate in project mage by magefree.
the class AshiokSculptorOfFearsEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
FilterPermanent filter = new FilterCreaturePermanent();
filter.add(new ControllerIdPredicate(source.getFirstTarget()));
new GainControlAllEffect(Duration.Custom, filter).apply(game, source);
return true;
}
use of mage.filter.predicate.permanent.ControllerIdPredicate in project mage by magefree.
the class AshlingTheExtinguisherTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) {
Player opponent = game.getPlayer(event.getPlayerId());
if (opponent != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls");
filter.add(new ControllerIdPredicate(opponent.getId()));
this.getTargets().clear();
this.addTarget(new TargetCreaturePermanent(filter));
return true;
}
}
return false;
}
use of mage.filter.predicate.permanent.ControllerIdPredicate in project mage by magefree.
the class BlindZealotTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Player opponent = game.getPlayer(event.getPlayerId());
if (opponent == null || !event.getSourceId().equals(this.sourceId) || !((DamagedEvent) event).isCombatDamage()) {
return false;
}
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls");
filter.add(new ControllerIdPredicate(opponent.getId()));
this.getTargets().clear();
this.addTarget(new TargetCreaturePermanent(filter));
return true;
}
use of mage.filter.predicate.permanent.ControllerIdPredicate in project mage by magefree.
the class CausticWaspsTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getSourceId().equals(this.sourceId) && ((DamagedPlayerEvent) event).isCombatDamage()) {
Player player = game.getPlayer(event.getTargetId());
if (player != null) {
FilterPermanent filter = new FilterPermanent("an artifact controlled by " + player.getLogName());
filter.add(CardType.ARTIFACT.getPredicate());
filter.add(new ControllerIdPredicate(event.getTargetId()));
this.getTargets().clear();
this.addTarget(new TargetPermanent(filter));
return true;
}
}
return false;
}
use of mage.filter.predicate.permanent.ControllerIdPredicate in project mage by magefree.
the class CyclopsGladiatorEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
UUID defenderId = game.getCombat().getDefenderId(source.getSourceId());
if (defenderId != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
filter.add(new ControllerIdPredicate(defenderId));
TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
Player player = game.getPlayer(source.getControllerId());
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
if (player != null && player.chooseTarget(Outcome.Detriment, target, source, game)) {
Permanent permanent = game.getPermanent(target.getFirstTarget());
Permanent cyclops = game.getPermanent(source.getSourceId());
if (permanent != null && cyclops != null) {
permanent.damage(cyclops.getPower().getValue(), cyclops.getId(), source, game, false, true);
cyclops.damage(permanent.getPower().getValue(), permanent.getId(), source, game, false, true);
return true;
}
}
}
}
return false;
}
Aggregations