Пример #1
0
        public bool CheckHSequence(Mobile target)
        {
            if (Caster is ScriptMobile && target is ScriptMobile)
            {
                ScriptMobile mob = (ScriptMobile)Caster;
                if (mob.PVPInfo != null)
                {
                    if (!mob.PVPInfo.CurrentEvent.mode.AllowFriendlyFire(mob, (ScriptMobile)target))
                    {
                        return(false);
                    }
                }
            }

            if (!target.Alive)
            {
                Caster.SendLocalizedMessage(501857);                   // This spell won't work on that!
                return(false);
            }
            else if (Caster.CanBeHarmful(target) && CheckSequence())
            {
                GuardVer2.CheckOnHSpell(Caster);
                Caster.DoHarmful(target);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        /// Détermine la séquence de combat d'une tentative de coup de l'attaquant au défenseur.
        /// </summary>
        /// <param name="atk">L'attaquant</param>
        /// <param name="def">Le défenseur</param>
        /// <returns>Le délai nécessaire avant de pouvoir porter le prochain coup.</returns>
        public int Sequence(Mobile atk, Mobile def)
        {
            GuardVer2.CheckOnHit(atk); // La séquence est activée seulement si le joueur attaquant est "InRange" du défenseur. Donc le warmode ne trigger pas le OnHit.

            if (!BandageContext.IsHealingSelf(atk))
            {
                if (Toucher(atk, def))
                {
                    def = ProtectionTechnique.GetOnHitEffect(def);
                    OnHit(atk, def);
                }
                else
                {
                    OnMiss(atk, def);
                }

                CheckEquitationAttaque(atk);
            }
            else
            {
                atk.SendMessage("Vous ne pouvez pas vous battre tout en vous soignant avec des bandages.");
            }

            return(ProchaineAttaque(atk));
        }
Пример #3
0
            private Item TryStealItem(Item toSteal, ref bool caught)
            {
                Item stolen = null;

                object root = toSteal.RootParent;

                StealableArtifactsSpawner.StealableInstance si = null;
                if (toSteal.Parent == null || !toSteal.Movable)
                {
                    si = StealableArtifactsSpawner.GetStealableInstance(toSteal);
                }

                if (m_Thief is ScriptMobile)
                {
                    ScriptMobile mob = (ScriptMobile)m_Thief;
                    if (mob.PVPInfo != null)
                    {
                        if (!mob.PVPInfo.CurrentEvent.mode.AllowLoot())
                        {
                            return(stolen);
                        }
                    }
                }

                if (!IsEmptyHanded(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005584);                       // Both hands must be free to steal.
                }

                /*else if ( root is Mobile && ((Mobile)root).Player && IsInnocentTo( m_Thief, (Mobile)root ) && !IsInGuild( m_Thief ) )
                 * {
                 *      m_Thief.SendLocalizedMessage( 1005596 ); // You must be in the thieves guild to steal from other players.
                 * }
                 * else if ( SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild( m_Thief ) && m_Thief.Kills > 0 )
                 * {
                 *      m_Thief.SendLocalizedMessage( 502706 ); // You are currently suspended from the thieves guild.
                 * }*/
                else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable)
                {
                    m_Thief.SendLocalizedMessage(1005598);                       // You can't steal from shopkeepers.
                }
                else if (root is PlayerVendor)
                {
                    m_Thief.SendLocalizedMessage(502709);                       // You can't steal from vendors.
                }
                else if (!m_Thief.CanSee(toSteal))
                {
                    m_Thief.SendLocalizedMessage(500237);                       // Target can not be seen.
                }
                else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true))
                {
                    m_Thief.SendLocalizedMessage(1048147);                       // Your backpack can't hold anything else.
                }
                else if (si == null && (toSteal.Parent == null || !toSteal.Movable))
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (toSteal.CheckBlessed(root))
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (Core.AOS && si == null && toSteal is Container)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1))
                {
                    m_Thief.SendLocalizedMessage(502703);                       // You must be standing next to an item to steal it.
                }
                else if (si != null && m_Thief.Skills[SkillName.Vol].Value < 100.0)
                {
                    m_Thief.SendLocalizedMessage(1060025, "", 0x66D);                       // You're not skilled enough to attempt the theft of this item.
                }
                else if (toSteal.Parent is Mobile)
                {
                    m_Thief.SendLocalizedMessage(1005585);                       // You cannot steal items which are equiped.
                }
                else if (root == m_Thief)
                {
                    m_Thief.SendLocalizedMessage(502704);                       // You catch yourself red-handed.
                }
                else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root))
                {
                }
                else if (root is Corpse)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else
                {
                    double w = toSteal.Weight + toSteal.TotalWeight;

                    double max = 6;

                    if (w > max)
                    {
                        m_Thief.SendMessage("That is too heavy to steal.");
                    }
                    else
                    {
                        if (toSteal.Stackable && toSteal.Amount > 1)
                        {
                            int maxAmount = (int)((m_Thief.Skills[SkillName.Vol].Value / 10.0) / toSteal.Weight);

                            if (maxAmount < 1)
                            {
                                maxAmount = 1;
                            }
                            else if (maxAmount > toSteal.Amount)
                            {
                                maxAmount = toSteal.Amount;
                            }

                            int amount = Utility.RandomMinMax(1, maxAmount);

                            if (amount >= toSteal.Amount)
                            {
                                int pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Vol, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = toSteal;
                                }
                            }
                            else
                            {
                                int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Vol, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount);

                                    if (stolen == null)
                                    {
                                        stolen = toSteal;
                                    }
                                }
                            }
                        }
                        else
                        {
                            int iw = (int)Math.Ceiling(w);
                            iw *= 10;

                            if (m_Thief.CheckTargetSkill(SkillName.Vol, toSteal, iw - 22.5, iw + 27.5))
                            {
                                stolen = toSteal;
                            }
                        }

                        if (stolen != null)
                        {
                            GuardVer2.CheckOnSteal(m_Thief);
                            m_Thief.SendLocalizedMessage(502724);                               // You succesfully steal the item.

                            if (si != null)
                            {
                                toSteal.Movable = true;
                                si.Item         = null;
                            }
                            caught = false;
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(502723);                               // You fail to steal the item.
                            caught = true;
                        }

                        if (m_Thief is ScriptMobile)
                        {
                            ScriptMobile sm = (ScriptMobile)m_Thief;

                            IPooledEnumerable <Mobile> eable = m_Thief.GetMobilesInRange(3);
                            foreach (Mobile mob in eable)
                            {
                                sm.Detection.FaireJet(mob, 0.1);
                            }
                        }

                        //caught = ( m_Thief.Skills[SkillName.Vol].Value < Utility.Random( 150 ) );
                    }
                }

                return(stolen);
            }
Пример #4
0
        public static void Container_Snoop(Container cont, Mobile from)
        {
            if (from.AccessLevel > AccessLevel.Player || from.InRange(cont.GetWorldLocation(), 1))
            {
                Mobile root = cont.RootParent as Mobile;

                if (root != null && !root.Alive)
                {
                    return;
                }

                if (from is ScriptMobile)
                {
                    ScriptMobile mob = (ScriptMobile)from;
                    if (mob.PVPInfo != null)
                    {
                        if (!mob.PVPInfo.CurrentEvent.mode.AllowLoot())
                        {
                            return;
                        }
                    }
                }

                if (root != null && root.AccessLevel > AccessLevel.Player && from.AccessLevel == AccessLevel.Player)
                {
                    from.SendLocalizedMessage(500209);                       // You can not peek into the container.
                    return;
                }

                if (root != null && from.AccessLevel == AccessLevel.Player && !CheckSnoopAllowed(from, root))
                {
                    from.SendLocalizedMessage(1001018);                       // You cannot perform negative acts on your target.
                    return;
                }

                if (root != null && from.AccessLevel == AccessLevel.Player && from.Skills[SkillName.Fouille].Value < Utility.Random(100))
                {
                    Map map = from.Map;

                    if (map != null)
                    {
                        /*IPooledEnumerable eable = map.GetClientsInRange( from.Location, 8 );
                         *
                         * foreach ( NetState ns in eable )
                         * {
                         *      if ( ns.Mobile != from )
                         *              ns.Mobile.NonlocalOverheadMessage(  message );
                         * }
                         *
                         * eable.Free();*/
                    }
                }

                //if ( from.AccessLevel == AccessLevel.Player )
                //	Titles.AwardKarma( from, -4, true );

                GuardVer2.CheckOnSnoop(from);
                if (from.AccessLevel > AccessLevel.Player || from.CheckTargetSkill(SkillName.Fouille, cont, 0.0, 102.0))
                {
                    if (cont is TrapableContainer && ((TrapableContainer)cont).ExecuteTrap(from))
                    {
                        return;
                    }

                    if (from is ScriptMobile)
                    {
                        ScriptMobile pm = (ScriptMobile)from;
                        pm.Detection.FaireJet(root, 0.05);
                    }

                    cont.DisplayTo(from);
                }
                else
                {
                    string message = String.Format("*Tente de voler le sac d'un personnage.*");

                    from.NonlocalOverheadMessage(MessageType.Emote, 0, true, message);
                    from.SendLocalizedMessage(500210); // You failed to peek into the container.

                    from.RevealingAction();
                }
            }
            else
            {
                from.SendLocalizedMessage(500446);                   // That is too far away.
            }
        }