/*-------------------------------------------------------------------------*/
  public List<MazeEvent> resolve() {
    Maze.getInstance().getUserConfig().setProperty(var, value);
    Maze.getInstance().saveUserConfig();

    Maze.log(Log.DEBUG, "setting user config [" + var + "]=[" + value + "]");

    return null;
  }
  /*-------------------------------------------------------------------------*/
  @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;
  }
  /*-------------------------------------------------------------------------*/
  public java.util.List<MazeEvent> handlePlayerAction(
      Maze maze, Point tile, int facing, int playerAction) {
    if (playerAction != PlayerAction.LOCKS) {
      return null;
    }

    if (State.EMPTY.equalsIgnoreCase(MazeVariables.get(this.mazeVariable))) {
      return null;
    }

    maze.encounterChest(this);
    return null;
  }
  /*-------------------------------------------------------------------------*/
  @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;
  }
 /*-------------------------------------------------------------------------*/
 public void initialise(Maze maze, Point tile, int tileIndex) {
   if (!State.EMPTY.equalsIgnoreCase(MazeVariables.get(this.mazeVariable))) {
     engineObject.setTileIndex(tileIndex);
     maze.addObject(engineObject);
   }
 }
 /*-------------------------------------------------------------------------*/
 public List<MazeEvent> resolve() {
   Maze.getInstance().backToMain();
   return null;
 }
 /*-------------------------------------------------------------------------*/
 private void exit() {
   Maze.getInstance().getUi().clearDialog();
 }
 /*-------------------------------------------------------------------------*/
 public int getDelay() {
   return Maze.getInstance().getUserConfig().getCombatDelay();
 }