|
|
|
@@ -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 { |
|
|
|
|