Esempio n. 1
0
        public virtual ObjCharacter GetAttackTarget(NPCScriptBase _this, ObjNPC npc)
        {
            switch (npc.TableAI.HatreType)
            {
            case 0:     //仇恨的
                if (npc.TableAI.SortType == 0)
                {
                    return(npc.GetMaxHatre());
                }
                if (npc.TableAI.SortType == 1)
                {
                    return(npc.GetMinHatre());
                }
                Logger.Warn("GetAttackTarget AiId={0} Config Error!! HatreType={1} , SortType={2}", npc.TableAI.Id,
                            npc.TableAI.HatreType, npc.TableAI.SortType);
                return(null);

            case 1:     //距离的

                if (npc.TableAI.SortType == 0)
                {
                    return(npc.GetMaxDistanceEnemy());
                }
                if (npc.TableAI.SortType == 1)
                {
                    return(npc.GetMinDistanceEnemy());
                }
                Logger.Warn("GetAttackTarget AiId={0} Config Error!! HatreType={1} , SortType={2}", npc.TableAI.Id,
                            npc.TableAI.HatreType, npc.TableAI.SortType);
                return(null);

            case 2:     //按血量

                if (npc.TableAI.SortType == 0)
                {
                    return(npc.GetMaxHpNow());
                }
                if (npc.TableAI.SortType == 1)
                {
                    return(npc.GetMinHpNow());
                }
                Logger.Warn("GetAttackTarget AiId={0} Config Error!! HatreType={1} , SortType={2}", npc.TableAI.Id,
                            npc.TableAI.HatreType, npc.TableAI.SortType);
                return(null);

            case 3:     //按职业
            {
                switch (npc.TableAI.SortType)
                {
                case 2:         //战法猎
                    return(npc.GetCharacterByRole(NPCScriptBase.tempTypeList2));

                case 3:
                    return(npc.GetCharacterByRole(NPCScriptBase.tempTypeList3));

                case 4:
                    return(npc.GetCharacterByRole(NPCScriptBase.tempTypeList4));

                case 5:
                    return(npc.GetCharacterByRole(NPCScriptBase.tempTypeList5));

                case 6:
                    return(npc.GetCharacterByRole(NPCScriptBase.tempTypeList6));

                case 7:
                    return(npc.GetCharacterByRole(NPCScriptBase.tempTypeList7));
                }
            }
                Logger.Warn("GetAttackTarget AiId={0} Config Error!! HatreType={1} , SortType={2}", npc.TableAI.Id,
                            npc.TableAI.HatreType, npc.TableAI.SortType);
                return(null);
            }
            return(null);
        }