Using the Spell Power API to Read an Entity's Spell Damage
What the API gives you
The mod exposes a library so other mods (or your own code) can query a caster's spell damage for a given school. It factors in the entity's attributes, active status effects, and enchantments, and it also reports critical strike chance and multiplier. This is the intended way to make a custom spell scale with the player's build instead of hardcoding numbers.
Query flow
1. Get the caster entity and pick the school you are casting (for example Fire).
2. Call the API's spell damage lookup for that entity and school. It returns the resolved damage after attributes, effects, and enchantments are applied.
3. Separately request critical chance and critical damage, then roll the crit yourself or let the API do it.
4. Apply the result to your spell's damage source.
Why use it instead of reading attributes directly
Reading spell_power:fire alone ignores buffs and enchantments. The API centralizes that math, so every spell in your pack behaves consistently and reacts to the same buffs. If a spell feels weak, check whether the caster actually has points in that school's attribute and whether any status effect is modifying it. Remember the API is a library — it does nothing on its own until a spell mod calls it.