Example #1
0
        public static void FatigueOnDamage(Mobile m, int damage, DFAlgorithm df)
        {
            double fatigue = 0.0;

            switch (m.DFA)
            {
            case DFAlgorithm.Standard:
            {
                if (Core.SA && m.Player)
                {
                    fatigue = damage + Utility.RandomMinMax(-3, 3);
                }
                else
                {
                    fatigue = (damage * (100.0 / m.Hits) * ((double)m.Stam / 100)) - 5.0;
                }
                break;
            }

            case DFAlgorithm.PainSpike:
            {
                if (Core.SA && m.Player)
                {
                    fatigue = (damage * 2) + Utility.RandomMinMax(-3, 3);
                }
                else
                {
                    fatigue = (damage * ((100.0 / m.Hits) + ((50.0 + m.Stam) / 100) - 1.0)) - 5.0;
                }
                break;
            }
            }

            var reduction = BaseArmor.GetInherentStaminaLossReduction(m) + 1;

            if (reduction > 0)
            {
                fatigue = fatigue / reduction;
            }

            if (fatigue > 0)
            {
                if (m.Stam - fatigue <= 0)
                {
                    m.Stam = Utility.RandomMinMax(0, Math.Min(3, m.Stam));
                }
                else
                {
                    m.Stam -= (int)fatigue;
                }
            }
        }
Example #2
0
        public static void FatigueOnDamage(Mobile m, int damage, DFAlgorithm df)
        {
            double fatigue = 0.0;

            switch (m.DFA)
            {
            case DFAlgorithm.Standard:
            {
                fatigue = (damage * (m.HitsMax / m.Hits) * ((double)m.Stam / m.StamMax)) - 5;

                fatigue = fatigue - (fatigue / 3);         //UOSI - Test to reduce lost stamina on hit
            }
            break;

            case DFAlgorithm.PainSpike:
            {
                fatigue = (damage * ((m.HitsMax / m.Hits) + ((50.0 + m.Stam) / m.StamMax) - 1.0)) - 5;
            }
            break;
            }

            var reduction = BaseArmor.GetInherentStaminaLossReduction(m) + 1;

            if (reduction > 1)
            {
                fatigue = fatigue / reduction;
            }

            if (fatigue > 0)
            {
                // On EA, if follows this special rule to reduce the chances of your stamina being dropped to 0
                if (m.Stam - fatigue <= 10)
                {
                    m.Stam -= (int)(fatigue * ((double)m.Hits / (double)m.HitsMax));
                }
                else
                {
                    m.Stam -= (int)fatigue;
                }
            }
        }