From 491a52c412d57216da83f9aec2a5e1c21ed07006 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 18 十二月 2025 21:17:15 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(诸葛亮潜能;增加触发类型51;效果5012支持配置同国概率及消耗buff状态;)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5012.py | 19 ++++++++++++++++++-
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py | 30 ++++++++++++++++++------------
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py | 8 +++++---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py | 3 ++-
4 files changed, 43 insertions(+), 17 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py
index 0fc0d02..298d6dd 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py
@@ -32,6 +32,7 @@
def __init__(self, batObj):
self._batObj = batObj
self._objID = batObj.GetID() if batObj else 0
+ self._skillIDList = [] # 已有技能ID列表,获取被动中快速判断已学技能用
# 技能
self._AffectSkillDict = {} # 被动技能 {(触发方式, 有效来源):{技能ID:[effID, ...], ...}, ...}
@@ -56,9 +57,9 @@
'''
effList = []
- # 额外子技能的一般是未学习的技能,直接加载自身的被动效果
+ # 触发自己未学习的技能,直接加载自身的被动效果,如额外子技能等
if connSkill and not isinstance(connSkill, IpyGameDataPY.IPY_Skill) and self._objID == connSkill.GetObjID() \
- and connSkill.GetBatType() == ChConfig.TurnBattleType_Enhance:
+ and connSkill.GetSkillID() not in self._skillIDList:
skillID = connSkill.GetSkillID()
if skillID not in self._affectSkillEnhanceDict:
effDict = {}
@@ -81,15 +82,17 @@
key = (tWay, tSrc)
if key not in effDict:
- effDict[key] = {}
- effList = effDict[key]
- if effectID not in effList:
- effList.append(effList)
+ effDict[key] = []
+ effIDList = effDict[key]
+ if effectID not in effIDList:
+ effIDList.append(effectID)
self._affectSkillEnhanceDict[skillID] = effDict
+ GameWorld.DebugLogEx("加载未学技能被动: objID=%s,skillID=%s,%s", self._objID, skillID, effDict)
+ key = (triggerWay, ChConfig.TriggerSrc_SkillSelf)
effDict = self._affectSkillEnhanceDict[skillID]
- if triggerWay in effDict:
- effList.append(["skill", skillID, 0, effDict[triggerWay]])
+ if key in effDict:
+ effList.append(["skill", skillID, 0, effDict[key]])
if triggerWay not in self._skillTriggerWayList and triggerWay not in self._buffTriggerWayList:
return effList
@@ -143,6 +146,10 @@
curSkill = skillManager.GetSkillByIndex(index)
if not curSkill:
continue
+ skillID = curSkill.GetSkillID()
+ # 附加添加已学技能,用于判断是否自身技能
+ if skillID not in self._skillIDList:
+ self._skillIDList.append(skillID)
for index in xrange(curSkill.GetEffectCount()):
curEffect = curSkill.GetEffect(index)
effectID = curEffect.GetEffectID()
@@ -877,10 +884,10 @@
class BatObj():
## 战斗实体对象数据,目前与某个NPCObj绑定
- def __init__(self):
+ def __init__(self, objID):
self.tfGUID = "" # 所属的某场回合战斗的guid
self.ownerID = 0 # 所属玩家ID,可能为0,0代表非玩家的战斗实体
- self.objID = 0
+ self.objID = objID
self.objName = ""
self.npcID = 0
self.heroID = 0
@@ -1236,8 +1243,7 @@
newObjID = self.__getNewObjID()
if not newObjID:
return newBatObj
- newBatObj = BatObj()
- newBatObj.objID = newObjID
+ newBatObj = BatObj(newObjID)
self.batObjDict[newObjID] = newBatObj
GameWorld.DebugLogEx("添加战斗单位: objID=%s", newObjID)
if False:
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 118e099..9ad4893 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -4015,7 +4015,8 @@
TriggerWay_FriendCombo, # 友军连击时(包含自己) 48
TriggerWay_FriendPursue, # 友军追击时(包含自己) 49
TriggerWay_FriendAttackOverDirectOne, # 友方使用技能后(多目标仅触发一次,包含自己) 50
-) = range(1, 1 + 50)
+TriggerWay_FriendAttackOverDirectOneNoSelf, # 友方使用技能后(多目标仅触发一次,不含自己) 51
+) = range(1, 1 + 51)
# 不加载的被动触发方式,一般用于本技能固定触发逻辑用的
TriggerWayNoLoadList = [TriggerWay_CurSkillEff, TriggerWay_CurSkillEffLst]
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5012.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5012.py
index ebb2e75..92611de 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5012.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5012.py
@@ -19,12 +19,29 @@
import IpyGameDataPY
import GameWorld
import ChConfig
+import TurnBuff
def DoSkillEffectLogic(turnFight, batObj, tagObj, effSkill, curEffect, connSkill, connBuff, **kwargs):
rate = curEffect.GetEffectValue(0)
+ bySameCountryFriendRate = curEffect.GetEffectValue(2) # 触发来源友方是同国时的概率
+ if bySameCountryFriendRate:
+ if "byFriendObj" in kwargs:
+ byFriendObj = kwargs["byFriendObj"]
+ if byFriendObj and byFriendObj.GetCountry() == batObj.GetCountry():
+ rate = bySameCountryFriendRate
if not GameWorld.CanHappen(rate):
- #GameWorld.DebugLog("概率进行追击不触发!")
+ #GameWorld.DebugLogEx("5012概率进行追击不触发! %s", rate)
return
+
+ costBuffState = curEffect.GetEffectValue(3) # 可设置需消耗某状态buff(默认1层)
+ if costBuffState:
+ buffMgr = batObj.GetBuffManager()
+ buff = buffMgr.FindBuffByState(costBuffState)
+ if not buff:
+ #GameWorld.DebugLogEx("5012不存在buff状态,无法触发! costBuffState=%s", costBuffState)
+ return
+ TurnBuff.DoBuffLayerChange(turnFight, batObj, buff, buff.GetLayer() - 1, connSkill)
+
skillID = curEffect.GetEffectValue(1) # 技能ID,为0时释放本技能
if not skillID:
passiveSkill = effSkill
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py
index b67c3c9..552a4f0 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py
@@ -1296,7 +1296,7 @@
@param timeBuff: 持续结算的buff,如持续攻击、持续治疗等
'''
- #curID = curObj.GetID()
+ curID = curObj.GetID()
isUseSkill = False if timeBuff else True # buff的视为持续性的,否则为直接使用技能的攻击结果
isTurnNormalSkill = SkillCommon.isTurnNormalSkill(useSkill)
isAngerSkill = SkillCommon.isAngerSkill(useSkill)
@@ -1552,7 +1552,9 @@
if isAttackDirect:
if not triggerOne:
TurnPassive.OnTriggerPassiveEffect(turnFight, lineupObj, ChConfig.TriggerWay_FriendAttackOverDirectOne, tagObj, connSkill=useSkill, byFriendObj=curObj)
-
+ if curID != lineupObj.GetID():
+ TurnPassive.OnTriggerPassiveEffect(turnFight, lineupObj, ChConfig.TriggerWay_FriendAttackOverDirectOneNoSelf, tagObj, connSkill=useSkill, byFriendObj=curObj)
+
# 连击
if batType == ChConfig.TurnBattleType_Combo:
TurnPassive.OnTriggerPassiveEffect(turnFight, lineupObj, ChConfig.TriggerWay_FriendCombo, tagObj, connSkill=useSkill, byFriendObj=curObj)
@@ -1872,7 +1874,7 @@
elif tagAim == ChConfig.SkillTagAim_MainSkillFriend:
if "byFriendObj" not in kwargs:
return
- byFriendObj = kwargs["byFriendObj"]
+ byFriendObj = kwargs.pop("byFriendObj") # 触发即移除,防止一直传递引发其他问题,如触发的技能再触发其他技能会被视为也是有byFriendObj
passiveTagObjList = [byFriendObj]
GameWorld.DebugLogEx("被动触发技能,针对来源友军! effSkillID=%s,effectID=%s,passiveSkillID=%s,bySkillID=%s,byFriendID=%s",
effSkillID, effectID, passiveSkillID, bySkillID, byFriendObj.GetID())
--
Gitblit v1.8.0