Examples of StackAbility


Examples of mage.game.stack.StackAbility

                    ability = options.get(0);
                else
                    ability = options.get(rnd.nextInt(options.size()));
            }
            if (ability.isUsesStack()) {
                game.getStack().push(new StackAbility(ability, playerId));
                if (ability.activate(game, false)) {
                    actionCount++;
                    return true;
                }
            } else {
View Full Code Here

Examples of mage.game.stack.StackAbility

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event.getType() == GameEvent.EventType.ACTIVATED_ABILITY) {
            Permanent equipment = game.getPermanent(this.getSourceId());
            if (equipment != null && equipment.getAttachedTo() != null && equipment.getAttachedTo().equals(event.getSourceId())) {
                StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
                if (!(stackAbility.getStackAbility() instanceof ManaAbility)) {
                    Effect effect = this.getEffects().get(0);
                    effect.setValue("stackAbility", stackAbility.getStackAbility());
                    return true;
                }
            }
        }
        return false;
View Full Code Here

Examples of mage.game.stack.StackAbility

        Player controller = game.getPlayer(source.getControllerId());
        Permanent sourcePermanent = game.getPermanent(source.getSourceId());
        if (ability != null && controller != null && sourcePermanent != null) {
            Ability newAbility = ability.copy();
            newAbility.newId();
            game.getStack().push(new StackAbility(newAbility, source.getControllerId()));
            if (newAbility.getTargets().size() > 0) {
                if (controller.chooseUse(newAbility.getEffects().get(0).getOutcome(), "Choose new targets?", game)) {
                    newAbility.getTargets().clearChosen();
                    if (newAbility.getTargets().chooseTargets(newAbility.getEffects().get(0).getOutcome(), source.getControllerId(), newAbility, game) == false) {
                        return false;
View Full Code Here

Examples of mage.game.stack.StackAbility

            Emblem emblem = (Emblem) object;
            this.rarity = Rarity.SPECIAL;
            this.rules = emblem.getAbilities().getRules(emblem.getName());
        }
        if (this.rarity == null && object instanceof StackAbility) {
            StackAbility stackAbility = (StackAbility)object;
            this.rarity = Rarity.NA;
            this.rules = new ArrayList<>();
            this.rules.add(stackAbility.getRule());
            if (stackAbility.getZone().equals(Zone.COMMAND)) {
                this.expansionSetCode = stackAbility.getExpansionSetCode();
            }
        }
    }
View Full Code Here

Examples of mage.game.stack.StackAbility

                        }
                        stack.put(stackObject.getId(),
                                new StackAbilityView(game, (StackAbility)stackObject, object.getName(), new CardView(new EmblemView(((Emblem)object),sourceCard))));
                        checkPaid(stackObject.getId(), ((StackAbility)stackObject));
                    } else {
                        StackAbility stackAbility = ((StackAbility)object);
                        stackAbility.newId();
                        stack.put(stackObject.getId(), new CardView(((StackAbility)stackObject)));
                        checkPaid(stackObject.getId(), ((StackAbility)stackObject));
                    }
                } else {
                    logger.error("Stack Object for stack ability not found: " + stackObject.getStackAbility().getRule());
View Full Code Here

Examples of mage.game.stack.StackAbility

            if (effect != null && ability.getControllerId().equals(playerId)) {
                Target target = effect.getTarget();
                if (!target.doneChosing()) {
                    for (UUID targetId: target.possibleTargets(ability.getSourceId(), ability.getControllerId(), game)) {
                        Game sim = game.copy();
                        StackAbility newAbility = (StackAbility) ability.copy();
                        SearchEffect newEffect = getSearchEffect((StackAbility) newAbility);
                        newEffect.getTarget().addTarget(targetId, newAbility, sim);
                        sim.getStack().push(newAbility);
                        SimulationNode newNode = new SimulationNode(node, sim, ability.getControllerId());
                        node.children.add(newNode);
View Full Code Here

Examples of mage.game.stack.StackAbility

        Ability ability = source.copy();
        List<Ability> options = getPlayableOptions(ability, game);
        if (options.isEmpty()) {
            if (logger.isDebugEnabled())
                logger.debug("simulating -- triggered ability:" + ability);
            game.getStack().push(new StackAbility(ability, playerId));
            ability.activate(game, false);
            game.applyEffects();
            game.getPlayers().resetPassed();
        }
        else {
View Full Code Here

Examples of mage.game.stack.StackAbility

        return true;
    }

    protected void addAbilityNode(SimulationNode parent, Ability ability, Game game) {
        Game sim = game.copy();
        sim.getStack().push(new StackAbility(ability, playerId));
        ability.activate(sim, false);
        sim.applyEffects();
        SimulationNode newNode = new SimulationNode(parent, sim, playerId);
        logger.debug(indent(newNode.getDepth()) + "simulating -- node #:" + SimulationNode.getCount() + " triggered ability option");
        for (Target target: ability.getTargets()) {
View Full Code Here

Examples of mage.game.stack.StackAbility

    }

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (EventType.ACTIVATED_ABILITY.equals(event.getType()) && event.getSourceId().equals(getSourceId())) {
            StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getTargetId());
            if (stackAbility != null && (stackAbility.getStackAbility() instanceof OutlastAbility)) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

Examples of mage.game.stack.StackAbility

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event.getType() == EventType.ACTIVATED_ABILITY) {
            Card source = game.getPermanentOrLKIBattlefield(event.getSourceId());
            if (source.getCardType().contains(CardType.ARTIFACT)) {
                StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
                if (!(stackAbility.getStackAbility() instanceof ManaAbility)) {
                    Effect effect = this.getEffects().get(0);
                    effect.setValue("stackAbility", stackAbility.getStackAbility());
                    return true;
                }
            }
        }
        return false;
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.