| | |
| | | if "LV" in npcFBAttrDict:
|
| | | strengthenLV = npcFBAttrDict["LV"]
|
| | |
|
| | | attrDict = GetNPCStrengthenAttrDict(npcID, strengthenLV, strengthenPlayerCnt, strengthenIpyData)
|
| | | attrDict = {} #GetNPCStrengthenAttrDict(npcID, strengthenLV, strengthenPlayerCnt, strengthenIpyData)
|
| | | attrDict.update(npcFBAttrDict) # 如果副本有指定属性,则以副本为主
|
| | | if not attrDict:
|
| | | return
|
| | |
| | | for skillID in skillIDList:
|
| | | skillManager.LearnSkillByID(skillID)
|
| | | return
|
| | |
|
| | | def GetNPCStrengthenAttrDict(npcID, strengthenLV=0, strengthenPlayerCnt=0, strengthenIpyData=None):
|
| | | if not strengthenLV and not strengthenPlayerCnt:
|
| | | return {}
|
| | | npcData = GameWorld.GetGameData().FindNPCDataByID(npcID)
|
| | | if not npcData:
|
| | | return {}
|
| | | |
| | | attrStrengthenInfo = ReadChConfig.GetEvalChConfig("NPCAttrStrengthen")
|
| | | if not attrStrengthenInfo:
|
| | | return {}
|
| | | |
| | | attrDict = {}
|
| | | paramDict = attrStrengthenInfo[NPCAttr_ParamDict] # 过程参数公式字典
|
| | | attrStrengthenDict = attrStrengthenInfo[NPCAttr_AttrStrengthenList] # 属性成长公式字典
|
| | | playerCntCoefficient = attrStrengthenInfo[NPCAttr_PlayerCntCoefficient] # 人数系数
|
| | | npcIDPlayerCntCoefficient = attrStrengthenInfo[NPCAttr_NPCPlayerCntCoefficient] # 特殊NPC人数系数
|
| | | baseMaxHP = GameObj.GetHP(npcData) # NPCData 没有提供Max接口,对应使用GetHP
|
| | | |
| | | if strengthenLV:
|
| | | if not strengthenIpyData:
|
| | | strengthenIpyData = IpyGameDataPY.GetIpyGameDataNotLog("NPCStrengthen", npcID)
|
| | | if not strengthenIpyData:
|
| | | return {}
|
| | | |
| | | playerCurLVIpyData = PlayerControl.GetPlayerLVIpyData(strengthenLV) # 取增强怪物等级对应此等级的玩家参考属性值
|
| | | if not playerCurLVIpyData:
|
| | | return {}
|
| | | |
| | | # NPC表可用参数
|
| | | SkillAtkRate = GetSkillAtkRate(npcData) # 技能伤害
|
| | | FinalHurt = GetFinalHurt(npcData)
|
| | | |
| | | # 参考玩家属性参数
|
| | | ReMaxHP = playerCurLVIpyData.GetReMaxHP() # 最大生命值
|
| | | ReAtk = playerCurLVIpyData.GetReAtk() # 攻击(最小、最大攻击)
|
| | | ReDef = playerCurLVIpyData.GetReDef() # 防御
|
| | | ReHit = playerCurLVIpyData.GetReHit() # 命中
|
| | | ReMiss = playerCurLVIpyData.GetReMiss() # 闪避
|
| | | ReAtkSpeed = playerCurLVIpyData.GetReAtkSpeed() # 攻击速度
|
| | | ReSkillAtkRate = playerCurLVIpyData.GetReSkillAtkRate() # 技能伤害比例
|
| | | ReDamagePer = playerCurLVIpyData.GetReDamagePer() # 增加伤害
|
| | | ReDamReduce = playerCurLVIpyData.GetReDamReduce() # 减少伤害
|
| | | ReIgnoreDefRate = playerCurLVIpyData.GetReIgnoreDefRate() # 无视防御比例
|
| | | ReLuckyHitRate = playerCurLVIpyData.GetReLuckyHitRate() # 会心一击率
|
| | | ReLuckyHit = playerCurLVIpyData.GetReLuckyHit() # 会心一击伤害
|
| | | ReBleedDamage = playerCurLVIpyData.GetReBleedDamage() # 流血伤害增加
|
| | | ReIceAtk = playerCurLVIpyData.GetReIceAtk() # 真实伤害
|
| | | ReIceDef = playerCurLVIpyData.GetReIceDef() # 真实抵御
|
| | | RePetAtk = playerCurLVIpyData.GetRePetAtk() # 灵宠攻击
|
| | | RePetSkillAtkRate = playerCurLVIpyData.GetRePetSkillAtkRate() # 灵宠技能
|
| | | RePetDamPer = playerCurLVIpyData.GetRePetDamPer() # 灵宠伤害增加
|
| | | ReFinalHurt = playerCurLVIpyData.GetReFinalHurt() # 固定伤害增加
|
| | | ReFinalHurtReduce = playerCurLVIpyData.GetReFinalHurtReduce() # 固定伤害减少
|
| | | RePotionReply = playerCurLVIpyData.GetRePotionReply() # 血瓶恢复量
|
| | | RePotionCD = playerCurLVIpyData.GetRePotionCD() # ѪƿCD
|
| | | ReFightPower = playerCurLVIpyData.GetReFightPower() # 战斗力
|
| | | |
| | | # 增加NPC属性参数
|
| | | HitTime = strengthenIpyData.GetHitTime() # 怪物受击次数
|
| | | DefCoefficient = strengthenIpyData.GetDefCoefficient() # 人物防御系数
|
| | | AtkCoefficient = strengthenIpyData.GetAtkCoefficient() # 人物攻击系数
|
| | | AdjustCoefficient = strengthenIpyData.GetAdjustCoefficient() # 调整系数比例
|
| | | AtkInterval = strengthenIpyData.GetAtkInterval() # 怪物攻击间隔
|
| | | HitRate = strengthenIpyData.GetHitRate() # 对人物的命中率
|
| | | MissRate = strengthenIpyData.GetMissRate() # 对人物的闪避率
|
| | | MonterNum = strengthenIpyData.GetMonterNum() # 怪物数
|
| | | IceAtkCoefficient = strengthenIpyData.GetIceAtkCoefficient() # 元素攻击比例
|
| | | IceDefCoefficient = strengthenIpyData.GetIceDefCoefficient() # 元素抗性比例
|
| | | MaxEnduranceTime = strengthenIpyData.GetMaxEnduranceTime() # 玩家最大承受伤害时间
|
| | | FightPowerCoefficient = strengthenIpyData.GetFightPowerCoefficient() # 压制战斗力系数
|
| | | |
| | | # 过程参数
|
| | | AtkReplyCoefficient = eval(FormulaControl.GetCompileFormula("NPCParam_AtkReplyCoefficient",
|
| | | paramDict["AtkReplyCoefficient"])) # 怪物攻击回复调整值
|
| | | MonterHurt = eval(FormulaControl.GetCompileFormula("NPCParam_MonterHurt", paramDict["MonterHurt"])) # 怪物固定伤害
|
| | | LostHPPerSecond = eval(FormulaControl.GetCompileFormula("NPCParam_LostHPPerSecond", paramDict["LostHPPerSecond"])) # 玩家每秒掉血量
|
| | | LVStrengthenMark = strengthenIpyData.GetLVStrengthenMark()
|
| | | attrStrengthenList = attrStrengthenDict.get(LVStrengthenMark, [])
|
| | | for attrKey, strengthenFormat in attrStrengthenList:
|
| | | strengthenValue = int(eval(FormulaControl.GetCompileFormula("NPCStrengthen_%s_%s" % (attrKey,LVStrengthenMark), strengthenFormat)))
|
| | | #GameWorld.DebugLog(" %s=%s" % (attrKey, strengthenValue))
|
| | | locals()[attrKey] = strengthenValue # 创建该属性局部变量作为参数提供给后面属性计算时用
|
| | | attrDict[attrKey] = strengthenValue
|
| | | |
| | | # 当战力系数为0时,NPC战力默认为NPC表压制战力
|
| | | if FightPowerCoefficient:
|
| | | attrDict["FightPower"] = int(ReFightPower * FightPowerCoefficient / 10000.0)
|
| | | |
| | | if strengthenPlayerCnt:
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | dataMapID = FBCommon.GetRecordMapID(mapID)
|
| | | formulaKey = "MapCoefficient_%s" % mapID
|
| | | playerCntAttrCoefficient = playerCntCoefficient.get(mapID, {})
|
| | | if not playerCntAttrCoefficient and dataMapID in playerCntCoefficient:
|
| | | playerCntAttrCoefficient = playerCntCoefficient[dataMapID]
|
| | | formulaKey = "MapCoefficient_%s" % dataMapID
|
| | | if npcID in npcIDPlayerCntCoefficient:
|
| | | playerCntAttrCoefficient = npcIDPlayerCntCoefficient[npcID]
|
| | | formulaKey = "NPCCoefficient_%s" % npcID
|
| | | for attrKey, coefficientDict in playerCntAttrCoefficient.items():
|
| | | if attrKey in attrDict:
|
| | | attrValue = attrDict[attrKey]
|
| | | elif attrKey == "MaxHP":
|
| | | attrValue = baseMaxHP
|
| | | else:
|
| | | attrFuncName = "Get%s" % attrKey
|
| | | if not hasattr(npcData, attrFuncName):
|
| | | continue
|
| | | attrValue = getattr(npcData, attrFuncName)()
|
| | | # 按字典配置
|
| | | if isinstance(coefficientDict, dict):
|
| | | coefficient = GameWorld.GetDictValueByRangeKey(coefficientDict, strengthenPlayerCnt, 1)
|
| | | # 按公式配置
|
| | | elif isinstance(coefficientDict, str):
|
| | | formulaKey = "%s_%s" % (formulaKey, attrKey)
|
| | | coefficient = eval(FormulaControl.GetCompileFormula(formulaKey, coefficientDict))
|
| | | else:
|
| | | coefficient = 1
|
| | | attrDict[attrKey] = int(attrValue * coefficient)
|
| | | |
| | | #GameWorld.DebugLog("计算NPC属性成长: npcID=%s,strengthenLV=%s,strengthenPlayerCnt=%s,baseMaxHP=%s,attrDict=%s" |
| | | # % (npcID, strengthenLV, strengthenPlayerCnt, baseMaxHP, attrDict))
|
| | | return attrDict
|
| | |
|
| | | def GiveKillNPCDropPrize(curPlayer, mapID, npcCountDict, exp_rate=None, mailTypeKey=None, isMail=False,
|
| | | extraItemList=[], prizeMultiple=1, dropItemMapInfo=[], curGrade=0, isVirtualDrop=False):
|
| | |
| | | addAngry += useSkill.GetSkillAngry()
|
| | |
|
| | | # 玩家攻击增加额外仇恨
|
| | | if objDetel.GetGameObjType() == IPY_GameWorld.gotPlayer:
|
| | | addAngry += PlayerControl.GetAddAngry(objDetel)
|
| | | #if objDetel.GetGameObjType() == IPY_GameWorld.gotPlayer:
|
| | | # addAngry += PlayerControl.GetAddAngry(objDetel)
|
| | |
|
| | | self.AddObjToAngryList(objDetel, addAngry)
|
| | | return
|
| | |
| | | curNPC.SetMaxAtk(heroAttrDict.get(ShareDefine.Def_Effect_Atk, 1))
|
| | | curNPC.SetDef(heroAttrDict.get(ShareDefine.Def_Effect_Def, 1))
|
| | | GameObj.SetMaxHP(curNPC, heroAttrDict.get(ShareDefine.Def_Effect_MaxHP, 1))
|
| | | |
| | | #GameObj.SetMissRate(curNPC, npcDataEx.GetMissRate())
|
| | | #GameObj.SetMissDefRate(curNPC, npcDataEx.GetMissDefRate())
|
| | | #GameObj.SetSuperHitRate(curNPC, npcDataEx.GetSuperHitRate())
|
| | | #GameObj.SetSuperHitRateReduce(curNPC, npcDataEx.GetSuperHitRateReduce())
|
| | | #GameObj.SetFaintRate(curNPC, npcDataEx.GetFaintRate())
|
| | | #GameObj.SetFaintDefRate(curNPC, npcDataEx.GetFaintDefRate())
|
| | | #GameObj.SetComboRate(curNPC, npcDataEx.GetComboRate())
|
| | | #GameObj.SetComboDefRate(curNPC, npcDataEx.GetComboDefRate())
|
| | | #GameObj.SetAtkBackRate(curNPC, npcDataEx.GetAtkBackRate())
|
| | | #GameObj.SetAtkBackDefRate(curNPC, npcDataEx.GetAtkBackDefRate())
|
| | | #GameObj.SetSuckHPPer(curNPC, npcDataEx.GetSuckHPPer())
|
| | | #GameObj.SetSuckHPDefPer(curNPC, npcDataEx.GetSuckHPDefPer())
|
| | | return
|
| | |
|
| | | ## 刷新NPC属性
|
| | |
| | | PlayerVip.DoAddVIPKillLVExp(lastHurtPlayer, GetNPCLV(curNPC))
|
| | |
|
| | | # SPֵ
|
| | | PlayerControl.AddZhenQiByKillNPC(lastHurtPlayer, curNPC.GetSP())
|
| | | #PlayerControl.AddZhenQiByKillNPC(lastHurtPlayer, curNPC.GetSP())
|
| | | return
|
| | |
|
| | | #---------------------------------------------------------------------
|