From 294292aee595f31c6ee57a2ecb8538d1486057b4 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期二, 26 三月 2019 17:26:14 +0800 Subject: [PATCH] 6373 【后端】【2.0】删除无用功能代码、封包、配置(页游天梯) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py | 139 +++++++++++++++++++++++++--------------------- 1 files changed, 76 insertions(+), 63 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py index ed418c1..854897d 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py @@ -99,6 +99,13 @@ coolDownTime = curSkill.GetCoolDownTime() remainTime = coolDownTime if isPassiveSkill(curSkill): + if curSkill.GetFuncType() == ChConfig.Def_SkillFuncType_GiftSkill: + # 天赋有减CD效果 + reduceSkillCDPer += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, None, curSkill, ChConfig.TriggerType_GiftReduceCD) + # 减CD比率 + if reduceSkillCDPer > 0: + remainTime = int(remainTime * max(0, ShareDefine.Def_MaxRateValue - reduceSkillCDPer) / ShareDefine.Def_MaxRateValue) + # 被动技能的处理和主动技能区分 curSkill.SetRemainTime(remainTime) return @@ -213,11 +220,12 @@ def PlayerLoginMergeServerSkillLogic(curPlayer, tick): playerID = curPlayer.GetPlayerID() - if not GameWorld.IsMergeServer(): + if not GameWorld.IsCrossServer(): GameWorld.DebugLog("非跨服服务器上线不清除buff...", playerID) return - ClearBuffSkillTypeIDList = ReadChConfig.GetEvalChConfig("ClearBuffSkillTypeID") + #ClearBuffSkillTypeIDList = ReadChConfig.GetEvalChConfig("ClearBuffSkillTypeID") + ClearBuffSkillTypeIDList = [] # 跨服服务器上线清除增益/减益buff GameWorld.Log("跨服服务器上线清除buff...", playerID) clearBuffList = [] # 先汇总再清除,不然索引会变更 @@ -272,6 +280,15 @@ curSkill.SetRemainTime(0) GameWorld.DebugLog(" SetRemainTime 0 skillName=%s,skillTypeID=%s" % (curSkill.GetSkillName(), curSkill.GetSkillTypeID()), playerID) + return + +def ResetAllSkillCD(curPlayer): + skillManager = curPlayer.GetSkillManager() + for i in xrange(skillManager.GetSkillCount()): + skill = skillManager.GetSkillByIndex(i) + if skill.GetRemainTime() != 0: + skill.SetRemainTime(0) + skill.Sync_Skill() return ## 刷新玩家所有技能的剩余时间(上线) @@ -465,6 +482,8 @@ return int(value) + + ## 玩家召唤NPC(当前玩家,召唤技能,召唤兽ID,召唤兽属性列表, 召唤兽离自己的距离, 当前时间) # @param curPlayer 当前玩家 # @param curSkill 召唤技能 @@ -507,6 +526,8 @@ summonPos = GameMap.GetEmptyPlaceInArea(curPlayer.GetPosX(), curPlayer.GetPosY(), summonDist) summonNPC.Reborn(summonPos.GetPosX(), summonPos.GetPosY()) summonNPC.SetBornTime(tick) + # 继承技能等级 + SetSummonNPCSkillLV(summonNPC, curSkill) if curSkill: summonNPC.SetLastTime(curSkill.GetLastTime()) #----设置为无敌,在AI中解除无敌 @@ -514,6 +535,38 @@ summonNPC.SetCanAttack(False) return + +# 召唤兽技能继承,玩家释放技能的等级 +def SetSummonNPCSkillLV(summonNPC, curSkill): + if curSkill.GetEffect(0).GetEffectValue(1) == 0: + return + skillLV = curSkill.GetSkillLV() - 1 + if skillLV == 0: + return + + skillManager = summonNPC.GetSkillManager() + learnSkillIDList =[] + for index in range(0, skillManager.GetSkillCount()): + useSkill = skillManager.GetSkillByIndex(index) + #已经到尾部了 + if not useSkill or useSkill.GetSkillTypeID() == 0: + break + + useSkillTypeID = useSkill.GetSkillTypeID() + # 找到可学习的技能 + learnSkillID = useSkillTypeID + skillLV + findSkill = GameWorld.GetGameData().GetSkillBySkillID(learnSkillID) + if not findSkill: + continue + if findSkill.GetSkillTypeID() != useSkillTypeID: + # 不是同一个技能 + continue + learnSkillIDList.append(learnSkillID) + + for skillID in learnSkillIDList: + skillManager.LearnSkillByID(skillID, False) + return + ## 设置召唤兽属性 # @param curPlayer 当前玩家 @@ -624,10 +677,10 @@ # @param curNPC NPC实例 # @param summonID 召唤兽的NPCID # @return 召唤兽数量 -def GetSummonCountByNPCID(curNPC, summonID): +def GetSummonCountByNPCID(gameObj, summonID): count = 0 - for i in range(0, curNPC.GetSummonCount()): - summonNPC = curNPC.GetSummonNPCAt(i) + for i in range(0, gameObj.GetSummonCount()): + summonNPC = gameObj.GetSummonNPCAt(i) if not summonNPC: continue @@ -1127,6 +1180,10 @@ if curHP <= 0: return + if PassiveBuffEffMng.GetValueByPassiveBuffTriggerType(curObj, None, None, ChConfig.TriggerType_ForbidenCure): + # 禁止治疗 + return + # 治疗加成 curePer = PlayerControl.GetCurePer(curObj) if curObjType == IPY_GameWorld.gotPlayer else ChConfig.Def_MaxRateValue addValue = int(addValue*curePer*1.0/ChConfig.Def_MaxRateValue) @@ -1195,6 +1252,11 @@ GameWorld.Log('###技能伤害血量异常,数值错误 = %s,技能类型ID = %s' % (lostValue, skillTypeID)) return + if not curObj.GetCanAttack(): + # 无敌不掉血 + ## 后续有其他情况也应考虑进来,如镖车是否某状态不掉血 + return + #lostValue = GetGoblinLostHP(curObj, lostValue) curObjType = curObj.GetGameObjType() curSkill = GameWorld.GetGameData().FindSkillByType(skillTypeID, 1) @@ -1206,10 +1268,13 @@ notifyLostValue = lostValue curObjHP_BeforeAttack = GameObj.GetHP(curObj) + if curObjHP_BeforeAttack == 0: + # 没有血量不能再触发 + return if reduceHP : + lostValue = AttackCommon.CalcAtkProDef(buffOwner, curObj, lostValue, curSkill, tick) # 血盾 - lostValue = AttackCommon.CalcBloodShield(buffOwner, curObj, lostValue) #剩余血量 @@ -1230,6 +1295,8 @@ # 已广播的不重复 GameObj.SetHP(curObj, remainHP, not view) + AttackCommon.WriteHurtLog(buffOwner, curObj, curSkill, lostValue, hurtType, "持续掉血") + if view: #广播伤血类型 AttackCommon.ChangeHPView(curObj, buffOwner, skillTypeID, notifyLostValue, hurtType) @@ -1237,13 +1304,14 @@ # 濒死状态触发技能 if GameObj.GetHP(curObj) == 0: PassiveBuffEffMng.OnPassiveSkillTrigger(curObj, None, curSkill, ChConfig.TriggerType_WillDead, tick) - + PassiveBuffEffMng.OnPassiveBuffTrigger(curObj, None, curSkill, ChConfig.TriggerType_WillDead, tick) #无法找到Buff拥有者 if not buffOwner: - AttackCommon.DoLogic_ObjDead(curObj) + AttackCommon.DoLogic_ObjDead(None, curObj, curSkill, tick) return + #NPC需要手动添加伤血和仇恨, 因为无调用DoAttack if curObjType == IPY_GameWorld.gotNPC: @@ -2077,61 +2145,6 @@ #GameWorld.DebugLog("GetRestoreMP restoreType=%s,restoreMP=%s" % (restoreType, restoreMP)) return restoreMP - -## 获取技能对最终伤害影响的效果比例 -# @param skill 使用的技能 -# @return -#=============================================================================== -# def GetSkillFinalHurtPer(atkObj, defObj, skill, tick): -# -# atkObjType = atkObj.GetGameObjType() -# defObjType = defObj.GetGameObjType() -# -# finalPer = ChConfig.Def_MaxRateValue # 默认10000 -# -# if atkObjType != IPY_GameWorld.gotPlayer: -# return finalPer -# -# # 技能对玩家的影响 -# if defObjType == IPY_GameWorld.gotPlayer: -# -# # 减少值 -# reduceHurtPerEff = GetSkillEffectByEffectID(skill, ChConfig.Def_Skill_Effect_ReduceFinalHurtPer) -# curReducePer = 0 if not reduceHurtPerEff else reduceHurtPerEff.GetEffectValue(0) -# finalPer -= curReducePer -# -# # 增加值 -# addHurtPerEff = GetSkillEffectByEffectID(skill, ChConfig.Def_Skill_Effect_AddFinalHurtPer) -# curAddPer = 0 if not addHurtPerEff else addHurtPerEff.GetEffectValue(0) -# finalPer += curAddPer -# -# #根据防守方职业 计算攻击方伤害加成 -# if defObj.GetJob() in [ShareDefine.PlayerJob_Warrior, ShareDefine.PlayerJob_Knight]: -# finalPer += PlayerControl.GetJobAHurtAddPer(atkObj) -# elif defObj.GetJob() in [ShareDefine.PlayerJob_Wizard, ShareDefine.PlayerJob_ForceUser]: -# finalPer += PlayerControl.GetJobBHurtAddPer(atkObj) -# elif defObj.GetJob() in [ShareDefine.PlayerJob_Assassin, ShareDefine.PlayerJob_BowMaster]: -# finalPer += PlayerControl.GetJobCHurtAddPer(atkObj) -# -# # 对NPC的影响 -# elif defObjType == IPY_GameWorld.gotNPC: -# finalPer += PlayerControl.GetNPCHurtAddPer(atkObj) -# if defObj.GetNPCID() in ReadChConfig.GetEvalChConfig("PlayerSpecialAttrBossID"): -# finalPer += PlayerControl.GetBossIDHurtAddPer(atkObj) -# -# # 技能连击加成 -# curSkillTypeID = skill.GetSkillTypeID() -# comboSkillTypeID = atkObj.GetDictByKey(ChConfig.Def_PlayerKey_ComboSkillTypeID) -# # 如果是触发连击的技能, 则附加连击伤害加成 -# if curSkillTypeID == comboSkillTypeID: -# comboAddPer = atkObj.GetDictByKey(ChConfig.Def_PlayerKey_ComboAddHurtPer) -# finalPer += comboAddPer -# GameWorld.DebugLog("连击最终伤害加成%s, skillID=%s" % (comboAddPer, curSkillTypeID)) -# -# finalPer = max(0, finalPer) -# -# return finalPer -#=============================================================================== ## 更新技能连击数 # @param attacker -- Gitblit v1.8.0