Aldriana / ShadowCraft-Engine

Calculations backend for ShadowCraft, a WoW theorycraft project.
GNU Lesser General Public License v3.0
37 stars 22 forks source link

Weapon enchants #34

Closed julienp closed 13 years ago

julienp commented 13 years ago

Weapon enchants need to be a new instance of PPMProc for each weapon since their proc_chance is modified in Weapon.init, otherwise you end up changing the same class level PPMProc.

julienp commented 13 years ago

Trinkets and other procs in the ProcsList will have the same the same issue if you ever end up modifying them. I'm not sure if there's a case where that will happen, but we might as well change them the same way to make the code more robust.

julienp commented 13 years ago

I just realized that my current code assumes all weapon procs are PPMProcs and all trinkets Procs. I'd solve this by adding a is_ppm flag to the data tuples in allowed_procs and allowed_enchants. Either you create a Proc or PPMProc instance based on that flag or simply roll the PPMProc methods into Proc, with init augmented by an is_ppm argument. I'll wait for someone to review this before I go ahead with the changes.

julienp commented 13 years ago

Sigh, just noticed that get_all_procs_for_stat and get_all_damage_procs don't work properly at all. I'll look into it.

julienp commented 13 years ago

Fixed. I'll make sure to test better before sending a pull-request, sorry.