diff --git a/src/game/combat/actions.ts b/src/game/combat/actions.ts index 67d8062..9bab1d4 100644 --- a/src/game/combat/actions.ts +++ b/src/game/combat/actions.ts @@ -33,7 +33,7 @@ export abstract class DamageAction extends Action { desc, [new CapableCondition(), new EnemyCondition()].concat(conditions) ) - this.test = new StatTest(Stat.Power) + this.test = new StatTest(Stat.Power, 10) } execute (user: Creature, target: Creature): LogEntry { diff --git a/src/game/combat/tests.ts b/src/game/combat/tests.ts index d3c9792..ea61989 100644 --- a/src/game/combat/tests.ts +++ b/src/game/combat/tests.ts @@ -30,10 +30,11 @@ abstract class RandomTest implements CombatTest { export class StatVigorTest extends RandomTest { private f: (x: number) => number + private k = 0.1 - constructor (public readonly stat: Stat, k = 0.1) { + constructor (public readonly stat: Stat, private bias = 0) { super() - this.f = logistic(0, 1, k) + this.f = logistic(0, 1, this.k) } odds (user: Creature, target: Creature): number { @@ -56,7 +57,7 @@ export class StatVigorTest extends RandomTest { userPercent *= 4 } - return this.f(user.stats[this.stat] * userPercent - target.stats[this.stat] * targetPercent) + return this.f(this.bias + user.stats[this.stat] * userPercent - target.stats[this.stat] * targetPercent) } explain (user: Creature, target: Creature): LogEntry { @@ -82,7 +83,7 @@ export class StatVigorTest extends RandomTest { } const userMod = user.stats[this.stat] * userPercent const targetMod = target.stats[this.stat] * targetPercent - const delta = (userMod - targetMod) + const delta = userMod - targetMod if (delta === 0) { result = new LogLine('You and the target have the same effective', new PropElem(this.stat), '.') @@ -100,14 +101,15 @@ export class StatVigorTest extends RandomTest { export class StatTest extends RandomTest { private f: (x: number) => number + private k = 0.1 - constructor (public readonly stat: Stat, k = 0.1) { + constructor (public readonly stat: Stat, private bias = 0) { super() - this.f = logistic(0, 1, k) + this.f = logistic(0, 1, this.k) } odds (user: Creature, target: Creature): number { - return this.f(user.stats[this.stat] - target.stats[this.stat]) + return this.f(this.bias + user.stats[this.stat] - target.stats[this.stat]) } explain (user: Creature, target: Creature): LogEntry {