Search in sources :

Example 1 with HunterToken

use of mage.game.permanent.token.HunterToken in project mage by magefree.

the class JabbaTheHuttEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        CreateTokenEffect effect = new CreateTokenEffect(new HunterToken(), 1, true, false);
        effect.apply(game, source);
        Permanent token = game.getPermanent(effect.getLastAddedTokenIds().get(0));
        Permanent opponentCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
        if (token != null && opponentCreature != null) {
            return token.fight(opponentCreature, source, game);
        }
    }
    return false;
}
Also used : Player(mage.players.Player) TargetOpponentsCreaturePermanent(mage.target.common.TargetOpponentsCreaturePermanent) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) FilterOpponentsCreaturePermanent(mage.filter.common.FilterOpponentsCreaturePermanent) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) HunterToken(mage.game.permanent.token.HunterToken)

Aggregations

CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)1 FilterOpponentsCreaturePermanent (mage.filter.common.FilterOpponentsCreaturePermanent)1 Permanent (mage.game.permanent.Permanent)1 HunterToken (mage.game.permanent.token.HunterToken)1 Player (mage.players.Player)1 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)1 TargetOpponentsCreaturePermanent (mage.target.common.TargetOpponentsCreaturePermanent)1