use of mage.abilities.dynamicvalue.common.ColorsOfManaSpentToCastCount in project mage by magefree.
the class ExertInfluenceEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
MageObject sourceObject = game.getObject(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
if (controller != null && sourceObject != null) {
int colors = new ColorsOfManaSpentToCastCount().calculate(game, source, this);
if (targetCreature.getPower().getValue() <= colors) {
game.addEffect(new GainControlTargetEffect(Duration.Custom, true), source);
}
return true;
}
return false;
}
Aggregations