Esempio n. 1
0
        public override bool FollowTarget(NPCInstance npc, RoleActor target)
        {
            if (!base.FollowTarget(npc, target))
            {
                return(false);
            }

            Vector3 standPos = target.GetSurroundPosition(npc.GetPosition(), (int)npc.mCastSpellDistance, npc.Id);

            if (!Util.PassableForMod(npc.HostMap.Navigator, standPos))
            {
                if (!Util.PassableForMod(npc.HostMap.Navigator, target.GetPosition()))
                {
                    return(false);
                }
                standPos = target.GetPosition();
            }

            if (!npc.MoveTo(standPos))
            {
                return(false);
            }

            npc.ChangeState(eNPCState.FollowTarget);

            return(true);
        }
Esempio n. 2
0
        public override bool FollowTarget(NPCInstance npc, RoleActor target)
        {
            if (!base.FollowTarget(npc, target))
            {
                return(false);
            }

            //超出追击范围
            if (Util.DistanceH(npc.GetPosition(), npc.mSpawnPoint) > npc.InMapData.followRange)
            {
                return(false);
            }

            npc.SelectSpell();

            if (npc.CanCastSpell())
            {
                //到释放技能距离
                npc.ChangeState(eNPCState.WaitCoolDown);
            }
            else
            {
                if (npc.InMapData.followRange > 0)
                {
                    Vector3 standPos = target.GetSurroundPosition(npc.GetPosition(), (int)npc.mCastSpellDistance, npc.Id);
                    if (!Util.PassableForMod(npc.HostMap.Navigator, standPos))
                    {
                        if (!Util.PassableForMod(npc.HostMap.Navigator, target.GetPosition()))
                        {
                            return(false);
                        }

                        standPos = target.GetPosition();
                    }

                    if (!npc.MoveTo(standPos))
                    {
                        return(false);
                    }
                }

                npc.ChangeState(eNPCState.FollowTarget);
            }

            return(true);
        }
Esempio n. 3
0
        public override bool FollowTarget(PlayerInstance player, RoleActor target)
        {
            if (!base.FollowTarget(player, target))
            {
                return(false);
            }

            player.SelectSpell();

            if (player.CanCastSpell())
            {
                //到释放技能距离
                player.ChangeState(ePlayerState.WaitCoolDown);
            }
            else
            {
                Vector3 standPos = target.GetSurroundPosition(player.GetPosition(), (int)player.mCastSpellDistance, player.Id);
                if (!Util.PassableForMod(player.HostMap.Navigator, standPos))
                {
                    if (!Util.PassableForMod(player.HostMap.Navigator, player.GetPosition()))
                    {
                        return(false);
                    }
                    standPos = player.GetPosition();
                }

                if (!player.MoveTo(standPos))
                {
                    return(false);
                }

                player.ChangeState(ePlayerState.FollowTarget);
            }

            return(true);
        }