Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// Sword.js
(function () {
  /* global adventurejs A */

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.BladedWeapon.Sword
   * @augments adventurejs.BladedWeapon
   * @class adventurejs.Sword
   * @ajsconstruct MyGame.createAsset({ "class":"Sword", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading ToolClasses
   * @param {String} game_name The name of the top level game object.
   * @param {String} name A name for the object, to be serialized and used as ID.
   * @summary Lockpicks can be used to pick locks.
   * @classdesc
   * <p>
   * <strong>Sword</strong> is a subclass of
   * {@link adventurejs.BladedWeapon|BladedWeapon} that
   * can be used to stab or hit.
   * </p>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Sword",
   *   name: "singing sword",
   *   place: { in: "Weapons Locker" },
   * });
   * </code></pre>
   **/
  class Sword extends adventurejs.BladedWeapon {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Sword";
      this.singlePluralPairs = [["sword", "swords"]];
      this.setIOVs(["kill", "hit"]); // stab
    }
  }

  adventurejs.Sword = Sword;
})();