public void ModifyStatBonus(EffectEnum effect, int value, bool opposite = false) { GenericStat stat = null; bool addValue = false; foreach (GenericStat forStat in myStats) { if (forStat.AddEffects.Contains(effect)) { stat = forStat; addValue = true; break; } if (forStat.SubEffects.Contains(effect)) { stat = forStat; addValue = false; break; } } if (stat == null) { return; } if (opposite) { addValue = !addValue; } if (addValue) { stat.Bonus += value; } else { stat.Bonus -= value; } }
public void ModifyStatGiven(EffectEnum effect, int value) { GenericStat stat = null; bool addValue = false; foreach (GenericStat forStat in myStats) { if (forStat.AddEffects.Contains(effect)) { stat = forStat; addValue = true; break; } if (forStat.SubEffects.Contains(effect)) { stat = forStat; addValue = false; break; } } if (stat == null) { return; } if (addValue) { stat.Given += value; } else { stat.Given -= value; } }