Пример #1
0
            protected override void OnTarget(Mobile from, object target)
            {
                PlayerMobile player = from as PlayerMobile;

                if (player == null)
                {
                    return;
                }

                Mobile mobile = target as Mobile;

                if (mobile == null)
                {
                    player.SendMessage("You cannot focus your follower's aggression against that.");
                    return;
                }

                if (!player.InLOS(mobile) || mobile.Hidden)
                {
                    player.SendMessage("That target is out of your line of sight.");
                    return;
                }

                if (!mobile.CanBeDamaged() || mobile.AccessLevel > AccessLevel.Player)
                {
                    player.SendMessage("That is not a valid target.");
                    return;
                }

                if (player.AllFollowers.Count == 0)
                {
                    player.SendMessage("You must have one or more followers in order to focus their aggression.");
                    return;
                }

                List <BaseCreature> m_FocusedCreatures = new List <BaseCreature>();

                int validFollowers = 0;

                foreach (BaseCreature creature in player.AllFollowers)
                {
                    if (creature == null)
                    {
                        continue;
                    }
                    if (!creature.Alive)
                    {
                        continue;
                    }
                    if (Utility.GetDistance(player.Location, creature.Location) > 12)
                    {
                        continue;
                    }

                    m_FocusedCreatures.Add(creature);
                }

                if (m_FocusedCreatures.Count == 0)
                {
                    player.SendMessage("You do not have any followers close enough to hear your command.");
                    return;
                }

                if (player.CheckTargetSkill(SkillName.Herding, 0, 120, 1.0))
                {
                    double aggressionAmount = BaseCreature.HerdingFocusedAggressionDamageBonus * ((double)player.Skills.Herding.Value / 100);

                    foreach (BaseCreature creature in m_FocusedCreatures)
                    {
                        creature.FocusedAggressionTarget     = mobile;
                        creature.FocusedAggresionValue       = aggressionAmount;
                        creature.FocusedAggressionExpiration = DateTime.UtcNow + TimeSpan.FromMinutes(BaseCreature.HerdingFocusedAggressionDuration);
                    }

                    from.FixedParticles(0x373A, 10, 30, 5036, 2116, 0, EffectLayer.Head);
                    from.PlaySound(0x650);

                    mobile.PublicOverheadMessage(MessageType.Regular, 2117, false, "*focused aggression*");
                    mobile.FixedParticles(0x373A, 10, 30, 5036, 2116, 0, EffectLayer.Head);
                    mobile.PlaySound(0x650);

                    from.SendMessage("You focus your follower's aggression towards your target.");
                    from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.HerdingSuccessCooldown * 1000);

                    from.BeginAction(typeof(ShepherdsCrook));
                    Timer.DelayCall(TimeSpan.FromMilliseconds(SkillCooldown.HerdingSuccessCooldown * 1000), delegate
                    {
                        if (from == null)
                        {
                            return;
                        }

                        from.EndAction(typeof(ShepherdsCrook));
                    });
                }

                else
                {
                    from.SendMessage("You fail to focus your followers aggression.");
                    from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.HerdingFailureCooldown * 1000);

                    from.BeginAction(typeof(ShepherdsCrook));
                    Timer.DelayCall(TimeSpan.FromMilliseconds(SkillCooldown.HerdingFailureCooldown * 1000), delegate
                    {
                        if (from == null)
                        {
                            return;
                        }

                        from.EndAction(typeof(ShepherdsCrook));
                    });
                }
            }