Beispiel #1
0
        private static void ProcessDiscordance(DiscordanceInfo info)
        {
            Mobile from = info.m_From;
            Mobile targ = info.m_Target;
            bool   ends = false;

            if (info.m_PVP && info.m_Expires < DateTime.UtcNow)
            {
                DiscordanceInfo.RemoveDiscord(info);
            }
            else
            {
                // 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 || targ.IsDeadBondedPet || !from.Alive || from.Hidden || targ.Hidden || from.IsDeadBondedPet)
                {
                    ends = true;
                }
                else
                {
                    int  maxRange = BaseInstrument.GetBardRange(from, SkillName.Discordance);
                    bool inRange  = targ.InRange((IPoint3D)from, maxRange);

                    Map targetMap = targ.Map;

                    if (targ is BaseMount mount && mount.Rider != null)
                    {
                        Mobile rider = mount.Rider;

                        inRange   = rider.InRange((IPoint3D)from, maxRange);
                        targetMap = rider.Map;
                    }

                    if (from.Map != targetMap || !inRange)
                    {
                        ends = true;
                    }
                }

                if (ends && info.m_Ending && info.m_EndTime < DateTime.UtcNow)
                {
                    DiscordanceInfo.RemoveDiscord(info);
                }
                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);
                }
            }
        }