Examples of addCounters()


Examples of mage.game.permanent.Permanent.addCounters()

    @Override
    public boolean apply(Game game, Ability source) {       
        Player controller = game.getPlayer(source.getControllerId());
        Permanent sourcePermanent = game.getPermanent(source.getSourceId());
        if (sourcePermanent != null && controller != null) {
            sourcePermanent.addCounters(CounterType.DESPAIR.createInstance(), game);
        }
        if (sourcePermanent == null) {
            sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
        }
        if (sourcePermanent != null && controller != null) {           
View Full Code Here

Examples of mage.game.permanent.Permanent.addCounters()

        if (target == null) {
            return false;
        }
        for (Counter counter : target.getCounters().values()) {
            Counter newCounter = new Counter(counter.getName(), counter.getCount());
            target.addCounters(newCounter, game);
        }
        return true;
    }

    @Override
View Full Code Here

Examples of mage.game.permanent.Permanent.addCounters()

            if (obj != null && obj instanceof SpellAbility) {
                // delete to prevent using it again if put into battlefield from other effect
                setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
                int amount = ((SpellAbility)obj).getManaCostsToPay().getX();
                if (amount > 0) {
                    permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
                }
            }
        }
        return true;
    }
View Full Code Here

Examples of mage.game.permanent.Permanent.addCounters()

        int amountCounters = fromPermanent.getCounters().getCount(CounterType.P1P1);
        if (amountCounters > 0) {
            Player controller = game.getPlayer(source.getControllerId());
            if (controller.getAmount(0, amountCounters, "How many counters do you want to move?", game) > 0){
                fromPermanent.getCounters().removeCounter(CounterType.P1P1, amountCounters);
                toPermanent.addCounters(CounterType.P1P1.createInstance(amountCounters), game);
            }
        }
        return true;
    }
}
View Full Code Here

Examples of mage.game.permanent.Permanent.addCounters()

        Permanent permanent = game.getPermanent(source.getSourceId());
        if (permanent != null && player != null) {
            int amount = game.getBattlefield().countAll(filter1, source.getControllerId(), game) - 1;
            amount += player.getGraveyard().count(filter2, game);
            if (amount > 0) {
                permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
            }
            return true;
        }
        return false;
    }
View Full Code Here

Examples of mage.game.permanent.Permanent.addCounters()

        if (permanent != null) {
            Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
            if (obj != null && obj instanceof SpellAbility) {
                int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
                if (amount > 0) {
                    permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
                }
            }
        }
        return true;
    }
View Full Code Here

Examples of mage.game.permanent.Permanent.addCounters()

            if (obj != null && obj instanceof SpellAbility) {
                // delete to prevent using it again if put into battlefield from other effect
                setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
                int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
                if (amount > 0) {
                    permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
                }
            }
        }
        return true;
    }
View Full Code Here

Examples of mage.game.permanent.Permanent.addCounters()

        if (source.getTargets().size() > 0) {
            Target multiTarget = source.getTargets().get(0);
            for (UUID target: multiTarget.getTargets()) {
                Permanent permanent = game.getPermanent(target);
                if (permanent != null) {
                    permanent.addCounters(CounterType.P1P1.createInstance(multiTarget.getTargetAmount(target)), game);
                }
            }
        }
        return true;
    }
View Full Code Here

Examples of mage.game.permanent.Permanent.addCounters()

    @Override
    public boolean replaceEvent(GameEvent event, Ability source, Game game) {
        Permanent creature = game.getPermanent(event.getTargetId());
        if (creature != null) {
            creature.addCounters(CounterType.P1P1.createInstance(), game);
        }
        discard();
        return false;
    }
View Full Code Here

Examples of mage.game.permanent.Permanent.addCounters()

            for (UUID targetId: getTargetPointer().getTargets(game, source)) {
                Permanent permanent = game.getPermanent(targetId);
                if (permanent != null) {
                    int existingCounters = permanent.getCounters().getCount(CounterType.P1P1);
                    if (existingCounters > 0) {
                        permanent.addCounters(CounterType.P1P1.createInstance(existingCounters), game);
                    }
                }
            }
            return true;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.