Search in sources :

Example 1 with MustBeBlockedByTargetSourceEffect

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

the class CrashingBoarsEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player defendingPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
    if (defendingPlayer != null) {
        Target target = new TargetControlledCreaturePermanent(1, 1, filter, true);
        if (target.choose(Outcome.Neutral, defendingPlayer.getId(), source.getSourceId(), game)) {
            RequirementEffect effect = new MustBeBlockedByTargetSourceEffect();
            effect.setTargetPointer(new FixedTarget(target.getFirstTarget(), game));
            game.addEffect(effect, source);
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) RequirementEffect(mage.abilities.effects.RequirementEffect) Player(mage.players.Player) Target(mage.target.Target) FixedTarget(mage.target.targetpointer.FixedTarget) TargetControlledCreaturePermanent(mage.target.common.TargetControlledCreaturePermanent) MustBeBlockedByTargetSourceEffect(mage.abilities.effects.common.combat.MustBeBlockedByTargetSourceEffect)

Aggregations

RequirementEffect (mage.abilities.effects.RequirementEffect)1 MustBeBlockedByTargetSourceEffect (mage.abilities.effects.common.combat.MustBeBlockedByTargetSourceEffect)1 Player (mage.players.Player)1 Target (mage.target.Target)1 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)1 FixedTarget (mage.target.targetpointer.FixedTarget)1