Original Post
quote:Kylotan posted this in the earlier thread that kinda went off topic. The code above works great for attributes, but what is a good way to implement skills that operate on the attributes? Should every skill be each own class? Diff player and NPC types may share some skills etc. Any ideas?
int Character::GetTotalModifiersTo(String stat) const {
// Loop through all effects. If the stat matches this one, apply the
// difference to the running total. Return the final amount
int total_modifier = 0;
EffectList::const_iterator eli;
for (eli = effects.begin(); eli != effects.end(); ++eli)
total_modifier += (*eli)->GetModifiersTo(stat);
return total_modifier; }