// Lockpick.js
(function () {
/*global adventurejs A*/
"use strict";
/**
* @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Key.Lockpick
* @augments adventurejs.Key
* @class adventurejs.Lockpick
* @ajsconstruct MyGame.createAsset({ "class":"Lockpick", "name":"foo", [...] })
* @ajsconstructedby adventurejs.Game#createAsset
* @ajsnavheading KeyClasses
* @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.
* @tutorial CreateKey
* @classdesc
* <p>
* <strong>Lockpick</strong> is a subclass of
* {@link adventurejs.Key|Key}
* that can be used to unlock locked
* {@link adventurejs.Asset|Assets}.
* Lockpick has
* <code>quirks.pick_means_unlock</code>
* set to true, which makes
* <code class="property">pick lock with lockpick</code>
* equivalent to
* <code class="property">unlock lock with key</code>.
* The interaction is determined by properties on both objects.
* The Lockpick will have a list of Asset
* <a href="#id">IDs</a> it can unlock in its
* <code class="property">asset.iov.unlock.with_assets</code>,
* and the locked object will also have the
* Lockpick ID listed in its
* <code class="property">asset.dov.unlock.with_assets</code>.
* property. (You can set just one or the other in your game file.
* As long as one is set, the Lockpick and Lock will be associated during
* initialization.) The locked object will also have
* asset.dov.lock.enabled set to true. See the example below to create a Lockpick and
* a locked chest.
* </p>
* <pre class="display"><code class="language-javascript">MyGame.createAsset({
* class: "Lockpick",
* name: "iron lockpick",
* place: { in: "Treasure Room" },
* iov: { pick: { with_assets: ['treasure chest'], }, },
* });
* MyGame.createAsset({
* class: "Chest",
* name: "iron chest",
* place: { in: "Treasure Room" },
* dov: { pick: { with_assets: ['iron lockpick'], }, },
* is: { locked: true, },
* });
* </code></pre>
**/
class Lockpick extends adventurejs.Key {
constructor(name, game_name) {
super(name, game_name);
this.class = "Lockpick";
this.singlePluralPairs = [
["pick", "picks"],
["lockpick", "lockpicks"],
];
this.setIOV("pick");
this.quirks.pick_means_unlock = true;
}
}
adventurejs.Lockpick = Lockpick;
})();