Search in sources :

Example 6 with SoldierToken

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

the class LieutenantsOfTheGuardEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    // Outcome.Benefit - AI will boost all the time (Strength choice)
    // TODO: add AI hint logic in the choice method, see Tyrant's Choice as example
    TwoChoiceVote vote = new TwoChoiceVote("Strength (+1/+1 counter)", "Numbers (1/1 token)", Outcome.Benefit);
    vote.doVotes(source, game);
    int strengthCount = vote.getVoteCount(true);
    int numbersCount = vote.getVoteCount(false);
    Permanent permanent = source.getSourcePermanentIfItStillExists(game);
    if (strengthCount > 0 && permanent != null) {
        permanent.addCounters(CounterType.P1P1.createInstance(strengthCount), source.getControllerId(), source, game);
    }
    if (numbersCount > 0) {
        new SoldierToken().putOntoBattlefield(numbersCount, game, source, source.getControllerId());
    }
    return strengthCount + numbersCount > 0;
}
Also used : SoldierToken(mage.game.permanent.token.SoldierToken) Permanent(mage.game.permanent.Permanent) TwoChoiceVote(mage.choices.TwoChoiceVote)

Example 7 with SoldierToken

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

the class BasriKetTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    int attackingNonTokens = 0;
    for (UUID attacker : game.getCombat().getAttackers()) {
        Permanent permanent = game.getPermanent(attacker);
        if (filter.match(permanent, game)) {
            attackingNonTokens++;
        }
    }
    if (attackingNonTokens > 0) {
        this.getEffects().clear();
        addEffect(new CreateTokenEffect(new SoldierToken(), attackingNonTokens, true, true));
        return true;
    }
    return false;
}
Also used : SoldierToken(mage.game.permanent.token.SoldierToken) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) UUID(java.util.UUID)

Aggregations

SoldierToken (mage.game.permanent.token.SoldierToken)7 Permanent (mage.game.permanent.Permanent)4 Player (mage.players.Player)4 UUID (java.util.UUID)3 CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)3 Effect (mage.abilities.effects.Effect)2 OneShotEffect (mage.abilities.effects.OneShotEffect)2 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)2 CreateTokenTargetEffect (mage.abilities.effects.common.CreateTokenTargetEffect)1 TwoChoiceVote (mage.choices.TwoChoiceVote)1 FilterPermanent (mage.filter.FilterPermanent)1 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)1 Token (mage.game.permanent.token.Token)1 Target (mage.target.Target)1 TargetPlayer (mage.target.TargetPlayer)1 TargetControlledPermanent (mage.target.common.TargetControlledPermanent)1 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)1 FixedTarget (mage.target.targetpointer.FixedTarget)1