Package mage.game

Examples of mage.game.Game.fireEvent()


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


                        for (UUID blockerId: group.getBlockers()) {
                            sim.getPlayer(defenderId).declareBlocker(defenderId, blockerId, attackerId, sim);
                        }
                    }
                }
                sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_BLOCKERS, defenderId, defenderId));
                SimulationNode newNode = new SimulationNode(node, sim, defenderId);
                if (logger.isDebugEnabled()) {
                    logger.debug(indent(node.depth) + "simulating block for player:" + game.getPlayer(defenderId).getName());
                }
                sim.checkStateAndTriggered();
View Full Code Here

                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)) {
                    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, false);
                                }
                            }
                            sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_ATTACKERS, playerId, playerId));
                            SimulationNode newNode = new SimulationNode(node, sim, activePlayerId);
                            logger.debug(indent(node.depth) + "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(node, sim, defenderId);
                                    logger.debug(indent(node.depth) + "simulating -- node #:" + SimulationNode.getCount() + " declare blockers");
                                    newNode.setCombat(sim.getCombat());
                                    node.children.add(newNode);
                                }
View Full Code Here

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

        //add a node with no blockers
        Game sim = game.copy();
        engagements.put(sim.getCombat().getValue().hashCode(), 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, false);
                }
            }
            sim.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_ATTACKERS, attackerId, attackerId));
            SimulationNode newNode = new SimulationNode(node, sim, attackerId);
            if (logger.isDebugEnabled()) {
                logger.debug(indent(node.depth) + "simulating attack for player:" + game.getPlayer(attackerId).getName());
            }
            sim.checkStateAndTriggered();
View Full Code Here

            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_ATTACKERS_STEP_POST, sim.getActivePlayerId(), sim.getActivePlayerId()));
            Combat simCombat = sim.getCombat().copy();
            sim.getPhase().setStep(new DeclareBlockersStep());
            val = simulateCombat(sim, newNode, alpha, beta, counter);
            if (!attackerId.equals(playerId)) {
                if (val < beta) {
View Full Code Here

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

        }

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

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

        return new ArrayList<>(engagements.values());
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.