use of mage.abilities.effects.common.continuous.GainAbilityControlledEffect in project mage by magefree.
the class FaithsShieldEffect 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) {
if (FatefulHourCondition.instance.apply(game, source)) {
ChoiceColor choice = new ChoiceColor();
if (!controller.choose(Outcome.Protect, choice, game)) {
return false;
}
if (choice.getColor() != null) {
game.informPlayers(mageObject.getLogName() + ": " + controller.getLogName() + " has chosen " + choice.getChoice());
FilterCard filter = new FilterCard();
filter.add(new ColorPredicate(choice.getColor()));
filter.setMessage(choice.getChoice());
Ability ability = new ProtectionAbility(filter);
game.addEffect(new GainAbilityControlledEffect(ability, Duration.EndOfTurn), source);
game.addEffect(new GainAbilityControllerEffect(ability, Duration.EndOfTurn), source);
return true;
}
} else {
game.addEffect(new GainProtectionFromColorTargetEffect(Duration.EndOfTurn), source);
return true;
}
}
return false;
}
use of mage.abilities.effects.common.continuous.GainAbilityControlledEffect in project mage by magefree.
the class PathbreakerIbexEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
int maxPower = 0;
for (Permanent perm : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) {
if (perm.getPower().getValue() > maxPower) {
maxPower = perm.getPower().getValue();
}
}
ContinuousEffect effect = new GainAbilityControlledEffect(TrampleAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURES);
game.addEffect(effect, source);
if (maxPower != 0) {
effect = new BoostControlledEffect(maxPower, maxPower, Duration.EndOfTurn);
game.addEffect(effect, source);
}
return true;
}
use of mage.abilities.effects.common.continuous.GainAbilityControlledEffect in project mage by magefree.
the class FinaleOfDevastationEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
int xValue = source.getManaCostsToPay().getX();
if (xValue >= 10) {
ContinuousEffect effect1 = new BoostControlledEffect(xValue, xValue, Duration.EndOfTurn);
game.addEffect(effect1, source);
ContinuousEffect effect2 = new GainAbilityControlledEffect(HasteAbility.getInstance(), Duration.EndOfTurn, new FilterCreaturePermanent());
game.addEffect(effect2, source);
}
return true;
}
use of mage.abilities.effects.common.continuous.GainAbilityControlledEffect in project mage by magefree.
the class OverwhelmingStampedeInitEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
int maxPower = 0;
for (Permanent perm : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) {
if (perm.getPower().getValue() > maxPower) {
maxPower = perm.getPower().getValue();
}
}
ContinuousEffect effect = new GainAbilityControlledEffect(TrampleAbility.getInstance(), Duration.EndOfTurn, new FilterCreaturePermanent());
game.addEffect(effect, source);
if (maxPower != 0) {
effect = new BoostControlledEffect(maxPower, maxPower, Duration.EndOfTurn);
game.addEffect(effect, source);
}
return true;
}
use of mage.abilities.effects.common.continuous.GainAbilityControlledEffect in project mage by magefree.
the class SamiteElderEffect method apply.
public boolean apply(Game game, Ability source) {
Permanent target = game.getPermanent(source.getFirstTarget());
if (target != null) {
for (ObjectColor color : target.getColor(game).getColors()) {
FilterCard filter = new FilterCard(color.getDescription());
filter.add(new ColorPredicate(color));
game.addEffect(new GainAbilityControlledEffect(new ProtectionAbility(filter), Duration.EndOfTurn, new FilterControlledCreaturePermanent()), source);
}
return true;
}
return false;
}
Aggregations