//回家 public virtual void OnEnterGoHome(NPCScriptBase _this, ObjNPC npc) { if (npc.TableNpc.LeaveFightAddBlood != 0) { npc.ResetAttribute(); } npc.RemoveCantMoveBuff(); }
public void ChangeAi(NPCScriptBase _this, ObjNPC npc, int nextId) { if (nextId == -1) { return; } var tbAI = Table.GetAI(nextId); if (tbAI == null) { return; } npc.TableAI = tbAI; Logger.Info("guid={0},sceneid={1}", npc.Scene.Guid, npc.Scene.TypeId); SceneServer.Instance.ServerControl.ObjSpeak(npc.EnumAllVisiblePlayerIdExclude(), npc.ObjId, tbAI.EnterSpeak, string.Empty); }
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); }
public virtual void Init(NPCScriptBase _this, ObjNPC npc) { }