## Formulas for holy wrath vs orc / dragon slaying.

If you are interested in helping with tiles, vaults, patches or documentation, this is the place for that.

Vestibule Violator

Posts: 1533

Joined: Thursday, 16th December 2010, 20:52

### Formulas for holy wrath vs orc / dragon slaying.

In creating my spreadsheet, I noticed that the damage formulas for orc and dragon slaying are identical. Holy wrath has a _nearly_ identical formula which leads to virtually the same result, but not quite. Is this intentional or an oversight? Can I submit a patch to make holy wrath use the same formula?

Orc and Dragon slaying are:
Code:
`special_damage = 1 + random2(3*damage_done/2);`

Holy Wrath:
Code:
`special_damage = 1 + (random2(damage_done * 15) / 10);`

If damage_done=10:

Orc / Dragon avg= 1 + random2(15)
Holy avg = 1+ random2(150)/10

The two have different results because random2 generates a number from 0 to (value - 1)
Holy is slightly better because it can randomize up to 149, which is essentially 150, while orc/dragon can only randomize up to 14.

Dungeon Master

Posts: 4031

Joined: Thursday, 16th December 2010, 20:37

Location: France

### Re: Formulas for holy wrath vs orc / dragon slaying.

I think they are identical. When dividing numbers, if the result is an integer, it's always rounded down. So 149 / 10 = 14. Unifying them into a single function is indeed a good idea.
<+Grunt> You dereference an invalid pointer! Ouch! That really hurt! The game dies...

Vestibule Violator

Posts: 1533

Joined: Thursday, 16th December 2010, 20:52

### Re: Formulas for holy wrath vs orc / dragon slaying.

Is that what it means if a function is initiated as e.g. "int functionname (arguments)"?

If true, I probably have to re-evaluate a lot of the calculations in my spreadsheet...

Dungeon Master

Posts: 4031

Joined: Thursday, 16th December 2010, 20:37

Location: France

### Re: Formulas for holy wrath vs orc / dragon slaying.

Yes, it means the function returns an integer. That's why some functions use the scale parameter set to 100, to fix rounding errors. You can use INT() in excel to convert a result to integer for better accuracy.
<+Grunt> You dereference an invalid pointer! Ouch! That really hurt! The game dies...

Vestibule Violator

Posts: 1533

Joined: Thursday, 16th December 2010, 20:52

### Re: Formulas for holy wrath vs orc / dragon slaying.

Hmm. I think keeping decimals may still be good for estimating averages. E.g there may be a bonus that will only return 0, 1, 2 or 3, but for estimating average, you are best off with 1.5, and not chopping it to 1.