use of mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect in project mage by magefree.
the class EldraziMimicEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
if (permanent != null) {
ContinuousEffect effect = new SetPowerToughnessTargetEffect(permanent.getPower().getValue(), permanent.getToughness().getValue(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
game.addEffect(effect, source);
return true;
}
}
return false;
}
use of mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect in project mage by magefree.
the class RiseAndShineEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> permanents = game.getBattlefield().getActivePermanents(RiseAndShine.filter, source.getControllerId(), source.getSourceId(), game);
if (permanents.isEmpty()) {
return false;
}
game.addEffect(new AddCardTypeTargetEffect(Duration.EndOfGame, CardType.ARTIFACT, CardType.CREATURE).setTargetPointer(new FixedTargets(permanents, game)), source);
game.addEffect(new SetPowerToughnessTargetEffect(0, 0, Duration.EndOfGame).setTargetPointer(new FixedTargets(permanents, game)), source);
for (Permanent permanent : permanents) {
permanent.addCounters(CounterType.P1P1.createInstance(4), source.getControllerId(), source, game);
}
return true;
}
use of mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect in project mage by magefree.
the class SereneMasterEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourceCreature = game.getPermanent(source.getSourceId());
if (controller != null && sourceCreature != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature it's blocking");
filter.add(new BlockedByIdPredicate((source.getSourceId())));
Target target = new TargetCreaturePermanent(filter);
if (target.canChoose(source.getSourceId(), controller.getId(), game)) {
if (controller.chooseTarget(outcome, target, source, game)) {
Permanent attackingCreature = game.getPermanent(target.getFirstTarget());
if (attackingCreature != null) {
int newSourcePower = attackingCreature.getPower().getValue();
int newAttackerPower = sourceCreature.getPower().getValue();
ContinuousEffect effect = new SetPowerToughnessTargetEffect(newSourcePower, sourceCreature.getToughness().getValue(), Duration.EndOfCombat);
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
game.addEffect(effect, source);
effect = new SetPowerToughnessTargetEffect(newAttackerPower, attackingCreature.getToughness().getValue(), Duration.EndOfCombat);
effect.setTargetPointer(new FixedTarget(attackingCreature.getId(), game));
game.addEffect(effect, source);
return true;
}
}
}
}
return false;
}
use of mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect in project mage by magefree.
the class ExuberantWolfbearEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (permanent == null) {
return false;
}
game.addEffect(new SetPowerToughnessTargetEffect(permanent.getPower().getValue(), permanent.getToughness().getValue(), Duration.EndOfTurn), source);
return true;
}
use of mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect in project mage by magefree.
the class IslandOfWakWakEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent targetCreature = game.getPermanent(source.getFirstTarget());
if (targetCreature != null) {
int toughness = targetCreature.getToughness().getBaseValueModified();
game.addEffect(new SetPowerToughnessTargetEffect(0, toughness, Duration.EndOfTurn), source);
return true;
}
return false;
}
Aggregations