| | |
| | | import GameObj
|
| | | import PassiveBuffEffMng
|
| | | import IpyGameDataPY
|
| | | import TurnAttack
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
| | | lvSummonNPC = curPlayer.GetLV()
|
| | | summonNPC.SetLV(lvSummonNPC)
|
| | | summonNPC.SetCountry(curPlayer.GetCountry())
|
| | | summonNPC.SetDict(ChConfig.Def_NpcDictKey_CampType, curPlayer.GetFaction())
|
| | | GameObj.SetFaction(summonNPC, curPlayer.GetFaction())
|
| | | summonNPC.GetNPCAngry().Init(ChConfig.Def_SummonNPC_Angry_Count)
|
| | | #设置召唤兽属性
|
| | | SetSummonNPCProperty(curPlayer, summonNPC, curSkill)
|
| | |
| | | # @param addValue 添加值
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def SkillAddHP(curObj, skillTypeID, addValue, isNotify=True):
|
| | | def SkillAddHP(curObj, skillID, addValue, isNotify=True, srcObj=None):
|
| | | if not srcObj:
|
| | | srcObj = curObj
|
| | | curObjType = curObj.GetGameObjType()
|
| | |
|
| | | #=======================================================================
|
| | | # if curObj.GetMapID() in ChConfig.CanNotRecoverMapIDList and skillTypeID not in ChConfig.ForceRecoverSkillList:
|
| | | # GameWorld.DebugLog("该地图无法使用技能恢复血量!")
|
| | | # return
|
| | | #=======================================================================
|
| | | if GameObj.GetPyPlayerState(curObj, ChConfig.Def_PlayerState_LimitAddHP):
|
| | | #GameWorld.DebugLog("当前禁疗状态下,无法恢复!")
|
| | | return
|
| | |
|
| | |
|
| | | if addValue <= 0:
|
| | | GameWorld.Log('###技能回复血量异常,数值错误 = %s,技能类型ID = %s' % (addValue , skillTypeID))
|
| | | GameWorld.Log('###技能回复血量异常,数值错误 = %s,技能ID = %s' % (addValue , skillID))
|
| | | return
|
| | |
|
| | | curHP = GameObj.GetHP(curObj)
|
| | |
| | | return
|
| | |
|
| | | # 治疗加成
|
| | | curePer = PlayerControl.GetCurePer(curObj) if curObjType == IPY_GameWorld.gotPlayer else ChConfig.Def_MaxRateValue |
| | | addValue = int(addValue*curePer*1.0/ChConfig.Def_MaxRateValue)
|
| | | #curePer = PlayerControl.GetCurePer(curObj) if curObjType == IPY_GameWorld.gotPlayer else ChConfig.Def_MaxRateValue |
| | | #addValue = int(addValue*curePer*1.0/ChConfig.Def_MaxRateValue)
|
| | |
|
| | | maxHP = GameObj.GetMaxHP(curObj)
|
| | |
|
| | | #血已最大值,不再恢复,跳出
|
| | | if curHP == maxHP:
|
| | | if curHP >= maxHP:
|
| | | GameWorld.DebugLog("满血不用回血,只通知回血表现!")
|
| | | #广播加血类型
|
| | | if isNotify:
|
| | | AttackCommon.ChangeHPView(curObj, curObj, skillTypeID, addValue, ChConfig.Def_HurtTYpe_Recovery)
|
| | | return
|
| | | AttackCommon.ChangeHPView(curObj, srcObj, skillID, addValue, ChConfig.Def_HurtTYpe_Recovery)
|
| | | return addValue
|
| | |
|
| | | remainHP = min(curHP + addValue, maxHP)
|
| | | cureHP = remainHP - curHP # 实际治疗量
|
| | | TurnAttack.AddTurnObjCureHP(curObj, srcObj, addValue, cureHP, skillID)
|
| | |
|
| | | #---玩家处理---
|
| | | if curObjType == IPY_GameWorld.gotPlayer:
|
| | | GameObj.SetHP(curObj, remainHP, not isNotify)
|
| | | GameObj.SetHP(curObj, remainHP, False) # 先不通知
|
| | | FBLogic.OnFBAddHP(curObj, addValue)
|
| | |
|
| | | #---NPC处理---
|
| | |
| | | PetControl.SetPetHP(curObj, remainHP)
|
| | | #普通NPC回血
|
| | | else:
|
| | | GameObj.SetHP(curObj, remainHP)
|
| | | if not isNotify:
|
| | | #已广播的不重复
|
| | | curObj.Notify_HP()
|
| | | |
| | | GameObj.SetHP(curObj, remainHP, False) # 先不通知
|
| | | |
| | | #广播加血类型
|
| | | if isNotify:
|
| | | AttackCommon.ChangeHPView(curObj, curObj, skillTypeID, addValue, ChConfig.Def_HurtTYpe_Recovery)
|
| | | |
| | | AttackCommon.ChangeHPView(curObj, srcObj, skillID, addValue, ChConfig.Def_HurtTYpe_Recovery)
|
| | | |
| | | return
|
| | |
|
| | | ## 直接扣血不走公式
|
| | |
| | | else:
|
| | | # 已广播的不重复
|
| | | GameObj.SetHP(curObj, remainHP, not view)
|
| | | |
| | | lostHP = curObjHP_BeforeAttack - GameObj.GetHP(curObj) # 实际掉血量
|
| | |
|
| | | AttackCommon.WriteHurtLog(buffOwner, curObj, curSkill, lostValue, hurtType, "持续掉血")
|
| | | if view:
|
| | |
| | | elif curObjType == IPY_GameWorld.gotNPC:
|
| | | AttackCommon.NPCAddObjInHurtList(attackerOwner, curObj, curObjHP_BeforeAttack, lostValue)
|
| | |
|
| | | TurnAttack.AddTurnObjHurtValue(buffOwner, curObj, hurtType, lostValue, lostHP, curSkill)
|
| | | |
| | | #统一调用攻击结束动作
|
| | | if isDoAttackResult:
|
| | | BaseAttack.DoLogic_AttackResult(buffOwner, curObj, None, tick)
|
| | | return
|
| | | return lostHP
|
| | |
|
| | | ## 检查增加淬毒buff
|
| | | # @param skillTypeID 使用的技能typeID
|
| | |
| | | if not curSkill:
|
| | | return ChConfig.Def_BattleRelationType_Comm
|
| | | #0通哟 1 PVP类型 2PVE类型
|
| | | return curSkill.GetHurtType()
|
| | | return curSkill.GetHurtType() % 10
|
| | |
|
| | | def isXPSkill(curSkill):
|
| | | ## 是否xp怒气技能
|
| | | return curSkill and curSkill.GetXP() > 0
|
| | |
|
| | | def isTurnNormalAtkSkill(curSkill):
|
| | | ## 是否回合普攻技能,区别与无技能的普通A一下,该普攻同样可以有各种技能效果,只是他属于普攻
|
| | | return curSkill and curSkill.GetFuncType() == ChConfig.Def_SkillFuncType_TurnNormaAttack
|
| | |
|
| | | ## 检查技能是否为被动技能, 用于控制不可释放技能
|
| | | def isPassiveSkill(curSkill):
|
| | |
| | | # @param useSkill 使用的技能
|
| | | # @return 基础治疗值
|
| | | # @remarks 函数详细说明.
|
| | | def GetCureBaseValue(attacker, useSkill):
|
| | | return GetAttackerHurtValueByAtkType(attacker, AttackCommon.GetBattleType(attacker, useSkill))
|
| | |
|
| | | ## 获得基础伤害值(目前用于持续性技能的计算)
|
| | | # @param attacker 攻击者
|
| | | # @param useSkill 使用的技能
|
| | | # @return 基础伤害值
|
| | | # @remarks 获得基础伤害值
|
| | | def GetHurtBaseValue(attacker, useSkill):
|
| | | return GetAttackerHurtValueByAtkType(attacker, AttackCommon.GetBattleType(attacker, useSkill))
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | ## 通过攻击类型获得攻击方伤害值
|
| | | # @param attacker 攻击者
|
| | | # @param atkType 攻击类型(物理攻击、摩法攻击)
|
| | | # @return 攻击方伤害值
|
| | | # @remarks 通过攻击类型获得攻击方伤害值
|
| | | def GetAttackerHurtValueByAtkType(attacker, atkType):
|
| | | |
| | | return (attacker.GetMinAtk() + random.random() * (attacker.GetMaxAtk() - attacker.GetMinAtk()))
|
| | | #===========================================================================
|
| | | # if atkType == IPY_GameWorld.ghtPhy:
|
| | | # #(最小攻击 + rand()*( 最大攻击伤害-最小攻击伤害 )
|
| | | # return (attacker.GetMinAtk() + random.random() * (attacker.GetMaxAtk() - attacker.GetMinAtk()))
|
| | | # |
| | | # #(最小剑气伤害 + rand()*( 最大剑气伤害-最小剑气伤害 )
|
| | | # return (attacker.GetMAtkMin() + random.random() * (attacker.GetMAtkMax() - attacker.GetMAtkMin()))
|
| | | #===========================================================================
|
| | | def GetCureBaseValue(attacker, useSkill): return attacker.GetMaxAtk()
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | ## 获得某技能管理器是否有特定技能
|
| | |
| | | curePercent = 1.0 #治疗加成值
|
| | | cureBaseValue = 0 #治疗基础值
|
| | |
|
| | | #passiveSkill = GetSkillFromOtherSkillByEffectID(userObj, curSkill, ChConfig.Def_Skill_Effect_PassiveSkillID)
|
| | | |
| | | #该被动技能已学, 则处理被动影响的效果
|
| | | #===========================================================================
|
| | | # if passiveSkill != None and isPassiveSkill(passiveSkill):
|
| | | # cureEffect = GetSkillEffectByEffectID(passiveSkill, ChConfig.Def_Skill_Effect_CureUpper)
|
| | | # |
| | | # #计算治疗加成,按几率触发
|
| | | # if GameWorld.CanHappen(passiveSkill.GetHappenRate(), ChConfig.Def_MaxRateValue) \
|
| | | # and cureEffect != None:
|
| | | # curePercent += cureEffect.GetEffectValue(0) / float(ChConfig.Def_MaxRateValue)
|
| | | #===========================================================================
|
| | | |
| | | #特殊技能的附加值
|
| | | addExValue = 0
|
| | |
|
| | |
| | | cureBaseValue = GameObj.GetLastHurtValue(userObj)
|
| | | elif cureType == ChConfig.Def_Cure_TagMaxHP:
|
| | | cureBaseValue = 0 if not tagObj else GameObj.GetMaxHP(tagObj)
|
| | | |
| | | |
| | | #这边写死了效果1,基本已经定型
|
| | | #获得技能的计算参数值
|
| | | if cureType == ChConfig.Def_Cure_PHY:
|
| | | # 根据敏捷,力量差值及效果系数计算恢复比例
|
| | | skillPer = max(0, userObj.GetPHY() - userObj.GetSTR()) / float(curSkill.GetEffect(0).GetEffectValue(0))
|
| | | GameWorld.DebugLog("英勇复苏: 敏=%s,力=%s,skillPer=%s" % (userObj.GetPHY(), userObj.GetSTR(), skillPer))
|
| | | else: |
| | | skillPer = curSkill.GetEffect(0).GetEffectValue(0) / float(ChConfig.Def_MaxRateValue)
|
| | | #技能附加
|
| | | #elif cureType == ChConfig.Def_Cure_TagAtk:
|
| | | # cureBaseValue = 0 if not tagObj else GetCureBaseValue(tagObj, curSkill)
|
| | | #elif cureType == ChConfig.Def_Cure_LostHP:
|
| | | # cureBaseValue = max(0, GameObj.GetMaxHP(userObj) - GameObj.GetHP(userObj))
|
| | | #elif cureType == ChConfig.Def_Cure_BeHurtValue:
|
| | | # cureBaseValue = GameObj.GetLastBeHurtValue(userObj)
|
| | | |
| | | skillPer = curSkill.GetEffect(0).GetEffectValue(0)
|
| | | #技能附加固定值
|
| | | skillValue = curSkill.GetEffect(0).GetEffectValue(1)
|
| | |
|
| | | skillPer += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(userObj, None, curSkill, ChConfig.TriggerType_AddHP)/float(ChConfig.Def_MaxRateValue)
|
| | | skillPer += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(userObj, None, curSkill, ChConfig.TriggerType_AddHP)
|
| | | skillPer /= float(ChConfig.Def_MaxRateValue)
|
| | | |
| | | # 回合制
|
| | | curePer = 0 # 治疗加成
|
| | | cureDefPer = 0 # 敌方的弱化治疗
|
| | | angerOverflow = 0 # 怒气溢出值
|
| | | if userObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightPosInfo):
|
| | | if isXPSkill(curSkill):
|
| | | angerOverflow = max(GameObj.GetXP(userObj) - IpyGameDataPY.GetFuncCfg("AngerXP", 2), 0)
|
| | | #enemyObj = TurnAttack.GetEnemyObj(userObj)
|
| | | #curePer += GameObj.GetCurePer(userObj)
|
| | | #if enemyObj:
|
| | | # cureDefPer += GameObj.GetCureDefPer(enemyObj)
|
| | | |
| | | curePer /= float(ChConfig.Def_MaxRateValue)
|
| | | cureDefPer /= float(ChConfig.Def_MaxRateValue)
|
| | | |
| | | baseValue = max(0, cureBaseValue) # 防止基值被弱化为负值,在恢复比例也是负值的情况下负负得正导致可以恢复血量
|
| | | |
| | | #公式计算治疗值
|
| | | cureHP = int((cureBaseValue * skillPer + skillValue + addExValue) * curePercent)
|
| | | cureHP = eval(IpyGameDataPY.GetFuncCompileCfg("CureFormula", 1))
|
| | | #cureHP = (cureHP + skillValue + addExValue) * curePercent # 策划没有要求,但是支持的,先屏蔽
|
| | | if not largeNum:
|
| | | cureHP = min(cureHP, ChConfig.Def_UpperLimit_DWord)
|
| | | cureHP = max(1, int(cureHP)) # 保底1点
|
| | |
|
| | | #GameWorld.DebugLog("获取治疗值(%s):cureType=%s,cureBaseValue=%s,skillPer=%s,skillValue=%s" |
| | | # % (cureHP, cureType, cureBaseValue, skillPer, skillValue))
|
| | | GameWorld.DebugLog("获取治疗值(%s):skillID=%s,cureType=%s,baseValue=%s,skillPer=%s,curePer=%s,cureDefPer=%s,angerOverflow=%s" |
| | | % (cureHP, curSkill.GetSkillID(), cureType, baseValue, skillPer, curePer, cureDefPer, angerOverflow))
|
| | | return cureHP
|
| | |
|
| | |
|