use of mage.filter.predicate.permanent.BlockingAttackerIdPredicate in project mage by magefree.
the class LabyrinthRaptorEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
if (permanent == null) {
return false;
}
Player player = game.getPlayer(game.getCombat().getDefendingPlayerId(permanent.getId(), game));
if (player == null) {
return false;
}
FilterPermanent filterPermanent = new FilterPermanent("creature blocking " + permanent.getIdName());
filterPermanent.add(new BlockingAttackerIdPredicate(permanent.getId()));
Effect effect = new SacrificeEffect(filterPermanent, 1, "");
effect.setTargetPointer(new FixedTarget(player.getId(), game));
return effect.apply(game, source);
}
use of mage.filter.predicate.permanent.BlockingAttackerIdPredicate in project mage by magefree.
the class PlagueWightEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent == null) {
return false;
}
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new BlockingAttackerIdPredicate(source.getSourceId()));
game.addEffect(new BoostAllEffect(-1, -1, Duration.EndOfTurn, filter, false), source);
return true;
}
use of mage.filter.predicate.permanent.BlockingAttackerIdPredicate in project mage by magefree.
the class GreaterWerewolfEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourcePermanent != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(Predicates.or(new BlockedByIdPredicate(sourcePermanent.getId()), new BlockingAttackerIdPredicate(sourcePermanent.getId())));
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
Effect effect = new AddCountersTargetEffect(CounterType.M0M2.createInstance(), Outcome.UnboostCreature);
effect.setTargetPointer(new FixedTarget(permanent, game));
effect.apply(game, source);
}
return true;
}
return false;
}
use of mage.filter.predicate.permanent.BlockingAttackerIdPredicate in project mage by magefree.
the class SpittingSlugEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourcePermanent != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(Predicates.or(new BlockedByIdPredicate(sourcePermanent.getId()), new BlockingAttackerIdPredicate(sourcePermanent.getId())));
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
ContinuousEffect effect = new GainAbilityTargetEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
}
return true;
}
return false;
}
Aggregations