public static void ReverseEffect(Actor a, StatModifier mod) { int modValue = mod.Modifier; //Finds the percentage value if necessary if (mod.Percentage == true) { modValue = LogicHelpers.CalculatePercentage(a.GetStatValue(mod.Stat), mod.Modifier); } //MUST find the percentage value before converting it to a nerf //Will Create a nerf if necessary if (mod.Buff == true) { modValue = modValue * (-1); } a.ApplyStatChange(mod.Stat, modValue); }
}//EvalCondition private static int GetComparisonValue(Actor actor, StatCondition condition) { int compareValue; //Checking for percent value if (condition.Percetage) { //A switch statement is needed in order to properly compare MaxHp to HP or MaxMana to Mana switch (condition.Stat) { case ActorStats.MaxHealthPoints: //TODO if any abilitites decrease MaxHP value then this formula might not work anymore compareValue = LogicHelpers.CalculatePercentage(actor.MaxManaPoints, condition.ComparisonValue); break; case ActorStats.HealthPoints: compareValue = LogicHelpers.CalculatePercentage(actor.MaxHealthPoints, condition.ComparisonValue); break; case ActorStats.MaxManaPoints: compareValue = LogicHelpers.CalculatePercentage(actor.MaxManaPoints, condition.ComparisonValue); break; case ActorStats.ManaPoints: compareValue = LogicHelpers.CalculatePercentage(actor.MaxManaPoints, condition.ComparisonValue); break; default: compareValue = LogicHelpers.CalculatePercentage(actor.GetStatValue(condition.Stat), condition.ComparisonValue); break; } //end switch } //if else { compareValue = condition.ComparisonValue; } //else return(compareValue); } //GetCompareValue