Examples of applyEffects()


Examples of mage.game.Game.applyEffects()

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

Examples of mage.game.Game.applyEffects()

        logger.fine("simulating attack -- node#: " + SimulationNode.getCount());
      sim.checkStateAndTriggered();
      while (!sim.getStack().isEmpty()) {
        sim.getStack().resolve(sim);
        logger.fine("resolving triggered abilities");
        sim.applyEffects();
      }
      sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARE_ATTACKERS_STEP_POST, sim.getActivePlayerId(), sim.getActivePlayerId()));
      Combat simCombat = sim.getCombat().copy();
      sim.getPhase().setStep(new DeclareBlockersStep());
      val = simulateCombat(sim, newNode, depth-1, alpha, beta, counter);
View Full Code Here

Examples of mage.game.Game.applyEffects()

          logger.fine("simulating block -- node#: " + SimulationNode.getCount());
        sim.checkStateAndTriggered();
        while (!sim.getStack().isEmpty()) {
          sim.getStack().resolve(sim);
          logger.fine("resolving triggered abilities");
          sim.applyEffects();
        }
        sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARE_BLOCKERS_STEP_POST, sim.getActivePlayerId(), sim.getActivePlayerId()));
        Combat simCombat = sim.getCombat().copy();
        finishCombat(sim);
        if (sim.isGameOver()) {
View Full Code Here

Examples of mage.game.Game.applyEffects()

    if (logger.isLoggable(Level.FINE))
      logger.fine("simulating -- adding " + allActions.size() + " children:" + allActions);
    for (Ability action: allActions) {
      Game sim = game.copy();
      if (sim.getPlayer(playerId).activateAbility((ActivatedAbility) action.copy(), sim)) {
        sim.applyEffects();
        if (!sim.isGameOver() && action.isUsesStack()) {
          // only pass if the last action uses the stack
          sim.getPlayer(currentPlayer.getId()).pass();
          sim.getPlayerList().getNext();
        }
View Full Code Here

Examples of mage.game.Game.applyEffects()

        sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_BLOCKERS, defendingPlayerId, defendingPlayerId));

        sim.checkStateAndTriggered();
        while (!sim.getStack().isEmpty()) {
            sim.getStack().resolve(sim);
            sim.applyEffects();
        }
        sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARE_BLOCKERS_STEP_POST, sim.getActivePlayerId(), sim.getActivePlayerId()));

        simulateStep(sim, new FirstCombatDamageStep());
        simulateStep(sim, new CombatDamageStep());
View Full Code Here

Examples of mage.game.Game.applyEffects()

        simulateStep(sim, new EndOfCombatStep());
        // The following commented out call produces random freezes.
        //sim.checkStateAndTriggered();
        while (!sim.getStack().isEmpty()) {
            sim.getStack().resolve(sim);
            sim.applyEffects();
        }

        return new SurviveInfo(!sim.getBattlefield().containsPermanent(attacker.getId()), !sim.getBattlefield().containsPermanent(blocker.getId()));
    }
View Full Code Here

Examples of mage.game.Game.applyEffects()

        sim.checkStateAndTriggered();
        while (!sim.getStack().isEmpty()) {
            triggered = true;
            sim.getStack().resolve(sim);
            sim.applyEffects();
        }
        sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARE_BLOCKERS_STEP_POST, sim.getActivePlayerId(), sim.getActivePlayerId()));

        simulateStep(sim, new FirstCombatDamageStep());
        simulateStep(sim, new CombatDamageStep());
View Full Code Here

Examples of mage.game.Game.applyEffects()

        // The following commented out call produces random freezes.
        //sim.checkStateAndTriggered();
        while (!sim.getStack().isEmpty()) {
            triggered = true;
            sim.getStack().resolve(sim);
            sim.applyEffects();
        }

        return new SurviveInfo(!sim.getBattlefield().containsPermanent(attacker.getId()), false, sim.getPlayer(defenderId), triggered);
    }
View Full Code Here

Examples of mage.game.Game.applyEffects()

                }
                sim.checkStateAndTriggered();
                while (!sim.getStack().isEmpty()) {
                    sim.getStack().resolve(sim);
                    logger.debug(indent(node.depth) + "resolving triggered abilities");
                    sim.applyEffects();
                }
                sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARE_BLOCKERS_STEP_POST, sim.getActivePlayerId(), sim.getActivePlayerId()));
                Combat simCombat = sim.getCombat().copy();
                finishCombat(sim);
                if (sim.gameOver(null)) {
View Full Code Here

Examples of mage.game.Game.applyEffects()

                logger.debug(indent(node.depth) + "interrupted");
                break;
            }
            Game sim = game.copy();
            if (sim.getPlayer(currentPlayer.getId()).activateAbility((ActivatedAbility) action.copy(), sim)) {
                sim.applyEffects();
                if (checkForUselessAction(sim, node, action, currentPlayer.getId())) {
                    logger.debug(indent(node.depth) + "found useless action: " + action);
                    continue;
                }
                if (!sim.gameOver(null) && action.isUsesStack()) {
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.