// roboticizeInput.js
(function () {
/* global adventurejs A */
var p = adventurejs.Parser.prototype;
/**
* Remove some common phrases that are polite but unhelpful.
* @memberOf adventurejs.Parser
* @method adventurejs.Parser#roboticizeInput
* @param {String} input
* @returns {String}
*/
p.roboticizeInput = function Parser_roboticizeInput(input) {
this.game.log(
"L1566",
"log",
"high",
`[roboticizeInput.js] roboticizeInput() receive: ${input}`,
"Parser"
);
const this_turn = this.input_history[0];
const last_turn = this.input_history[1];
if (/please /i.test(input)) {
input = input.replace(input, /please /gi, " ");
this_turn.asked_politely = true;
}
// replace "I want to"
if (/i want to /i.test(input)) {
input = input.replace(input, /i want to /gi, "");
this_turn.asked_politely = true;
}
// replace "I want you to"
if (/i want you to /i.test(input)) {
input = input.replace(input, /i want you to /gi, "");
this_turn.asked_politely = true;
}
this.game.log(
"L1567",
"log",
"high",
`[roboticizeInput.js] roboticizeInput() return: ${input}`,
"Parser"
);
return input;
};
})();