public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
 {
     if ( info.ButtonID == 2 )
     {
         if ( m_Victim != null && !m_Victim.Blessed && m_Vamp != null && m_Vamp.InRange(m_Victim, 1) && m_Victim.Alive &&
             m_Vamp.Alive && !m_Vamp.Paralyzed && m_Victim is PlayerMobile && !((PlayerMobile)m_Victim).IsVampire )
         {
             m_Vamp.Emote( "*feeds on {0}*", m_Victim.Name );
             m_Vamp.PlaySound( 49 );
             m_Victim.FixedParticles( 0x377A, 244, 25, 9950, 31, 0, EffectLayer.Head );
             m_Victim.Damage( 10 );
             ((PlayerMobile)m_Vamp).BPs += 2;
             ((PlayerMobile)m_Vamp).NextFeedingAllowed = DateTime.Now + TimeSpan.FromSeconds( 5 );
             foreach (DiseaseTimer timer in HealthAttachment.GetHA(m_Victim).CurrentDiseases)
             {
                 if (!HealthAttachment.GetHA(m_Vamp).HasDisease(timer.Disease))
                 {
                     DiseaseTimer newDis = new DiseaseTimer(m_Vamp, timer.Disease);
                     HealthAttachment.GetHA(m_Vamp).CurrentDiseases.Add(newDis);
                     newDis.Start();
                 }
             }
         }
     }
 }
Esempio n. 2
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                if( from == null || targeted == null || !(from is PlayerMobile) )
                    return;

                if( !((PlayerMobile)from).CanFeed )
                    return;

                if ( targeted is Corpse )
                {
                    Corpse corpse = targeted as Corpse;

                    if( !corpse.Channeled && corpse.Owner != null && (corpse.Owner.BodyValue == 400 || corpse.Owner.BodyValue == 401 || corpse.Owner.BodyValue == 402) )
                    {
                        from.Emote( "*sinks {0} fangs into the fallen body's neck and drains its blood*", ((PlayerMobile)from).GetPossessivePronoun() );
                        from.PlaySound( 49 );
                        ((PlayerMobile)from).BPs += 2;
                        corpse.Hue = 0;
                        ((PlayerMobile)from).NextFeedingAllowed = DateTime.Now + TimeSpan.FromSeconds( 5 );
                        Server.Spells.SpellHelper.Turn( from, corpse );
                        from.Animate( 32, 5, 1, true, false, 0 );
                        corpse.Channeled = true;
                        Effects.SendLocationParticles( corpse, 0x377A, 244, 25, 31, 0, 9550, 0 );

                        foreach(DiseaseTimer timer in HealthAttachment.GetHA(corpse.Owner).CurrentDiseases)
                        {
                            if(!HealthAttachment.GetHA(from).HasDisease(timer.Disease))
                            {
                                DiseaseTimer newDis = new DiseaseTimer(from, timer.Disease);
                                HealthAttachment.GetHA(from).CurrentDiseases.Add(newDis);
                                newDis.Start();
                            }
                        }
                    }
                }

                else if( targeted is Mobile )
                    TryFeed( from, (Mobile)targeted, false );
            }
Esempio n. 3
0
            public static void TryFeed( Mobile from, Mobile targeted, bool forced )
            {
                if( from == null || targeted == null || !(from is PlayerMobile) || !(targeted.BodyValue == 400 || targeted.BodyValue == 401) || !from.InRange(targeted, 1) )
                    return;

                PlayerMobile m = from as PlayerMobile;

                if( !m.CanFeed )
                    return;

                if( targeted.Paralyzed && !targeted.Blessed )
                {
                    from.Emote( "*feeds on {0}*", targeted.Name );
                    from.PlaySound( 49 );
                    targeted.FixedParticles( 0x377A, 244, 25, 9950, 31, 0, EffectLayer.Head );
                    ((PlayerMobile)from).BPs += 2;
                    ((PlayerMobile)from).NextFeedingAllowed = DateTime.Now + TimeSpan.FromSeconds( 5 );

                    int damage = (1 - m.Feats.GetFeatLevel( FeatList.Feeding )) * 5;

                    if( damage > 0 )
                        targeted.Damage( damage, from );

                    foreach (DiseaseTimer timer in HealthAttachment.GetHA(targeted).CurrentDiseases)
                    {
                        if (!HealthAttachment.GetHA(m).HasDisease(timer.Disease))
                        {
                            DiseaseTimer newDis = new DiseaseTimer(m, timer.Disease);
                            HealthAttachment.GetHA(m).CurrentDiseases.Add(newDis);
                            newDis.Start();
                        }
                    }
                }

                else if( targeted is PlayerMobile && !((PlayerMobile)targeted).IsVampire && !forced )
                {
                    targeted.CloseGump( typeof(Gumps.AllowFeedingGump) );
                    targeted.SendGump( new Gumps.AllowFeedingGump(from, targeted) );
                }
            }
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    Mobile m = targeted as Mobile;
                    if (!HealthAttachment.GetHA(m).HasDisease(m_Dis))
                    {
                        DiseaseTimer timer = new DiseaseTimer(m, m_Dis);
                        timer.Start();
                        HealthAttachment.GetHA(m).CurrentDiseases.Add(timer);
                        from.SendMessage("You have successfully added " + m_Dis.ToString() + " to " + m.Name + "'s diseases.");
                    }
                }

                base.OnTarget(from, targeted);
            }
        public void TryCatchDisease(Disease dis)
        {
            if (m_Player == null || m_Player.Deleted)
            {
                Delete();
                return;
            }

            if (m_Player is PlayerMadeStatue)
                return;

            if (m_Player.IsDeadBondedPet)
                return;

            if (m_Player.Blessed)
                return;

            if (m_Player.Frozen)
                return;

            if (!m_Player.Alive)
                return;

            if (m_Player is PlayerMobile && (m_Player as PlayerMobile).IsVampire)
                return;

            if (dis == Disease.None)
                return;

            if (HasDisease(dis))
                return;

            if (!CanCatch(dis))
                return;

            if (Utility.RandomMinMax(1, 100) < DiseaseResistance(dis))
                return;

            DiseaseTimer newTimer = new DiseaseTimer(m_Player, dis);
            newTimer.Start();
            m_CurrentDiseases.Add(newTimer);
            m_LastCaught[dis] = DateTime.Now;
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 2:
                    {
                        #region Version 2

                        int count = reader.ReadInt();
                        for (int i = 0; i < count; i++)
                        {
                            Disease dis = (Disease)reader.ReadInt();
                            DateTime last = reader.ReadDateTime();
                            m_LastCaught.Add(dis, last);
                        }

                        int dcount = reader.ReadInt();
                        for (int i = 0; i < dcount; i++)
                        {
                            Disease dis = (Disease)reader.ReadInt();
                            int immu = reader.ReadInt();
                            m_DiseaseImmunities.Add(dis, immu);
                        }

                        #endregion
                        goto case 1;
                    }
                case 1:
                    {
                        #region Version 1
                        m_Disfigurement = reader.ReadInt();
                        m_LastAppearanceRecovery = reader.ReadDateTime();
                        int count = reader.ReadInt();
                        if (m_CurrentDiseases == null)
                            m_CurrentDiseases = new List<DiseaseTimer>();
                        for (int i = 0; i < count; i++)
                        {
                            Disease newDisease = (Disease)reader.ReadInt();
                            Mobile newInfected = reader.ReadMobile();
                            int newRecovCount = reader.ReadInt();
                            TimeSpan newIncuLeft = reader.ReadTimeSpan();

                            DiseaseTimer newTimer = new DiseaseTimer(newInfected, newDisease, newIncuLeft);
                            newTimer.RecoveryCount = newRecovCount;
                            newTimer.Start();
                            m_CurrentDiseases.Add(newTimer);
                        }
                        #endregion
                        goto case 0;
                    }
                case 0:
                    {
                        #region Version 0
                        m_Player = (Mobile)reader.ReadMobile();
                        m_LastInjury = reader.ReadDateTime();
                        int count = reader.ReadInt();
                        if(m_CurrentInjuries == null)
                            m_CurrentInjuries = new List<InjuryTimer>();
                        for (int i = 0; i < count; i++)
                        {
                            Injury timerInjury = (Injury)reader.ReadInt();
                            DateTime timerStartTime = reader.ReadDateTime();
                            InjuryTimer newInjuryTimer = new InjuryTimer(timerInjury, this);
                            newInjuryTimer.StartTime = timerStartTime;
                            m_CurrentInjuries.Add(newInjuryTimer);
                            newInjuryTimer.Start();
                        }
                        #endregion
                        break;
                    }
            }
        }