Search in sources :

Example 1 with GoadTargetEffect

use of mage.abilities.effects.common.combat.GoadTargetEffect in project mage by magefree.

the class BesmirchEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    if (game.getPermanent(source.getFirstTarget()) != null) {
        TargetPointer target = new FixedTarget(source.getFirstTarget(), game);
        // gain control
        game.addEffect(new GainControlTargetEffect(Duration.EndOfTurn).setTargetPointer(target), source);
        // haste
        game.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn).setTargetPointer(target), source);
        // goad
        game.addEffect(new GoadTargetEffect().setTargetPointer(target), source);
        // untap
        new UntapTargetEffect().setTargetPointer(target).apply(game, source);
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) UntapTargetEffect(mage.abilities.effects.common.UntapTargetEffect) TargetPointer(mage.target.targetpointer.TargetPointer) GainControlTargetEffect(mage.abilities.effects.common.continuous.GainControlTargetEffect) GoadTargetEffect(mage.abilities.effects.common.combat.GoadTargetEffect)

Example 2 with GoadTargetEffect

use of mage.abilities.effects.common.combat.GoadTargetEffect in project mage by magefree.

the class AgitatorAntEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    for (Player player : game.getState().getPlayersInRange(source.getControllerId(), game).stream().map(game::getPlayer).filter(Objects::nonNull).collect(Collectors.toList())) {
        if (game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, player.getId(), game) < 1 || !player.chooseUse(Outcome.BoostCreature, "Put two +1/+1 counters on a creature you control?", source, game)) {
            continue;
        }
        TargetPermanent targetPermanent = new TargetControlledCreaturePermanent(0, 1);
        targetPermanent.setNotTarget(true);
        player.choose(Outcome.BoostCreature, targetPermanent, source.getSourceId(), game);
        Permanent permanent = game.getPermanent(targetPermanent.getFirstTarget());
        if (permanent == null || !permanent.addCounters(CounterType.P1P1.createInstance(2), player.getId(), source, game)) {
            continue;
        }
        game.addEffect(new GoadTargetEffect().setTargetPointer(new FixedTarget(permanent, game)), source);
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) TargetPermanent(mage.target.TargetPermanent) TargetPermanent(mage.target.TargetPermanent) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) GoadTargetEffect(mage.abilities.effects.common.combat.GoadTargetEffect)

Example 3 with GoadTargetEffect

use of mage.abilities.effects.common.combat.GoadTargetEffect in project mage by magefree.

the class KaimaTheFracturedCalmEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    int goaded = 0;
    for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game)) {
        if (permanent.getAttachments().stream().map(game::getPermanent).filter(Objects::nonNull).noneMatch(p -> p.isControlledBy(source.getControllerId()) && p.hasSubtype(SubType.AURA, game))) {
            continue;
        }
        game.addEffect(new GoadTargetEffect().setTargetPointer(new FixedTarget(permanent, game)), source);
        goaded++;
    }
    if (goaded < 1) {
        return false;
    }
    Permanent permanent = source.getSourcePermanentIfItStillExists(game);
    if (permanent != null) {
        permanent.addCounters(CounterType.P1P1.createInstance(goaded), source, game);
    }
    return true;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) GoadTargetEffect(mage.abilities.effects.common.combat.GoadTargetEffect)

Aggregations

GoadTargetEffect (mage.abilities.effects.common.combat.GoadTargetEffect)3 FixedTarget (mage.target.targetpointer.FixedTarget)3 Permanent (mage.game.permanent.Permanent)2 UntapTargetEffect (mage.abilities.effects.common.UntapTargetEffect)1 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)1 GainControlTargetEffect (mage.abilities.effects.common.continuous.GainControlTargetEffect)1 Player (mage.players.Player)1 TargetPermanent (mage.target.TargetPermanent)1 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)1 TargetPointer (mage.target.targetpointer.TargetPointer)1