Exemplo n.º 1
0
        private static bool CastAbortTimer(PlayerInstance ch, string argument)
        {
            var sn = ch.tempnum;

            if (Macros.IS_VALID_SN(sn))
            {
                var skill = RepositoryManager.Instance.GetEntity <SkillData>(sn);
                if (skill == null)
                {
                    ch.SendTo("Something went wrong...");
                    return(false);
                }

                var skillLevel = skill.SkillLevels.ToList()[(int)ch.CurrentClass];
                var mana       = ch.IsNpc() ? 0 : Macros.UMAX(skill.MinimumMana, 100 / (2 + ch.Level - skillLevel));
                var blood      = Macros.UMAX(1, (mana + 4) / 8);

                if (ch.IsVampire())
                {
                    ch.GainCondition(ConditionTypes.Bloodthirsty, -1 * Macros.UMAX(1, blood / 3));
                }
                else if (!ch.IsImmortal())
                {
                    ch.CurrentMana -= mana / 3;
                }
            }

            ch.SetColor(ATTypes.AT_MAGIC);
            ch.SendTo("You stop chanting...");

            return(true);
        }
Exemplo n.º 2
0
        private static void DrinkFromBlood(PlayerInstance ch, ObjectInstance obj)
        {
            if (CheckFunctions.CheckIfTrue(ch, !ch.IsVampire(), "It is not in your nature to do such things."))
            {
                return;
            }

            if (obj.Timer < 0 && ch.Level > 5 && ch.GetCondition(ConditionTypes.Bloodthirsty) > 5 + ch.Level / 10)
            {
                ch.SendTo("It is beneath you to stoop to drinking blood from the ground!");
                ch.SendTo("Unless in dire need, you'd much rather have blood from a victim's neck!");
                return;
            }

            if (CheckFunctions.CheckIfTrue(ch, ch.GetCondition(ConditionTypes.Bloodthirsty) >= 10 + ch.Level,
                                           "Alas... you cannot consume any more blood."))
            {
                return;
            }

            var maxCond = GetMaximumCondition();

            if (CheckFunctions.CheckIfTrue(ch, ch.GetCondition(ConditionTypes.Bloodthirsty) >= maxCond ||
                                           ch.GetCondition(ConditionTypes.Thirsty) >= maxCond,
                                           "You are too full to drink any blood."))
            {
                return;
            }

            if (!MudProgHandler.ExecuteObjectProg(MudProgTypes.Use, ch, obj, null, null))
            {
                comm.act(ATTypes.AT_BLOOD, "$n drinks from the spilled blood.", ch, null, null, ToTypes.Room);
                ch.SetColor(ATTypes.AT_BLOOD);
                ch.SendTo("You relish in the replenishment of this vital fluid...");

                if (obj.Values.Quantity <= 1)
                {
                    ch.SetColor(ATTypes.AT_BLOOD);
                    ch.SendTo("You drink the last drop of blood from the spill");
                    comm.act(ATTypes.AT_BLOOD, "$n drinks the last drop of blood from the spill.", ch, null, null,
                             ToTypes.Room);
                }
            }

            ch.GainCondition(ConditionTypes.Bloodthirsty, 1);
            ch.GainCondition(ConditionTypes.Full, 1);
            ch.GainCondition(ConditionTypes.Thirsty, 1);

            if (obj.Values.Quantity - 1 <= 0)
            {
                obj.Extract();
                ObjectFactory.CreateBloodstain(ch, RepositoryManager.Instance);
            }
        }