Improved duration stacking (code included)

All new ideas for the upcoming releases of ToME 4.x.x should be discussed here

Moderator: Moderator

Post Reply
Message
Author
Umbrall
Thalore
Posts: 153
Joined: Sat Feb 23, 2013 7:53 pm

Improved duration stacking (code included)

#1 Post by Umbrall »

In short:
replace all instances of:

Code: Select all

local dur = math.ceil((old_eff.dur + new_eff.dur) / 2)
in timed effects with

Code: Select all

local dur = math.floor((old_dam + new_dam) / (old_eff.power + new_effect.power))
What this does is weight the duration such that the dps of any given effect will never decrease from the sum of the two parts (alternatively you can do it as the max of their dps's instead of the sum, but this has the weird situation where without capping it would just stack duration instead of damage, and is therefore wrong)

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Improved duration stacking (code included)

#2 Post by darkgod »

>Hum you second formula doesnt use duration at all I'm not sure I understand
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Umbrall
Thalore
Posts: 153
Joined: Sat Feb 23, 2013 7:53 pm

Re: Improved duration stacking (code included)

#3 Post by Umbrall »

It does actually, the old_dam and new_dam values have the durations multiplied into them already (as they're already used by other stuff)

So in short where T is duration and D is damage per turn it's
(D1T1 + D2T2) / (D1 + D2)

Post Reply