Calculators

Pets

Calculates the pet food, advancement items, stat gains, and event points to level pets from a current level to a goal level.


Signature

import { calculatePets } from 'whiteout-survival-data'

calculatePets(goals?: PetGoal[]): PetCalculation

Input

PetGoal

goals has one entry for each pet and defaults to an empty list.

FieldTypeDescription
idstringPet id from pets()
currentnumberLevel of the pet now, from 1 to the max level of the pet
goalnumberLevel to reach, from current to the max level of the pet
currentAdvancedbooleanOptional. True when the pet is already advanced at current
goalAdvancedbooleanOptional. True to pay for the advancement at goal too. Both flags are false by default

An advanced flag is valid only on a level that is a multiple of PET_ADVANCEMENT_INTERVAL (10).


Result

PetCalculation

The result has one entry in items for each goal, and the same fields summed over all goals.

FieldTypeDescription
itemsPetItemResult[]One entry for each goal
levelsnumberLevels gained
advancementsnumberAdvancements paid for
resourcesUpgradeMaterial[]itemId and amount pairs: pet food and the advancement items
troopAttacknumberGain in Troop Attack in percent, rounded to 2 decimals
troopDefensenumberGain in Troop Defense in percent, rounded to 2 decimals
powernumberGain in troops power
advancementScorenumberPet advancement score of the advancements paid for
eventPointsPetEventPointsEvent points of the score for svs, allianceShowdown, and kingOfIcefield

Each item also has the pet id and name.


How it works

Each level after current up to goal costs the pet food of that level. A pet advances at every level that is a multiple of 10 and needs the advancement to go past that level. A range that starts at or passes such a level pays for the advancement items of that level. A goal that is a multiple of 10 pays for its advancement only when goalAdvanced is true. Use it for the final advancement at the max level. A pet that is already advanced at its current level (currentAdvanced) does not pay for that advancement again.

The stat gains are the difference between the stats of the two states. An advanced state uses the advanced (refined) values of the level. Each advancement paid for adds its advancementScore.

The event points are the score times the points of the "Pet advancement score increases by 1" row in the scoring rows of events(). The rows pay 50 in SvS, 30 in Alliance Showdown, and 50 in King of Icefield for each point of score.


Constants

ConstantValueDescription
PET_ADVANCEMENT_INTERVAL10The level step between advancements. Use it to show the same advancement levels

Errors

ErrorThrown when
ErrorA pet id is not in pets()
RangeErrorA level is not a whole number from 1 to the max level of the pet, or a goal is below the current level
RangeErrorAn advanced flag is set on a level that is not a multiple of 10

Examples

import { calculatePets } from 'whiteout-survival-data'

const result = calculatePets([{ id: 'cave-hyena', current: 1, goal: 25 }])

result.resources
// [{ itemId: 'pet-food', amount: 7145 }, { itemId: 'taming-manual', amount: 45 }]
result.advancements // 2 (at levels 10 and 20)
result.troopAttack // 2.05
result.power // 147600
result.advancementScore // 1500
result.eventPoints.svs // 75000

Pay for the advancement at the goal level too:

const advanced = calculatePets([
  { id: 'cave-hyena', current: 1, goal: 10, goalAdvanced: true },
])

advanced.resources
// [{ itemId: 'pet-food', amount: 1715 }, { itemId: 'taming-manual', amount: 15 }]
advanced.advancements // 1
advanced.troopAttack // 0.87

Without goalAdvanced, a goal of 10 buys the levels but not the advancement:

calculatePets([{ id: 'cave-hyena', current: 1, goal: 10 }]).advancements // 0

Data and assumptions

The numbers come from the data behind pets() and from the scoring rows of events(). Pets have no training time in the data, so the result has no time.


Next steps

Previous
Research