示例#1
0
        public void OnTargetKilled()
        {
            Cancel();

            int targetFame = m_Target.Fame;

            if (m_Perfection > 0)
            {
                int restore = Math.Min(m_Perfection * (targetFame + 5000) / 25000, 10);

                m_Source.Hits += restore;
                m_Source.Stam += restore;
                m_Source.Mana += restore;
            }

            if (m_Source.Virtues.Honor > targetFame)
            {
                return;
            }

            double dGain = (targetFame / 100) * (m_HonorDamage / m_TotalDamage); //Initial honor gain is 100th of the monsters honor

            if (m_HonorDamage == m_TotalDamage && m_FirstHit == FirstHit.Granted)
            {
                dGain = dGain * 1.5; //honor gain is increased alot more if the combat was fully honorable
            }
            else
            {
                dGain = dGain * 0.9;
            }

            int gain = Math.Min((int)dGain, 200);

            if (gain < 1)
            {
                gain = 1; // Minimum gain of 1 honor when the honor is under the monsters fame
            }
            if (VirtueHelper.IsHighestPath(m_Source, VirtueName.Honor))
            {
                m_Source.SendLocalizedMessage(1063228); // You cannot gain more Honor.
                return;
            }

            bool gainedPath = false;

            if (VirtueHelper.Award(m_Source, VirtueName.Honor, gain, ref gainedPath))
            {
                if (gainedPath)
                {
                    m_Source.SendLocalizedMessage(1063226); // You have gained a path in Honor!
                }
                else
                {
                    m_Source.SendLocalizedMessage(1063225); // You have gained in Honor.
                }
            }
        }
示例#2
0
        public static void Sacrifice(Mobile from, object targeted)
        {
            if (!from.CheckAlive())
            {
                return;
            }

            PlayerMobile pm = from as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            Mobile targ = targeted as Mobile;

            if (targ == null)
            {
                return;
            }

            if (!ValidateCreature(targ))
            {
                from.SendLocalizedMessage(1052014); // You cannot sacrifice your fame for that creature.
            }
            else if (((targ.Hits * 100) / Math.Max(targ.HitsMax, 1)) < 90)
            {
                from.SendLocalizedMessage(1052013); // You cannot sacrifice for this monster because it is too damaged.
            }
            else if (from.Hidden)
            {
                from.SendLocalizedMessage(1052015); // You cannot do that while hidden.
            }
            else if (VirtueHelper.IsHighestPath(from, VirtueName.Sacrifice))
            {
                from.SendLocalizedMessage(1052068); // You have already attained the highest path in this virtue.
            }
            else if (from.Fame < 2500)
            {
                from.SendLocalizedMessage(1052017); // You do not have enough fame to sacrifice.
            }
            else if (DateTime.UtcNow < (pm.LastSacrificeGain + GainDelay))
            {
                from.SendLocalizedMessage(1052016); // You must wait approximately one day before sacrificing again.
            }
            else
            {
                int toGain;

                if (from.Fame < 5000)
                {
                    toGain = 500;
                }
                else if (from.Fame < 10000)
                {
                    toGain = 1000;
                }
                else
                {
                    toGain = 2000;
                }

                from.Fame = 0;

                // I have seen the error of my ways!
                targ.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1052009);

                from.SendLocalizedMessage(1052010); // You have set the creature free.

                Timer.DelayCall(TimeSpan.FromSeconds(1.0), targ.Delete);

                pm.LastSacrificeGain = DateTime.UtcNow;

                bool gainedPath = false;

                if (VirtueHelper.Award(from, VirtueName.Sacrifice, toGain, ref gainedPath))
                {
                    if (gainedPath)
                    {
                        from.SendLocalizedMessage(1052008); // You have gained a path in Sacrifice!

                        if (pm.AvailableResurrects < 3)
                        {
                            ++pm.AvailableResurrects;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1054160); // You have gained in sacrifice.
                    }
                }

                from.SendLocalizedMessage(1052016); // You must wait approximately one day before sacrificing again.
            }
        }