1234567891011121314151617 |
- /// <reference path="../AI.ts" />
- module AIRules {
- export var attackInRange = AI.combatRules.createAndAddRule({
- name : "Attack in range",
- firstPriority : AIRules.PRIORITY_ACTING_ON_SITUATION,
- code : (runner : RulebookRunner<Person>) => {
- let person = runner.noun;
- let hostileTo = person.AI.hostileTo;
- for (let i = 0; i < hostileTo.length; i++) {
- if (hostileTo[i].isVisibleTo(person)) {
- return new ActionAttack(person, hostileTo[i]);
- }
- }
- }
- });
- }
|