void ModDerivedStat(Globals.DerivedStat stat, float value, bool isAdditive) { int index = (int)stat; Debug.Log("ModDerivedStat(" + stat.ToString() + ", " + value + ", " + isAdditive + ")"); //Debug.Log("From: " + derivedStatMods[index]); Debug.Log("From: " + derivedStats[index, 1]); if (isAdditive) { //derivedStatMods[index] += value; derivedStats[index, 1] += value; } else { //derivedStatMods[index] += baseDerivedStats[index] * (1 + value/100f); derivedStats[index, 1] += derivedStats[index, 0] * (1 + value/100f); } //Debug.Log("To: " + derivedStatMods[index]); Debug.Log("From: " + derivedStats[index, 1]); //totalDerivedStats[index] = baseDerivedStats[index] + derivedStatMods[index]; //Total calculation no longer needed, values in rows 0 and 1 are summed as-needed }
public void TakeDamage(Globals.DerivedStat stat, Spell.Category category, List<Spell.School> schools, float rawValue) { int damageTaken = CalculateMitigatedDamage(category, schools, rawValue); switch(stat) { case Globals.DerivedStat.MaxHP: currHP -= damageTaken; OnLoseHP(); break; case Globals.DerivedStat.MaxMP: currMP -= damageTaken; OnLoseMP(); break; case Globals.DerivedStat.MaxAP: currAP -= damageTaken; OnLoseAP(); break; default: Debug.Log("Invalid stat. Damage was not dealt to HP, MP, or AP"); break; } }
public void TakeDamage(Globals.DerivedStat stat, float rawValue) { rawValue = Mathf.RoundToInt(rawValue); switch(stat) { case Globals.DerivedStat.MaxHP: currHP -= rawValue; OnLoseHP(); break; case Globals.DerivedStat.MaxMP: currMP -= rawValue; OnLoseMP(); break; case Globals.DerivedStat.MaxAP: currAP -= rawValue; OnLoseAP(); break; default: Debug.Log("Damage was not dealt to HP, MP, or AP"); break; } }
// method to retrieve a particular Derived Stat public float GetTotalDerivedStat(Globals.DerivedStat stat) { return derivedStats[(int)stat, 0] + derivedStats[(int)stat, 1]; //return totalDerivedStats[(int)stat]; }
public float GetBaseDerivedStat(Globals.DerivedStat stat) { return derivedStats[(int)stat, 0]; //return baseDerivedStats[(int)stat]; }