// Pen.js
(function () {
/*global adventurejs A*/
"use strict";
/**
* @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.WritingImplement.Pen
* @augments adventurejs.WritingImplement
* @class adventurejs.Pen
* @ajsconstruct MyGame.createAsset({ "class":"Pen", "name":"foo", [...] })
* @ajsconstructedby adventurejs.Game#createAsset
* @ajsnavheading WritingClasses
* @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 A writing implement.
* @classdesc
* <p>
* <strong>Pen</strong> is a subclass of
* {@link adventurejs.WritingImplement|WritingImplement}.
* Pens and other WritingImplements have their
* <code class="property">iov.write.enabled</code>
* property set to true, which allows a player to write on things
* with <code class="property">asset.dov.write.enabled</code>
* set to true, such as {@link adventurejs.Paper|Paper}.
* </p>
* <p>
* All that distinguishes Pen from other WritingImplements
* is that its
* <code class="property">attached</code>
* {@link adventurejs.Aspect|Aspect}
* allows an instance of class
* {@link adventurejs.PenCap|PenCap} to be attached.
* </p>
* <h3 class="examples">Example:</h3>
* <pre class="display"><code class="language-javascript">MyGame.createAsset({
* class: "Pen",
* name: "red pen",
* article: "a",
* adjectives: "red",
* place: { on: "table" },
* descriptions: { look: "It's a pen with red ink. ", },
* });
* MyGame.createAsset({
* class: "PenCap",
* name: "pen cap",
* article: "a",
* place: { on: "table" },
* descriptions: { look: "It's a cap for a pen. ", },
* });
* MyGame.createAsset({
* class: "Paper",
* name: "construction paper",
* descriptions: { look: "It's a pink sheet of construction paper. ", },
* adjectives: ["pink"]
* place: { on: "bottom drawer" },
* });
* </code></pre>
* <p>
* The above example uses
* <code class="property">with_classes</code>
* to limit what a
* player can put in without having to write custom
* failure code for every object. To learn more, see
* <a href="/doc/Tangibles_Aspects.html">How to Use Aspects</a>.
* </p>
**/
class Pen extends adventurejs.WritingImplement {
constructor(name, game_name) {
super(name, game_name);
this.class = "Pen";
this.noun = "pen";
this.plural = "pens";
this.singlePluralPairs = [["pen", "pens"]];
this.group = ["writing implements"];
this.aspects.attached = new adventurejs.Aspect(
"attached",
this.game_name
).set({
parent_id: this.id,
list_in_room: false,
list_in_examine: true,
maxcount: 1, // presumably a cap
with_classes: ["PenCap"],
});
}
}
adventurejs.Pen = Pen;
})();