|
@@ -4,12 +4,14 @@
|
|
|
/// <reference path="../../Functions.ts" />
|
|
|
|
|
|
interface AIOptions {
|
|
|
+ actor : Thing,
|
|
|
wanderer? : boolean,
|
|
|
wandersOn? : Region,
|
|
|
picksShinies? : boolean
|
|
|
}
|
|
|
|
|
|
class AI {
|
|
|
+ public actor : Thing;
|
|
|
public wanderer = true;
|
|
|
public wandersOn : Region;
|
|
|
public wanderChance = 50;
|
|
@@ -25,16 +27,15 @@ class AI {
|
|
|
* Executing an AI returns an Action. DOESN'T execute the action, just finds it!
|
|
|
* @returns {Promise<Action>}
|
|
|
*/
|
|
|
- public async execute (actor : Thing) : Promise<Action> {
|
|
|
+ public async execute () : Promise<Action> {
|
|
|
let promise : Promise<Action>;
|
|
|
- // TODO: if actor.isInCombat();
|
|
|
if (promise != undefined) {
|
|
|
promise = AI.combatRules.execute({
|
|
|
- noun : actor
|
|
|
+ noun : this.actor
|
|
|
}, ...this.extraCombatRules);
|
|
|
} else {
|
|
|
promise = AI.rules.execute({
|
|
|
- noun : actor
|
|
|
+ noun : this.actor
|
|
|
}, ...this.extraRules);
|
|
|
}
|
|
|
|