public Dictionary <StatsEnum, float> GetStatsOfModifier(EffectModifierEnum modifierEnum) { if (stats != null && stats.ContainsKey(modifierEnum)) { return(stats[modifierEnum]); } return(new Dictionary <StatsEnum, float>()); }
public Dictionary <AttributesEnum, float> GetAttributesOfModifier(EffectModifierEnum modifierEnum) { if (attributes != null && attributes.ContainsKey(modifierEnum)) { return(attributes[modifierEnum]); } return(new Dictionary <AttributesEnum, float>()); }
private static Effect StackResolveStats(Effect effectToApplyMaxTo, Effect effectToAddFrom, EffectModifierEnum effectModifier) //TODO: the actual list of stats needs to be passed in as well... { Debug.Log("StackResolveStats, effect modifier is: " + effectModifier); if (effectToAddFrom.stats.ContainsKey(effectModifier) == false) { return(effectToApplyMaxTo); } Debug.Log("StackResolveStats after precondition check, list length: " + effectToAddFrom.stats[effectModifier].Count); //TODO: this shows as having a count of 3, yet the loop below doesn't run a single time foreach (KeyValuePair <StatsEnum, float> kvp in effectToAddFrom.stats[effectModifier]) { Debug.Log("StackResolveStats inner loop"); float current = 0; if (effectToApplyMaxTo.stats[effectModifier].ContainsKey(kvp.Key)) { current = effectToApplyMaxTo.stats[effectModifier][kvp.Key]; } if (current < kvp.Value) { effectToApplyMaxTo.stats[effectModifier][kvp.Key] = kvp.Value; Debug.Log("StackResolveStats inner if"); } } //only keep the largest values return(effectToApplyMaxTo); }
private static Effect StackResolveDamage(Effect effectToAddTo, Effect effectToAddFrom, EffectModifierEnum effectModifier) { if (effectToAddTo.damage.ContainsKey(effectModifier) == false) { Debug.Log("List does not contain key: " + effectModifier); return(effectToAddTo); } Debug.Log("Length of list is: " + effectToAddTo.damage[effectModifier].Count); foreach (KeyValuePair <DamageEnum, float> kvp in effectToAddTo.damage[effectModifier]) { effectToAddTo.damage[effectModifier][kvp.Key] += kvp.Value; Debug.Log(kvp.Key + ": was the key modified"); } //linerally add values return(effectToAddTo); }