예제 #1
0
        public static bool GetEffect(Mobile targ, ref int effect)
        {
            SpiritInfo info = m_Table[targ] as SpiritInfo;

            if (info == null)
            {
                return(false);
            }

            effect = info.m_Effect;
            return(true);
        }
예제 #2
0
        private static void ProcessSpirit(SpiritInfo info)
        {
            Mobile from = info.m_From;
            Mobile targ = info.m_Creature;
            bool   ends = false;

            // According to uoherald bard must remain alive, visible, and
            // within range of the target or the effect ends in 15 seconds.
            if (!targ.Alive || targ.Deleted || !from.Alive)
            {
                ends = true;
            }
            else
            {
                int range = (int)targ.GetDistanceToSqrt(from);

                if (from.Map != targ.Map || range > info.m_Effect)
                {
                    ends = true;
                }
            }

            if (ends && info.m_Ending && info.m_EndTime < DateTime.UtcNow)
            {
                if (info.m_Timer != null)
                {
                    info.m_Timer.Stop();
                }

                info.Clear();
                m_Table.Remove(targ);
            }
            else
            {
                if (ends && !info.m_Ending)
                {
                    info.m_Ending  = true;
                    info.m_EndTime = DateTime.UtcNow + TimeSpan.FromSeconds(15);
                }
                else if (!ends)
                {
                    info.m_Ending  = false;
                    info.m_EndTime = DateTime.UtcNow;
                }

                targ.FixedEffect(0x376A, 1, 32);
            }
        }
예제 #3
0
            protected override void OnTarget(Mobile from, object target)
            {
                ArrayList mods   = new ArrayList();
                double    scalar = m_wep.MaxRange / 50.0;

                if (target is Mobile)
                {
                    Mobile targ = (Mobile)target;
                    if (m_Table.Contains(targ)) //Already buffed
                    {
                        from.SendMessage("Your target is already under the influence of The Spirit");
                    }
                    else
                    {
                        from.SendMessage("You imbue them with the power of spirit.");

                        mods.Add(new ResistanceMod(ResistanceType.Physical, m_wep.MaxRange / 2));
                        mods.Add(new ResistanceMod(ResistanceType.Fire, m_wep.MaxRange / 2));
                        mods.Add(new ResistanceMod(ResistanceType.Cold, m_wep.MaxRange / 2));
                        mods.Add(new ResistanceMod(ResistanceType.Poison, m_wep.MaxRange / 2));
                        mods.Add(new ResistanceMod(ResistanceType.Energy, m_wep.MaxRange / 2));

                        for (int i = 0; i < targ.Skills.Length; ++i)
                        {
                            if (targ.Skills[i].Value > 0)
                            {
                                mods.Add(new DefaultSkillMod((SkillName)i, true, targ.Skills[i].Value * scalar));
                            }
                        }
                        mods.Add(new StatMod(StatType.Str, "SpiritStr", (int)(targ.RawStr * scalar), TimeSpan.Zero));
                        mods.Add(new StatMod(StatType.Int, "SpiritInt", (int)(targ.RawInt * scalar), TimeSpan.Zero));
                        mods.Add(new StatMod(StatType.Dex, "SpiritDex", (int)(targ.RawDex * scalar), TimeSpan.Zero));
                        SpiritInfo info = new SpiritInfo(from, targ, m_wep.MaxRange / 2, mods);
                        info.m_Timer = Timer.DelayCall <SpiritInfo>(TimeSpan.Zero, TimeSpan.FromSeconds(1.25), new TimerStateCallback <SpiritInfo>(ProcessSpirit), info);

                        m_Table[target] = info;
                    }
                }
                else
                {
                    from.SendMessage("You point your sword, but nothing significant appears to happen.");
                }
            }