void DrainTargetStrength(DaggerfallEntityBehaviour entity, int amount) { if (entity == null) { return; } EntityEffectManager targetManager = entity.GetComponent <EntityEffectManager>(); if (targetManager == null) { return; } // Find incumbent strength drain effect on target or assign new drain DrainStrength drain = targetManager.FindIncumbentEffect <DrainStrength>() as DrainStrength; if (drain == null) { // Create and assign bundle // We bypass saving throws as target already had a chance at start of payload delivery EntityEffectBundle bundle = targetManager.CreateSpellBundle(DrainStrength.EffectKey); targetManager.AssignBundle(bundle, AssignBundleFlags.BypassSavingThrows); // Find new bundle now its assigned drain = targetManager.FindIncumbentEffect <DrainStrength>() as DrainStrength; } // Increment incumbent drain magnitude on target if (drain != null) { drain.IncreaseMagnitude(amount); } }