Пример #1
0
        public void OnTargetKilled()
        {
            this.Cancel();

            int targetFame = this.m_Target.Fame;

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

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

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

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

            if (this.m_HonorDamage == this.m_TotalDamage && this.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(this.m_Source, VirtueName.Honor))
            {
                this.m_Source.SendLocalizedMessage(1063228); // You cannot gain more Honor.
                return;
            }

            bool gainedPath = false;

            if (VirtueHelper.Award(this.m_Source, VirtueName.Honor, (int)gain, ref gainedPath))
            {
                if (gainedPath)
                {
                    this.m_Source.SendLocalizedMessage(1063226); // You have gained a path in Honor!
                }
                else
                {
                    this.m_Source.SendLocalizedMessage(1063225); // You have gained in Honor.
                }
            }
        }
Пример #2
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 * m_HonorDamageTwentieths) / (double)(20 * m_TotalDamage);

            dGain = dGain * dGain / 2000000.0;

            if (m_FirstHit == FirstHit.Granted)
            {
                dGain *= 1.1;                 // Is this correct?
            }
            int gain = Math.Min((int)dGain, 200);

            if (gain <= 0)
            {
                return;
            }

            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, (int)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.
                }
            }
        }
Пример #3
0
        public static void Sacrifice(Mobile from, object targeted)
        {
            if (!from.CheckAlive())
            {
                return;
            }

            if (from is not PlayerMobile pm)
            {
                return;
            }

            if (targeted is not Mobile targ)
            {
                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 (Core.Now < pm.LastSacrificeGain + GainDelay)
            {
                from.SendLocalizedMessage(1052016); // You must wait approximately one day before sacrificing again.
            }
            else
            {
                int toGain = from.Fame switch
                {
Пример #4
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.Now < (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), new TimerCallback(targ.Delete));

                pm.LastSacrificeGain = DateTime.Now;

                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.
            }
        }
Пример #5
0
        public static void Honor(Mobile from, object targeted)
        {
            if (!from.CheckAlive())
            {
                return;
            }

            Mobile targ = targeted as Mobile;

            if (targ == null)
            {
                return;
            }

            VirtueLevel level = VirtueHelper.GetLevel(from, VirtueName.Honor);

            if (targ == from)
            {
                if (CantEmbrace(from))
                {
                    from.SendLocalizedMessage(1063230);                       // You must wait awhile before you can embrace honor again.

                    return;
                }

                if (level < VirtueLevel.Seeker)
                {
                    from.SendLocalizedMessage(1063234);                       // You do not have enough honor to do that

                    return;
                }

                Timer t = (Timer)m_Table[from];

                if (t != null)
                {
                    t.Stop();
                }

                Timer t2 = (Timer)m_Table2[from];

                if (t2 != null)
                {
                    t.Stop();
                }

                double delay = 0;

                switch (level)
                {
                case VirtueLevel.Seeker:
                    delay = 60.0;
                    break;

                case VirtueLevel.Follower:
                    delay = 90.0;
                    break;

                case VirtueLevel.Knight:
                    delay = 120.0;
                    break;
                }

                m_Table[from] = t = Timer.DelayCall(TimeSpan.FromSeconds(delay), new TimerStateCallback(Expire_Callback), from);

                m_Table2[from] = t2 = Timer.DelayCall(TimeSpan.FromMinutes(5.0), new TimerStateCallback(Expire_Callback2), from);

                from.SendLocalizedMessage(1063235);                   // You embrace your honor

                if (VirtueHelper.Atrophy(from, VirtueName.Honor))
                {
                    from.SendLocalizedMessage(1063227);                       // You have lost some Honor.
                }
            }
            else
            {
                if (targ is BaseCreature)
                {
                    BaseCreature cr = targ as BaseCreature;

                    if (cr.HonorOpponent != null && cr.HonorOpponent != from)
                    {
                        from.SendLocalizedMessage(1063233);                           // Somebody else is honoring this opponent

                        return;
                    }
                }

                if (targ is PlayerMobile)
                {
                    PlayerMobile pm = targ as PlayerMobile;

                    if (pm.HonorOpponent != null && pm.HonorOpponent != from)
                    {
                        from.SendLocalizedMessage(1063233);                           // Somebody else is honoring this opponent

                        return;
                    }
                }

                if (VirtueHelper.IsHighestPath(from, VirtueName.Honor))
                {
                    from.SendLocalizedMessage(1063228);                       // You cannot gain more Honor.

                    return;
                }

                if (!from.InRange(targ.Location, 5))
                {
                    from.SendLocalizedMessage(1063232);                       // You are too far away to honor your opponent

                    return;
                }

                if (((targ.Hits * 100) / Math.Max(targ.HitsMax, 1)) < 85)
                {
                    from.SendLocalizedMessage(1063166);                       // You cannot honor this monster because it is too damaged.

                    return;
                }

                if (!NotorietyHandlers.Mobile_AllowHarmful(from, targ))
                {
                    return;
                }

                if (!from.CanSee(targ) || !from.InLOS(targ))
                {
                    return;
                }

                from.Direction = from.GetDirectionTo(targ.Location);

                from.Animate(32, 5, 1, true, false, 0);

                from.Say(1063231);                   // I honor you

                PlayerMobile player = from as PlayerMobile;

                player.HonorOpponent = targ;

                if (targ is BaseCreature)
                {
                    ((BaseCreature)targ).HonorOpponent = player;
                }

                if (targ is PlayerMobile)
                {
                    ((PlayerMobile)targ).HonorOpponent = player;
                }

                player.SpotHonor = player.Location;

                player.Perfection = 0;
            }
        }