1234567891011121314151617181920212223 |
- /// <reference path="../AI.ts" />
- module AIRules {
- export var PickShiny = AI.rules.createAndAddRule({
- name : "Pick Shinies",
- firstPriority : AIRules.PRIORITY_ACTING_ON_PLACE,
- conditions : (runner : RulebookRunner<Person>) => {
- let person = runner.noun;
- return person.AI.picksShinies;
- },
- code : (runner : RulebookRunner<Person>) => {
- let person = runner.noun;
- let visibleThings = person.AI.newNoticed;
- if (visibleThings.length > 0) {
- for (let i = 0; i < visibleThings.length; i++) {
- if (!visibleThings[i].fixedInPlace && visibleThings[i].getShiny()) {
- return new ActionTake(person, visibleThings[i]);
- }
- }
- }
- }
- });
- }
|