use of mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect in project mage by magefree.
the class MasterOfWindsEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
int power = player.chooseUse(Outcome.Neutral, "Have this creature become a 4/1 or a 1/4?", null, "4/1", "1/4", source, game) ? 4 : 1;
game.addEffect(new SetPowerToughnessSourceEffect(power, 5 - power, Duration.EndOfTurn, SubLayer.SetPT_7b), source);
return true;
}
use of mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect in project mage by magefree.
the class NamelessRaceEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanentEntering(source.getSourceId());
if (controller == null || permanent == null) {
return false;
}
int permanentsInPlay = new PermanentsOnBattlefieldCount(filter).calculate(game, source, null);
int cardsInGraveyards = new CardsInAllGraveyardsCount(filter2).calculate(game, source, null);
int maxAmount = Math.min(permanentsInPlay + cardsInGraveyards, controller.getLife());
int payAmount = controller.getAmount(0, maxAmount, "Pay up to " + maxAmount + " life", game);
Cost cost = new PayLifeCost(payAmount);
if (!cost.pay(source, game, source, source.getControllerId(), true)) {
return false;
}
Card sourceCard = game.getCard(source.getSourceId());
game.informPlayers((sourceCard != null ? sourceCard.getLogName() : "") + ": " + controller.getLogName() + " pays " + payAmount + " life");
game.addEffect(new SetPowerToughnessSourceEffect(payAmount, payAmount, Duration.Custom, SubLayer.CharacteristicDefining_7a), source);
permanent.addInfo("life paid", CardUtil.addToolTipMarkTags("Life paid: " + payAmount), game);
return true;
}
use of mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect in project mage by magefree.
the class AquamorphEntityReplacementEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent;
if (event instanceof EntersTheBattlefieldEvent) {
permanent = ((EntersTheBattlefieldEvent) event).getTarget();
} else {
permanent = game.getPermanent(event.getTargetId());
}
if (permanent == null) {
return false;
}
Choice choice = new ChoiceImpl(true);
choice.setMessage("Choose what the creature becomes to");
choice.getChoices().add(choice51);
choice.getChoices().add(choice15);
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && !controller.choose(Outcome.Neutral, choice, game)) {
discard();
return false;
}
int power = 0;
int toughness = 0;
switch(choice.getChoice()) {
case choice51:
power = 5;
toughness = 1;
break;
case choice15:
power = 1;
toughness = 5;
break;
}
game.addEffect(new SetPowerToughnessSourceEffect(power, toughness, Duration.Custom, SubLayer.SetPT_7b), source);
return true;
}
use of mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect in project mage by magefree.
the class SwornDefenderEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent targetPermanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
if (controller != null && targetPermanent != null) {
int newPower = CardUtil.overflowDec(targetPermanent.getToughness().getValue(), 1);
int newToughness = CardUtil.overflowInc(targetPermanent.getPower().getValue(), 1);
game.addEffect(new SetPowerToughnessSourceEffect(newPower, newToughness, Duration.EndOfTurn, SubLayer.SetPT_7b), source);
return true;
}
return false;
}
use of mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect in project mage by magefree.
the class ShapeStealerEffect 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 SetPowerToughnessSourceEffect(permanent.getPower().getValue(), permanent.getToughness().getValue(), Duration.EndOfTurn, SubLayer.SetPT_7b);
game.addEffect(effect, source);
return true;
}
}
return false;
}
Aggregations