| @@ -1,7 +1,7 @@ | |||
| import { Condition, Vigor } from "../combat" | |||
| import { Condition, Stat, Vigor, VoreStat } from "../combat" | |||
| import { Creature } from "../creature" | |||
| import { Container } from '../vore' | |||
| import { LogEntry, LogLine, PropElem } from '../interface' | |||
| import { FAElem, LogEntry, LogLine, PropElem } from '../interface' | |||
| import { ToBe, Verb } from '../language' | |||
| import * as Words from '../words' | |||
| @@ -275,3 +275,33 @@ export class MassRatioCondition implements Condition { | |||
| } | |||
| } | |||
| } | |||
| export class StatCondition implements Condition { | |||
| constructor (private stat: Stat | VoreStat, private amount: number) { | |||
| } | |||
| allowed (user: Creature, target: Creature): boolean { | |||
| if (this.stat in Stat) { | |||
| return user.stats[this.stat as Stat] >= this.amount | |||
| } else if (this.stat in VoreStat) { | |||
| return user.voreStats[this.stat as VoreStat] >= this.amount | |||
| } else { | |||
| return false | |||
| } | |||
| } | |||
| explain (user: Creature, target: Creature): LogEntry { | |||
| if (this.allowed(user, target)) { | |||
| return new LogLine( | |||
| `${user.name.capital} ${user.name.conjugate(Words.Have)} at least ${this.amount} `, | |||
| new PropElem(this.stat) | |||
| ) | |||
| } else { | |||
| return new LogLine( | |||
| `${user.name.capital} must ${user.name.conjugate(Words.Have)} at least ${this.amount} `, | |||
| new PropElem(this.stat) | |||
| ) | |||
| } | |||
| } | |||
| } | |||
| @@ -1,8 +1,8 @@ | |||
| import { Effective, Damage, DamageType, CompositionAction, StatDamageFormula, Action, Stat, Vigor, VoreStat } from '../combat' | |||
| import { TextLike } from '../language' | |||
| import { Creature } from '../creature' | |||
| import { TestCategory } from './tests' | |||
| import { EnemyCondition, PairCondition, TogetherCondition } from './conditions' | |||
| import { CompositionTest, OpposedStatScorer, TestCategory } from './tests' | |||
| import { EnemyCondition, PairCondition, StatCondition, TogetherCondition } from './conditions' | |||
| import { DamageConsequence, LogConsequence } from './consequences' | |||
| import { LogLine } from '../interface' | |||
| import * as Words from '../words' | |||
| @@ -93,7 +93,8 @@ export class FlauntPerk extends Perk { | |||
| conditions: [ | |||
| new PairCondition(), | |||
| new EnemyCondition(), | |||
| new TogetherCondition() | |||
| new TogetherCondition(), | |||
| new StatCondition(VoreStat.Prey, 1) | |||
| ], | |||
| consequences: [ | |||
| new LogConsequence( | |||
| @@ -106,6 +107,18 @@ export class FlauntPerk extends Perk { | |||
| ] | |||
| ) | |||
| ) | |||
| ], | |||
| tests: [ | |||
| new CompositionTest( | |||
| [ | |||
| new OpposedStatScorer( | |||
| { Charm: 1, Bulk: 0.01 }, | |||
| { Willpower: 1 } | |||
| ) | |||
| ], | |||
| (user, target) => new LogLine(`${user.name.capital.possessive} predatory advances aren't enough to intimidate ${target.name.objective}.`), | |||
| TestCategory.Vore | |||
| ) | |||
| ] | |||
| } | |||
| )] | |||