コード例 #1
0
        public static void OnVirtueUsed(Mobile from)
        {
            if (!from.Alive)
            {
                return;
            }

            if (VirtueHelper.GetLevel(from, VirtueName.Spirituality) < VirtueLevel.Seeker)
            {
                from.SendLocalizedMessage(1155829); // You must be a Seeker of Spirituality to invoke this Virtue.
            }
            else
            {
                from.SendLocalizedMessage(1155827); // Target whom you wish to embrace with your Spirituality

                from.BeginTarget(
                    10,
                    false,
                    TargetFlags.None,
                    (mobile, targeted) =>
                {
                    if (targeted is Mobile m)
                    {
                        if (VirtueHelper.GetLevel(from, VirtueName.Spirituality) < VirtueLevel.Seeker)
                        {
                            from.SendLocalizedMessage(1155812);     // You must be at least a Seeker of Humility to Invoke this ability.
                        }
                        else if (!m.Alive)
                        {
                            from.SendLocalizedMessage(1155828);     // Thy target must be among the living.
                        }
                        else if (m is BaseCreature creature && !creature.Controlled && !creature.Summoned)
                        {
                            from.SendLocalizedMessage(1155837);     // You can only embrace players and pets with Spirituality.
                        }
コード例 #2
0
ファイル: Sacrifice.cs プロジェクト: tflynt91/TrueUO
        public static void CheckAtrophy(Mobile from)
        {
            PlayerMobile pm = from as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            try
            {
                if ((pm.LastSacrificeLoss + LossDelay) < DateTime.UtcNow)
                {
                    if (VirtueHelper.Atrophy(from, VirtueName.Sacrifice, LossAmount))
                    {
                        from.SendLocalizedMessage(1052041); // You have lost some Sacrifice.
                    }
                    VirtueLevel level = VirtueHelper.GetLevel(from, VirtueName.Sacrifice);

                    pm.AvailableResurrects = (int)level;
                    pm.LastSacrificeLoss   = DateTime.UtcNow;
                }
            }
            catch (Exception e)
            {
                Diagnostics.ExceptionLogging.LogException(e);
            }
        }
コード例 #3
0
ファイル: Honor.cs プロジェクト: travismills82/TrueUO
        private static int GetHonorDuration(PlayerMobile from)
        {
            switch (VirtueHelper.GetLevel(from, VirtueName.Honor))
            {
            case VirtueLevel.Seeker:
                return(30);

            case VirtueLevel.Follower:
                return(90);

            case VirtueLevel.Knight:
                return(300);

            default:
                return(0);
            }
        }
コード例 #4
0
        public static void Valor(Mobile from, object targ)
        {
            var idol = targ as IdolOfTheChampion;

            if (idol == null || idol.Deleted || idol.Spawn == null || idol.Spawn.Deleted)
            {
                from.SendLocalizedMessage(1054035); // You must target a Champion Idol to challenge the Champion's spawn!
            }
            else if (from.Hidden)
            {
                from.SendLocalizedMessage(1052015); // You cannot do that while hidden.
            }
            else if (idol.Spawn.HasBeenAdvanced)
            {
                from.SendLocalizedMessage(1054038); // The Champion of this region has already been challenged!
            }
            else
            {
                var vl = VirtueHelper.GetLevel(from, VirtueName.Valor);

                if (idol.Spawn.Active)
                {
                    if (idol.Spawn.Champion != null) //TODO: Message?
                    {
                        return;
                    }

                    int needed, consumed;

                    switch (idol.Spawn.Rank)
                    {
                    case 0:
                    {
                        needed = consumed = 2500;
                        break;
                    }

                    case 1:
                    {
                        needed = consumed = 5000;
                        break;
                    }

                    case 2:
                    {
                        needed   = 10000;
                        consumed = 7500;
                        break;
                    }

                    default:
                    {
                        needed   = 20000;
                        consumed = 10000;
                        break;
                    }
                    }

                    if (from.Virtues.GetValue((int)VirtueName.Valor) >= needed)
                    {
                        VirtueHelper.Atrophy(from, VirtueName.Valor, consumed);

                        from.SendLocalizedMessage(1054037); // Your challenge is heard by the Champion of this region! Beware its wrath!

                        idol.Spawn.HasBeenAdvanced = true;
                        idol.Spawn.AdvanceLevel();
                    }
                    else
                    {
                        from.SendLocalizedMessage(
                            1054039); // The Champion of this region ignores your challenge. You must further prove your valor.
                    }
                }
                else
                {
                    if (vl == VirtueLevel.Knight)
                    {
                        VirtueHelper.Atrophy(from, VirtueName.Valor, 11000);

                        from.SendLocalizedMessage(1054037); // Your challenge is heard by the Champion of this region! Beware its wrath!

                        idol.Spawn.EndRestart();
                        //idol.Spawn.HasBeenAdvanced = true;
                    }
                    else
                    {
                        from.SendLocalizedMessage(
                            1054036); // You must be a Knight of Valor to summon the champion's spawn in this manner!
                    }
                }
            }
        }
コード例 #5
0
ファイル: Spirituality.cs プロジェクト: Evad-lab/ServUOX
        public static void OnVirtueUsed(Mobile from)
        {
            if (!from.Alive)
            {
                return;
            }

            if (VirtueHelper.GetLevel(from, VirtueName.Spirituality) < VirtueLevel.Seeker)
            {
                from.SendLocalizedMessage(1155829); // You must be a Seeker of Spirituality to invoke this Virtue.
            }
            else
            {
                from.SendLocalizedMessage(1155827); // Target whom you wish to embrace with your Spirituality

                from.BeginTarget(
                    10,
                    false,
                    TargetFlags.None,
                    (mobile, targeted) =>
                {
                    if (targeted is Mobile)
                    {
                        var m = (Mobile)targeted;

                        if (VirtueHelper.GetLevel(from, VirtueName.Spirituality) < VirtueLevel.Seeker)
                        {
                            from.SendLocalizedMessage(1155812);     // You must be at least a Seeker of Humility to Invoke this ability.
                        }
                        else if (!m.Alive)
                        {
                            from.SendLocalizedMessage(1155828);     // Thy target must be among the living.
                        }
                        else if (m is BaseCreature && !((BaseCreature)m).Controlled && !((BaseCreature)m).Summoned)
                        {
                            from.SendLocalizedMessage(1155837);     // You can only embrace players and pets with Spirituality.
                        }
                        else if (IsEmbracee(m))
                        {
                            from.SendLocalizedMessage(1155836);     // They are already embraced by Spirituality.
                        }
                        else if (m.MeleeDamageAbsorb > 0)
                        {
                            from.SendLocalizedMessage(
                                1156039);     // You may not use the Spirituality Virtue while the Attunement spell is active.
                        }
                        else if (m is BaseCreature || m is PlayerMobile)
                        {
                            var context = new SpiritualityContext(from, m);

                            ActiveTable[from] = context;

                            m.SendLocalizedMessage(1155839);     // Your spirit has been embraced! You feel more powerful!
                            from.SendLocalizedMessage(1155835);  // You have lost some Spirituality.

                            BuffInfo.AddBuff(
                                m,
                                new BuffInfo(
                                    BuffIcon.Spirituality,
                                    1155824,
                                    1155825,
                                    string.Format(
                                        "{0}\t{1}",
                                        context.Reduction.ToString(),
                                        context.Pool.ToString())));     // ~1_VAL~% Reduction to Incoming Damage<br>~2_VAL~ Shield HP Remaining

                            VirtueHelper.Atrophy(from, VirtueName.Spirituality, 3200);

                            Timer.DelayCall(
                                TimeSpan.FromMinutes(20),
                                () =>
                            {
                                if (ActiveTable != null && ActiveTable.ContainsKey(from))
                                {
                                    ActiveTable.Remove(from);

                                    m.SendLocalizedMessage(1155840);         // Your spirit is no longer embraced. You feel less powerful.

                                    BuffInfo.RemoveBuff(m, BuffIcon.Spirituality);
                                }
                            });
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1155837);     // You can only embrace players and pets with Spirituality.
                    }
                });
            }
        }
コード例 #6
0
        public static void OnVirtueUsed(Mobile from)
        {
            if (VirtueHelper.GetLevel(from, VirtueName.Humility) < VirtueLevel.Seeker)
            {
                from.SendLocalizedMessage(1155812); // You must be at least a Seeker of Humility to Invoke this ability.
            }
            else if (from.Alive)
            {
                from.SendLocalizedMessage(1155817); // Target the pet you wish to embrace with your Humility.
                from.BeginTarget(
                    10,
                    false,
                    TargetFlags.None,
                    (m, targeted) =>
                {
                    if (targeted is BaseCreature)
                    {
                        BaseCreature bc = (BaseCreature)targeted;

                        if (!bc.Alive)
                        {
                            from.SendLocalizedMessage(1155815);     // You cannot embrace Humility on the dead!
                        }
                        else if (VirtueHelper.GetLevel(m, VirtueName.Humility) < VirtueLevel.Seeker)
                        {
                            from.SendLocalizedMessage(1155812);     // You must be at least a Seeker of Humility to Invoke this ability.
                        }
                        else if (!bc.Controlled && !bc.Summoned)
                        {
                            from.SendLocalizedMessage(1155813);     // You can only embrace your Humility on a pet.
                        }
                        else if (ActiveTable.ContainsKey(bc))
                        {
                            from.SendLocalizedMessage(1156047);     // That pet has already embraced Humility.
                        }
                        else
                        {
                            VirtueHelper.Atrophy(from, VirtueName.Humility, 3200);

                            from.SendLocalizedMessage(1155818);     // You have lost some Humility.

                            ActiveTable[bc] = from;

                            m.PrivateOverheadMessage(
                                MessageType.Regular,
                                1150,
                                1155819,
                                from.NetState);     // *Your pet surges with the power of your Humility!*

                            bc.FixedEffect(0x373A, 10, 16);

                            BuffInfo.AddBuff(
                                from,
                                new BuffInfo(
                                    BuffIcon.Humility,
                                    1156049,
                                    1156050,
                                    TimeSpan.FromMinutes(20),
                                    from,
                                    string.Format("{0}\t{1}", bc.Name, GetRegenBonus(bc))));     // Pet: ~1_NAME~<br>+~2_VAL~ HPR<br>

                            CheckTimer();
                            bc.ResetStatTimers();

                            Timer.DelayCall(
                                TimeSpan.FromMinutes(20),
                                mob =>
                            {
                                if (mob != null && ActiveTable.ContainsKey(mob))
                                {
                                    Mobile user = ActiveTable[mob];
                                    ActiveTable.Remove(mob);

                                    BuffInfo.RemoveBuff(user, BuffIcon.Humility);

                                    user.PrivateOverheadMessage(
                                        MessageType.Regular,
                                        1150,
                                        1155823,
                                        from.NetState);         // *Your pet's power returns to normal*

                                    CheckTimer();
                                }
                            },
                                bc);
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1155813);     // You can only embrace your Humility on a pet.
                    }
                });
            }
        }