use of mage.abilities.effects.common.continuous.GainAbilityTargetEffect in project mage by magefree.
the class MoltenPrimordialEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
boolean result = false;
for (Target target : source.getTargets()) {
if (target instanceof TargetCreaturePermanent) {
Permanent targetCreature = game.getPermanent(target.getFirstTarget());
if (targetCreature != null) {
ContinuousEffect effect1 = new GainControlTargetEffect(Duration.EndOfTurn);
effect1.setTargetPointer(new FixedTarget(targetCreature.getId(), game));
game.addEffect(effect1, source);
ContinuousEffect effect2 = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
effect2.setTargetPointer(new FixedTarget(targetCreature.getId(), game));
game.addEffect(effect2, source);
targetCreature.untap(game);
result = true;
}
}
}
return result;
}
use of mage.abilities.effects.common.continuous.GainAbilityTargetEffect in project mage by magefree.
the class NaturesBlessingEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent targetPermanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
if (controller != null && targetPermanent != null) {
Choice choice = new ChoiceImpl(true);
choice.setMessage("Choose one");
choice.setChoices(choices);
if (controller.choose(outcome, choice, game)) {
switch(choice.getChoice()) {
case "Banding":
gainedAbility = BandingAbility.getInstance();
break;
case "First strike":
gainedAbility = FirstStrikeAbility.getInstance();
break;
case "Trample":
gainedAbility = TrampleAbility.getInstance();
}
}
if (gainedAbility != null) {
game.addEffect(new GainAbilityTargetEffect(gainedAbility, Duration.Custom), source);
} else {
targetPermanent.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game);
game.informPlayers(controller.getLogName() + " puts a +1/+1 counter on " + targetPermanent.getLogName());
}
return true;
}
return false;
}
use of mage.abilities.effects.common.continuous.GainAbilityTargetEffect in project mage by magefree.
the class RapidFireEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (controller != null && permanent != null) {
if (!permanent.getAbilities().containsClass(RampageAbility.class)) {
ContinuousEffect effect = new GainAbilityTargetEffect(new RampageAbility(2), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
}
}
return false;
}
use of mage.abilities.effects.common.continuous.GainAbilityTargetEffect in project mage by magefree.
the class SkyclawThrashEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (controller.flipCoin(source, game, true) && sourcePermanent != null) {
ContinuousEffect effect = new BoostTargetEffect(1, 1, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(sourcePermanent, game));
game.addEffect(effect, source);
effect = new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(sourcePermanent, game));
game.addEffect(effect, source);
}
return true;
}
return false;
}
use of mage.abilities.effects.common.continuous.GainAbilityTargetEffect in project mage by magefree.
the class UnwillingRecruitEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent targetCreature = game.getPermanent(source.getFirstTarget());
if (targetCreature != null) {
source.getEffects().get(0).setTargetPointer(new FixedTarget(targetCreature.getId(), game));
game.addEffect(new GainControlTargetEffect(Duration.EndOfTurn), source);
targetCreature.untap(game);
game.addEffect(new BoostTargetEffect(source.getManaCostsToPay().getX(), 0, Duration.EndOfTurn), source);
game.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn), source);
return true;
}
return false;
}
Aggregations