Esempio n. 1
0
        public static void CheckHit(Mobile defender)
        {
            SearingWeaponContext context = (SearingWeaponContext)PropertyEffect.GetContext(defender, EffectsType.Searing);

            if (context == null)
            {
                new SearingWeaponContext(defender);
            }
        }
Esempio n. 2
0
        protected static void AddEffects(PropertyEffect effect)
        {
            Effects.Add(effect);

            if (effect.TickDuration > TimeSpan.MinValue)
            {
                effect.StartTimer();
            }
        }
Esempio n. 3
0
        public static void CheckHit(Mobile attacker, Mobile defender)
        {
            SearingWeaponContext context = PropertyEffect.GetContext <SearingWeaponContext>(attacker, defender, EffectsType.Searing);

            if (context == null)
            {
                new SearingWeaponContext(attacker, defender);
            }
        }
Esempio n. 4
0
        public static void RemoveContext(Mobile from, EffectsType type)
        {
            PropertyEffect effect = GetContext(from, type);

            if (effect != null)
            {
                effect.RemoveEffects();
            }
        }
Esempio n. 5
0
        public static IEnumerable <T> GetContextsForVictim <T>(Mobile victim) where T : PropertyEffect
        {
            for (var index = 0; index < Effects.Count; index++)
            {
                PropertyEffect propertyEffect = Effects[index];

                if (propertyEffect is T effect && (effect.Victim == victim))
                {
                    yield return(effect);
                }
            }
        }
Esempio n. 6
0
        public static bool CheckHit(Mobile attacker, Mobile defender, Item weapon)
        {
            SplinteringWeaponContext context = (SplinteringWeaponContext)PropertyEffect.GetContext(attacker, EffectsType.Splintering);

            if (context == null)
            {
                new SplinteringWeaponContext(attacker, defender, weapon);
                return(true);
            }

            return(false);
        }
Esempio n. 7
0
        public static void CheckDamage(Mobile from, int damage, int phys, int fire, int cold, int pois, int ergy, int direct)
        {
            DamageEaterContext context = PropertyEffect.GetContext <DamageEaterContext>(from, EffectsType.DamageEater);

            if (context == null && HasValue(from))
            {
                context = new DamageEaterContext(from);
            }

            if (context != null)
            {
                context.OnDamage(damage, phys, fire, cold, pois, ergy, direct);
            }
        }
Esempio n. 8
0
            public InternalTimer(PropertyEffect effect)
                : base(effect.TickDuration, effect.TickDuration)
            {
                m_Effect = effect;

                if (effect != null && effect.Duration > TimeSpan.MinValue)
                {
                    m_Expires = DateTime.UtcNow + effect.Duration;
                }
                else
                {
                    m_Expires = DateTime.MinValue;
                }
            }
Esempio n. 9
0
        public static void CheckHit(Mobile attacker, Mobile defender, int damage)
        {
            BaseShield shield = defender.FindItemOnLayer(Layer.TwoHanded) as BaseShield;

            if (shield != null && shield.ArmorAttributes.SoulCharge > 0 && shield.ArmorAttributes.SoulCharge > Utility.Random(100))
            {
                SoulChargeContext sc = PropertyEffect.GetContext <SoulChargeContext>(defender, EffectsType.SoulCharge);

                if (sc == null)
                {
                    sc = new SoulChargeContext(defender, shield);
                }

                sc.OnDamaged(damage);
            }
        }
Esempio n. 10
0
        public static bool CheckHit(Mobile attacker, Mobile defender, WeaponAbility ability, Item weapon)
        {
            if (defender == null || (Core.EJ && (ability == WeaponAbility.Disarm || ability == WeaponAbility.InfectiousStrike || SkillMasterySpell.HasSpell(attacker, typeof(SkillMasterySpell)))))
            {
                return(false);
            }

            SplinteringWeaponContext context = PropertyEffect.GetContext <SplinteringWeaponContext>(attacker, defender, EffectsType.Splintering);

            if (context == null)
            {
                new SplinteringWeaponContext(attacker, defender, weapon);
                return(true);
            }

            return(false);
        }
Esempio n. 11
0
        public static T GetContext <T>(Mobile from, Mobile victim) where T : PropertyEffect
        {
            PropertyEffect first = null;

            for (var index = 0; index < Effects.Count; index++)
            {
                var e = Effects[index];

                if (e.Attacker == from && e.Victim == victim && e.GetType() == typeof(T))
                {
                    first = e;
                    break;
                }
            }

            return(first as T);
        }
Esempio n. 12
0
        public static void CheckHit(Mobile attacker, Mobile defender)
        {
            if (IsImmune(defender))
            {
                attacker.SendLocalizedMessage(1157324); // Your target is currently immune to sparks!
                return;
            }

            SparksContext context = PropertyEffect.GetContext <SparksContext>(attacker, defender, EffectsType.Sparks);

            if (context == null)
            {
                context = new SparksContext(attacker, defender, null);

                attacker.PlaySound(0x20A);
                defender.FixedParticles(0x3818, 1, 11, 0x13A8, 0, 0, EffectLayer.Waist);
            }
        }
Esempio n. 13
0
        public static void CheckHit(Mobile attacker, Mobile defender)
        {
            if (IsImmune(defender))
            {
                attacker.SendLocalizedMessage(1157322); // Your target is currently immune to swarm!
                return;
            }

            SwarmContext context = PropertyEffect.GetContext <SwarmContext>(attacker, defender, EffectsType.Swarm);

            if (context != null)
            {
                context.RemoveEffects();
            }

            context = new SwarmContext(attacker, defender, null);

            defender.NonlocalOverheadMessage(MessageType.Regular, 0x5C, 1114447, defender.Name); // * ~1_NAME~ is stung by a swarm of insects *
            defender.LocalOverheadMessage(MessageType.Regular, 0x5C, 1071905);                   // * The swarm of insects bites and stings your flesh! *
        }
Esempio n. 14
0
        public static int CheckHit(Mobile attacker, Mobile defender)
        {
            int mana   = (int)(30.0 * ((double)(AosAttributes.GetValue(attacker, AosAttribute.LowerManaCost) + BaseArmor.GetInherentLowerManaCost(attacker)) / 100.0));
            int damage = 0;

            if (attacker.Mana >= mana)
            {
                attacker.Mana -= mana;
                damage        += 50;

                defender.SendLocalizedMessage(1157317); // The attack shatters your bones!
            }

            if (IsImmune(defender))
            {
                attacker.SendLocalizedMessage(1157316); // Your target is currently immune to bone breaking!
                return(damage);
            }

            if (20 > Utility.Random(100))
            {
                BoneBreakerContext context = PropertyEffect.GetContext <BoneBreakerContext>(attacker, defender, EffectsType.BoneBreaker);

                if (context == null)
                {
                    new BoneBreakerContext(attacker, defender, null);
                    defender.SendLocalizedMessage(1157363); // Your bones are broken! Stamina drain over time!

                    defender.PlaySound(0x204);
                    defender.FixedEffect(0x376A, 9, 32);

                    defender.FixedEffect(0x3779, 10, 20, 1365, 0);
                }
            }

            return(damage);
        }
Esempio n. 15
0
        public static void CheckHit(Mobile attacker, Mobile defender)
        {
            if (IsImmune(defender))
            {
                attacker.SendLocalizedMessage(1157322); // Your target is currently immune to swarm!
                return;
            }

            SwarmContext context = PropertyEffect.GetContext <SwarmContext>(attacker, defender, EffectsType.Swarm);

            if (context == null)
            {
                context = new SwarmContext(attacker, defender, null);

                if (defender.NetState != null)
                {
                    defender.PrivateOverheadMessage(MessageType.Regular, 1150, 1157321, defender.NetState); // *You are engulfed in a swarm of insects!*
                }
                Server.Effects.SendTargetEffect(defender, context._ID, 40);

                defender.PlaySound(0x00E);
                defender.PlaySound(0x1BC);
            }
        }
Esempio n. 16
0
 public static bool HasContext(Mobile defender)
 {
     return(PropertyEffect.GetContext <SearingWeaponContext>(defender, EffectsType.Searing) != null);
 }
Esempio n. 17
0
            public InternalTimer(PropertyEffect effect)
                : base(effect.TickDuration, effect.TickDuration)
            {
                m_Effect = effect;

                if (effect != null && effect.Duration > TimeSpan.MinValue)
                    m_Expires = DateTime.Now + effect.Duration;
                else
                    m_Expires = DateTime.MinValue;
            }