ID:1713761
 
Code:
/*
-=Beastmaster=-

Stance 1: Lev 1 - Rampage: +05% Cooldown Reduction, +10% Damage, +05% Criticial Rate
Lev 2 - Rampage: +10% Cooldown Reduction, +15% Damage, +08% Criticial Rate
Lev 3 - Rampage: +15% Cooldown Reduction, +20% Damage, +11% criticial Rate
Lev 4 - Rampage: +25% Cooldown Reduction, +30% Damage, +14% criticial Rate
15% to Cause bleed effect and deal 50% of enemies current wounds*/

mob/proc
//Call this when changing Sub Attributes works well for buffs and debuffs
sub_stat_boost(var/Sub_attribute/sA = null, amt = null)
sA.boost += amt


mob/proc
activate_beastmaster_stance(var/path)
path = text2path(path)

var/ability/S = locate(path) in abilities

if(stance == "Rampage")

sub_stat_boost(critical_rate, amt = (S.level * 3) + 2)
sub_stat_boost(physical_damage, amt = (S.level * 5) + 5 + S.level > 3?5:0)
sub_stat_boost(spiritual_damage, amt = (S.level * 5) + 5 + S.level > 3?5:0)
sub_stat_boost(cooldowns_reduction, amt = S.level * 5 + S.level > 3?5:0)


Problem description: Alright so within the project, I have multiple stances and each stance increments a sub_attribute by a certain value. The value is dependent on the Rank/level of that Stance. I was wondering if I could give a Stance an associative list that holds what sub_attribute it will boost and by what value. Note, like I said before the value will change depending on the level of that stance. Then when I call the "activate_beastmaster_stance" proc, I could do something along the lines of.

mob/proc
activate_beastmaster_stance(var/path)
if(stance == "Rampage")
for(var/sub_attribute/s in rampage.list)
var/p = for(var/v in src.vars)

if(v == s) sub_stat_boost(v, amt = s.value)

//That's what I think should be done but I am not sure at all.


Maybe I wasn't clear. I have over 20 stances in my project and each stance boosts a certain stat by specific value. That value can be changed based on the level of the Stance. Is there an efficient way to apply those values to whatever that stat could be? Or should I just carry on with a bunch of if and else statements and call sub_stat_boost()?
Bump
Doing this with lists would probably be pretty complicated but it would be simple to do by making DATUMS for your stances and giving them their own variables (their level, what attributes they affect, etc.)
In response to Jaysburn
I see. All stances are under the "ability" datum. I think I will continue with what I am doing now because it's easier than creating more variables. Thanks for responding.
In response to Gokussj99
Thanks for responding but that's not what I am looking for but it's mostly because I am not sure where you are going with this.

All stances have different types of sub_attributes they can enhance. it would be easier to simply use sub_stat_boost()