I've made a stats system for my game that allows me to modifiy a player's stats (like speed, health etc) with both flat and multiplicative values, which also allows you to specify a lifetime before the bonus disappears. However, I'd like to be able to create decaying bonuses as well, i.e. lasts for a lifetime then falls off linearly from 100% effect to 0% effect over a decay time. I've been stuck on this for a little while, and I can't think of a way to make it work with my current setup. Is anyone able to let me know if this is possible with how it's set up now, and how I might go about doing it?
This is how I've implemented the stats system, using classes for StatModifier and Stat, in which Stat contains a base value and a list of StatModifiers: https://paste.mod.gg/tkulirmvmyzz/0
Also worth noting, everything I've got so far has been tested and works
A tool for sharing your source code with the world!