use of mage.target.common.TargetCreaturePermanent in project mage by magefree.
the class TopplegeistAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
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.target.common.TargetCreaturePermanent in project mage by magefree.
the class ToothCollectorAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
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.target.common.TargetCreaturePermanent in project mage by magefree.
the class TowerAboveTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getSourceId().equals(this.getSourceId())) {
this.getTargets().clear();
TargetCreaturePermanent target = new TargetCreaturePermanent();
this.addTarget(target);
return true;
}
return false;
}
use of mage.target.common.TargetCreaturePermanent in project mage by magefree.
the class UrgeToFeedEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
TargetCreaturePermanent target = new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, true);
if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) {
for (UUID vampireId : target.getTargets()) {
Permanent vampire = game.getPermanent(vampireId);
if (vampire != null) {
vampire.tap(source, game);
vampire.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game);
}
}
}
return true;
}
use of mage.target.common.TargetCreaturePermanent 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;
}
Aggregations