use of mage.abilities.effects.common.continuous.SetPowerSourceEffect in project mage by magefree.
the class RiptideManglerEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
game.addEffect(new SetPowerSourceEffect(StaticValue.get(permanent.getPower().getValue()), Duration.WhileOnBattlefield, SubLayer.SetPT_7b), source);
return true;
}
use of mage.abilities.effects.common.continuous.SetPowerSourceEffect 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