use of mage.abilities.effects.common.continuous.SetPowerToughnessAllEffect in project mage by magefree.
the class BrineHagEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourcePermanent != null) {
List<Permanent> list = new ArrayList<>();
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
for (Permanent creature : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, playerId, game)) {
if (sourcePermanent.getDealtDamageByThisTurn().contains(new MageObjectReference(creature.getId(), game))) {
list.add(creature);
}
}
}
}
if (!list.isEmpty()) {
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new PermanentInListPredicate(list));
game.addEffect(new SetPowerToughnessAllEffect(0, 2, Duration.Custom, filter, true), source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.continuous.SetPowerToughnessAllEffect in project mage by magefree.
the class MassDiminishEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new ControllerIdPredicate(source.getFirstTarget()));
game.addEffect(new SetPowerToughnessAllEffect(1, 1, Duration.UntilYourNextTurn, filter, true), source);
return true;
}
Aggregations