OOP implementation of BUFFS and Stats. Suggestion

Posted by Mattia Manzo Manzati on Game Development See other posts from Game Development or by Mattia Manzo Manzati
Published on 2012-11-10T10:59:51Z Indexed on 2012/11/10 11:16 UTC
Read the original article Hit count: 218

I am developing an MMORPG server using NodeJS.

I am not sure how to implement Buffs, i mean, equipped objects or used skills have effects on the Player() which has many Stats(), some of them have a max cap...

Effects can change the Stat value, increasing or decreasing it by a value, a percentage or completly rewrite the value of the stat.

After a while I have decided to create a base class for buffs, which can be hidden (if they are casted from an equipped object) or shown if they came from an ability (Spell).

Anyway I need suggestion how to implement it, use an array for all active buffs for a stat and have a function calculate the value of the stat affected by buffs each time I need the value of the stat or...? Other more OOP's ways to do it?

I have read this What's a way to implement a flexible buff/debuff system? but this implements only a percentage system, which buffs can only say "+10%, +20%, etc...", but I would love to have an hybrid system, which can have percentage values or static values (like WoW does), and using modifiers it's hard to implement, because modifiers refers to the current value of stat :/

Thanks for suggestions :)

© Game Development or respective owner

Related posts about architecture

Related posts about JavaScript