public StatTable(StatTable other) { id = nextId++; // Base values must be copied BaseValues = new StatMap(other.BaseValues); // Don't need to copy these directly, as changing level will propagate changes LeveledValues = new StatMap(); ModifiedValues = new StatMap(); // Progressions, modifiers, dependants must be copied Progressions = new StatMap(other.Progressions); Dependants = new StatDependantMap(other.Dependants); // Modifiers need extra care, as they need to refer to other objects Modifiers = new Dictionary <string, ModifierMap>(); foreach (KeyValuePair <string, ModifierMap> modMap in other.Modifiers) { foreach (KeyValuePair <ModifierType, HashSet <StatModifier> > modSet in modMap.Value) { foreach (StatModifier mod in modSet.Value) { AddModifier(new StatModifier(mod, this)); } } } // Using property fills out leveled and modified values Level = other.Level; }
public StatTable(int level_ = 1) { id = nextId++; BaseValues = new StatMap(); LeveledValues = new StatMap(); ModifiedValues = new StatMap(); Progressions = new StatMap(); Modifiers = new Dictionary <string, ModifierMap>(); Dependants = new StatDependantMap(); Level = level_; }