Exemplo n.º 1
0
        public static void ArtiChance(Mobile m, BaseCreature bc)
        {
            if (bc == null || bc.Deleted)
            {
                return;
            }

            double hits = (double)bc.GetHits();
            double stam = (double)bc.GetStam();
            double mana = (double)bc.GetMana();

            double fromluck = m.Luck;

            if (fromluck > (double)1200)
            {
                fromluck = (double)1200;
            }

            double luckscaler = (double)(1.0 + (fromluck / 1000));


            double       artichance = luckscaler * (20 * (hits + stam + mana) / 6000);
            PlayerMobile pm         = m as PlayerMobile;

            XmlArtifactBonus xab = (XmlArtifactBonus)XmlAttach.FindAttachment(pm, typeof(XmlArtifactBonus));

            if (xab != null)
            {
                artichance *= xab.Value;
                if (artichance > 100.00)
                {
                    artichance = 100.00;
                }
                if (artichance < 0.00)
                {
                    artichance = 0.00;
                }
                percent = artichance / 100.00;

                if (m.AccessLevel > AccessLevel.GameMaster)
                {
                    m.SendMessage("[GM DEBUG] {0}% drop chance.", percent * 100);
                }
            }
            else
            {
                if (artichance > 100.00)
                {
                    artichance = 100.00;
                }
                if (artichance < 0.00)
                {
                    artichance = 0.00;
                }
                percent = artichance / 100.00;

                if (m.AccessLevel > AccessLevel.GameMaster)
                {
                    m.SendMessage("[GM DEBUG] {0}% chance.", percent * 100);
                }
            }
        }
Exemplo n.º 2
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (from == null || targeted == null)
            {
                return;
            }

            if (targeted is BaseCreature)
            {
                BaseCreature bc = (BaseCreature)targeted as BaseCreature;

                if (bc == null || bc.Deleted)
                {
                    return;
                }
                else
                {
                    double percent = 0.0;

                    //int karma = Math.Abs( bc.Karma );
                    //int fame = bc.Fame;
                    double hits = (double)bc.HitsMax;
                    double stam = (double)bc.StamMax;
                    double mana = (double)bc.ManaMax;

                    double fromluck = from.Luck;

                    if (fromluck > (double)1200)
                    {
                        fromluck = (double)1200;
                    }

                    double luckscaler = (double)(1.0 + (fromluck / 1000));

                    double       artichance = luckscaler * (20 * (hits + stam + mana) / 6000);
                    PlayerMobile pm         = from as PlayerMobile;

                    XmlArtifactBonus xab = (XmlArtifactBonus)XmlAttach.FindAttachment(pm, typeof(XmlArtifactBonus));
                    if (xab != null)
                    {
                        artichance *= xab.Value;
                        if (artichance > 100.00)
                        {
                            artichance = 100.00;
                        }
                        if (artichance < 0.00)
                        {
                            artichance = 0.00;
                        }
                        percent = artichance / 100.00;

                        //if( pm.AccessLevel > AccessLevel.GameMaster )
                        pm.SendMessage("{0}% chance.", percent * 100);
                    }
                    else
                    {
                        if (artichance > 100.00)
                        {
                            artichance = 100.00;
                        }
                        if (artichance < 0.00)
                        {
                            artichance = 0.00;
                        }
                        percent = artichance / 100.00;

                        //if( from.AccessLevel > AccessLevel.GameMaster )
                        from.SendMessage("{0}% chance.", percent * 100);
                    }
                }
            }
        }