Ejemplo n.º 1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            m_BrainType = (TypeOfBrain)reader.ReadInt();
        }
Ejemplo n.º 2
0
        public UOACZBrains() : base(7408)
        {
            Name   = "brains";
            Weight = 1;

            BrainsType = (TypeOfBrain)Utility.RandomMinMax(0, 3);
        }
Ejemplo n.º 3
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return;
            }

            if (player.IsUOACZHuman)
            {
                player.SendMessage("You decide against consuming this.");
                return;
            }

            if (!IsChildOf(from.Backpack))
            {
                from.SendMessage("That item must be in your pack in order to use it.");
                return;
            }

            if (DateTime.UtcNow < player.m_UOACZAccountEntry.UndeadProfile.NextUndeadItemAllowed)
            {
                string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, player.m_UOACZAccountEntry.UndeadProfile.NextUndeadItemAllowed, false, false, false, true, true);
                player.SendMessage("You may not use another undead item for " + timeRemaining + ".");

                return;
            }

            player.m_UOACZAccountEntry.UndeadProfile.NextUndeadItemAllowed = DateTime.UtcNow + TimeSpan.FromSeconds(UOACZSystem.UndeadItemCooldownSeconds);

            player.PlaySound(Utility.RandomList(0x5DA, 0x5A9, 0x5AB, 0x03A, 0x03B, 0x03C));

            TypeOfBrain brainType = m_BrainType;

            Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate
            {
                switch (brainType)
                {
                case TypeOfBrain.Healing:
                    int hitsRegained = (int)(Math.Round((double)player.HitsMax * .33));
                    player.Heal(hitsRegained);

                    player.FixedParticles(0x376A, 9, 32, 5030, 0, 0, EffectLayer.Waist);
                    player.PlaySound(0x202);
                    break;

                case TypeOfBrain.Mana:
                    int manaRegained = (int)(Math.Round((double)player.ManaMax * .66));
                    player.Mana     += manaRegained;

                    player.FixedParticles(0x376A, 9, 32, 5030, 1364, 0, EffectLayer.Waist);
                    player.PlaySound(0x1EB);
                    break;

                case TypeOfBrain.SwarmHeal:
                    Queue m_Queue = new Queue();

                    foreach (BaseCreature follower in player.AllFollowers)
                    {
                        if (!UOACZSystem.IsUOACZValidMobile(follower))
                        {
                            continue;
                        }
                        if (Utility.GetDistance(player.Location, follower.Location) > 12)
                        {
                            continue;
                        }
                        if (follower.Hits == follower.HitsMax)
                        {
                            continue;
                        }

                        m_Queue.Enqueue(follower);
                    }

                    while (m_Queue.Count > 0)
                    {
                        BaseCreature follower = (BaseCreature)m_Queue.Dequeue();

                        int healingAmount = (int)(Math.Round((double)follower.HitsMax * .25));

                        follower.Heal(healingAmount);

                        follower.FixedParticles(0x376A, 9, 32, 5030, 0, 0, EffectLayer.Waist);
                        follower.PlaySound(0x202);
                    }
                    break;

                case TypeOfBrain.CooldownReduction:
                    player.FixedParticles(0x373A, 10, 15, 5036, EffectLayer.Head);
                    player.PlaySound(0x3BD);

                    foreach (UOACZUndeadAbilityEntry abilityEntry in player.m_UOACZAccountEntry.UndeadProfile.m_Abilities)
                    {
                        DateTime cooldown = abilityEntry.m_NextUsageAllowed;

                        double cooldownReduction = abilityEntry.m_CooldownMinutes * .20;

                        abilityEntry.m_NextUsageAllowed = abilityEntry.m_NextUsageAllowed.Subtract(TimeSpan.FromMinutes(cooldownReduction));
                    }

                    UOACZSystem.RefreshAllGumps(player);
                    break;
                }
            });

            Delete();
        }