Overview

Path PyPoE/poe/sim/formula.py
Version 1.0.0a0
Revision $Id: db9df107ffbe3149f2652c1059fae216594b2782 $
Author Omega_K2

Description

Formulas for calculating certain things.

Agreement

See PyPoE/LICENSE

Todo

Find out the real function for calculating the stat requirement.

Documentation

class PyPoE.poe.sim.formula.GemTypes[source]

Bases: enum.Enum

Variables:
  • support – Support Skill Gem
  • active – Active Skill Gem
PyPoE.poe.sim.formula.armour_damage_reduction(armour, damage)[source]

Calculates the damage reduction from armour.

Note

The final damage reduction may differ; there are other stats that can grant damage reduction and damage reduction is capped.

Parameters:
  • armour (int) – Armour value of the defender
  • damage (int) – Physical damage of the attacker’s hit before mitigation
Returns:

damage reduction factor

Return type:

int

PyPoE.poe.sim.formula.chance_to_hit(accuracy, evasion)[source]

Calculates the chance to hit for the given accuracy and evasion.

Parameters:
  • accuracy (int) – Accuracy rating of the attacker
  • evasion (int) – Evasion rating of the defender
Returns:

chance to hit

Return type:

float

PyPoE.poe.sim.formula.chance_to_evade(accuracy, evasion)[source]

Calculates the chance to evade for the given accuracy and evasion.

Parameters:
  • accuracy (int) – Accuracy rating of the attacker
  • evasion (int) – Evasion rating of the defender
Returns:

chance to evade

Return type:

float

PyPoE.poe.sim.formula.gem_stat_requirement(level, gtype=<GemTypes.support: 1>, multi=100)[source]

Calculates and returns the stat requirement for the specified level requirement.

The calculations vary depending on the gem type (i.e. active or support gem) and on the multiplier.

Currently only multipliers of 100, 60 and 40 are supported.

Warning

These functions are primarily reverse engineered and may break with updates.

Generally, the gem stat requirements seem to be based on a linear function (i.e. f(x) = ax+b), however values are rounded.

For the values a & b were calculated with linear regression, then sightly adjusted to produce the correct results for existing gems, but it may not be entirely accurate. In particular it seems strange that the formula changes depending on the multiplier; I haven’t been able to figure out a single formula that works for all, so for the time being each multiplier comes with their own formula.

Parameters:
  • level (int) – Level requirement for the current gem level
  • gtype (GemTypes) – Type of the gem; i.e. GemTypes.support or GemTypes.active
  • multi (int) – Stat multiplier, i.e. from SkillGems.dat
Returns:

calculated stat requirement

Return type:

int

Raises:

ValueError – if multi is unsupported if gtype is invalid