Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
A simple example game. chalice, dungeon, demo ChaliceGame

Examples:Chalice Dungeon

A super simple dungeon.

To be written...

 


// ChaliceGame.js
/*global adventurejs A ChaliceGame*/

var ChaliceGame = new adventurejs.Game("ChaliceGame", "ChaliceGameDisplay").set(
  {
    title: "Dungeon!",
    author: "Ivan Cockrum",
    description: "Welcome... to the dungeon!",
    version: "0.0.1",
  }
);

ChaliceGame.settings.set({
  // debug_keywords: { general: true },
  if_input_is_empty_print_room_description: false,
  if_input_is_an_asset_name_examine_it: true,
  if_parser_has_no_response_print_this: "I have no response to your input. ",
  if_input_is_empty_print_this: "I didn't see any input. ",
});

ChaliceGame.createAsset({
  class: "Room",
  name: "Inner Sanctum",
  description:
    "It feels like days since you entered The Dungeon. You've sprung all the traps, won all the battles, answered all the riddles, retrieved your items from the thief, and finally arrived here, at the inner sanctum. After years of questing, {our} goal is finally within reach. You clench your fist around the melted brass key that hangs by a fine chain around your neck. ",
});

ChaliceGame.createAsset({
  class: "Player",
  name: "Swordy McSwordface",
  is: { active: true },
  place: { in: "Inner Sanctum" },
});

ChaliceGame.createAsset({
  class: "Key",
  name: "melted brass key",
  is: {
    known: true,
  },
  iov: { unlock: { with_assets: ["battered chest"] } },
  description:
    "It's a small key, made of brass. It's scarred and a bit melted from some unknown incident, but the teeth appear intact. You've carried it since it was given to you by your father. ",
  article: "a",
  adjectives: ["brass", "melted", "small"],
  synonyms: ["chain"],
  place: { in: "Swordy McSwordface" },
});

ChaliceGame.createAsset({
  class: "Chest",
  name: "battered chest",
  place: { in: "Inner Sanctum" },
  is: {
    closed: true,
    locked: true,
  },
  dov: {
    close: false,
    unlock: { with_assets: ["melted brass key"] },
    open: {
      doAfterSuccess: function () {
        if (ChaliceGame.$("glowing chalice").$is("in", "battered chest")) {
          ChaliceGame.print(
            "The chalice glows warmly inside the chest, drawing you to it. If half of the legends are true..."
          );
        }
      },
    },
  },
  description:
    "The battered chest appears to be made of fire hardened teak or walnut bound with straps of dark, tarnished brass. ",
  adjectives: [
    "treasure",
    "wood",
    "brass",
    "dark",
    "tarnished",
    "teak",
    "walnut",
  ],
  synonyms: ["lock"],
});

ChaliceGame.createAsset({
  class: "Chalice",
  name: "glowing chalice",
  place: { in: "battered chest" },
  description:
    "The chalice glows enticingly, continuously shifting color across the visible spectrum. You've never wanted anything so much in your life. ",
  contains: "godsmead",
  dov: {
    take: {
      doBeforeTry: function () {
        if (ChaliceGame.$("glowing chalice").$is("in", "battered chest")) {
          ChaliceGame.prependTurn(
            "Your hand trembles as you reach for the chalice. "
          );
        }
      },
      doAfterSuccess: function () {
        ChaliceGame.print("Something unseen rumbles deep beneath the earth. ");
      },
    },
  },
}); // chalice

ChaliceGame.createAsset({
  class: "Liquid",
  name: "godsmead",
  description: "The godsmead shimmers like liquid gold. ",
}); // godsmead

Source files