doomeer / kalandralang

A programming language for Path of Exile crafting recipes.
MIT License
57 stars 4 forks source link

[Improvement] Tiers and complex mod groups #24

Closed raphaelrieuhelft closed 2 years ago

raphaelrieuhelft commented 2 years ago

Suppose I'm crafting a caster weapon and I want to check for tier 2+ increased spell damage. Currently, I believe I cannot use tier to do so, because the mod belongs in the group WeaponCasterDamagePrefix, which it shares with increased cold/fire/lightning damage. This returns an error, presumably because the sort in Item.mod_tier fails when there are two mods with identical averages. It would be a good improvement to recognize any tier 2 spell/fire/cold/lightning damage as tier 2 WeaponCasterDamagePrefix, and also to have some way to disambiguate later on.

For the first part, maybe the sort could batch together mods with identical values. (This could also be a partial solution to the problem of essence mods, as they could be included in the batches even though they have weight 0.)

doomeer commented 2 years ago

Indeed, I think grouping mods with equal stats should work and should not require to have special cases for some mods; I should try that.

doomeer commented 2 years ago

I have pushed a commit to implement this suggestion and it seems to work well. I tested with the following program:

buy "Metadata/Items/Weapons/TwoHandWeapons/Staves/StaffE3"
  with "ColdDamagePrefixOnTwoHandWeapon7"
if tier "WeaponCasterDamagePrefix" <= 2 then gain 1 chaos

The mod is correctly shown as having tier 2.