| | |
| | | import IPY_GameWorld
|
| | | import GameObj
|
| | | import GameMap
|
| | | import AttackCommon
|
| | | import SkillCommon
|
| | | import AICommon
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
| | |
|
| | | npcControl = NPCCommon.NPCControl(curNPC)
|
| | | #刷新自己仇恨度列表
|
| | | npcControl.RefreshAngryList(tick, 1000) # 为确保踩陷阱体验,暂定1秒
|
| | | npcControl.RefreshAngryList(tick, 500) # 为确保踩陷阱体验,
|
| | | #遍历仇恨列表找到最近的,并触发
|
| | | 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
|
| | |
|
| | | #进入战斗
|
| | | NPCFight(curNPC, npcControl, curObj, tick)
|
| | | if not NPCFight(curNPC, npcControl, curObj, tick):
|
| | | continue
|
| | | return
|
| | |
|
| | | return
|
| | |
| | |
|
| | | if curSkill == None:
|
| | | GameWorld.Log("陷阱 = %s 数据库查找技能失败"%curNPC.GetName())
|
| | | return
|
| | | return True
|
| | | |
| | | battleRelationType = AttackCommon.GetBattleRelationType(curNPC, curObj)
|
| | | |
| | | skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
|
| | | if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
|
| | | # PK模式的判定
|
| | | return False
|
| | | |
| | | curNPC.SetDict("traptagType", curObj.GetGameObjType())
|
| | | curNPC.SetDict("traptagID", curObj.GetID())
|
| | |
|
| | | #触发技能, 改为统一在死亡时释放技能
|
| | | #SkillShell.NPCUseSkillTag(curNPC, curObj, curSkill, tick)
|
| | |
|
| | | #有玩家进入仇恨列表,,,自爆
|
| | | npcControl.SetKilled()
|
| | | return
|
| | | return True
|
| | |
|
| | | ## NPC死亡
|
| | | # @param curNPC 当前npc
|
| | |
| | |
|
| | | #死亡NPC不能攻击, 这里设置NPC血量为1
|
| | | curNPC.SetHP(1)
|
| | | |
| | |
|
| | | #获得技能管理器
|
| | | skillManager = curNPC.GetSkillManager()
|
| | | curSkill = skillManager.GetSkillByIndex(0)
|
| | | if not curSkill:
|
| | | return
|
| | | |
| | |
|
| | | curObj = GameWorld.GetObj(curNPC.GetDictByKey("traptagID"), curNPC.GetDictByKey("traptagType"))
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | SkillShell.NPCUseSkill(curNPC, curSkill, tick)
|
| | | if curObj == None or GameObj.GetHP(curObj) <= 0:
|
| | | SkillShell.NPCUseSkill(curNPC, curSkill, tick)
|
| | | return
|
| | | |
| | | AICommon.DoNPCUseSkill(curNPC, curObj, curSkill, 0, tick)
|
| | |
|
| | | 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
|
| | | #===============================================================================
|
| | |
|