Package mage.game

Examples of mage.game.Game.fireEvent()


    if (numGroups == 0) return new ArrayList<Combat>();

    //add a node with no blockers
    Game sim = game.copy();
    engagements.put(sim.getCombat().getValue(sim), sim.getCombat());
    sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_BLOCKERS, playerId, playerId));

    List<Permanent> blockers = getAvailableBlockers(game);
    addBlocker(game, blockers, engagements);

    return new ArrayList<Combat>(engagements.values());
View Full Code Here


      for (CombatGroup group: engagement.getGroups()) {
        for (UUID attackId: group.getAttackers()) {
          sim.getPlayer(attackerId).declareAttacker(attackId, defenderId, sim);
        }
      }
      sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_ATTACKERS, playerId, playerId));
      SimulationNode newNode = new SimulationNode(sim, depth, game.getActivePlayerId());
      if (logger.isLoggable(Level.FINE))
        logger.fine("simulating attack -- node#: " + SimulationNode.getCount());
      sim.checkStateAndTriggered();
      while (!sim.getStack().isEmpty()) {
View Full Code Here

      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);
      if (!attackerId.equals(playerId)) {
        if (val < beta) {
View Full Code Here

          UUID attackerId = group.getAttackers().get(0);
          for (UUID blockerId: group.getBlockers()) {
            sim.getPlayer(defenderId).declareBlocker(blockerId, attackerId, sim);
          }
        }
        sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_BLOCKERS, playerId, playerId));
        SimulationNode newNode = new SimulationNode(sim, depth, defenderId);
        if (logger.isLoggable(Level.FINE))
          logger.fine("simulating block -- node#: " + SimulationNode.getCount());
        sim.checkStateAndTriggered();
        while (!sim.getStack().isEmpty()) {
View Full Code Here

        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()) {
          val = GameStateEvaluator.evaluate(playerId, sim);
        }
View Full Code Here

              for (CombatGroup group: engagement.getGroups()) {
                for (UUID attackerId: group.getAttackers()) {
                  sim.getPlayer(activePlayerId).declareAttacker(attackerId, defenderId, sim);
                }
              }
              sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_ATTACKERS, playerId, playerId));
              SimulationNode newNode = new SimulationNode(sim, node.getDepth()-1, activePlayerId);
              logger.fine("simulating -- node #:" + SimulationNode.getCount() + " declare attakers");
              newNode.setCombat(sim.getCombat());
              node.children.add(newNode);
            }
View Full Code Here

                  for (CombatGroup group: engagement.getGroups()) {
                    for (UUID blockerId: group.getBlockers()) {
                      group.addBlocker(blockerId, defenderId, sim);
                    }
                  }
                  sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_BLOCKERS, playerId, playerId));
                  SimulationNode newNode = new SimulationNode(sim, node.getDepth()-1, defenderId);
                  logger.fine("simulating -- node #:" + SimulationNode.getCount() + " declare blockers");
                  newNode.setCombat(sim.getCombat());
                  node.children.add(newNode);
                }
View Full Code Here

        if (blocker == null || attacker == null || sim.getPlayer(defendingPlayerId) == null) {
            return null;
        }

        sim.getPlayer(defendingPlayerId).declareBlocker(defendingPlayerId, blocker.getId(), attacker.getId(), sim);
        sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_BLOCKERS, defendingPlayerId, defendingPlayerId));

        sim.checkStateAndTriggered();
        while (!sim.getStack().isEmpty()) {
            sim.getStack().resolve(sim);
            sim.applyEffects();
View Full Code Here

        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());
        simulateStep(sim, new EndOfCombatStep());
        // The following commented out call produces random freezes.
View Full Code Here

        combat.setDefenders(sim);

        UUID defenderId = sim.getCombat().getDefenders().iterator().next();
        boolean triggered = false;

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

        sim.checkStateAndTriggered();
        while (!sim.getStack().isEmpty()) {
            triggered = true;
            sim.getStack().resolve(sim);
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.