示例#1
0
  /*-------------------------------------------------------------------------*/
  @Override
  public java.util.List<MazeEvent> springTrap() {
    Maze maze = Maze.getInstance();

    java.util.List<MazeEvent> result = new ArrayList<MazeEvent>();

    Point tile = maze.getTile();
    int facing = maze.getFacing();

    if (getTraps() != null && getTraps().size() > 0 && getCurrentTrap() != null) {
      result.addAll(getCurrentTrap().getPayload().execute(maze, tile, tile, facing));
    }

    if (maze.getCurrentCombat() != null) {
      // something has started a combat
      // leave the chest basically unopened
      return result;
    }

    // check if trap has killed the party
    result.add(new CheckPartyStatusEvent());

    if (Maze.getInstance().getParty() != null && Maze.getInstance().getParty().numAlive() > 0) {
      result.addAll(executeChestContents());
    }

    return result;
  }
示例#2
0
  /*-------------------------------------------------------------------------*/
  @Override
  public java.util.List<MazeEvent> executeChestContents() {
    Maze maze = Maze.getInstance();

    java.util.List<MazeEvent> result = new ArrayList<MazeEvent>();

    Point tile = maze.getTile();
    int facing = maze.getFacing();

    // chest opens
    result.add(new MazeScriptEvent("_OPEN_CHEST_"));

    // chest contents
    result.addAll(getChestContents().execute(maze, tile, tile, facing));

    // clean up and back to movement
    result.add(new SetChestStateEvent(this, Chest.State.EMPTY));
    result.add(new RemoveObjectEvent(getEngineObject()));
    result.add(new SetStateEvent(maze, Maze.State.MOVEMENT));

    return result;
  }