Scale() public static méthode

public static Scale ( int input, int percent ) : int
input int
percent int
Résultat int
Exemple #1
0
            protected override void OnTick()
            {
                if (CheckResistPoison())
                {
                    // Curing this way cause we don't want to trigger the PoisonCured event,
                    // so that the resistance timer is not refreshed.
                    m_Mobile.Poison = null;
                    BuffInfo.RemoveBuff(m_Mobile, BuffIcon.Poison);

                    m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, true, "* You feel yourself resisting the effects of the poison *");

                    m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, true, $"* {m_Mobile.Name} seems resistant to the poison *");

                    Stop();
                    return;
                }

                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136);                       // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                int damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);

                if (damage < m_Poison.m_Minimum)
                {
                    damage = m_Poison.m_Minimum;
                }
                else if (damage > m_Poison.m_Maximum)
                {
                    damage = m_Poison.m_Maximum;
                }

                #region Darkglow
                var poisoner = DarkglowPotion.GetPoisoner(m_Mobile);

                if (poisoner != null)
                {
                    int distance = (int)m_Mobile.GetDistanceToSqrt(poisoner.Location);

                    if (distance > 1)
                    {
                        if (distance > 20)
                        {
                            distance = 20;
                        }

                        damage += AOS.Scale(damage, distance * 5);
                        poisoner.SendLocalizedMessage(1072850);                           // Darkglow poison increases your damage!
                    }
                }
                #endregion

                var honorTarget = m_Mobile as IHonorTarget;

                if (honorTarget != null && honorTarget.ReceivedHonorContext != null)
                {
                    honorTarget.ReceivedHonorContext.OnTargetPoisoned();
                }

                AOS.Damage(m_Mobile, damage, 0, 0, 0, 100, 0);

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_Mobile, m_Poison, m_Poison);
                }

                #region Parasitic
                poisoner = ParasiticPotion.GetPoisoner(m_Mobile);

                if (poisoner != null && m_Mobile.InRange(poisoner.Location, 1))
                {
                    int toHeal = Math.Min(damage, poisoner.HitsMax - poisoner.Hits);

                    if (toHeal > 0)
                    {
                        poisoner.SendLocalizedMessage(1060203, toHeal.ToString());                           // You have had ~1_HEALED_AMOUNT~ hit points of damage healed.
                        poisoner.Hits += toHeal;
                    }
                }
                #endregion
            }