Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// rochambeau.js

(function () {
  /* global adventurejs A */

  /**
   * @augments {adventurejs.Verb}
   * @class rochambeau
   * @ajsnode game.dictionary.verbs.rochambeau
   * @ajsconstruct MyGame.createVerb({ "name": "rochambeau", [...] });
   * @ajsconstructedby adventurejs.Dictionary#createVerb
   * @hideconstructor
   * @ajsinstanceof Verb
   * @ajsnavheading AltercationVerbs
   * @summary Verb meaning rochambeau asset.
   * @ajssynonyms rochambeau
   * @tutorial BasicVerbs_Subscriptions
   * @tutorial AdvancedVerbs_VerbAnatomy
   * @tutorial AdvancedVerbs_VerbProcess
   * @tutorial AdvancedVerbs_ModifyVerbs
   * @tutorial AdvancedVerbs_ModifyVerbs
   * @classdesc
   * <pre class="display border outline">
   * <span class="ajs-player-input">&gt; rochambeau troll</span>
   * You rochambeau the troll. The troll stares at you for a long time. Honestly, long enough that it starts to feel kind of awkward. Trolls are infamously hard to read and you're just not sure what to make of it. You've just about decided to turn and run when the troll expels a loud breath that you didn't realize it was holding, pitches forward onto its knees, and then to the ground, where it clamps its hands to its groin and rolls into a foetal position. Apparently you've won the fight.
   * </pre>
   * <p>
   * <strong>Rochambeau</strong> a
   * {@link adventurejs.Character|Character}
   * {@link adventurejs.Asset|Asset}.
   * Requires that the Asset to be rochambeaued has
   * asset.dov.rochambeau.enabled
   * set to true and asset.gender = male.
   * By default, no special results will occur.
   * Authors wanting to make use of it may need to use a method such
   * as verb hooks. See
   * <a href="/doc/BasicVerbs_PhaseHooks.html">Verb Phases</a>
   * to learn more.
   * </p>
   * @ajsverbreactions
   * @ajsverbphases doBeforeTry, doAfterTry, doBeforeSuccess, doAfterSuccess
   * </div>
   */
  A.Preverbs.rochambeau = {
    name: "rochambeau",
    prettyname: "rochambeau",
    past_tense: "rochambeaued",
    synonyms: ["rochambeau"],
    gerund: "rochambeauing",

    /**
     * @ajsverbstructures
     * @memberof rochambeau
     */
    accepts_structures: ["verb noun"],

    /**
     * @memberof rochambeau
     * @ajsverbphrase
     * phrase1:
     * {
     *   accepts_noun:true,
     *   requires_noun:true,
     *   noun_must_be:
     *   {
     *     known: true,
     *     tangible: true,
     *     present: true,
     *     visible: true,
     *     reachable: true,
     *   },
     * },
     */
    phrase1: {
      accepts_noun: true,
      requires_noun: true,
      noun_must_be: {
        known: true,
        character: true,
        present: true,
        visible: true,
        reachable: true,
      },
    },

    /**
     * @memberof hit
     * @ajsverbparams
     * with_params: {},
     */
    with_params: {},

    doTry: function () {
      var input = this.game.getInput();
      var subject = input.getSubject();
      var direct_object = input.getAsset(1);
      var indirect_object = input.getAsset(2);
      var indirect_preposition = input.getPreposition(2);
      var indirect_inferred;
      var results;
      var msg = "";

      // verb enabled?
      if (!direct_object.isDOV(this.name)) {
        this.game.debug(
          `D1629`,
          `${this.name}.js `,
          ` ${direct_object.id}.dov.${this.name}.enabled is false `
        );
        msg += `{We} can't ${this.name} ${direct_object.articlename}. `;
        this.handleFailure(msg);
        return null;
      }

      // male?
      if (!direct_object.gender === "male") {
        this.game.debug(
          `D1630`,
          `${this.name}.js `,
          ` ${direct_object.id}.gender !== male `
        );
        msg += `${direct_object.Articlename} hasn't even got balls, that {we're} aware of. `;
        this.handleFailure(msg);
        return null;
      }

      // verb state? skip

      // single use direct object?
      if (
        direct_object.allowVerbOnce(this.name, "dov") &&
        direct_object.didVerb(this.name, "dov")
      ) {
        this.game.debug(
          `D1631`,
          `${this.name}.js `,
          ` ${direct_object.id}.dov.${this.name}.once and ${direct_object.id}.did.${this.name}.directly `
        );
        msg += `{We've} already ${this.past_tense} ${direct_object.articlename} enough. `;
        this.handleFailure(msg);
        return false;
      }

      return true;
    },

    doSuccess: function () {
      var input = this.game.getInput();
      var subject = input.getSubject();
      var direct_object = input.getAsset(1);
      var direct_preposition = input.getPreposition(1);
      var indirect_object = input.getAsset(2);
      var indirect_preposition = input.getPreposition(2);
      var results;
      var msg = "";

      // compose output
      msg += `{We} ${this.agree()} ${direct_object.articlename}, right in the nuts! `;

      // --------------------------------------------------
      // print output
      // --------------------------------------------------
      return this.handleSuccess(msg);
    },
  };
})(); // hit