| | |
| | | import ShareDefine
|
| | | import GameObj
|
| | | import PassiveBuffEffMng
|
| | | import IpyGameDataPY
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
| | | curSkill.SetLastUseTick(tick)
|
| | | coolDownTime = curSkill.GetCoolDownTime()
|
| | | remainTime = coolDownTime
|
| | | |
| | | skillTypeID = curSkill.GetSkillTypeID()
|
| | | if atkObj and skillTypeID in IpyGameDataPY.GetFuncEvalCfg("SkillCD", 1):
|
| | | reduceSkillCDPer += PlayerControl.GetTheFBSkillsCD(atkObj)
|
| | | |
| | | if isPassiveSkill(curSkill):
|
| | | if curSkill.GetFuncType() == ChConfig.Def_SkillFuncType_GiftSkill:
|
| | | # 天赋有减CD效果
|
| | |
| | | curSkill.SetLastUseTick(tick)
|
| | |
|
| | | return
|
| | |
|
| | | def GivePlayerSkillByJobSkill(curPlayer, jobSkillInfo):
|
| | | ## 根据职业技能ID给玩家技能, 支持字典{"job":[skillID, ...], ...} {job:[skillID, ...], ...} 或 列表[skillID, ...]
|
| | | |
| | | if not jobSkillInfo:
|
| | | return
|
| | | |
| | | jobSkillList = []
|
| | | if isinstance(jobSkillInfo, dict):
|
| | | job = curPlayer.GetJob()
|
| | | if job in jobSkillInfo:
|
| | | jobSkillList = jobSkillInfo[job]
|
| | | elif str(job) in jobSkillInfo:
|
| | | jobSkillList = jobSkillInfo[str(job)]
|
| | | elif isinstance(jobSkillInfo, list) or isinstance(jobSkillInfo, tuple):
|
| | | jobSkillList = jobSkillInfo
|
| | | jobSkillList = list(jobSkillList)
|
| | | |
| | | if not jobSkillList:
|
| | | return
|
| | | |
| | | isLearnNew = False
|
| | | skillManager = curPlayer.GetSkillManager()
|
| | | playerControl = PlayerControl.PlayerControl(curPlayer)
|
| | | GameWorld.DebugLog("给玩家技能: %s" % jobSkillList)
|
| | | for skillID in jobSkillList:
|
| | | skillData = GameWorld.GetGameData().GetSkillBySkillID(skillID)
|
| | | if skillData == None:
|
| | | continue
|
| | | if not CheckSkillJob(curPlayer, skillData):
|
| | | continue
|
| | | if not SkillShell.CheckLearnSkillCondition(curPlayer, skillData):
|
| | | continue
|
| | | |
| | | if skillManager.FindSkillBySkillID(skillID):
|
| | | #GameWorld.DebugLog("已经有该技能!skillID=%s" % skillID)
|
| | | continue
|
| | | |
| | | isLearnNew = True
|
| | | skillLV = skillData.GetSkillLV()
|
| | | skillTypeID = skillData.GetSkillTypeID()
|
| | | beforeFightPower = 0
|
| | | if skillLV > 1:
|
| | | befSkill = skillManager.FindSkillBySkillTypeID(skillTypeID)
|
| | | beforeFightPower = 0 if not befSkill else befSkill.GetFightPower()
|
| | | |
| | | skillManager.LVUPSkillByID(skillID)
|
| | | GameWorld.DebugLog(" 给玩家技能: skillTypeID=%s,skillID=%s,skillLV=%s" % (skillTypeID, skillID, skillLV), curPlayer.GetID())
|
| | | |
| | | DataRecordPack.DR_LearnORUPSkill(curPlayer, skillTypeID, skillLV)
|
| | | |
| | | if isPassiveSkill(skillData):
|
| | | pass
|
| | | #PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer, skillTypeID)
|
| | | |
| | | playerControl.RefreshSkillFightPowerEx(skillID, beforeFightPower, isRefreshState=False)
|
| | | |
| | | if isLearnNew:
|
| | | playerControl.RefreshPlayerAttrState()
|
| | | return isLearnNew
|
| | |
|
| | | ## 玩家登录检查学习技能(上线)
|
| | | # @param curPlayer 当前玩家
|
| | |
| | | if not angryValue_ID:
|
| | | continue
|
| | |
|
| | | summonNPCAngry.AddAngry(angryValue_ID, angryValue.GetObjType(), angryValue.GetAngryValue())
|
| | | summonNPCAngry.AddAngry(angryValue_ID, angryValue.GetObjType(), angryValue.GetAngryValue(), angryValue.GetAngryValueEx())
|
| | |
|
| | | summonNPC.NotifyAppear() # 最终统一通知NPC出现
|
| | | #返回值,技能释放成功
|
| | |
| | | #
|
| | | # for i in range(0, curNPC.GetSummonCount()):
|
| | | # summonNPC = curNPC.GetSummonNPCAt(i)
|
| | | # if summonNPC.GetHP() > 0:
|
| | | # if GameObj.GetHP(summonNPC) > 0:
|
| | | # continue
|
| | | #
|
| | | # summonIsFull = False
|
| | |
| | | #summonNPC.SetBaseAtkInterval(int(curPlayer.GetAtkInterval() * skillPer))
|
| | | summonNPC.SetBaseMissRate(int(curPlayer.GetMiss() * skillPer))
|
| | | summonNPC.SetBaseSuperHiteRate(int(curPlayer.GetSuperHitRate() * skillPer))
|
| | | summonNPC.SetBaseMaxHP(int(curPlayer.GetMaxHP() * skillPer))
|
| | | GameObj.SetBaseMaxHP(summonNPC, int(GameObj.GetMaxHP(curPlayer) * skillPer))
|
| | | #summonNPC.SetBaseHPRestore(int(curPlayer.GetHPRestoreSetting() * skillPer))
|
| | | #summonNPC.SetOrgSpeed(int(curPlayer.GetOrgSpeed() * skillPer))
|
| | | return
|
| | |
| | | summonNPC.SetBaseAtkInterval(summonNPC.GetAtkInterval())
|
| | | summonNPC.SetBaseMissRate(summonNPC.GetMiss())
|
| | | summonNPC.SetBaseSuperHiteRate(summonNPC.GetSuperHitRate())
|
| | | summonNPC.SetBaseMaxHP(summonNPC.GetMaxHP())
|
| | | GameObj.SetBaseMaxHP(summonNPC, GameObj.GetMaxHP(summonNPC))
|
| | | summonNPC.SetBaseHPRestore(summonNPC.GetHPRestore())
|
| | | #summonNPC.SetOrgSpeed( summonNPC.GetOrgSpeed( ))
|
| | | return
|
| | |
| | | GameObj.SetHP(curObj, remainHP)
|
| | | if not isNotify:
|
| | | #已广播的不重复
|
| | | curObj.Notify_HPEx()
|
| | | curObj.Notify_HP()
|
| | |
|
| | | #广播加血类型
|
| | | if isNotify:
|
| | |
| | | curObjType = curObj.GetGameObjType()
|
| | | curSkill = GameWorld.GetGameData().FindSkillByType(skillTypeID, 1)
|
| | |
|
| | | atkObjType = buffOwner.GetGameObjType() if buffOwner else -1
|
| | | |
| | | # 技能对指定BOSS无效果-----------------
|
| | | if curObjType == IPY_GameWorld.gotNPC and curObj.GetIsBoss() not in ChConfig.Def_SkillAttack_NPCIsBoss:
|
| | | if curSkill and GetSkillBattleType(curSkill) == ChConfig.Def_BattleRelationType_CommNoBoss:
|
| | | if curSkill and GetSkillBattleType(curSkill) == ChConfig.Def_BattleRelationType_CommNoBoss and SkillShell.IsNPCSkillResist(curObj):
|
| | | return
|
| | |
|
| | | notifyLostValue = lostValue
|
| | |
| | | if curObjHP_BeforeAttack == 0:
|
| | | # 没有血量不能再触发
|
| | | return
|
| | | |
| | | if buffOwner:
|
| | | aRealmLV, dRealmLV = AttackCommon.GetPVERealmLVs(buffOwner, curObj, atkObjType, curObjType) # 获取境界
|
| | | if curObjType == IPY_GameWorld.gotNPC and ChConfig.IsGameBoss(curObj) and dRealmLV > aRealmLV:
|
| | | # 攻击高境界的BOSS 伤害固定为1
|
| | | lostValue = 1
|
| | |
|
| | | if skillAffect:
|
| | | lostValue = AttackCommon.CalcHurtHPWithBuff(buffOwner, curObj, lostValue, curSkill, tick)
|
| | |
| | | if curObj.GetGameNPCObjType() == IPY_GameWorld.gnotPet:
|
| | | PetControl.SetPetHP(curObj, remainHP)
|
| | | else:
|
| | | GameObj.SetHP(curObj, remainHP)
|
| | | timeLostHPIpyData = IpyGameDataPY.GetIpyGameDataNotLog("NPCTimeLostHP", curObj.GetNPCID())
|
| | | if timeLostHPIpyData:
|
| | | AttackCommon.UpdateTimeMonsterHP(curObj, timeLostHPIpyData, tick)
|
| | | else:
|
| | | GameObj.SetHP(curObj, remainHP)
|
| | | |
| | | if not view : # 已广播的不重复
|
| | | curObj.Notify_HPEx()
|
| | | curObj.Notify_HP()
|
| | |
|
| | | #其他对象逻辑处理
|
| | | else:
|
| | |
| | | GameObj.SetHP(curObj, remainHP, not view)
|
| | |
|
| | | AttackCommon.WriteHurtLog(buffOwner, curObj, curSkill, lostValue, hurtType, "持续掉血")
|
| | | |
| | | if view:
|
| | | #广播伤血类型
|
| | | AttackCommon.ChangeHPView(curObj, buffOwner, skillTypeID, notifyLostValue, hurtType)
|
| | | if buffOwner:
|
| | | PassiveBuffEffMng.OnPassiveSkillTrigger(buffOwner, curObj, curSkill, ChConfig.TriggerType_AttackOverPassive, tick)
|
| | |
|
| | | # 濒死状态触发技能
|
| | | if GameObj.GetHP(curObj) == 0:
|
| | |
| | | attackerOwner = None
|
| | |
|
| | | #---根据BUFF主人类型决定是否给攻击者主人仇恨---
|
| | | if buffOwner.GetGameObjType() == IPY_GameWorld.gotNPC:
|
| | | if atkObjType == IPY_GameWorld.gotNPC:
|
| | | attackerOwner = NPCCommon.GetNpcObjOwnerDetail(buffOwner)
|
| | |
|
| | | #添加仇恨
|
| | |
| | | curNPCControl.AddObjToAngryList(attackerOwner, 1)
|
| | |
|
| | | # 加伤血
|
| | | if buffOwner.GetGameObjType() == IPY_GameWorld.gotNPC:
|
| | | if atkObjType == IPY_GameWorld.gotNPC:
|
| | | attackerOwner = NPCCommon.GetNpcObjOwnerDetail(buffOwner)
|
| | | else:
|
| | | attackerOwner = buffOwner
|
| | |
|
| | | # 2013-1-3,去除npc攻击造成的伤血记录
|
| | | if attackerOwner != None and attackerOwner.GetGameObjType() == IPY_GameWorld.gotPlayer:
|
| | | AttackCommon.NPCAddObjInHurtList(attackerOwner, curObj, curObjHP_BeforeAttack, lostValue) |
| | | #CheckAddPoisonAtkBuff(skillTypeID, attackerOwner, curObj, tick)
|
| | |
|
| | | if curObjType == IPY_GameWorld.gotPlayer:
|
| | | AttackCommon.OnPVPDamage(attackerOwner, lostValue, curObj, "SkillLostHP")
|
| | |
|
| | | elif curObjType == IPY_GameWorld.gotNPC:
|
| | | AttackCommon.NPCAddObjInHurtList(attackerOwner, curObj, curObjHP_BeforeAttack, lostValue)
|
| | | |
| | | #统一调用攻击结束动作
|
| | | if isDoAttackResult:
|
| | | BaseAttack.DoLogic_AttackResult(buffOwner, curObj, None, tick)
|
| | |
| | | #宠物特殊处理
|
| | | if curObj.GetGameNPCObjType() == IPY_GameWorld.gnotPet:
|
| | | pass
|
| | | #curObj.Sync_RefreshProp(IPY_GameWorld.PetInfoRefresh_HP, curObj.GetHP(), True)
|
| | | #curObj.Sync_RefreshProp(IPY_GameWorld.PetInfoRefresh_HP, GameObj.GetHP(curObj), True)
|
| | | else:
|
| | | curObj.Notify_HPEx()
|
| | | curObj.Notify_HP()
|
| | |
|
| | |
|
| | | ## 获得技能buff的拥有者
|
| | |
| | |
|
| | | #---添加的Buff值---
|
| | | addBuffValue = 0
|
| | | #是否是持续性技能
|
| | | if curSkill.GetSkillType() in ChConfig.Def_LstBuff_List:
|
| | | callFunc = GameWorld.GetExecFunc(GameSkills, "SkillBuff_AddBuffValue.AddBuffValue")
|
| | | |
| | | if callFunc != None:
|
| | | addBuffValue = int(callFunc(curObj, None, curSkill, tick))
|
| | | else:
|
| | | GameWorld.ErrLog("SkillBuff_AddBuffValue.AddBuffValue")
|
| | | #===========================================================================
|
| | | # #是否是持续性技能
|
| | | # if curSkill.GetSkillType() in ChConfig.Def_LstBuff_List:
|
| | | # callFunc = GameWorld.GetExecFunc(GameSkills, "SkillBuff_AddBuffValue.AddBuffValue")
|
| | | # |
| | | # if callFunc != None:
|
| | | # addBuffValue = int(callFunc(curObj, None, curSkill, tick))
|
| | | # else:
|
| | | # GameWorld.ErrLog("SkillBuff_AddBuffValue.AddBuffValue")
|
| | | #===========================================================================
|
| | |
|
| | | return BuffSkill.DoAddBuff(curObj , buffType, curSkill , tick, [addBuffValue])
|
| | |
|
| | |
| | | return returnInfo
|
| | |
|
| | | buffManager = buffTuple[0]
|
| | | findBuff = buffManager.FindBuff(skillTypeID)
|
| | | findBuff = buffManager.FindBuff(findSkill.GetSkillTypeID())
|
| | | returnInfo[1] = buffManager
|
| | | returnInfo[0] = findBuff
|
| | |
|
| | | return returnInfo
|
| | |
|
| | |
|
| | | def FindBuffByOwner(gameObj, skillTypeID, ownerID, ownerType):
|
| | | findSkill = GameWorld.GetGameData().GetSkillBySkillID(skillTypeID)
|
| | | buffType = GetBuffType(findSkill)
|
| | | buffTuple = GetBuffManagerByBuffType(gameObj, buffType)
|
| | | if buffTuple == ():
|
| | | return None
|
| | | |
| | | buffManager = buffTuple[0]
|
| | | for i in range(0, buffManager.GetBuffCount()):
|
| | | curBuff = buffManager.GetBuff(i)
|
| | | if not curBuff:
|
| | | continue
|
| | | |
| | | #判断是否拥有同一类型的技能
|
| | | if curBuff.GetSkill().GetSkillTypeID() != skillTypeID:
|
| | | continue
|
| | | |
| | | #判断是否拥有同一类型的技能
|
| | | if curBuff.GetOwnerID() != ownerID:
|
| | | continue
|
| | | |
| | | if curBuff.GetOwnerType() != ownerType:
|
| | | continue
|
| | | |
| | | return curBuff
|
| | | |
| | | return None
|
| | |
|
| | | def FindBuffByOwnerEx(gameObj, skillTypeID, ownerID, ownerType):
|
| | | findSkill = GameWorld.GetGameData().GetSkillBySkillID(skillTypeID)
|
| | | buffType = GetBuffType(findSkill)
|
| | | buffTuple = GetBuffManagerByBuffType(gameObj, buffType)
|
| | | if buffTuple == ():
|
| | | return None, None, None, None
|
| | | |
| | | buffManager = buffTuple[0]
|
| | | for i in range(0, buffManager.GetBuffCount()):
|
| | | curBuff = buffManager.GetBuff(i)
|
| | | if not curBuff:
|
| | | continue
|
| | | |
| | | #判断是否拥有同一类型的技能
|
| | | if curBuff.GetSkill().GetSkillTypeID() != skillTypeID:
|
| | | continue
|
| | | |
| | | #判断是否拥有同一类型的技能
|
| | | if curBuff.GetOwnerID() != ownerID:
|
| | | continue
|
| | | |
| | | if curBuff.GetOwnerType() != ownerType:
|
| | | continue
|
| | | |
| | | return curBuff, buffManager, buffType, findSkill
|
| | | |
| | | return None, None, None, None
|
| | | #---------------------------------------------------------------------
|
| | | ## 执行清空命令 参数:玩家, 保留技能类型列表
|
| | | # @param curPlayer 玩家
|
| | |
| | | ChConfig.Def_SkillType_PassiveActionBuff, #被动触发的控制类buff 18
|
| | | ChConfig.Def_SkillType_PassiveLstPlsBuff, #被动触发持续增益类buff 21
|
| | | ChConfig.Def_SkillType_PassiveLstDepBuff, #被动触发持续减益类buff 22
|
| | | ChConfig.Def_SkillType_PassiveLstPlsBuffAtk,
|
| | | ]
|
| | |
|
| | | ## 被动触发的技能效果或者释放技能
|
| | |
| | | ChConfig.Def_SkillType_PassiveActionBuff, #被动触发的控制类buff 18
|
| | | ChConfig.Def_SkillType_PassiveLstPlsBuff, #被动触发持续增益类buff 21
|
| | | ChConfig.Def_SkillType_PassiveLstDepBuff, #被动触发持续减益类buff 22
|
| | | ChConfig.Def_SkillType_PassiveLstPlsBuffAtk,
|
| | | ]
|
| | |
|
| | | def isPassiveAttr(curSkill):
|
| | |
| | | # @param cureType 治疗类型(影响公式)自定义:1.伤害 2.最大血量
|
| | | # @return 治疗值
|
| | | # @remarks 获得治疗值
|
| | | def GetCureHP(userObj, tagObj, curSkill, cureType=ChConfig.Def_Cure_Attack):
|
| | | def GetCureHP(userObj, tagObj, curSkill, cureType=ChConfig.Def_Cure_Attack, largeNum=False):
|
| | | curePercent = 1.0 #治疗加成值
|
| | | cureBaseValue = 0 #治疗基础值
|
| | |
|
| | |
| | | elif cureType == ChConfig.Def_Cure_PHY:
|
| | | cureBaseValue = GameObj.GetMaxHP(userObj)
|
| | | elif cureType == ChConfig.Def_Cure_HurtValue:
|
| | | cureBaseValue = userObj.GetDictByKey(ChConfig.Def_PlayerKey_LastHurtValue)
|
| | | cureBaseValue = GameObj.GetLastHurtValue(userObj)
|
| | | elif cureType == ChConfig.Def_Cure_TagMaxHP:
|
| | | cureBaseValue = 0 if not tagObj else GameObj.GetMaxHP(tagObj)
|
| | |
|
| | |
| | | #技能附加
|
| | | skillValue = curSkill.GetEffect(0).GetEffectValue(1)
|
| | |
|
| | | skillPer += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(userObj, None, curSkill, ChConfig.TriggerType_AddHP)/float(ChConfig.Def_MaxRateValue)
|
| | | #公式计算治疗值
|
| | | cureHP = int((cureBaseValue * skillPer + skillValue + addExValue) * curePercent)
|
| | | if not largeNum:
|
| | | cureHP = min(cureHP, ChConfig.Def_UpperLimit_DWord)
|
| | |
|
| | | #GameWorld.DebugLog("获取治疗值(%s):cureType=%s,cureBaseValue=%s,skillPer=%s,skillValue=%s"
|
| | | # % (cureHP, cureType, cureBaseValue, skillPer, skillValue))
|
| | |
| | | #
|
| | | # return
|
| | | #===========================================================================
|
| | | |
| | | def GetSkillAddPerByID(curPlayer, skillTypeID):
|
| | | ## 获取技能伤害百分比提升值
|
| | | # @param skillTypeID: 技能TypeID
|
| | | SkillAddPerAttrIDDict = IpyGameDataPY.GetConfigEx("SkillAddPerAttrIDDict")
|
| | | if not SkillAddPerAttrIDDict:
|
| | | SkillAddPerAttrIDDict = {}
|
| | | skillPlusAttrIDDict = IpyGameDataPY.GetFuncEvalCfg("SkillPlusAttrID", 2, {})
|
| | | for attrIDStr, skillTypeIDList in skillPlusAttrIDDict.items():
|
| | | attrID = int(attrIDStr)
|
| | | if attrID not in ShareDefine.SkillAddPerAttrIDList:
|
| | | continue
|
| | | for cfgSkillTypeID in skillTypeIDList:
|
| | | SkillAddPerAttrIDDict[cfgSkillTypeID] = attrID
|
| | | IpyGameDataPY.SetConfigEx("SkillAddPerAttrIDDict", SkillAddPerAttrIDDict)
|
| | |
|
| | | |
| | | if skillTypeID not in SkillAddPerAttrIDDict:
|
| | | return 0
|
| | | curAttrID = SkillAddPerAttrIDDict[skillTypeID]
|
| | | attrInfo = ChConfig.ItemEffect_AttrDict.get(curAttrID, [])
|
| | | if attrInfo == []:
|
| | | return 0
|
| | | effIndex = attrInfo[0][0]
|
| | | return EffGetSet.GetValueByEffIndex(curPlayer, effIndex)
|
| | |
|
| | | def GetSkillReducePerByID(curPlayer, skillTypeID):
|
| | | ## 获取技能伤害百分比减伤值
|
| | | # @param skillTypeID: 技能TypeID
|
| | | SkillReducePerAttrIDDict = IpyGameDataPY.GetConfigEx("SkillReducePerAttrIDDict")
|
| | | if not SkillReducePerAttrIDDict:
|
| | | SkillReducePerAttrIDDict = {}
|
| | | skillPlusAttrIDDict = IpyGameDataPY.GetFuncEvalCfg("SkillPlusAttrID", 2, {})
|
| | | for attrIDStr, skillTypeIDList in skillPlusAttrIDDict.items():
|
| | | attrID = int(attrIDStr)
|
| | | if attrID not in ShareDefine.SkillReducePerAttrIDList:
|
| | | continue
|
| | | for cfgSkillTypeID in skillTypeIDList:
|
| | | SkillReducePerAttrIDDict[cfgSkillTypeID] = attrID
|
| | | IpyGameDataPY.SetConfigEx("SkillReducePerAttrIDDict", SkillReducePerAttrIDDict)
|
| | | |
| | | if skillTypeID not in SkillReducePerAttrIDDict:
|
| | | return 0
|
| | | curAttrID = SkillReducePerAttrIDDict[skillTypeID]
|
| | | attrInfo = ChConfig.ItemEffect_AttrDict.get(curAttrID, [])
|
| | | if attrInfo == []:
|
| | | return 0
|
| | | effIndex = attrInfo[0][0]
|
| | | return EffGetSet.GetValueByEffIndex(curPlayer, effIndex)
|
| | |
|