use of mage.abilities.effects.common.continuous.GainAbilitySourceEffect in project mage by magefree.
the class FlowstoneSculptureEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Choice choice = new ChoiceImpl(true);
choice.setMessage("Choose ability to add");
choice.setChoices(choices);
if (!controller.choose(outcome, choice, game)) {
return false;
}
String chosen = choice.getChoice();
if (chosen.equals("+1/+1 counter")) {
return new AddCountersSourceEffect(CounterType.P1P1.createInstance()).apply(game, source);
} else {
Ability gainedAbility;
switch(chosen) {
case "Flying":
gainedAbility = FlyingAbility.getInstance();
break;
case "First strike":
gainedAbility = FirstStrikeAbility.getInstance();
break;
default:
gainedAbility = TrampleAbility.getInstance();
break;
}
game.addEffect(new GainAbilitySourceEffect(gainedAbility, Duration.WhileOnBattlefield), source);
return true;
}
}
return false;
}
use of mage.abilities.effects.common.continuous.GainAbilitySourceEffect in project mage by magefree.
the class GargantuanGorillaFightEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && sourcePermanent != null) {
TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true);
SacrificeTargetCost cost = new SacrificeTargetCost(target);
if (!controller.chooseUse(Outcome.Benefit, "Sacrifice a Forest?", source, game) || !cost.canPay(source, source, source.getControllerId(), game) || !cost.pay(source, game, source, source.getControllerId(), true)) {
sourcePermanent.sacrifice(source, game);
controller.damage(7, sourcePermanent.getId(), source, game);
} else if (cost.isPaid()) {
for (Permanent permanent : cost.getPermanents()) {
if (filterSnow.match(permanent, game)) {
game.addEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.EndOfTurn), source);
break;
}
}
}
return true;
}
return false;
}
use of mage.abilities.effects.common.continuous.GainAbilitySourceEffect in project mage by magefree.
the class GuileSonicSoldierEffect method makeAbility.
private static final ReflexiveTriggeredAbility makeAbility() {
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DamageTargetEffect(4), false);
ability.addTarget(new TargetAnyTarget());
Mode mode = new Mode(new GainAbilitySourceEffect(LifelinkAbility.getInstance(), Duration.EndOfTurn).setText("{this} gains lifelink"));
mode.addEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn).setText("and indestructible until end of turn"));
ability.withFirstModeFlavorWord("Sonic Boom").addMode(mode.withFlavorWord("Flash Kick"));
return ability;
}
use of mage.abilities.effects.common.continuous.GainAbilitySourceEffect in project mage by magefree.
the class LunarAvengerEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Choice choice = new ChoiceImpl(true);
choice.setMessage("Choose ability to add");
choice.setChoices(choices);
if (!controller.choose(outcome, choice, game)) {
return false;
}
Ability gainedAbility;
String chosen = choice.getChoice();
switch(chosen) {
case "Flying":
gainedAbility = FlyingAbility.getInstance();
break;
case "First strike":
gainedAbility = FirstStrikeAbility.getInstance();
break;
default:
gainedAbility = HasteAbility.getInstance();
break;
}
game.addEffect(new GainAbilitySourceEffect(gainedAbility, Duration.EndOfTurn), source);
return true;
}
return false;
}
use of mage.abilities.effects.common.continuous.GainAbilitySourceEffect in project mage by magefree.
the class ShiftingCeratopsEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Choice choice = new ChoiceImpl(true);
choice.setMessage("Choose an ability");
choice.setChoices(choices);
if (!player.choose(outcome, choice, game)) {
return false;
}
Ability ability = null;
switch(choice.getChoice()) {
case "Reach":
ability = ReachAbility.getInstance();
break;
case "Trample":
ability = TrampleAbility.getInstance();
break;
case "Haste":
ability = HasteAbility.getInstance();
break;
}
if (ability != null) {
game.addEffect(new GainAbilitySourceEffect(ability, Duration.EndOfTurn), source);
}
return true;
}
Aggregations