From 2560077959fd4d841ce35cb65e2367e568b3b08b Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期五, 19 一月 2024 17:26:02 +0800 Subject: [PATCH] 10019 【砍树】回合战斗(调整闪避公式计算方式;灵宠及反击必命中;普攻暴击后可触发被动;调整击晕优先级提前到其他被动触发前;NPC新增触发被动方式;) 1. 调整闪避公式计算方式,改为是否闪避,简化公式; 2. 增加灵宠及反击必命中;部分触发类伤害技能可通过技能ExAttr2配置必命中; 3. 普攻暴击后可触发被动; 4. 调整击晕优先级提前到反击和其他被动触发前;不然可能导致被攻击方先触发了反击或某些被动后再被击晕;最大击晕概率配置由6000调整为9000; 5. NPC支持被击、闪避、击晕、暴击、连击、反击前、反击后可触发被动; 6. 回血量增加支持按已损失血量百分比恢复; --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py | 65 +++++++++++++++++++++++--------- 1 files changed, 47 insertions(+), 18 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py index f3a4525..9903f9f 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py @@ -1264,7 +1264,7 @@ __DoPlayerBeAttacked(attacker, defender, curSkill, tick) elif defenderType == IPY_GameWorld.gotNPC: - __DoNPCBeAttacked(defender, curSkill, tick) + __DoNPCBeAttacked(attacker, defender, curSkill, tick) else: GameWorld.Log("被攻击错误 : %d " % defender.GetGameObjType()) @@ -1591,23 +1591,15 @@ # 根据伤血类型触发技能,群攻只触发一次,放在伤血列表被清之前 -def OnHurtTypeTriggerSkill(attacker, target, curSkill, tick): +def OnHurtTypeTriggerSkill(attacker, target, curSkill, skillHurtLists, tick): usePassiveSkillResult = True # 第一次判断不能调用,即代表都不可用无需循环 usePassiveSkillResultOnSuperHit = True # 暴击对象1V1触发,第一次判断不能调用,即代表都不可用无需循环 - - skillHurtLists = [] # 内部触发清除g_skillHurtList - for i in xrange(g_skillHurtList.GetHurtCount()): - hurtObj = g_skillHurtList.GetHurtAt(i) - if not hurtObj: - continue - - skillHurtLists.append([hurtObj.GetObjID(), hurtObj.GetObjType(), hurtObj.GetAttackType()]) #命中个数记录特殊处理 PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(attacker, target, curSkill, ChConfig.TriggerType_HitValue) # #持续攻击类BUFF 类剑刃风暴是先给自身一个持续性buff,这一次不算伤害不可触发 - if curSkill and ChConfig.Def_SkillType_LstPlsBuffAtk != curSkill.GetSkillType(): + if not curSkill or (curSkill and ChConfig.Def_SkillType_LstPlsBuffAtk != curSkill.GetSkillType()): #只对第一目标造成某伤害类型时触发技能, 需先存储 skillHurtLists OnHurtTypeTriggerSkillFirstObj(attacker, curSkill, tick) @@ -1664,8 +1656,41 @@ # 技能使用结束,在处理技能逻辑和通知封包之后调用 def UseSkillOver(attacker, defender, curSkill, tick): + defHurtType = 0 + atkID = attacker.GetID() + defID = defender.GetID() if defender else 0 + skillHurtLists = [] # 内部触发清除g_skillHurtList + for i in xrange(g_skillHurtList.GetHurtCount()): + hurtObj = g_skillHurtList.GetHurtAt(i) + if not hurtObj: + continue + skillHurtLists.append([hurtObj.GetObjID(), hurtObj.GetObjType(), hurtObj.GetAttackType()]) + if defID == hurtObj.GetObjID(): + defHurtType = hurtObj.GetAttackType() + + isAtkSkill = (not curSkill or curSkill.GetSkillType() in ChConfig.Def_CanAttackSkill_List or curSkill.GetFuncType() == ChConfig.Def_SkillFuncType_PassiveSkillWithSP) + # 优先处理击晕 + if isAtkSkill: + if defHurtType != ChConfig.Def_HurtType_Miss: # 非闪避才可触发 + AttackFaintRate(attacker, defender, curSkill, tick) + + # 回合制下 + turnBattleType = attacker.GetDictByKey(ChConfig.Def_Obj_Dict_TurnBattleType) + if turnBattleType: + attacker.SetDict(ChConfig.Def_Obj_Dict_TurnBattleType, 0) # 直接重置,不然后续触发逻辑可能被视为连击 + if turnBattleType == ChConfig.TurnBattleType_Combo: + comboNum = attacker.GetDictByKey(ChConfig.Def_Obj_Dict_TurnComboNum) + 1 + attacker.SetDict(ChConfig.Def_Obj_Dict_TurnComboNum, comboNum) + GameWorld.DebugLog(" 连击: atkID=%s,comboNum=%s" % (atkID, comboNum)) + PassiveBuffEffMng.OnPassiveSkillTrigger(attacker, defender, curSkill, ChConfig.TriggerType_Combo, tick) + elif turnBattleType == ChConfig.TurnBattleType_AtkBack: + atkBackNum = attacker.GetDictByKey(ChConfig.Def_Obj_Dict_TurnAtkBackNum) + 1 + attacker.SetDict(ChConfig.Def_Obj_Dict_TurnAtkBackNum, atkBackNum) + GameWorld.DebugLog(" 反击: atkID=%s,atkBackNum=%s" % (atkID, atkBackNum)) + PassiveBuffEffMng.OnPassiveSkillTrigger(attacker, defender, curSkill, ChConfig.TriggerType_AtkBackAft, tick) + # 根据伤血类型触发技能,群攻只触发一次,放在伤血列表被清之前 - OnHurtTypeTriggerSkill(attacker, defender, curSkill, tick) + OnHurtTypeTriggerSkill(attacker, defender, curSkill, skillHurtLists, tick) # 普通或者可以主动释放的攻击性技能 if not curSkill or (curSkill.GetSkillType() == ChConfig.Def_SkillType_Atk and\ @@ -1676,14 +1701,13 @@ PassiveBuffEffMng.OnPassiveBuffTrigger(attacker, defender, curSkill, ChConfig.TriggerType_Buff_AttackSubLayer, tick) # 普攻和对敌技能, 此处暂且特殊处理Def_SkillFuncType_PassiveSkillWithSP,待优化 - if not curSkill or curSkill.GetSkillType() in ChConfig.Def_CanAttackSkill_List or curSkill.GetFuncType() == ChConfig.Def_SkillFuncType_PassiveSkillWithSP: + if isAtkSkill: PassiveBuffEffMng.OnPassiveSkillTrigger(attacker, defender, curSkill, ChConfig.TriggerType_AttackOver, tick) PassiveBuffEffMng.OnPassiveBuffTrigger(attacker, defender, curSkill, ChConfig.TriggerType_AttackOver, tick) # TriggerType_AttackOver 和 TriggerType_AttackOverPassive 根据触发的被动buff效果顺序而定 PassiveBuffEffMng.OnPassiveSkillTrigger(attacker, defender, curSkill, ChConfig.TriggerType_AttackOverPassive, tick) - AttackFaintRate(attacker, defender, curSkill, tick) else: PassiveBuffEffMng.OnPassiveSkillTrigger(attacker, defender, curSkill, ChConfig.TriggerType_SkillOverNoAttack, tick) @@ -1740,11 +1764,11 @@ lastTick = attacker.GetDictByKey(ChConfig.Def_PlayerKey_AttrFaintCD) remainTick = faintCD - (tick - lastTick) if remainTick > 0: - GameWorld.DebugLog("击晕CD中! rate=%s,剩余tick=%s" % (rate, remainTick), attacker.GetID()) + GameWorld.DebugLog(" 击晕CD中! rate=%s,剩余tick=%s,atkID=%s" % (rate, remainTick, attacker.GetID())) return attacker.SetDict(ChConfig.Def_PlayerKey_AttrFaintCD, tick) - GameWorld.DebugLog("可触发击晕! rate=%s,tagID=%s" % (rate, defender.GetID()), attacker.GetID()) - SkillCommon.AddBuffBySkillType(defender, ChConfig.Def_SkillID_AtkerFaint, tick) + GameWorld.DebugLog(" 可触发击晕! rate=%s,atkID=%s,defID=%s" % (rate, attacker.GetID(), defender.GetID())) + SkillCommon.AddBuffBySkillType(defender, ChConfig.Def_SkillID_AtkerFaint, tick, buffOwner=attacker) return @@ -1985,7 +2009,7 @@ # @param tick 当前时间 # @return None # @remarks 函数详细说明. -def __DoNPCBeAttacked(curNPC, curSkill, tick): +def __DoNPCBeAttacked(attacker, curNPC, curSkill, tick): #NPC已经死亡 if GameObj.GetHP(curNPC) <= 0: return @@ -2004,6 +2028,11 @@ # 被击添加不让主动移动,应用AI1 if curNPC.GetIsBoss() == 0: curNPC.SetDict("NPCBeAttackedAI1", tick) + + # 回合制下NPC被击可触发 + if (not curSkill or curSkill.GetSkillType() in ChConfig.Def_CanAttackSkill_List) and curNPC.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightTimeline): + PassiveBuffEffMng.OnPassiveSkillTrigger(curNPC, attacker, None, ChConfig.TriggerType_BeAttackOver, tick) + return # 客户端搜索对象的链式攻击 -- Gitblit v1.8.0