use of mage.filter.common.FilterCreaturePermanent 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.common.FilterCreaturePermanent in project mage by magefree.
the class RiptideEntrancerTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Player opponent = game.getPlayer(event.getPlayerId());
if (opponent != null && event.getSourceId().equals(this.sourceId)) {
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.common.FilterCreaturePermanent in project mage by magefree.
the class AnHavvaInnEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("green creatures");
filter.add(new ColorPredicate(ObjectColor.GREEN));
int greenCreatures = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
player.gainLife(greenCreatures + 1, game, source);
}
return true;
}
use of mage.filter.common.FilterCreaturePermanent in project mage by magefree.
the class AnHavvaConstableEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
MageObject mageObject = game.getObject(source.getSourceId());
if (mageObject != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("green creatures");
filter.add(new ColorPredicate(ObjectColor.GREEN));
int number = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
mageObject.getToughness().setValue(number + 1);
return true;
}
}
return false;
}
use of mage.filter.common.FilterCreaturePermanent in project mage by magefree.
the class ArcbondEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
int damage = (Integer) this.getValue("damage");
UUID sourceId = (UUID) this.getValue("sourceId");
MageObject sourceObject = game.getObject(source.getSourceId());
if (sourceObject != null && damage > 0 && sourceId != null) {
Permanent targetObject = game.getPermanentOrLKIBattlefield(sourceId);
if (targetObject != null) {
game.informPlayers(sourceObject.getLogName() + ": " + targetObject.getLogName() + " deals " + damage + " damage to each other creature and each player");
}
FilterPermanent filter = new FilterCreaturePermanent("each other creature");
filter.add(Predicates.not(new PermanentIdPredicate(sourceId)));
return new DamageEverythingEffect(StaticValue.get(damage), filter, sourceId).apply(game, source);
}
return false;
}
Aggregations