private static double ReactPercent = 0.5;         //How much damage gets through

        public override int AbsorbDamage(Mobile attacker, Mobile defender, int damage)
        {
            damage = base.AbsorbDamage(attacker, defender, damage);

            AttuneWeaponSpell.TryAbsorb(defender, ref damage);

            if (Core.AOS)
            {
                return(damage);
            }

            int absorb = defender.MeleeDamageAbsorb;

            if (absorb > 0)
            {
                int absorbed = Math.Min(damage, absorb);

                defender.MeleeDamageAbsorb -= absorbed;
                if (defender.MeleeDamageAbsorb <= 0)
                {
                    defender.MeleeDamageAbsorb = 0;
                    defender.SendLocalizedMessage(1005556);                       // Your reactive armor spell has been nullified.
                }

                damage -= (int)(absorbed * ReactPercent);
                attacker.Damage((int)(absorbed * (1 - ReactPercent)), defender);

                attacker.PlaySound(0x1F1);
                attacker.FixedEffect(0x374A, 10, 16);
            }

            return(damage);
        }
Beispiel #2
0
        public bool CheckForAttuneWeapon()
        {
            if (!AttuneWeaponSpell.IsAbsorbing(this.m_Mobile) && this.m_Mobile.Mana > 24)
            {
                if (this.m_Mobile.Debug)
                {
                    this.m_Mobile.Say(1436, "Casting Attune Weapon");
                }

                new AttuneWeaponSpell(this.m_Mobile, null).Cast();
                return(true);
            }

            return(false);
        }
Beispiel #3
0
        public override int AbsorbDamage(Mobile attacker, Mobile defender, int damage)
        {
            damage = base.AbsorbDamage(attacker, defender, damage);

            AttuneWeaponSpell.TryAbsorb(defender, ref damage);

            if (Core.AOS)
            {
                return(damage);
            }

            int absorb = defender.MeleeDamageAbsorb;

            if (absorb > 0)
            {
                if (absorb > damage)
                {
                    int react = damage / 5;

                    if (react <= 0)
                    {
                        react = 1;
                    }

                    defender.MeleeDamageAbsorb -= damage;
                    damage = 0;

                    attacker.Damage(react, defender);

                    attacker.PlaySound(0x1F1);
                    attacker.FixedEffect(0x374A, 10, 16);
                }
                else
                {
                    defender.MeleeDamageAbsorb = 0;
                    defender.SendLocalizedMessage(1005556); // Your reactive armor spell has been nullified.
                    DefensiveSpell.Nullify(defender);
                }
            }

            return(damage);
        }
Beispiel #4
0
        public void SpellweavingPower()
        {
            CheckFocus();

            // Always attune if needed
            if (!AttuneWeaponSpell.IsAbsorbing(m_Mobile) && m_Mobile.Mana > 24)
            {
                if (m_Mobile.Debug)
                {
                    m_Mobile.Say(1436, "Casting Attune Weapon");
                }

                new AttuneWeaponSpell(m_Mobile, null).Cast();
            }

            if (m_Mobile.Combatant == null)
            {
                return;
            }

            // 10% chance to try and get help
            if (Utility.RandomDouble() > 0.89)
            {
                if (m_Mobile.Followers < m_Mobile.FollowersMax)
                {
                    Spell spell = GetSpellweavingSummon();

                    if (spell != null)
                    {
                        if (m_Mobile.Debug)
                        {
                            m_Mobile.Say(1436, "Summoning help");
                        }

                        spell.Cast();
                    }

                    if (m_Mobile.Target != null)
                    {
                        if (m_Mobile.Debug)
                        {
                            m_Mobile.Say(1436, "Invoking Nature's Fury's target");
                        }

                        m_Mobile.Target.Invoke(m_Mobile, m_Mobile.Combatant);
                    }

                    return;
                }
                else if (m_Mobile.Combatant is BaseCreature)
                {
                    if (m_Mobile.Debug)
                    {
                        m_Mobile.Say(1436, "Casting Dryad Allure");
                    }

                    new DryadAllureSpell(m_Mobile, null).Cast();
                }
            }

            RandomSpellweavingChoice();
            return;
        }