# How it works!

### Introduction

The summer of 2019, right before Classic was coming up I was feeling too exited to play any other game, and since I still had no key to the Beta, I decided to make better use of my time than drooling over Beta videos and streams. The result is a tool that will help players choose the most mana efficient healing spell ranks!

The rank selection is based on a *Healing Efficiency Score* (**HES**), which is derived from the combination of *Healing per Mana Efficiency* (**HPME**) and *Healing per Second* (**HpS**). A detailed description can be found in the calculations section

If you enjoyed the tool please consider a donation! All donations will go to keeping the site it up and running and paying those pesky server hosting fees.

If you want a more detailed explanation of how downranking works in Classic Wow, what to think about and how to apply it to your gaming, check out this video made by Defcamp & Melderon!

### Using the tool

- Fill out your total amount of Healing Power as shown in the in-game character pane
- Fill out your details like crit, haste or if you have the AQ20 tablets (Not relevant for TBC).
- Select your class
- Fill out the talents to match your own talent points
- Apply any of the available buffs
- Select a spell
- A tooltip is now shown, displaying the recommended spell rank.
- Click the button "Spell details" to open the advanced user's window to look at breakpoints and much more!
- A Table will be displayed for you to see the values of each metric for each rank. You can click on the top row of each column to sort by that factor.
- (Optional) Drag the slider to change the importance of
**HpME**and**HpS**.. Dragging the slider to the far side of either end, will completely disregard the other attribute. Also, below are two static graphs showing**HpME**and**HpS**. as a function of spell power by rank.

### Interpreting the results

The resulting recommended rank is chosen by maximizing **HES** (see next section) for the given **Healing Power**. However, **this does NOT mean that this is the only rank you should use**, the result only shows what rank will be most efficient, it is still up to you as a player to decide, situationally, when efficiency or healing throughput is most important!

The purpose of the tool is to provide players with enough data to make an informed decision, and understand their full toolset!

### Calculations

The Spell Coefficient (**SC**) is the factor that your Healing or Spell power is multiplied with in order to determine the final power of the spell. The way the **SC** is calculated depends on the nature of the spell, there are some general rules for how to calculate the SC, but as with all rules there are exceptions and a few spells such as Frost Nova and Lay on Hands, have their own modifiers.

The sections below will describe how this tool calculates Spell Coefficients, should you encounter any errors your are welcome to report a bug, or create a pull request. However, unless a reliable source is provided the requests will be rejected.

#### Direct spells and Over-Time spells

These two are the most straigt forward, since they are comprised of a single dividing factor.

Direct spells are spells that only have a direct impact such as *Holy Light* or *Healing Touch*. The coefficient is calculated by:
`[Direct spell coefficient] = [Cast Time of Spell] / 3.5`

Over-Time spells includes both Damage over time (**DoTs**) and Healing over Time (**HoTs**), such as *Rejuvenation* or *Curse of Agony*. The added damage or healing is divided equally among each tick of the spell and the standard formula is:
`[Over-Time spell coefficient] = [Duration of Spell] / 15`

#### Hybrid spells

Hybrid spells is a little bit more complicated, these are spells with both a direct effect and a Over-Time portion, such as *Regrowth*. The standard formula for hybrid spells is:
```
[Over-Time part] = ([Duration] / 15) / (([Duration] / 15) + ([Cast Time] / 3.5))
```

The duration and cast time limitations are then applied:

[Direct part] = 1 - [Over-Time portion]
```
[Over-Time coefficient] = ([Duration] / 15) * [Over-Time part]
```

[Direct coefficient] = ([Cast Time / 3.5) * [Direct part]
**DISCLAIMER:** Regrowth does not actually follow this standard formula and instead has its own spell specific coefficients as:
```
[Over-Time coefficient] = 0.497
```

[Direct coefficient] = 0.286

#### Spells below level 20

Casting a spell that can be learnt below level 20 incurs a significant penalty to the coefficient of the spell. This was introduced during Vanilla WoW in order to counter the unforseen power of heavily downranking spells.
The formula for this is:
`[Sub Level 20 Coefficient] = 1 - (Maximum(0, 20 - [Required level for the spell]) * 0.0375)`

#### Critical effect chance

Critical effect chance is the base percent chance that a spell will become a critical hit, causing **150%** of its normal effect. Direct spell effects are subjectable to critical hits, and over time effects are not.

Since landing critical hits will highly increase your healing throughput, critical chance does have a small effect on the **HES** due to the higher **HpS**. In this tool, critical chance is applied to the direct part of spells, as a static factor:
```
(1 + (1 + [Critical effect chance]/100)) / 2 = [Crit Coefficient]
```

#### Putting it all together

Now when we have all the parts we can calculate the final effective coefficient for the spell which is defined by:
`[Effective Coefficient] = [Basic Coefficient] * [Sub Level 20 Coefficient]`

Thus the actual power of the spell is:
`[Actual Power] = [Base power] + [+Power] * [Effective Coefficient]`

The result of the function above is what is used when calculating **HpME**, **HpS** and finally **HES**.
The **HpME** and **HpS** are quite straight forward, and calculated as:
```
HpME = [Actual Power] / [Mana Cost]
```

From these two we calculate the Healing Efficiency Score

HpS = [Actual Power] / [Cast time]
**HES** as:
```
HES = HpME^x * ln(HpS)^y
```

with x and y changing depending on the slider.
A few notes on this process:

- All cast times are considered before any spell haste or casting time talents are applied.
- All talents or buffs that increase the damage or healing from spells are applied after the coefficient calculations.
- All DoT/HoT durations are considered before any duration buffs or talents are applied. Keep in mind that these talents simply add extra ticks of damage or healing for the same amount that the spell would do otherwise.

#### Calculation example

As an example I will demonstrate how to determine the power of **Rank 3 Healing Wave** with **500 Healing Power**, and a **10% Critical effect chance**.
```
[Base Power] = ([Base min Power] + [Base max Power]) / 2 = (129 + 155) / 2 = 142
```

Which results in the actual power being:

[Basic Coefficient] = [Cast Time] / [Reference Cast Time] = 2.5 / 3.5 = 0.714

[Sub Level 20 Coefficient] = 1 - ((20 - [Spell level]) * 0.0375) = 1 - ((20 - 12) * 0.0375) = 0.7

[Effective Coefficient] = [Basic Coefficient] * [Sub Level 20 Coefficient] = 0.5

[Crit Coefficient] = (1 + (1 + 10/100)) / 2 = 1.05
```
[Actual Power] = ([Base Power] + ([Extra Power] * [Effective Coefficient])) * [Crit Coefficient]
```

= (142 + (500 * 0.5)) * 1.05

= 392 * 1.05 = *412*