Exemplo n.º 1
0
        public override void OnThink()
        {
            base.OnThink();

            if (Combatant == null)
            {
                return;
            }

            if (_NextMastery < DateTime.UtcNow)
            {
                if (SkillMasterySpell.HasSpell(this, typeof(RampageSpell)) || Utility.RandomDouble() > 0.5)
                {
                    SpecialMove.SetCurrentMove(this, SpellRegistry.GetSpecialMove(740));
                }
                else
                {
                    SkillMasterySpell spell = new RampageSpell(this, null);
                    spell.Cast();
                }

                _NextMastery = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(45, 70));
            }

            if (_NextSpecial < DateTime.UtcNow)
            {
                DoSpecial();
                _NextSpecial = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(45, 60));
            }
        }
Exemplo n.º 2
0
        public virtual SpecialMove GetSpecialMove()
        {
            int skill = (int)m_Mobile.Skills[SkillName.Ninjitsu].Value;

            if (skill < 40)
            {
                return(null);
            }

            int avail = 1;

            if (skill >= 85)
            {
                avail = 3;
            }
            else if (skill >= 80)
            {
                avail = 2;
            }

            switch (Utility.Random(avail))
            {
            case 0:
                return(SpellRegistry.GetSpecialMove(500));    //new FocusAttack();

            case 1:
                return(SpellRegistry.GetSpecialMove(503));    //new KiAttack();

            case 2:
                return(SpellRegistry.GetSpecialMove(501));    //new DeathStrike();
            }

            return(null);
        }
Exemplo n.º 3
0
        private static void Targeted_Spell(TargetedSpellEventArgs e)
        {
            try
            {
                Mobile from = e.Mobile;

                if (!DesignContext.Check(from))
                {
                    return; // They are customizing
                }

                Spellbook book    = null;
                int       spellID = e.SpellID;

                if (book == null || !book.HasSpell(spellID))
                {
                    book = Find(from, spellID);
                }

                if (book != null && book.HasSpell(spellID))
                {
                    SpecialMove move = SpellRegistry.GetSpecialMove(spellID);

                    if (move != null)
                    {
                        SpecialMove.SetCurrentMove(from, move);
                    }
                    else
                    {
                        Mobile to    = World.FindMobile(e.Target.Serial);
                        Item   toI   = World.FindItem(e.Target.Serial);
                        Spell  spell = SpellRegistry.NewSpell(spellID, from, null);

                        if (to != null)
                        {
                            spell.InstantTarget = to;
                        }
                        else if (toI != null)
                        {
                            spell.InstantTarget = toI as IDamageableItem;
                        }

                        if (spell != null)
                        {
                            spell.Cast();
                        }
                        else if (!Server.Spells.SkillMasteries.MasteryInfo.IsPassiveMastery(spellID))
                        {
                            from.SendLocalizedMessage(502345); // This spell has been temporarily disabled.
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500015); // You do not have that spell!
                }
            }
            catch { }
        }
Exemplo n.º 4
0
        private bool PerformFocusAttack()
        {
            if (Utility.RandomBool() && CanUseAbility(60.0, 20, focusChance))
            {
                SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(500));                     // Focus Attack
                return(true);
            }

            return(false);
        }
Exemplo n.º 5
0
        private static void Targeted_Spell(TargetedSpellEventArgs e)
        {
            try
            {
                Mobile from = e.Mobile;

                if (!DesignContext.Check(from))
                {
                    return; // They are customizing
                }

                int spellID = e.SpellID;

                Spellbook book = Find(from, spellID);

                if (book != null && book.HasSpell(spellID))
                {
                    SpecialMove move = SpellRegistry.GetSpecialMove(spellID);

                    if (move != null)
                    {
                        SpecialMove.SetCurrentMove(from, move);
                    }
                    else if (e.Target != null)
                    {
                        Mobile to    = World.FindMobile(e.Target.Serial);
                        Item   toI   = World.FindItem(e.Target.Serial);
                        Spell  spell = SpellRegistry.NewSpell(spellID, from, null);

                        if (spell != null && !Spells.SkillMasteries.MasteryInfo.IsPassiveMastery(spellID))
                        {
                            if (to != null)
                            {
                                spell.InstantTarget = to;
                            }
                            else if (toI != null)
                            {
                                spell.InstantTarget = toI as IDamageableItem;
                            }

                            spell.Cast();
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500015); // You do not have that spell!
                }
            }
            catch (Exception ex)
            {
                Diagnostics.ExceptionLogging.LogException(ex);
            }
        }
Exemplo n.º 6
0
        private static void EventSink_CastSpellRequest(CastSpellRequestEventArgs e)
        {
            Mobile from  = e.Mobile;
            Spell  spell = SpellRegistry.NewSpell(e.SpellID, from, null);

            if (!Multis.DesignContext.Check(from))
            {
                return; // They are customizing
            }
            if (spell != null && from.AccessLevel > AccessLevel.Player)
            {
                spell.Cast(); //staff do not need the spellbook
                return;
            }

            Spellbook book    = e.Spellbook as Spellbook;
            int       spellID = e.SpellID;

            if (book == null || !book.HasSpell(spellID))
            {
                book = Find(from, spellID);
            }

            if (book != null && book.HasSpell(spellID))
            {
                SpecialMove move = SpellRegistry.GetSpecialMove(spellID);

                if (move != null)
                {
                    SpecialMove.SetCurrentMove(from, move);
                }
                else
                {
                    if (spell != null)
                    {
                        spell.Cast();
                    }
                    else
                    {
                        from.SendLocalizedMessage(502345);   // This spell has been temporarily disabled.
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(500015);   // You do not have that spell!
            }
        }
Exemplo n.º 7
0
        public virtual SpecialMove GetHiddenSpecialMove()
        {
            int skill = (int)m_Mobile.Skills[SkillName.Ninjitsu].Value;

            if (skill < 40)
            {
                return(null);
            }

            if (skill >= 60)
            {
                //return .5 > Utility.RandomDouble() ? new SupriseAttack() : new Backstab();
                return(.5 > Utility.RandomDouble() ? SpellRegistry.GetSpecialMove(504) : SpellRegistry.GetSpecialMove(505));
            }

            return(SpellRegistry.GetSpecialMove(505)); //new Backstab();
        }
Exemplo n.º 8
0
        private static void EventSink_CastSpellRequest(CastSpellRequestEventArgs e)
        {
            Mobile from = e.Mobile;

            if (!DesignContext.Check(from))
            {
                return;                 // They are customizing
            }

            Spellbook book    = e.Spellbook as Spellbook;
            int       spellID = e.SpellID;

            if (book == null || !book.HasSpell(spellID))
            {
                book = Find(from, spellID);
            }

            if (book != null && book.HasSpell(spellID))
            {
                SpecialMove move = SpellRegistry.GetSpecialMove(spellID);

                if (move != null)
                {
                    SpecialMove.SetCurrentMove(from, move);
                }
                else
                {
                    Spell spell = SpellRegistry.NewSpell(spellID, from, null);

                    if (spell != null)
                    {
                        spell.Cast();
                    }
                    else if (!Server.Spells.SkillMasteries.MasteryInfo.IsPassiveMastery(spellID))
                    {
                        from.SendLocalizedMessage(502345);                           // This spell has been temporarily disabled.
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(500015);                 // You do not have that spell!
            }
        }
Exemplo n.º 9
0
        public virtual SpecialMove GetSpecialMove()
        {
            double skill = m_Mobile.Skills[SkillName.Ninjitsu].Value;

            SpecialMove special = SpecialMove.GetCurrentMove(m_Mobile);

            if (special != null)
            {
                return(special);
            }

            if (skill < 30 || m_Mobile.Mana < 30)
            {
                return(null);
            }

            int avail = 1;

            if (skill < 80)
            {
                avail = 2;
            }

            if (skill >= 85)
            {
                avail = 3;
                Mobile combatant = m_Mobile.Combatant;

                if (combatant != null && (int)combatant.Hits < (Utility.Random(10) + 10))
                {
                    return(SpellRegistry.GetSpecialMove(501));
                }
            }

            switch (Utility.Random(avail))
            {
            case 0: return(SpellRegistry.GetSpecialMove(500));    //new FocusAttack();

            case 1: return(SpellRegistry.GetSpecialMove(503));    //new KiAttack();

            case 2: return(SpellRegistry.GetSpecialMove(501));    //new DeathStrike();
            }
            return(null);
        }
Exemplo n.º 10
0
        public virtual SpecialMove GetSpecialMove()
        {
            var skill = (int)m_Mobile.Skills[SkillName.Bushido].Value;

            if (skill <= 50)
            {
                return(null);
            }

            if (m_Mobile.Combatant != null && m_Mobile.Combatant.Hits <= 10 && skill >= 25)
            {
                return(SpellRegistry.GetSpecialMove(400));                //new HonerableExecution();
            }
            if (skill >= 70 && CheckForMomentumStrike() && 0.5 > Utility.RandomDouble())
            {
                return(SpellRegistry.GetSpecialMove(405));        //new MomentumStrike();
            }
            return(SpellRegistry.GetSpecialMove(404));            // new LightningStrike();
        }
Exemplo n.º 11
0
        private void UseAttackAbility()
        {
            ArrayList t = BaseAttackHelperSE.GetAllAttackers(m_Mobile, 2);

            if (t.Count > 1)
            {
                if (Utility.Random(3) != 1)
                {
                    if (CanUseAbility(70.0, 10, 1.0))
                    {
                        SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(405));                             // Momentum Strike
                        return;
                    }
                }
            }

            if (CanUseAbility(50.0, 5, 1.0))
            {
                SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(404));                     // Lightning Strike
            }
            return;
        }
Exemplo n.º 12
0
        private static void Targeted_Spell(TargetedSpellEventArgs e)
        {
            Mobile from = e.NetState.Mobile;

            if (!Multis.DesignContext.Check(from))
            {
                return; // They are customizing
            }
            int spellID = e.SpellID;

            SpecialMove move = SpellRegistry.GetSpecialMove(spellID);

            if (move != null)
            {
                SpecialMove.SetCurrentMove(from, move);
            }
            else
            {
                Spell spell = SpellRegistry.NewSpell(spellID, from, null);
                if (spell != null)
                {
                    try
                    {
                        from.TargetLocked = true;
                        Mobile targeted = World.FindMobile(e.Target.Serial);
                        spell.DefineTargetForeignSpell(targeted);
                        spell.Cast();
                    }
                    catch { Console.WriteLine("Erro target Spell."); }
                    finally { from.TargetLocked = false; }
                }
                else
                {
                    from.SendLocalizedMessage(502345); // This spell has been temporarily disabled.
                }
            }
        }
Exemplo n.º 13
0
        public override object GetMasterySpell()
        {
            if (TribeType != EodonTribe.Urali)
            {
                BaseWeapon wep = Weapon as BaseWeapon;

                if (wep == null)
                {
                    return(null);
                }

                switch (wep.DefSkill)
                {
                case SkillName.Swords:
                    if (.5 > Utility.RandomDouble())
                    {
                        return(new FocusedEyeSpell(this, null));
                    }
                    else
                    {
                        return(SpellRegistry.GetSpecialMove(728));
                    }

                case SkillName.Fencing:
                    if (.5 > Utility.RandomDouble())
                    {
                        return(new ThrustSpell(this, null));
                    }
                    else
                    {
                        return(SpellRegistry.GetSpecialMove(725));
                    }

                case SkillName.Macing:
                    if (.5 > Utility.RandomDouble())
                    {
                        return(new ToughnessSpell(this, null));
                    }
                    else
                    {
                        return(SpellRegistry.GetSpecialMove(726));
                    }

                case SkillName.Wrestling:
                    if (.5 > Utility.RandomDouble())
                    {
                        return(new RampageSpell(this, null));
                    }
                    else
                    {
                        return(SpellRegistry.GetSpecialMove(740));
                    }

                case SkillName.Archery:
                    if (.5 > Utility.RandomDouble())
                    {
                        return(new FlamingShotSpell(this, null));
                    }
                    else
                    {
                        return(new PlayingTheOddsSpell(this, null));
                    }

                case SkillName.Throwing:
                    if (.5 > Utility.RandomDouble())
                    {
                        return(new ElementalFurySpell(this, null));
                    }
                    else
                    {
                        return(new CalledShotSpell(this, null));
                    }
                }
            }

            return(null);
        }
Exemplo n.º 14
0
        public virtual SpecialMove GetHiddenSpecialMove()
        {
            double skill = m_Mobile.Skills[SkillName.Ninjitsu].Value;

            SpecialMove special = SpecialMove.GetCurrentMove(m_Mobile);

            if (special != null)
            {
                return(special);
            }

            if (skill < 20 || m_Mobile.Mana < 30)
            {
                return(null);
            }

            int avail = 1;

            if (m_Mobile.AllowedStealthSteps != 0)
            {
                if (skill >= 30)
                {
                    avail = 2;
                }
                Mobile combatant = m_Mobile.Combatant;
                if (skill >= 85)
                {
                    avail = 3;
                    //Mobile combatant = m_Mobile.Combatant;
                    if (combatant != null && (combatant.Hits < (Utility.Random(10) + 10) || !combatant.Warmode))
                    {
                        return(SpellRegistry.GetSpecialMove(501));
                    }
                }

                switch (Utility.Random(avail))
                {
                case 0: combatant.Say("Getting BackStab"); return(SpellRegistry.GetSpecialMove(505));                       //new Backstab(); skill = 20;

                case 1: combatant.Say("Getting SurpriseAttack"); return(SpellRegistry.GetSpecialMove(504));                 //new SurpriseAttack(); skill = 30;

                case 2: combatant.Say("Getting DeathStrike"); return(SpellRegistry.GetSpecialMove(501));                    //new DeathStrike(); skill = 85;
                }
            }
            else
            {
                if (skill < 30)
                {
                    return(null);
                }

                if (skill < 80)
                {
                    avail = 2;
                }

                if (skill >= 85)
                {
                    avail = 3;
                    Mobile combatant = m_Mobile.Combatant;

                    if (combatant != null && (int)combatant.Hits < (Utility.Random(10) + 10))
                    {
                        return(SpellRegistry.GetSpecialMove(501));
                    }
                }

                switch (Utility.Random(avail))
                {
                case 0: return(SpellRegistry.GetSpecialMove(500));                        //new FocusAttack();

                case 1: return(SpellRegistry.GetSpecialMove(503));                        //new KiAttack();

                case 2: return(SpellRegistry.GetSpecialMove(501));                        //new DeathStrike();
                }
            }
            return(null);
        }
Exemplo n.º 15
0
        public override bool DoActionCombat()
        {
            Mobile combatant = m_Mobile.Combatant;

            if (combatant == null || combatant.Deleted || combatant.Map != m_Mobile.Map || !combatant.Alive || combatant.IsDeadBondedPet)
            {
                m_Mobile.DebugSay("My combatant is gone, so my guard is up");

                Action = ActionType.Guard;

                return(true);
            }

            if (MoveTo(combatant, true, m_Mobile.RangeFight))
            {
                m_Mobile.Direction = m_Mobile.GetDirectionTo(combatant);
            }
            else if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
            {
                if (m_Mobile.Debug)
                {
                    m_Mobile.DebugSay("My move is blocked, so I am going to attack {0}", m_Mobile.FocusMob.Name);
                }

                m_Mobile.Combatant = m_Mobile.FocusMob;
                Action             = ActionType.Combat;

                return(true);
            }
            else if (m_Mobile.GetDistanceToSqrt(combatant) > m_Mobile.RangePerception + 1)
            {
                if (m_Mobile.Debug)
                {
                    m_Mobile.DebugSay("I cannot find {0}, so my guard is up", combatant.Name);
                }

                Action = ActionType.Guard;

                return(true);
            }
            else
            {
                if (m_Mobile.Debug)
                {
                    m_Mobile.DebugSay("I should be closer to {0}", combatant.Name);
                }
            }

            if (!m_Mobile.Controlled && !m_Mobile.Summoned && m_Mobile.CanFlee)
            {
                if (m_Mobile.Hits < m_Mobile.HitsMax * 20 / 100)
                {
                    // We are low on health, should we flee?

                    bool flee = false;

                    if (m_Mobile.Hits < combatant.Hits)
                    {
                        // We are more hurt than them

                        int diff = combatant.Hits - m_Mobile.Hits;

                        flee = (Utility.Random(0, 100) < (10 + diff));                               // (10 + diff)% chance to flee
                    }
                    else
                    {
                        flee = Utility.Random(0, 100) < 10;                           // 10% chance to flee
                    }

                    if (flee)
                    {
                        if (m_Mobile.Debug)
                        {
                            m_Mobile.DebugSay("I am going to flee from {0}", combatant.Name);
                        }

                        Action = ActionType.Flee;
                    }
                }
            }

            if (combatant.Hits < (Utility.Random(10) + 10))
            {
                if (CanUseAbility(25.0, 0, heChance))
                {
                    SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(400));                         // Honorable Execution
                    return(true);
                }
            }

            UseSamuraiAbility();

            return(true);
        }
Exemplo n.º 16
0
        public override bool DoActionCombat()
        {
            if (m_Mobile.BodyMod != 0)
            {
                ChangeForm(0);
            }

            Mobile combatant = m_Mobile.Combatant;

            if (combatant == null || combatant.Deleted || combatant.Map != m_Mobile.Map || !combatant.Alive || combatant.IsDeadBondedPet)
            {
                m_Mobile.DebugSay("My combatant is gone, so my guard is up");

                Action = ActionType.Guard;

                return(true);
            }

            /*if ( !m_Mobile.InLOS( combatant ) )
             * {
             *      if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
             *      {
             *              m_Mobile.Combatant = combatant = m_Mobile.FocusMob;
             *              m_Mobile.FocusMob = null;
             *      }
             * }*/

            if (MoveTo(combatant, true, m_Mobile.RangeFight))
            {
                m_Mobile.Direction = m_Mobile.GetDirectionTo(combatant);
            }
            else if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
            {
                if (m_Mobile.Debug)
                {
                    m_Mobile.DebugSay("My move is blocked, so I am going to attack {0}", m_Mobile.FocusMob.Name);
                }

                m_Mobile.Combatant = m_Mobile.FocusMob;
                Action             = ActionType.Combat;

                return(true);
            }
            else if (m_Mobile.GetDistanceToSqrt(combatant) > m_Mobile.RangePerception + 1)
            {
                if (m_Mobile.Debug)
                {
                    m_Mobile.DebugSay("I cannot find {0}, so my guard is up", combatant.Name);
                }

                Action = ActionType.Guard;

                return(true);
            }
            else
            {
                if (m_Mobile.Debug)
                {
                    m_Mobile.DebugSay("I should be closer to {0}", combatant.Name);
                }
            }

            if (!m_Mobile.Controlled && !m_Mobile.Summoned && m_Mobile.CanFlee)
            {
                if (m_Mobile.Hits < m_Mobile.HitsMax * 20 / 100)
                {
                    // We are low on health, should we flee?

                    bool flee = false;

                    if (m_Mobile.Hits < combatant.Hits)
                    {
                        // We are more hurt than them

                        int diff = combatant.Hits - m_Mobile.Hits;

                        flee = (Utility.Random(0, 100) < (10 + diff));                               // (10 + diff)% chance to flee
                    }
                    else
                    {
                        flee = Utility.Random(0, 100) < 10;                           // 10% chance to flee
                    }

                    if (flee)
                    {
                        if (m_Mobile.Debug)
                        {
                            m_Mobile.DebugSay("I am going to flee from {0}", combatant.Name);
                        }

                        Action = ActionType.Flee;

                        if (CanUseAbility(50.0, 15, shadowJumpChance))
                        {
                            PerformHide();

                            m_Mobile.UseSkill(SkillName.Stealth);

                            if (m_Mobile.AllowedStealthSteps != 0)
                            {
                                if (PerformShadowjump(combatant))
                                {
                                    m_Mobile.Mana -= 15;
                                }
                            }
                        }
                    }
                }
            }

            if (combatant.Hits < (Utility.Random(10) + 10))
            {
                if (CanUseAbility(85.0, 30, 1.0))
                {
                    SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(501));                         // Death Strike
                    return(true);
                }
            }

            double dstToTarget = m_Mobile.GetDistanceToSqrt(combatant);

            if (dstToTarget > 2.0 && dstToTarget <= (m_Mobile.Skills[SkillName.Ninjitsu].Value / 10.0) && m_Mobile.Mana > 45 && comboChance > (Utility.RandomDouble() + MagnitudeBySkill()))
            {
                PerformHide();

                m_Mobile.UseSkill(SkillName.Stealth);

                if (m_Mobile.AllowedStealthSteps != 0)
                {
                    if (CanUseAbility(20.0, 30, 1.0))
                    {
                        SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(505));                             // Backstab
                    }
                    if (CanUseAbility(30.0, 20, 1.0))
                    {
                        SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(504));                             // Surprise Attack
                    }
                    PerformFocusAttack();

                    if (PerformShadowjump(combatant))
                    {
                        m_Mobile.Mana -= 15;
                    }
                }

                return(true);
            }

            if (PerformMirror())
            {
                return(true);
            }

            if (CanUseAbility(80.0, 25, kiChance) && m_Mobile.GetDistanceToSqrt(combatant) < 2.0)
            {
                SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(503));                     // Ki Attack
                return(true);
            }

            PerformFocusAttack();

            return(true);
        }