zenno/race/gate: new calculator
This commit is contained in:
+31
-2
@@ -93,6 +93,20 @@ export function distance(raceLen: number): Distance {
|
||||
return Distance.Long;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the distances at which each phase of a race ends.
|
||||
* @param raceLen Length of the race in meters
|
||||
* @returns Ends of each phase in meters
|
||||
*/
|
||||
export function phases(raceLen: number) {
|
||||
const sixth = raceLen / 6;
|
||||
return {
|
||||
[Phase.EarlyRace]: sixth,
|
||||
[Phase.MidRace]: 4 * sixth,
|
||||
[Phase.LateRace]: raceLen,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Race surfaces.
|
||||
*/
|
||||
@@ -372,7 +386,13 @@ export function fullSpurtHP(raceLen: number, spurtSpeed: number, hpRate: number)
|
||||
return spurtTime * hpRate;
|
||||
}
|
||||
|
||||
function baseSpeed(raceLen: number): number {
|
||||
/**
|
||||
* Calculate the base speed for a race.
|
||||
* Note that this is not the base target speed for a horse.
|
||||
* @param raceLen Race length in meters
|
||||
* @returns Base speed for the race
|
||||
*/
|
||||
export function baseSpeed(raceLen: number): number {
|
||||
return 20 - (raceLen - 2000) / 1000;
|
||||
}
|
||||
|
||||
@@ -748,13 +768,22 @@ export function duelAccelMod(gutsStat: number): number {
|
||||
* Calculate the speed modifier for running uphill.
|
||||
* Contrary to the race mechanics document, this is expressed as a negative number.
|
||||
* @param powerStat Final power stat
|
||||
* @param slopePer Slope percentage, generally one of 0.5, 1.0, 1.5, or 2.0
|
||||
* @param slopePer Slope percentage, one of 1.0, 1.5, or 2.0
|
||||
* @returns Speed modifier for running uphill, a negative value
|
||||
*/
|
||||
export function uphillMod(powerStat: number, slopePer: number): number {
|
||||
return (slopePer * -200) / powerStat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the speed modifier while running in downhill accel mode.
|
||||
* @param slopePer Slope percentage, one of -1.0, -1.5, or -2.0
|
||||
* @returns Speed modifier for downhill accel mode
|
||||
*/
|
||||
export function downhillAccelMod(slopePer: number): number {
|
||||
return 0.3 - slopePer/10;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the forward speed boost given when moving lanewise while a skill
|
||||
* that grants a lane change speed boost is active.
|
||||
|
||||
Reference in New Issue
Block a user