ResistMod, enemyAttackerStats);

                    damage = CalculateBackstabDamage(damage, backstabChance, mainDamType, weapon);
                }

                // Handle poisoned weapons
                if (damage > 0 && weapon.poisonType!= Poisons.None)
                {
                    FormulaHelper.InflictPoison(target, weapon.poisonType, false); // Will likely play around with this later on.
                    weapon.poisonType = Poisons.None;
                }
            }

            damage = Mathf.Max(0, damage); // I think this is just here to keep damage from outputting a negative value.

            if (damage < 1) // Cut off the execution if the damage is still not anything higher than 1 at this point in the method.
                return 0;

            if (attacker == player)
            {
                if (matResistMod <= 0.5f) // Probably add a book to the game that describes these resistances and weaknesses of monsters. Maybe title "Know Thy Enemy" or something.
                    DaggerfallUI.AddHUDText("This Weapon Is Not Very Effective Against This Creature.", 1.00f);
            }

            //Debug.Log("------------------------------------------------------------------------------------------");
            //Debug.LogFormat("Here is damage value before armor reduction is applied = {0}", damage);
            int damBefore = damage; // Something i'll likely want to implement later, that being taking enemy damage resistances into account for the damage reduction for calculating damage done to attacker weapon. Currently only worn armor is taken into consideration here in that regard.

            damage = CalculateArmorDamageReduction(attacker, target, damage, mainDamType, struckBodyPart, shieldBlockSuccess, critDamPen, weapon, shield);

            int damAfter = damage;
            //Debug.LogFormat("Here is damage value after armor reduction = {0}", damage);
            if (damBefore > 0)
            {
                int damReduPercent = ((100 * damAfter / damBefore) - 100) * -1;
                //Debug.LogFormat("Here is damage reduction percent = {0}%", damReduPercent);
                if (damReduPercent > 0 && damAfter == 0)
                    armorCompleteAbsorbed = true;   // For "out" return value later.
                else if (damReduPercent >= 35)
                    armorPartAbsorbed = true;       // For "out" return value later.
            }
            //Debug.Log("------------------------------------------------------------------------------------------");

            DamageEquipment(attacker, target, struckBodyPart, shieldBlockSuccess, mainDamType, damBefore, damAfter, enemyAttackerStats, weapon);

            if (damage < 1) // Cut off the execution if the damage is still not anything higher than 1 at this point in the method.
                return 0;

            // Apply Ring of Namira effect
            if (target == player)
            {
                DaggerfallUnityItem[] equippedItems = target.ItemEquipTable.EquipTable;
                DaggerfallUnityItem item = null;
                if (equippedItems.Length!= 0)
                {
                    if (IsRingOfNamira(equippedItems[(int)EquipSlots.Ring0]) || IsRingOfNamira(equippedItems[(int)EquipSlots.Ring1]))
                    {
                        IEntityEffect effectTemplate = GameManager.Instance.EntityEffectBroker.GetEffectTemplate(RingOfNamiraEffect.EffectKey);
                        effectTemplate.EnchantmentPayloadCallback(EnchantmentPayloadFlags.None,
                            targetEntity: AIAttacker.EntityBehaviour,
                            sourceItem: item,
                            sourceDamage: damage);
                    }
                }
            }

            //Debug.LogFormat("Damage {0} applied, animTime={1}  ({2})", damage, weaponAnimTime, GameManager.Instance.WeaponManager.ScreenWeapon.WeaponState);

            return damage;
        }

        private static bool IsRingOfNamira(DaggerfallUnityItem item)
        {
            return item!= null && item.ContainsEnchantment(DaggerfallConnect.FallExe.EnchantmentTypes.SpecialArtifactEffect, (int)ArtifactsSubTypes.Ring_of_Namira);
        }

        public static int CalculateWeaponAttackDamage(DaggerfallEntity attacker, DaggerfallEntity target, int damageModifier, int weaponAnimTime, DaggerfallUnityItem weapon, int mainDamType, float matResistMod, float critDamMulti, float damTypeResistMod, EnemyBasics.CustomEnemyStatValues enemyAttackerStats)
        {
            PlayerEntity player = GameManager.Instance.PlayerEntity;
            int damage = 0;
            float conditionMulti = 1f;
            int minDamLowerLimit = CalculateWeaponMinDamTypeLowerLimit(weapon, mainDamType);
            int minDamUpperLimit = CalculateWeaponMinDamTypeUpperLimit(weapon, mainDamType);
            int maxDamLowerLimit = CalculateWeaponMaxDamTypeLowerLimit(weapon, mainDamType);
            int maxDamUpperLimit = CalculateWeaponMaxDamTypeUpperLimit(weapon, mainDamType);

            if (attacker == GameManager.Instance.PlayerEntity) // Only the player has weapon damage effected by condition value.
            {
                conditionMulti = AlterDamageBasedOnWepCondition(weapon, mainDamType);
                //Debug.LogFormat("Damage Multiplier Due To Weapon Condition = {0}", conditionMulti);
            }

            if (mainDamType == 1)
                damage = UnityEngine.Random.Range(Mathf.Clamp((int)Mathf.Round((weapon.GetBaseBludgeoningDamageMin() + weapon.GetWeaponMaterialModDensity()) * conditionMulti * damTypeResistMod), minDamLowerLimit, minDamUpperLimit), Mathf.Clamp((int)Mathf.Round((weapon.GetBaseBludgeoningDamageMax() + weapon.GetWeaponMaterialModDensity()) * conditionMulti * damTypeResistMod), maxDamLowerLimit, maxDamUpperLimit)) + damageModifier;
            else if (mainDamType == 2)
                damage = UnityEngine.Random.Range(Mathf.Clamp((int)Mathf.Round((weapon.GetBaseSlashingDamageMin() + weapon.GetWeaponMaterialModShear()) * conditionMulti * damTypeResistMod), minDamLowerLimit, minDamUpperLimit), Mathf.Clamp((int)Mathf.Round((weapon.GetBaseSlashingDamageMax() + weapon.GetWeaponMaterialModShear()) * conditionMulti * damTypeResistMod), maxDamLowerLimit, maxDamUpperLimit)) + damageModifier;
            else if (mainDamType == 3)
                damage = UnityEngine.Random.Range(Mathf.Clamp((int)Mathf.Round((weapon.GetBasePiercingDamageMin() + weapon.GetWeaponMaterialModFracture()) * conditionMulti * damTypeResistMod), minDamLowerLimit, minDamUpperLimit), Mathf.Clamp((int)Mathf.Round((weapon.GetBasePiercingDamageMax() + weapon.GetWeaponMaterialModFracture()) * conditionMulti * damTypeResistMod), maxDamLowerLimit, maxDamUpperLimit)) + damageModifier;
            else
                damage = UnityEngine.Random.Range(weapon.GetBaseDamageMin(), weapon.GetBaseDamageMax() + 1) + damageModifier;

            // Apply strength modifier
            if (attacker == player)
            {
                if (ItemEquipTable.GetItemHands(weapon) == ItemHands.Both && weapon.TemplateIndex!= (int)Weapons.Short_Bow && weapon.TemplateIndex!= (int)Weapons.Long_Bow)
                    damage += (DamageModifier(attacker.Stats.LiveStrength)) * 2; // Multiplying by 2, so that two-handed weapons gets double the damage mod from Strength, except bows.
                else
                    damage += DamageModifier(attacker.Stats.LiveStrength);
            }
            else
            {
                if (ItemEquipTable.GetItemHands(weapon) == ItemHands.Both && weapon.TemplateIndex!= (int)Weapons.Short_Bow && weapon.TemplateIndex!= (int)Weapons.Long_Bow)
                    damage += (DamageModifier(enemyAttackerStats.strengthCustom)) * 2; // Multiplying by 2, so that two-handed weapons gets double the damage mod from Strength, except bows.
                else
                    damage += DamageModifier(enemyAttackerStats.strengthCustom);
            }

            if (damage < 1)
                damage = 0;

            if (damage >= 1)
                damage += GetBonusOrPenaltyByEnemyType(attacker, target