protected override void OnCalculate(InteractionParamHolder damageInfo, InteractionResult curResult, ContactResultInfo curContactResult) { //If the attack didn't hit, don't factor in DamageEffects if (StepResult.VictimResult.Hit == false) { StepResult.VictimResult.DamageEffect = DamageEffects.None; } //If the current result has no DamageEffects (whether the move didn't have any or a Defensive Action removed them) //or if the BattleEntity isn't vulnerable to any DamageEffects, then don't bother doing anything else if (StepResult.VictimResult.DamageEffect == DamageEffects.None || StepResult.VictimResult.Entity.EntityProperties.HasDamageEffectVulnerabilities() == false) { return; } //The DamageEffects stored in the result DamageEffects resultEffects = DamageEffects.None; //Get all the DamageEffects DamageEffects[] damageEffects = UtilityGlobals.GetEnumValues <DamageEffects>(); //Start at index 1, as 0 is the value of None indicating no DamageEffects for (int i = 1; i < damageEffects.Length; i++) { DamageEffects curEffect = damageEffects[i]; //If the move has the DamageEffect and the entity is affected by it, add it to the result //This approach is easier and more readable than removing effects if (UtilityGlobals.EnumHasFlag(StepResult.VictimResult.DamageEffect, curEffect) == true && StepResult.VictimResult.Entity.EntityProperties.IsVulnerableToDamageEffect(curEffect) == true) { resultEffects |= curEffect; } } //Set the result StepResult.VictimResult.DamageEffect = resultEffects; }