use of mage.MageInt in project mage by magefree.
the class ArniBrokenbrowEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject mageObject = game.getObject(source.getSourceId());
if (controller == null || mageObject == null) {
return false;
}
int power = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CONTROLLED_CREATURE, source.getControllerId(), game).stream().filter(Objects::nonNull).filter(permanent -> !permanent.getId().equals(source.getSourceId()) || permanent.getZoneChangeCounter(game) != source.getSourceObjectZoneChangeCounter()).map(MageObject::getPower).mapToInt(MageInt::getValue).max().orElse(0);
power += 1;
if (controller.chooseUse(outcome, "Change base power of " + mageObject.getLogName() + " to " + power + " until end of turn?", source, game)) {
game.addEffect(new SetPowerSourceEffect(StaticValue.get(power), Duration.EndOfTurn), source);
return true;
}
return false;
}
Aggregations