| | |
| | | # @param aiType: AI类型
|
| | | # @return 如果召唤失败返回None 否则返回召唤的NPC的实例
|
| | | # @remarks 在地图里召唤NPC 根据NPCID 出生点 AI类型 和TICK
|
| | | def SummonMapNpc(npcId, rebornX, rebornY, aiType=0, lastTime=0, playerID=0, sightLevel=0, refreshID=0, pvpPlayerID=0):
|
| | | def SummonMapNpc(npcId, rebornX, rebornY, aiType=0, lastTime=0, playerID=0, sightLevel=0, refreshID=0, mirrorPlayerID=0):
|
| | | npcData = GameWorld.GetGameData().FindNPCDataByID(npcId)
|
| | | if not npcData:
|
| | | GameWorld.ErrLog("找不到该NPCID: %s" % npcId)
|
| | |
| | | if curSummon.GetType() == ChConfig.ntRobot:
|
| | | __OnFBRobotReborn(curSummon, curSummon.GetLV())
|
| | |
|
| | | if curSummon.GetType() == ChConfig.ntPVP and pvpPlayerID:
|
| | | curSummon.SetDict(ChConfig.Def_NPC_Dict_PVPPlayerID, pvpPlayerID)
|
| | | if mirrorPlayerID:
|
| | | curSummon.SetDict(ChConfig.Def_NPC_Dict_MirrorPlayerID, mirrorPlayerID)
|
| | |
|
| | | curSummon.Reborn(rebornX, rebornY, False)
|
| | | NPCControl(curSummon).DoNPCRebornCommLogic(tick)
|
| | |
| | | if summonPlayerID > 0:
|
| | | curNPC.SetDict(ChConfig.Def_NPC_Dict_SummonMapNPCPlayerID, 0)
|
| | |
|
| | | if curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_PVPPlayerID):
|
| | | curNPC.SetDict(ChConfig.Def_NPC_Dict_PVPPlayerID, 0)
|
| | | if curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_MirrorPlayerID):
|
| | | curNPC.SetDict(ChConfig.Def_NPC_Dict_MirrorPlayerID, 0)
|
| | |
|
| | | refreshObj = NPCRealmRefresh.GetTagNPCRefresh(curNPC)
|
| | | if refreshObj:
|
| | |
| | | if PetControl.RefurbishPetAttr(curNPC):
|
| | | return
|
| | |
|
| | | pvpPlayerID = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_PVPPlayerID)
|
| | | if pvpPlayerID:
|
| | | self.SetPVPNPCPlayerAttr(pvpPlayerID)
|
| | | mirrorPlayerID = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_MirrorPlayerID)
|
| | | if mirrorPlayerID:
|
| | | self.SetMirrorPlayerNPCAttr(mirrorPlayerID, isReborn)
|
| | | else:
|
| | | DoNPCAttrStrengthen(curNPC, isReborn)
|
| | |
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def SetPVPNPCPlayerAttr(self, pvpPlayerID):
|
| | | PropDict, PlusDict = PlayerViewCacheTube.GetPlayerPropPlusDictByID(pvpPlayerID)
|
| | | def SetMirrorPlayerNPCAttr(self, mirrorPlayerID, isReborn):
|
| | | ## 设置镜像玩家NPC属性
|
| | | PropDict, PlusDict = PlayerViewCacheTube.GetPlayerPropPlusDictByID(mirrorPlayerID)
|
| | | if not PropDict:
|
| | | return
|
| | | curNPC = self.__Instance
|
| | |
| | | GameObj.SetAtkBackDefRate(curNPC, PropDict.get("AtkBackDefRate", 0))
|
| | | GameObj.SetSuckHPPer(curNPC, PropDict.get("SuckHPPer", 0))
|
| | | GameObj.SetSuckHPDefPer(curNPC, PropDict.get("SuckHPDefPer", 0))
|
| | | |
| | | |
| | | if not isReborn:
|
| | | return
|
| | | |
| | | skillManager = curNPC.GetSkillManager()
|
| | | SkillInfo = PlusDict.get("SkillInfo", {})
|
| | | for _, skillLVDict in SkillInfo.items():
|
| | | for skillID, _ in skillLVDict.items():
|
| | | skillID = GameWorld.ToIntDef(skillID)
|
| | | skillData = GameWorld.GetGameData().GetSkillBySkillID(skillID)
|
| | | if not skillData:
|
| | | continue
|
| | | skillManager.LearnSkillByID(skillID)
|
| | |
|
| | | GameWorld.DebugLog("SetPVPNPCPlayerAttr: objID=%s,NPCID=%s,pvpPlayerID=%s,maxHP=%s,SkillInfo=%s" |
| | | % (curNPC.GetID(), curNPC.GetNPCID(), pvpPlayerID, GameObj.GetMaxHP(curNPC), SkillInfo))
|
| | | learnSkillIDList = []
|
| | | for index in range(0, skillManager.GetSkillCount()):
|
| | | useSkill = skillManager.GetSkillByIndex(index)
|
| | | GameWorld.DebugLog(" NPC SkillID=%s" % useSkill.GetSkillID())
|
| | | learnSkillIDList.append(useSkill.GetSkillID())
|
| | | GameWorld.DebugLog("设置镜像玩家: objID=%s,NPCID=%s,mirrorPlayerID=%s,maxHP=%s,learnSkillIDList=%s" |
| | | % (curNPC.GetID(), curNPC.GetNPCID(), mirrorPlayerID, GameObj.GetMaxHP(curNPC), learnSkillIDList))
|
| | | return
|
| | |
|
| | | def SetHelpBattleRobotRebornAttr(self, fightPower):
|