コード例 #1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            if (version >= 0)
            {
                m_InteractionRange      = reader.ReadInt();
                m_StartingYieldCount    = reader.ReadInt();
                m_MaxPlayerInteractions = reader.ReadInt();
                m_TrapType           = (ScavengeTrapType)reader.ReadInt();
                m_TrapDifficulty     = reader.ReadInt();
                m_Locked             = reader.ReadBool();
                m_LockDifficulty     = reader.ReadInt();
                m_HitPoints          = reader.ReadInt();
                m_MaxHitPoints       = reader.ReadInt();
                m_HitSound           = reader.ReadInt();
                m_BreakSound         = reader.ReadInt();
                m_ScavengeDifficulty = reader.ReadInt();
                m_TrapResolveChance  = reader.ReadDouble();
                m_Expiration         = reader.ReadDateTime();
                m_Corrupted          = reader.ReadBool();
                m_CorruptionItem     = reader.ReadItem();

                int interactors = reader.ReadInt();
                for (int a = 0; a < interactors; a++)
                {
                    PlayerMobile player       = (PlayerMobile)reader.ReadMobile();
                    int          interactions = reader.ReadInt();

                    m_Interactors.Add(player, interactions);
                }

                int trapImmunePlayers = reader.ReadInt();
                for (int a = 0; a < trapImmunePlayers; a++)
                {
                    PlayerMobile player       = (PlayerMobile)reader.ReadMobile();
                    int          interactions = reader.ReadInt();

                    m_TrapImmunePlayers.Add(player, interactions);
                }
            }

            //-------------

            m_Timer = new InternalTimer(this);
            m_Timer.Start();
        }
コード例 #2
0
        public virtual void ResolveTrap(Mobile from)
        {
            switch (m_TrapType)
            {
            case ScavengeTrapType.Undead:
                PublicOverheadMessage(MessageType.Regular, UOACZSystem.yellowTextHue, false, ScavengeUndeadTrapText);

                int creatures = Utility.RandomMinMax(3, 5);

                for (int a = 0; a < creatures; a++)
                {
                    UOACZSystem.SpawnRandomCreature(from, Location, Map, UOACZPersistance.m_ThreatLevel - 50, 0, 3, false);
                }
                break;

            case ScavengeTrapType.Explosion:
                PublicOverheadMessage(MessageType.Regular, UOACZSystem.yellowTextHue, false, "*a trap is sprung*");

                from.FixedParticles(0x36BD, 20, 10, 5044, 0, 0, EffectLayer.Head);
                from.PlaySound(0x307);

                int damageMin = (int)(Math.Round((double)TrapDifficulty / 4));
                int damageMax = (int)(Math.Round((double)TrapDifficulty / 2));

                int damage = Utility.RandomMinMax(damageMin, damageMax);

                from.SendMessage("You have been hit by an explosive trap!");

                new Blood().MoveToWorld(from.Location, from.Map);
                AOS.Damage(from, damage, 0, 100, 0, 0, 0);
                break;

            case ScavengeTrapType.Hinder:
                PublicOverheadMessage(MessageType.Regular, UOACZSystem.yellowTextHue, false, "*a trap is sprung*");

                from.FixedEffect(0x376A, 10, 30, 0, 0);
                from.PlaySound(0x204);

                int duration = Utility.RandomMinMax(15, 30);

                from.SendMessage("You are trapped in place!");

                SpecialAbilities.EntangleSpecialAbility(1.0, null, from, 1.0, duration, -1, true, "", "", "-1");
                break;

            case ScavengeTrapType.Poison:
                PublicOverheadMessage(MessageType.Regular, UOACZSystem.yellowTextHue, false, "*a trap is sprung*");

                int poisonLevel = 0;

                double poisonChance = Utility.RandomDouble();

                if (poisonChance <= .25)
                {
                    poisonLevel = 0;
                }

                else if (poisonChance <= .70)
                {
                    poisonLevel = 1;
                }

                else if (poisonChance <= .95)
                {
                    poisonLevel = 2;
                }

                else
                {
                    poisonLevel = 3;
                }

                Poison poison = Poison.GetPoison(poisonLevel);

                from.SendMessage("You have been poisoned!");

                from.FixedEffect(0x372A, 10, 30, 2208, 0);
                Effects.PlaySound(from.Location, from.Map, 0x22F);

                from.ApplyPoison(from, poison);
                break;
            }

            m_TrapType = ScavengeTrapType.None;

            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);
            player.m_UOACZAccountEntry.TrapsSprung++;
        }