// Bicycle.js
(function () {
/*global adventurejs A*/
"use strict";
/**
* @ajstangiblecontainer on
* @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Rideable.Bicycle
* @augments adventurejs.Rideable
* @class adventurejs.Bicycle
* @ajsconstruct MyGame.createAsset({ "class":"Bicycle", "name":"foo", [...] })
* @ajsconstructedby adventurejs.Game#createAsset
* @ajsnavheading SportsEquipment
* @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 I want to ride my bicycle I want to ride my bike.
* @tutorial Tangibles_SimpleVehicles
* @classdesc
* <p>
* <strong>Bicycle</strong> is a child class of
* {@link adventurejs.Rideable|Rideable},
* which are unique in that
* {@link adventurejs.Player|Player}
* can both carry them in
* inventory and simultaneously be nested in/on them.
* Nesting is a special kind of parent/child relationship that
* is only used for
* {@link adventurejs.Character|Characters}.
* For more information about the unique behavior of this class,
* see the {@link adventurejs.Rideable|Rideable} page, or see
* <a href="/doc/Tangibles_SimpleVehicles.html">Simple Vehicles</a>.
* </p>
* <h3 class="examples">Example:</h3>
* <pre class="display"><code class="language-javascript">MyGame.createAsset({
* class: "Bicycle",
* name: "Sting Ray",
* synonyms: ["bike"], // the word "bicycle" is already provided with the class
* adjectives: ["Schwinn", "banana"],
* place: { in: "Garage" },
* descriptions: { look: "It's a classic Schwinn Sting Ray bicycle with banana seat. ", },
* customNestThatToThis: { // see <a href="/doc/Scripting_VerbActions.html">Verb Actions</a>
* "My Player": function(){
* MyGame.prependToOutput( "You wobble a bit getting on the bike. " );
* MyGame.appendToOutput( "Whew! " );
* // see <a href="/doc/Scripting_CustomizeOutput.html">Customize Output</a>
* }
* },
* customUnnestThatFromThis: {
* "My Player": function(){
* MyGame.prependToOutput( "You nearly fall getting off the bike. " );
* MyGame.appendToOutput( "Back on solid ground. " );
* }
* },
* });
* </code></pre>
* <p>
* The example above includes the use of several advanced methods
* that are worth noting:
* </p>
* <ul>
* <li>
* {@link adventurejs.Tangible#customNestThatToThis|customNestThatToThis}
* and
* {@link adventurejs.Tangible#customUnnestThatFromThis|customUnnestThatFromThis}
* are verb reactions that provide a way to run custom code
* when a Character moves in/out of any other Asset that is
* not a Room. To learn more, see
* <a href="/doc/Scripting_VerbReactions.html">Verb Reactions</a>.
* </li>
* <li>
* {@link adventurejs.Game#prependToOutput|prependToOutput}
* and
* {@link adventurejs.Game#appendToOutput|appendToOutput}
* are methods that provide a way to prepend or append custom
* strings to whatever default message will be output this turn.
* To learn more, see
* <a href="/doc/Scripting_CustomizeOutput.html">Customize Output</a>.
* </li>
* </ul>
**/
class Bicycle extends adventurejs.Rideable {
constructor(name, game_name) {
super(name, game_name);
this.class = "Bicycle";
this.singlePluralPairs = [["bicycle", "bicycles"]];
this.setDOVs(["tie"]);
this.default_aspect = "on";
this.quirks.climb_means_go_on = true;
this.dimensions.size = 7;
this.aspects.on = new adventurejs.Aspect("on", this.game_name).set({
parent_id: this.id,
maxcount: 0,
player: {
posture: "sit",
preposition: "on",
can: { enter: true, sit: true },
},
});
}
}
adventurejs.Bicycle = Bicycle;
})();