コード例 #1
0
        private static TimeSpan Mobile_StamRegenRate(Mobile from)
        {
            if (from.Skills == null)
            {
                return(Mobile.DefaultStamRate);
            }

            CheckBonusSkill(from, from.Stam, from.StamMax, SkillName.Focus);

            int points = (int)(from.Skills[SkillName.Focus].Value * 0.08);

            int cappedPoints = AosAttributes.GetValue(from, AosAttribute.RegenStam);

            if (CheckTransform(from, typeof(VampiricEmbraceSpell)))
            {
                cappedPoints += 15;
            }

            if (CheckAnimal(from, typeof(Kirin)))
            {
                cappedPoints += 20;
            }

            points += cappedPoints;

            if (from.Player)
            {
                Beastmaster bmr = Perk.GetByType <Beastmaster>((Player)from);

                if (bmr != null)
                {
                    points += bmr.BMasterRegenBonus();
                }

                Acrobat acr = Perk.GetByType <Acrobat>((Player)from);

                if (acr != null)
                {
                    points += acr.GetStamRegenBonus();
                }

                Adventurer adv = Perk.GetByType <Adventurer>((Player)from);

                if (adv != null)
                {
                    points += adv.GetStamRegenBonus();
                }

                Scout sct = Perk.GetByType <Scout>((Player)from);

                if (sct != null)
                {
                    points += sct.StamRegenBonus();
                }

                Dragoon drg = Perk.GetByType <Dragoon>((Player)from);

                if (drg != null)
                {
                    points += drg.Symbiosis();
                }

                Monk mk = Perk.GetByType <Monk>((Player)from);

                if (mk != null)
                {
                    points += mk.MeditationMastery();
                }

                int hungerRegen = (int)((from.Hunger + from.Thirst) * 0.10);

                if (hungerRegen != 0)
                {
                    points += hungerRegen;
                }

                if (from.Stam < 10)
                {
                    points += 16;
                }

                if (from.Stam < from.StamMax * 0.125)
                {
                    points += 8;
                }
            }

            if (!(from is Player))
            {
                points += (int)(from.Dex * 0.04);
            }

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

                if (bc.ControlMaster != null && bc.ControlMaster is Player)
                {
                    Player      master = bc.ControlMaster as Player;
                    Beastmaster bmr    = Perk.GetByType <Beastmaster>((Player)master);

                    if (bmr != null)
                    {
                        points += bmr.PackRegenBonus();
                    }
                }
            }

            if (from is BaseMount)
            {
                BaseMount mount = from as BaseMount;
                if (mount.Rider != null && mount.Rider is Player)
                {
                    Player  rider = mount.Rider as Player;
                    Dragoon drg   = Perk.GetByType <Dragoon>((Player)rider);

                    if (drg != null)
                    {
                        points += drg.Symbiosis();
                    }
                }
            }

            if (points < -1)
            {
                points = -1;
            }

            if (((from.Direction & Direction.Running) != 0) &&
                from.Mounted == false)
            {
                points = (int)(points / 1.618);
            }

            return(TimeSpan.FromSeconds(1.0 / (0.1 * (2 + points))));
        }
コード例 #2
0
        private static TimeSpan Mobile_StamRegenRate(Mobile from)
        {
            if (from.Skills == null)
            {
                return(Mobile.DefaultStamRate);
            }

            CheckBonusSkill(from, from.Stam, from.StamMax, SkillName.Focus);

            int points = (int)(from.Skills[SkillName.Focus].Value * 0.08);

            int cappedPoints = AosAttributes.GetValue(from, AosAttribute.RegenStam);

            points += cappedPoints;

            if (from.Player)
            {
                bool running = ((Player)from).isRunning && from.Mounted == false;

                if (((Player)from).lastMove < DateTime.Now - TimeSpan.FromSeconds(0.2))
                {
                    running = false;
                }

                if (running)
                {
                    points -= 32;
                }

                Beastmaster bmr = Perk.GetByType <Beastmaster>((Player)from);

                if (bmr != null)
                {
                    points += bmr.MasterRegenBonus();
                }

                Acrobat acr = Perk.GetByType <Acrobat>((Player)from);

                if (acr != null)
                {
                    points += acr.GetStamRegenBonus();
                }

                Adventurer adv = Perk.GetByType <Adventurer>((Player)from);

                if (adv != null)
                {
                    points += adv.GetStamRegenBonus();
                }

                Scout sct = Perk.GetByType <Scout>((Player)from);

                if (sct != null)
                {
                    points += sct.StamRegenBonus();
                }

                Dragoon drg = Perk.GetByType <Dragoon>((Player)from);

                if (drg != null)
                {
                    points += drg.Symbiosis();
                }

                Monk mk = Perk.GetByType <Monk>((Player)from);

                if (mk != null)
                {
                    points += mk.MeditationMastery();
                }

                int hungerRegen = (int)((from.Hunger + from.Thirst) * 0.10);

                if (hungerRegen != 0)
                {
                    points += hungerRegen;
                }

                if (from.Hits != 0 && from.HitsMax != 0)
                {
                    double hitsratio = (int)((from.HitsMax / from.Hits) / 4);
                    if (hitsratio != 0)
                    {
                        points = (int)(points * hitsratio);
                    }
                }
            }

            if (!(from is Player))
            {
                points += (int)(from.Dex * 0.04);
            }

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

                if (bc.ControlMaster != null && bc.ControlMaster is Player)
                {
                    Player      master = bc.ControlMaster as Player;
                    Beastmaster bmr    = Perk.GetByType <Beastmaster>((Player)master);

                    if (bmr != null)
                    {
                        points += bmr.PackRegenBonus();
                    }
                }
            }

            if (from is BaseMount)
            {
                BaseMount mount = from as BaseMount;
                if (mount.Rider != null && mount.Rider is Player)
                {
                    Player  rider = mount.Rider as Player;
                    Dragoon drg   = Perk.GetByType <Dragoon>((Player)rider);

                    if (drg != null)
                    {
                        points += drg.Symbiosis();
                    }
                }
            }

            if (points < -1)
            {
                points = -1;
            }

            return(TimeSpan.FromSeconds(1.0 / (0.1 * (2 + points))));
        }