예제 #1
0
        // Reveal uses magery and detect hidden vs. hide and stealth
        private static bool CheckDifficulty(Mobile from, Mobile m)
        {
            if (InvisibilitySpell.HasTimer(m))
            {
                return(true);
            }

            int magery       = (int)(GetJediDamage(from));
            int detectHidden = (int)(from.Skills[SkillName.EvalInt].Fixed);

            int hiding  = m.Skills[SkillName.Hiding].Fixed;
            int stealth = m.Skills[SkillName.Stealth].Fixed;
            int divisor = hiding + stealth;

            int chance;

            if (divisor > 0)
            {
                chance = 50 * (magery + detectHidden) / divisor;
            }
            else
            {
                chance = 100;
            }

            return(chance > Utility.Random(100));
        }
예제 #2
0
        public override void Drink(Mobile from)
        {
            if (from.Hidden)
            {
                from.SendLocalizedMessage(1073185);                   // You are already unseen.
                return;
            }

            PlayDrinkEffect(from);

            this.Consume();

            Point3D loc = from.Location;

            Timer.DelayCall(ComputeDelay(from), () =>
            {
                if (loc != from.Location)
                {
                    from.SendLocalizedMessage(1073187);                               // The invisibility effect is interrupted.
                }
                else
                {
                    Effects.SendLocationParticles(EffectItem.Create(new Point3D(from.X, from.Y, from.Z + 16), from.Map, EffectItem.DefaultDuration), 0x376A, 10, 15, 5045);
                    from.PlaySound(0x3C4);

                    from.Hidden  = true;
                    from.Warmode = false;

                    InvisibilitySpell.RemoveTimer(from);
                    InvisibilitySpell.AddTimer(from, ComputeDuration(from));
                }
            });
        }
예제 #3
0
        public override bool DoEffect(Mobile from, Mobile target)
        {
            if (!target.Hidden && from.InLOS(target) && target.Alive && from.CanBeBeneficial(target))
            {
                from.DoBeneficial(target);
                SpellHelper.Turn(from, target);

                Effects.SendLocationParticles(EffectItem.Create(new Point3D(target.X, target.Y, target.Z + 16), target.Map, EffectItem.DefaultDuration), 0x376A, 10, 15, 5045);
                target.PlaySound(0x3C4);

                target.Hidden = true;

                InvisibilitySpell.RemoveTimer(target);

                Timer t = new InvisibilitySpell.InternalTimer(target, TimeSpan.FromSeconds(30 + Utility.Random(91)));
                t.Start();
                InvisibilitySpell.m_Table[target] = t;

                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #4
0
        public bool ApplyInvisibilityEffect(PlayerMobile Wearer)
        {
            Spell spell = new InvisibilitySpell(Wearer, null);

            if (Wearer == null)
            {
                return(false);
            }

            if (Wearer.Hidden == true)
            {
                // player is already invisible...do nothing
                return(false);
            }
            else if (Wearer.Region.OnBeginSpellCast(Wearer, spell) == false)
            {
                Wearer.SendMessage("The magic normally within this object seems absent.");
                return(false);
            }
            else
            {
                // hide the player, set a timer to check for additional charges or reveal
                Wearer.Hidden = true;

                if (m_InvisTimer != null)
                {
                    m_InvisTimer.Stop();
                    m_InvisTimer = null;
                }

                m_InvisTimer = new MagicEffectTimer(Wearer, this, TimeSpan.FromSeconds(120));

                m_InvisTimer.Start();
                return(true);
            }
        }
예제 #5
0
        public virtual Spell ChooseSpell(Mobile c)
        {
            Spell spell = null;

            if (!SmartAI)
            {
                spell = CheckCastHealingSpell();

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

                if (IsNecromancer)
                {
                    double psDamage = ((m_Mobile.Skills[SkillName.SpiritSpeak].Value - c.Skills[SkillName.MagicResist].Value) / 10) + (c.Player ? 18 : 30);

                    if (psDamage > c.Hits)
                    {
                        return(new PainSpikeSpell(m_Mobile, null));
                    }
                }

                switch (Utility.Random(16))
                {
                case 0:
                case 1:         // Poison them
                {
                    if (c.Poisoned)
                    {
                        goto default;
                    }

                    m_Mobile.DebugSay("Attempting to poison");

                    spell = new PoisonSpell(m_Mobile, null);
                    break;
                }

                case 2:         // Bless ourselves
                {
                    m_Mobile.DebugSay("Blessing myself");

                    spell = new BlessSpell(m_Mobile, null);
                    break;
                }

                case 3:
                case 4:     // Curse them
                {
                    m_Mobile.DebugSay("Attempting to curse");

                    spell = GetRandomCurseSpell();
                    break;
                }

                case 5:         // Paralyze them
                {
                    if (c.Paralyzed || m_Mobile.Skills[SkillName.Magery].Value <= 50.0)
                    {
                        goto default;
                    }

                    m_Mobile.DebugSay("Attempting to paralyze");

                    spell = new ParalyzeSpell(m_Mobile, null);
                    break;
                }

                case 6:     // Drain mana
                {
                    m_Mobile.DebugSay("Attempting to drain mana");

                    spell = GetRandomManaDrainSpell();
                    break;
                }

                case 7:     // Invis ourselves
                {
                    if (Utility.RandomBool())
                    {
                        goto default;
                    }

                    m_Mobile.DebugSay("Attempting to invis myself");

                    spell = new InvisibilitySpell(m_Mobile, null);
                    break;
                }

                default:     // Damage them
                {
                    m_Mobile.DebugSay("Just doing damage");

                    spell = GetRandomDamageSpell();
                    break;
                }
                }

                return(spell);
            }

            spell = CheckCastHealingSpell();

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

            switch (Utility.Random(3))
            {
            case 0:     // Poison them
            {
                if (c.Poisoned)
                {
                    goto case 1;
                }

                spell = new PoisonSpell(m_Mobile, null);
                break;
            }

            case 1:     // Deal some damage
            {
                spell = GetRandomDamageSpell();

                break;
            }

            default:     // Set up a combo
            {
                if (m_Mobile.Mana > 15 && m_Mobile.Mana < 40)
                {
                    if (c.Paralyzed && !c.Poisoned && !m_Mobile.Meditating)
                    {
                        m_Mobile.DebugSay("I am going to meditate");

                        m_Mobile.UseSkill(SkillName.Meditation);
                    }
                    else if (!c.Poisoned)
                    {
                        spell = new ParalyzeSpell(m_Mobile, null);
                    }
                }
                else if (m_Mobile.Mana > 60)
                {
                    if (Utility.RandomBool() && !c.Paralyzed && !c.Frozen && !c.Poisoned)
                    {
                        m_Combo = 0;
                        spell   = new ParalyzeSpell(m_Mobile, null);
                    }
                    else
                    {
                        m_Combo = 1;
                        spell   = new ExplosionSpell(m_Mobile, null);
                    }
                }

                break;
            }
            }

            return(spell);
        }
예제 #6
0
        public virtual Spell ChooseSpell(Mobile c)
        {
            Spell spell = null;

            if (!SmartAI)
            {
                spell = CheckCastHealingSpell();

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

                switch (Utility.Random(16))
                {
                case 0:
                case 1:                         // Poison them
                {
                    //m_Mobile.DebugSay( "Attempting to poison" );

                    if (!c.Poisoned)
                    {
                        spell = new PoisonSpell(m_Mobile, null);
                    }

                    break;
                }

                case 2:                         // Bless ourselves.
                {
                    //m_Mobile.DebugSay( "Blessing myself" );

                    spell = new BlessSpell(m_Mobile, null);
                    break;
                }

                case 3:
                case 4:                         // Curse them.
                {
                    //m_Mobile.DebugSay( "Attempting to curse" );

                    spell = GetRandomCurse();
                    break;
                }

                case 5:                         // Paralyze them.
                {
                    //m_Mobile.DebugSay( "Attempting to paralyze" );

                    if (m_Mobile.Skills[SkillName.Magery].Value > 50.0)
                    {
                        spell = new ParalyzeSpell(m_Mobile, null);
                    }

                    break;
                }

                case 6:                         // Drain mana
                {
                    //m_Mobile.DebugSay( "Attempting to drain mana" );

                    spell = GetRandomManaDrainSpell();
                    break;
                }

                case 7:
                {
                    //m_Mobile.DebugSay( "Attempting to Invis" );

                    if (spell == null)
                    {
                        spell = new InvisibilitySpell(m_Mobile, null);
                    }

                    break;
                }

                default:                         // Damage them.
                {
                    //m_Mobile.DebugSay( "Just doing damage" );

                    spell = GetRandomDamage();
                    break;
                }
                }

                return(spell);
            }

            spell = CheckCastHealingSpell();

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

            switch (Utility.Random(2)) // Removido COMBO Utility.Random( 3 )
            {
            default:
            case 0:                     // Poison them
            {
                if (!c.Poisoned)
                {
                    spell = new PoisonSpell(m_Mobile, null);
                }

                break;
            }

            case 1:                     // Deal some damage
            {
                spell = GetRandomDamageSpell();

                break;
            }

            case 2:                     // Set up a combo
            {
                if (m_Mobile.Mana < 40 && m_Mobile.Mana > 15)
                {
                    if (c.Paralyzed && !c.Poisoned)
                    {
                        m_Mobile.DebugSay("I am going to meditate");

                        m_Mobile.UseSkill(SkillName.Meditation);
                    }
                    else if (!c.Poisoned)
                    {
                        spell = new ParalyzeSpell(m_Mobile, null);
                    }
                }
                else if (m_Mobile.Mana > 60)
                {
                    if (Utility.Random(2) == 0 && !c.Paralyzed && !c.Frozen && !c.Poisoned)
                    {
                        m_Combo = 0;
                        spell   = new ParalyzeSpell(m_Mobile, null);
                    }
                    else
                    {
                        m_Combo = 1;
                        spell   = new ExplosionSpell(m_Mobile, null);
                    }
                }

                break;
            }
            }

            return(spell);
        }
예제 #7
0
파일: Hiding.cs 프로젝트: nogu3ira/xrunuo
        public static TimeSpan OnUse(Mobile m)
        {
            if (m.Spell != null)
            {
                m.SendLocalizedMessage(501238);                   // You are busy doing something else and cannot hide.
                return(TimeSpan.FromSeconds(1.0));
            }

            double bonus = 0.0;

            var house = HousingHelper.FindHouseAt(m);

            if (house != null && house.IsFriend(m))
            {
                bonus = 100.0;
            }

            int range = 18 - (int)(m.Skills[SkillName.Hiding].Value / 10);

            bool badCombat = (!m_CombatOverride && m.Combatant != null && m.InRange(m.Combatant.Location, range) && m.Combatant.InLOS(m));
            bool ok        = !badCombat;

            if (ok)
            {
                if (!m_CombatOverride)
                {
                    foreach (Mobile check in m.GetMobilesInRange(range))
                    {
                        if (check.InLOS(m) && check.Combatant == m)
                        {
                            badCombat = true;
                            ok        = false;
                            break;
                        }
                    }
                }

                ok = (!badCombat && m.CheckSkill(SkillName.Hiding, 0.0 - bonus, 100.0 - bonus));
            }

            if (badCombat)
            {
                m.RevealingAction();

                m.LocalOverheadMessage(MessageType.Regular, 0x22, 501237);                   // You can't seem to hide right now.

                return(TimeSpan.FromSeconds(1.0));
            }
            else
            {
                if (ok)
                {
                    m.Hidden    = true;
                    m.Warmode   = false;
                    m.Combatant = null;
                    m.Target    = null;

                    //If you have drank a invis potion, you must stop the timer in order to remain hidden.
                    InvisibilitySpell.RemoveTimer(m);

                    m.LocalOverheadMessage(MessageType.Regular, 0x1F4, 501240);                       // You have hidden yourself well.
                }
                else
                {
                    m.RevealingAction();

                    m.LocalOverheadMessage(MessageType.Regular, 0x22, 501241);                       // You can't seem to hide here.
                }

                return(TimeSpan.FromSeconds(10.0));
            }
        }