Beispiel #1
0
        public override void OnBeforeDamage(Mobile from, ref int totalDamage, Server.DamageType type)
        {
            if (Region.IsPartOf("Khaldun") && IsChampionSpawn && !Caddellite.CheckDamage(from, type))
            {
                totalDamage = 0;
            }

            base.OnBeforeDamage(from, ref totalDamage, type);
        }
Beispiel #2
0
        public static bool CheckDamage(Mobile from, Server.DamageType type)
        {
            if (from is BaseCreature creature)
            {
                if (KhaldunTastyTreat.UnderInfluence(creature))
                {
                    return(true);
                }

                return(false);
            }

            if (from.Player)
            {
                Item damager;

                switch (type)
                {
                case Server.DamageType.Melee:
                case Server.DamageType.Ranged:
                    damager = from.FindItemOnLayer(Layer.OneHanded);

                    if (damager == null || !damager.HasSocket <Caddellite>())
                    {
                        damager = from.FindItemOnLayer(Layer.TwoHanded);
                    }

                    return(damager != null && damager.HasSocket <Caddellite>() && damager is BaseWeapon);

                default:
                    damager = from.FindItemOnLayer(Layer.OneHanded);

                    if (damager != null && damager.HasSocket <Caddellite>() && damager is Spellbook)
                    {
                        return(true);
                    }

                    damager = from.FindItemOnLayer(Layer.Neck);

                    if (damager == null || !damager.HasSocket <Caddellite>())
                    {
                        damager = from.FindItemOnLayer(Layer.Helm);
                    }

                    return(damager != null && damager.HasSocket <Caddellite>());
                }
            }

            return(false);
        }