use of mage.abilities.effects.common.continuous.BoostTargetEffect in project mage by magefree.
the class CatacombDragonEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent == null || !permanent.isCreature(game)) {
return false;
}
int unBoost = -1 * Math.floorDiv(permanent.getPower().getValue(), 2);
game.addEffect(new BoostTargetEffect(unBoost, 0), source);
return true;
}
use of mage.abilities.effects.common.continuous.BoostTargetEffect in project mage by magefree.
the class HandOfVecnaEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null || player.getHand().size() < 1) {
return false;
}
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
Permanent equipped = game.getPermanent(sourcePermanent != null ? sourcePermanent.getAttachedTo() : null);
List<Permanent> chooseable = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game);
if (equipped != null) {
chooseable.add(equipped);
}
Permanent toBoost;
switch(chooseable.size()) {
case 0:
return false;
case 1:
toBoost = chooseable.get(0);
break;
default:
FilterPermanent filter = new FilterPermanent("a creature to give +X/+X to");
filter.add(Predicates.or(chooseable.stream().map(permanent -> new MageObjectReferencePredicate(permanent, game)).collect(Collectors.toList())));
TargetPermanent target = new TargetPermanent(filter);
target.setNotTarget(true);
player.choose(outcome, target, source.getSourceId(), game);
toBoost = game.getPermanent(target.getFirstTarget());
}
int xValue = player.getHand().size();
game.addEffect(new BoostTargetEffect(xValue, xValue, Duration.EndOfTurn).setTargetPointer(new FixedTarget(toBoost, game)), source);
return true;
}
use of mage.abilities.effects.common.continuous.BoostTargetEffect in project mage by magefree.
the class RevengeEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent target = game.getPermanent(targetPointer.getFirst(game, source));
if (target != null && target.isCreature(game)) {
ContinuousEffect effect = new BoostTargetEffect(4, 0, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(target.getId(), game));
game.addEffect(effect, source);
return true;
}
return false;
}
use of mage.abilities.effects.common.continuous.BoostTargetEffect in project mage by magefree.
the class ChooseYourWeaponEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
game.addEffect(new BoostTargetEffect(permanent.getPower().getValue(), permanent.getToughness().getValue(), Duration.EndOfTurn), source);
return true;
}
use of mage.abilities.effects.common.continuous.BoostTargetEffect in project mage by magefree.
the class FlunkEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(game.getControllerId(source.getFirstTarget()));
if (player == null) {
return false;
}
int xValue = Math.max(7 - player.getHand().size(), 0);
game.addEffect(new BoostTargetEffect(-xValue, -xValue), source);
return true;
}
Aggregations