diff --git a/src/game/ai.ts b/src/game/ai.ts index 5d894d4..7161926 100644 --- a/src/game/ai.ts +++ b/src/game/ai.ts @@ -2,7 +2,7 @@ import { Creature } from './creature' import { Encounter, Action } from './combat' import { LogEntry } from './interface' import { PassAction } from './combat/actions' -import { NoPassDecider, NoReleaseDecider, ChanceDecider, NoSurrenderDecider } from './ai/deciders' +import { NoPassDecider, NoReleaseDecider, ChanceDecider, NoSurrenderDecider, FavorDigestDecider } from './ai/deciders' /** * A Decider determines how favorable an action is to perform. @@ -12,7 +12,7 @@ export interface Decider { } export class AI { - constructor (private deciders: Decider[]) { + constructor (public deciders: Decider[]) { } @@ -67,7 +67,8 @@ export class VoreAI extends AI { new NoReleaseDecider(), new NoSurrenderDecider(), new NoPassDecider(), - new ChanceDecider() + new ChanceDecider(), + new FavorDigestDecider() ] ) } diff --git a/src/game/ai/deciders.ts b/src/game/ai/deciders.ts index 74415e6..eaed6cf 100644 --- a/src/game/ai/deciders.ts +++ b/src/game/ai/deciders.ts @@ -1,7 +1,7 @@ import { Decider } from '../ai' import { Encounter, Action, Consequence, CompositionAction } from '../combat' import { Creature } from '../creature' -import { PassAction, ReleaseAction } from '../combat/actions' +import { PassAction, ReleaseAction, DigestAction } from '../combat/actions' import { StatusConsequence } from '../combat/consequences' import { SurrenderEffect } from '../combat/effects' @@ -98,3 +98,16 @@ export class NoSurrenderDecider extends ConsequenceFunctionDecider { ) } } + +/** + * Favors [[DigestAction]]s + */ +export class FavorDigestDecider implements Decider { + decide (encounter: Encounter, user: Creature, target: Creature, action: Action) { + if (action instanceof DigestAction) { + return 5 + } else { + return 1 + } + } +}