Пример #1
0
 public SlayerDamageTimer(SlayerDamageContext context)
     : base(TimeSpan.FromSeconds(10.0))
 {
     m_context = context;
     Priority  = TimerPriority.TwoFiftyMS;
     Start();
 }
Пример #2
0
        public static TimeSpan OnUse(Mobile m)
        {
            #region AOS
            if (Core.AOS)
            {
                Spell spell = new SpiritSpeakSpell(m);

                spell.Cast();

                if (spell.IsCasting)
                {
                    return(TimeSpan.FromSeconds(5.0));
                }

                return(TimeSpan.Zero);
            }
            #endregion AOS

            m.RevealingAction();

            if (m.CheckSkill(SkillName.SpiritSpeak, 0, 100))
            {
                #region ghosts
                // ghosts
                if (!m.CanHearGhosts)
                {
                    Timer  t    = new HearGhostsTimer(m);
                    double secs = m.Skills[SkillName.SpiritSpeak].Base / 50;
                    secs *= 90;
                    if (secs < 15)
                    {
                        secs = 15;
                    }

                    t.Delay = TimeSpan.FromSeconds(secs);                    //15seconds to 3 minutes
                    t.Start();
                    m.CanHearGhosts = true;
                }
                #endregion ghosts

                if (Core.UOAI || Core.UOAR)
                {
                    #region summon healing
                    // summon healing
                    if (m.Followers > 0)
                    {                           // okay, we have some followers
                        if (m_HealSummonsMemory.Recall(m) == false)
                        {                       // We don't remember this guy so create a new memory
                            double           MaxHealed = ((m.Skills.SpiritSpeak.Value + (m.Int * 2.0) + (m.Skills.Meditation.Value * 2.0)) / 5.0);
                            HealSummonsTimer th        = new HealSummonsTimer(new HealSummonsContext(m, MaxHealed));
                            m_HealSummonsMemory.Remember(m, th, 10);
                            th.Context.HealSummonsHP += th.Context.HealSummonsHPMax / 4.0;
                        }
                        else
                        {                               // we remember this guy so update
                            Memory.ObjectMemory om = m_HealSummonsMemory.Recall(m as object);
                            HealSummonsTimer    th = (HealSummonsTimer)om.Context;
                            if (th is HealSummonsTimer && th.Context != null)
                            {
                                th.Context.HealSummonsHP += th.Context.HealSummonsHPMax / 4.0;
                            }
                        }
                    }
                    #endregion summon healing
                }

                if (Core.UOAI || Core.UOAR)
                {
                    #region slayer damage bonus
                    // slayer damage bonus
                    if (CheckSlayer(m))
                    {                           // okay, they are holding a slayer
                        if (SpiritSpeak.SlayerDamageCache.Recall(m) == false)
                        {                       // no unused cached charge
                            if (m_SlayerDamageAccumulator.Recall(m) == false)
                            {                   // We don't remember this guy so create a new memory
                                double            spiritStrike = ((m.Skills.SpiritSpeak.Value + (m.Dex * 2.0) + (m.Skills.Tactics.Value * 2.0)) / 5.0);
                                SlayerDamageTimer th           = new SlayerDamageTimer(new SlayerDamageContext(m, spiritStrike));
                                m_SlayerDamageAccumulator.Remember(m, th, 10);
                                th.Context.SlayerDamageHP += th.Context.SlayerDamageHPMax / 4.0;
                                // (m_SlayerDamageAccumulator.Recall(m as object) as Memory.ObjectMemory).OnReleaseEventHandler = new Memory.OnReleaseEventHandler(th.Context.DoRelease);
                            }
                            else
                            {                                   // we remember this guy so update
                                Memory.ObjectMemory om = m_SlayerDamageAccumulator.Recall(m as object);
                                SlayerDamageTimer   th = (SlayerDamageTimer)om.Context;
                                if (th is SlayerDamageTimer && th.Context != null)
                                {
                                    th.Context.SlayerDamageHP += th.Context.SlayerDamageHPMax / 4.0;
                                }
                            }
                        }
                        else
                        {
                            Memory.ObjectMemory om  = SpiritSpeak.SlayerDamageCache.Recall(m as object);
                            SlayerDamageContext sdc = om.Context as SlayerDamageContext;
                            if (sdc.SlayerDamageHP > 0)
                            {
                                m.SendMessage("Your weapon is already fully charged.");
                            }
                            // else they have discharged their weapon and must now wait
                        }
                    }
                    #endregion slayer damage bonus
                }

                m.PlaySound(0x24A);
                m.SendLocalizedMessage(502444);                //You contact the neitherworld.
            }
            else
            {
                m.SendLocalizedMessage(502443);                //You fail to contact the neitherworld.
                m.CanHearGhosts = false;
            }

            return(TimeSpan.FromSeconds(1.0));
        }