| | |
| | |
|
| | | npcControl = NPCCommon.NPCControl(curNPC)
|
| | | #刷新自己仇恨度列表
|
| | | npcControl.RefreshAngryList(tick, 1000) # 为确保踩陷阱体验,暂定1秒
|
| | | npcControl.RefreshAngryList(tick, 500) # 为确保踩陷阱体验,暂定1秒
|
| | | #遍历仇恨列表找到最近的,并触发
|
| | | for i in range(0, curNPC.GetNPCAngry().GetAngryCount()):
|
| | | curAngry = curNPC.GetNPCAngry().GetAngryValueTag(i)
|
| | |
| | |
|
| | | #有NPC靠近,当超过攻击距离
|
| | | if GameWorld.GetDist(curNPC.GetPosX(), curNPC.GetPosY(),
|
| | | curObj.GetPosX(), curObj.GetPosY()) > curNPC.GetSight():
|
| | | curObj.GetPosX(), curObj.GetPosY()) > curNPC.GetAtkDist():
|
| | | continue
|
| | |
|
| | | #进入战斗
|
| | |
| | | GameObj.SetHP(curNPC, 0)
|
| | | return
|
| | |
|
| | | def OnGetOwnerRelation(curNPC, owner):
|
| | | # 陷阱与主人的关系
|
| | | |
| | | if owner.GetGameObjType() == IPY_GameWorld.gotPlayer:
|
| | | #自由PK区 or 非安全区内开全体 时可攻击主人
|
| | | if GameMap.GetAreaTypeByMapPos(owner.GetPosX(), owner.GetPosY()) == IPY_GameWorld.gatFreePK \
|
| | | or (GameMap.GetAreaTypeByMapPos(owner.GetPosX(), owner.GetPosY()) != IPY_GameWorld.gatSafe and \
|
| | | owner.GetAttackMode() == IPY_GameWorld.amAll):
|
| | | return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
|
| | | |
| | | return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
|
| | | #===============================================================================
|
| | | # def OnGetOwnerRelation(curNPC, owner):
|
| | | # # 陷阱与主人的关系
|
| | | # |
| | | # if owner.GetGameObjType() == IPY_GameWorld.gotPlayer:
|
| | | # #自由PK区 or 非安全区内开全体 时可攻击主人
|
| | | # if GameMap.GetAreaTypeByMapPos(owner.GetPosX(), owner.GetPosY()) == IPY_GameWorld.gatFreePK \
|
| | | # or (GameMap.GetAreaTypeByMapPos(owner.GetPosX(), owner.GetPosY()) != IPY_GameWorld.gatSafe and \
|
| | | # owner.GetAttackMode() == IPY_GameWorld.amAll):
|
| | | # return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
|
| | | # |
| | | # return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
|
| | | #===============================================================================
|
| | |
|