use of mage.target.common.TargetCreaturePermanent 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.target.common.TargetCreaturePermanent 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;
}
use of mage.target.common.TargetCreaturePermanent in project mage by magefree.
the class RevealingWindEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
while (game.getBattlefield().count(filter, source.getOriginalId(), source.getControllerId(), game) > 0 && controller.chooseUse(outcome, "Look at a face-down attacking creature?", source, game)) {
if (!controller.canRespond()) {
return false;
}
Target target = new TargetCreaturePermanent(filter);
if (controller.chooseTarget(outcome, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
Cards cards = new CardsImpl(card);
controller.lookAtCards(sourceObject.getName(), cards, game);
game.informPlayers(controller.getLogName() + " look at a face-down attacking creature");
}
}
}
}
return true;
}
use of mage.target.common.TargetCreaturePermanent in project mage by magefree.
the class SomnophoreTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (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.target.common.TargetCreaturePermanent in project mage by magefree.
the class ArtisanOfFormsCopyApplier method createAbility.
static Ability createAbility() {
Ability ability = new HeroicAbility(new CopyPermanentEffect(StaticFilters.FILTER_PERMANENT_CREATURE, new ArtisanOfFormsCopyApplier(), true).setText("have {this} become a copy of target creature, except it has this ability"), true);
ability.addTarget(new TargetCreaturePermanent());
return ability;
}
Aggregations