| | |
| | | import PlayerVip
|
| | | import GameObj
|
| | | import ChNPC
|
| | | import PassiveBuffEffMng
|
| | |
|
| | | import random
|
| | | import math
|
| | |
| | | # @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, mirrorPlayerID=0):
|
| | | def SummonMapNpc(npcId, rebornX, rebornY, aiType=0, lastTime=0, playerID=0, sightLevel=0, refreshID=0, mirrorPlayerID=0, skillIDList=None, skillIDExList=None):
|
| | | npcData = GameWorld.GetGameData().FindNPCDataByID(npcId)
|
| | | if not npcData:
|
| | | GameWorld.ErrLog("找不到该NPCID: %s" % npcId)
|
| | |
| | | curSummon.SetDict(ChConfig.Def_NPC_Dict_MirrorPlayerID, mirrorPlayerID)
|
| | |
|
| | | curSummon.Reborn(rebornX, rebornY, False)
|
| | | skillManager = curSummon.GetSkillManager()
|
| | | #有指定的技能,重新学习
|
| | | if skillIDList:
|
| | | #GameWorld.DebugLog("指定召唤兽技能: npcID=%s,skillIDList=%s" % (npcID, skillIDList))
|
| | | skillManager.ResetSkill()
|
| | | for skillID in skillIDList:
|
| | | skillManager.LVUPSkillByID(skillID)
|
| | | #附加学习技能
|
| | | if skillIDExList:
|
| | | for skillID in skillIDExList:
|
| | | if not skillManager.FindSkillBySkillID(skillID):
|
| | | skillManager.LVUPSkillByID(skillID)
|
| | | NPCControl(curSummon).DoNPCRebornCommLogic(tick)
|
| | |
|
| | | FBLogic.DoFBRebornSummonNPC(curSummon, tick)
|
| | | #__NotifyMapPlayerSummonMapNPC(npcId, rebornX, rebornY)
|
| | | if skillIDList or skillIDExList:
|
| | | learnSkillIDList = []
|
| | | for index in range(0, skillManager.GetSkillCount()):
|
| | | useSkill = skillManager.GetSkillByIndex(index)
|
| | | learnSkillIDList.append(useSkill.GetSkillID())
|
| | | GameWorld.DebugLog("召唤的NPC所有技能: curID=%s,npcID=%s,skill=%s" % (curSummon.GetID(), npcId, learnSkillIDList))
|
| | | return curSummon
|
| | |
|
| | | def SummonNPC(gameObj, npcID, rebornX, rebornY, skillIDList=None):
|
| | |
| | | PyGameData.g_playerPriWoodPileNPCDict.pop(priWoodPilePlayerID)
|
| | | break
|
| | |
|
| | | PassiveBuffEffMng.GetPassiveEffManager().RemovePassiveEff((curNPC.GetID(), IPY_GameWorld.gotNPC))
|
| | | |
| | | # C++设置npc死亡
|
| | | curNPC.SetDead(curNPC.GetDictByKey(ChConfig.Def_NPCDead_Reason),
|
| | | curNPC.GetDictByKey(ChConfig.Def_NPCDead_KillerType),
|
| | |
| | | #
|
| | | # #清空禁止
|
| | | # curNPC.ForbiddenSkillTypeList_Clear()
|
| | | |
| | | #宠物特殊处理
|
| | | if PetControl.RefurbishPetAttr(curNPC):
|
| | | return
|
| | |
|
| | | isPetNPC = PetControl.IsPetNPC(curNPC)
|
| | | mirrorPlayerID = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_MirrorPlayerID)
|
| | | if mirrorPlayerID:
|
| | | #宠物特殊处理
|
| | | if isPetNPC:
|
| | | PetControl.RefurbishPetAttr(curNPC)
|
| | | elif mirrorPlayerID:
|
| | | self.SetMirrorPlayerNPCAttr(mirrorPlayerID, isReborn)
|
| | | else:
|
| | | DoNPCAttrStrengthen(curNPC, isReborn)
|
| | |
| | | #客户端自己算血量上限
|
| | | # if GameObj.GetMaxHP(curNPC) != curNPCMaxHP_Before:
|
| | | # curNPC.Notify_MaxHP()
|
| | | |
| | | |
| | | PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curNPC)
|
| | | return
|
| | |
|
| | | def SetMirrorPlayerNPCAttr(self, mirrorPlayerID, isReborn):
|
| | | ## 设置镜像玩家NPC属性
|
| | | PropDict, PlusDict = PlayerViewCacheTube.GetPlayerPropPlusDictByID(mirrorPlayerID)
|
| | | PropDict, _ = 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))
|
| | | GameObj.SetCurePer(curNPC, PropDict.get("CurePer", 0))
|
| | | GameObj.SetCureDefPer(curNPC, PropDict.get("CureDefPer", 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)
|
| | | |
| | | learnSkillIDList = []
|
| | | for index in range(0, skillManager.GetSkillCount()):
|
| | | useSkill = skillManager.GetSkillByIndex(index)
|
| | | 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))
|
| | | GameWorld.DebugLog("设置镜像玩家: objID=%s,NPCID=%s,mirrorPlayerID=%s,maxHP=%s" |
| | | % (curNPC.GetID(), curNPC.GetNPCID(), mirrorPlayerID, GameObj.GetMaxHP(curNPC)))
|
| | | return
|
| | |
|
| | | def SetHelpBattleRobotRebornAttr(self, fightPower):
|