示例#1
0
        private static int CheckDamageForResistances(CharacterInstance victim, int dam, int dt)
        {
            var modDmg = dam;

            if (Macros.IS_FIRE(dt))
            {
                modDmg = victim.ModifyDamageWithResistance(modDmg, ResistanceTypes.Fire);
            }
            else if (Macros.IS_COLD(dt))
            {
                modDmg = victim.ModifyDamageWithResistance(modDmg, ResistanceTypes.Cold);
            }
            else if (Macros.IS_ACID(dt))
            {
                modDmg = victim.ModifyDamageWithResistance(modDmg, ResistanceTypes.Acid);
            }
            else if (Macros.IS_ELECTRICITY(dt))
            {
                modDmg = victim.ModifyDamageWithResistance(modDmg, ResistanceTypes.Electricity);
            }
            else if (Macros.IS_ENERGY(dt))
            {
                modDmg = victim.ModifyDamageWithResistance(modDmg, ResistanceTypes.Energy);
            }
            else if (Macros.IS_DRAIN(dt))
            {
                modDmg = victim.ModifyDamageWithResistance(modDmg, ResistanceTypes.Drain);
            }
            else if (Macros.IS_POISON(dt))
            {
                var skill = RepositoryManager.Instance.GetEntity <SkillData>("poison");
                if (skill != null)
                {
                    modDmg = victim.ModifyDamageWithResistance(modDmg, ResistanceTypes.Poison);
                }
            }
            else if ((dt == GetDamageHitType(DamageTypes.Pound)) ||
                     (dt == GetDamageHitType(DamageTypes.Stone)) ||
                     (dt == GetDamageHitType(DamageTypes.Pea)) ||
                     (dt == GetDamageHitType(DamageTypes.Crush)))
            {
                modDmg = victim.ModifyDamageWithResistance(modDmg, ResistanceTypes.Blunt);
            }
            else if ((dt == GetDamageHitType(DamageTypes.Stab)) ||
                     (dt == GetDamageHitType(DamageTypes.Bite)) ||
                     (dt == GetDamageHitType(DamageTypes.Dart)) ||
                     (dt == GetDamageHitType(DamageTypes.Pierce)) ||
                     (dt == GetDamageHitType(DamageTypes.Bolt)) ||
                     (dt == GetDamageHitType(DamageTypes.Arrow)))
            {
                modDmg = victim.ModifyDamageWithResistance(modDmg, ResistanceTypes.Pierce);
            }
            else if ((dt == GetDamageHitType(DamageTypes.Slice)) ||
                     (dt == GetDamageHitType(DamageTypes.Whip)) ||
                     (dt == GetDamageHitType(DamageTypes.Slash)) ||
                     (dt == GetDamageHitType(DamageTypes.Claw)))
            {
                modDmg = victim.ModifyDamageWithResistance(modDmg, ResistanceTypes.Slash);
            }

            return(modDmg);
        }