From b100e60651bd69472519d964f2e225148cfe7774 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 20 一月 2026 18:27:05 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(命格青龙、白虎调整为光环技能;优化光环技能支持层级;增加出发方式60-冰冻目标时;优化触发方式受控时、敌方受控时触发时机,解决受控触发被动导致的技能标签嵌套顺序问题;)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5022.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py | 111 +++++++++++++--------
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5014.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py | 68 +++++++++----
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5015.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnBuff.py | 41 +++-----
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnline.py | 4
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py | 9 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevel.py | 4
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5004.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/TurnFight.py | 26 +++-
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5009.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py | 9 +
13 files changed, 174 insertions(+), 108 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 3ecda4f..c5b6b38 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py
@@ -1037,6 +1037,15 @@
def GetPosNum(self): return self.posNum
def GetFaction(self): return self.faction
def SetFaction(self, faction): self.faction = faction
+ def GetBatObjType(self):
+ ## 战斗对象实例类型
+ if 1 <= self.posNum <= ShareDefine.LineupObjMax:
+ return ChConfig.BatObjType_BatHero
+ if self.posNum == ChConfig.TFPosNum_Mingge:
+ return ChConfig.BatObjType_Mingge
+ if ChConfig.TFPosNum_Lingshou <= self.posNum:
+ return ChConfig.BatObjType_Lingshou
+ return 0
def GetFightPower(self): return self.fightPower
def SetFightPower(self, fightPower): self.fightPower = fightPower
def GetLV(self): return self.lv
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
index 1fe65d0..2dd7d0e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
@@ -79,10 +79,11 @@
self.lineupInfo = {} # 传入初始化的阵容信息
self.shapeType = 0 # 阵型
self.fightPower = 0 # 阵容总战力
- self.minggeObj = None # 命格战斗对象
- self.posObjIDDict = {} # 站位对应战斗实体 {站位编号:batObjID, ...}, 站位编号小于0为非主战单位,如主公、红颜等
- self.heroObjIDDict = {} # 武将ID对应ObjID {heroID:batObjID, ...}
- self.lingshouObjIDDict = {} # 灵兽战斗单位 {位置编号:batObjID, ...}
+
+ self._posObjIDDict = {} # 站位对应战斗实体 {站位编号:batObjID, ...},如主公、命格、灵兽等
+ self._heroObjIDDict = {} # 武将ID对应ObjID {heroID:batObjID, ...}
+ self._batHeroObjIDList = [] # 主战武将对象ID列表
+ self._minggeObjID = 0 # 命格对象ID
self.actionNum = ActionNumStart # 行动位置,从1开始
self.totalHurt = 0 # 阵容总输出
@@ -93,7 +94,7 @@
def getReqPlayerID(self): return self.turnFight.getReqPlayerID() # 发起的玩家ID
- def isEmpty(self): return not self.posObjIDDict
+ def isEmpty(self): return not self._batHeroObjIDList
def setLineupInfo(self, lineupInfo):
## 设置阵容
@@ -111,25 +112,55 @@
def clearLineup(self):
## 清除阵容
batObjMgr = BattleObj.GetBatObjMgr()
- for objID in self.posObjIDDict.values():
+ for objID in self._posObjIDDict.values():
batObjMgr.delBatObj(objID)
- for objID in self.lingshouObjIDDict.values():
- batObjMgr.delBatObj(objID)
- if self.minggeObj:
- batObjMgr.delBatObj(self.minggeObj.GetID())
self.lineupInfo = {}
- self.posObjIDDict = {}
- self.heroObjIDDict = {}
- self.lingshouObjIDDict = {}
+ self._posObjIDDict = {}
+ self._heroObjIDDict = {}
+ self._batHeroObjIDList = []
+ self._minggeObjID = 0
self.fightPower = 0
self.totalHurt = 0
return
+
+ def addObj(self, batObj):
+ objID = batObj.GetID()
+ posNum = batObj.GetPosNum()
+ heroID = batObj.GetHeroID()
+ batObjType = batObj.GetBatObjType()
+ self._posObjIDDict[posNum] = objID
+ if heroID:
+ self._heroObjIDDict[heroID] = objID
+
+ if batObjType == ChConfig.BatObjType_BatHero:
+ if objID not in self._batHeroObjIDList:
+ self._batHeroObjIDList.append(objID)
+ elif batObjType == ChConfig.BatObjType_Mingge:
+ self._minggeObjID = objID
+ elif batObjType == ChConfig.BatObjType_Lingshou:
+ pass
+ return
+
+ def getPosObjIDDict(self): return self._posObjIDDict
+ def getAllPosObjIDList(self): return self._posObjIDDict.values()
+
+ def getBatHeroObjIDList(self): return self._batHeroObjIDList ## 获取主战武将对象ID列表
+
+ def getHeroObj(self, heroID):
+ if heroID not in self._heroObjIDDict:
+ return
+ return BattleObj.GetBatObjMgr().getBatObj(self._heroObjIDDict[heroID])
+
+ def getMinggeObj(self):
+ if not self._minggeObjID:
+ return
+ return BattleObj.GetBatObjMgr().getBatObj(self._minggeObjID)
def getDeadObjCnt(self):
## 获取本阵容目前死亡队员数
deadCnt = 0
batObjMgr = BattleObj.GetBatObjMgr()
- for objID in self.posObjIDDict.values():
+ for objID in self._batHeroObjIDList:
batObj = batObjMgr.getBatObj(objID)
if not batObj:
continue
@@ -137,13 +168,6 @@
continue
deadCnt += 1
return deadCnt
-
- def getHeroObj(self, heroID):
- if heroID not in self.heroObjIDDict:
- return
- return BattleObj.GetBatObjMgr().getBatObj(self.heroObjIDDict[heroID])
-
- def getMinggeObj(self): return self.minggeObj
class BatFaction():
## 战斗阵营
@@ -339,10 +363,7 @@
for batLineup in batFaction.lineupDict.values():
if not allKilled:
break
- for posNum, objID in batLineup.posObjIDDict.items():
- if posNum <= 0:
- # 非主战位置不判断
- continue
+ for objID in batLineup.getBatHeroObjIDList():
batObj = batObjMgr.getBatObj(objID)
if not batObj:
continue
@@ -403,9 +424,11 @@
tfLineup.OwnerID = batLineup.ownerID
tfLineup.ShapeType = batLineup.shapeType
tfLineup.ObjList = []
- for posNum, objID in batLineup.posObjIDDict.items():
+ for posNum, objID in batLineup.getPosObjIDDict().items():
batObj = batObjMgr.getBatObj(objID)
if not batObj:
+ continue
+ if posNum == ChConfig.TFPosNum_Mingge: # 理论上要都同步,但是前端需要同步修改,等前端要改时再同步
continue
tfObj = ChPyNetSendPack.tagSCTurnFightObj()
tfObj.ObjID = batObj.GetID()
@@ -965,7 +988,6 @@
if mgSkillIDList:
minggeObj = batObjMgr.addBatObj()
if minggeObj:
- batLineup.minggeObj = minggeObj
minggeObj.SetOwnerID(lineupPlayerID)
minggeObj.SetTFGUID(tfGUID)
minggeObj.SetFaction(faction)
@@ -974,6 +996,7 @@
skillManager.SkillReset()
for skillID in mgSkillIDList:
skillManager.LearnSkillByID(skillID)
+ batLineup.addObj(minggeObj)
GameWorld.DebugLogEx("AddBatObj 命格: faction:%s,num:%s,objID=%s,skillIDList=%s", faction, num, minggeObj.GetID(), skillManager.GetSkillIDList())
ResetObjSkill(minggeObj)
minggeObj.InitBatAttr({ChConfig.AttrID_MaxHP:1})
@@ -1018,7 +1041,7 @@
batObj = batObjMgr.addBatObj()
if not batObj:
break
- objID = batObj.GetID()
+ #objID = batObj.GetID()
if npcID:
batObj.SetNPCID(npcID)
elif lineupPlayerID:
@@ -1042,8 +1065,7 @@
for skillID in skillIDList:
skillManager.LearnSkillByID(skillID)
- batLineup.posObjIDDict[posNum] = objID
- batLineup.heroObjIDDict[heroID] = objID
+ batLineup.addObj(batObj)
GameWorld.DebugLogEx("AddBatObj %s,lv=%s,star=%s,skill=%s", GetObjName(batObj), lv, star, skillManager.GetSkillIDList())
ResetObjSkill(batObj)
@@ -1067,7 +1089,7 @@
GameWorld.DebugLogEx("切换小队重置玩家阵容武将...")
batLineup = batFaction.getBatlineup(1) # 只处理玩家阵容
batObjMgr = BattleObj.GetBatObjMgr()
- for objID in batLineup.posObjIDDict.values():
+ for objID in batLineup.getAllPosObjIDList():
batObj = batObjMgr.getBatObj(objID)
if not batObj:
continue
@@ -1607,7 +1629,6 @@
turnFight.syncState(FightState_Fighting)
TurnFightPerTurnBigStart(turnFight, turnNum)
- # 红颜
# 灵兽
if turnFight.winFaction:
@@ -1621,14 +1642,15 @@
faction, num = turnFight.actionSortList[turnFight.actionIndex]
batFaction = turnFight.getBatFaction(faction)
batLineup = batFaction.getBatlineup(num)
+ posObjIDDict = batLineup.getPosObjIDDict()
for posNum in range(batLineup.actionNum, PosNumMax + 1):
#GameWorld.DebugLogEx("武将位置: faction=%s,posNum=%s", faction, posNum)
- if posNum not in batLineup.posObjIDDict:
+ if posNum not in posObjIDDict:
batLineup.actionNum = posNum + 1
#GameWorld.DebugLogEx("没有武将: faction=%s,posNum=%s", faction, posNum)
continue
- objID = batLineup.posObjIDDict[posNum]
+ objID = posObjIDDict[posNum]
batObj = batObjMgr.getBatObj(objID)
# 玩家自己阵营,预判可否行动
@@ -1695,11 +1717,12 @@
faction, num = turnFight.actionSortList[turnFight.actionIndex]
batFaction = turnFight.getBatFaction(faction)
batLineup = batFaction.getBatlineup(num)
+ posObjIDDict = batLineup.getPosObjIDDict()
for posNum in range(batLineup.actionNum, PosNumMax + 1):
batLineup.actionNum = posNum + 1
- if posNum not in batLineup.posObjIDDict:
+ if posNum not in posObjIDDict:
continue
- objID = batLineup.posObjIDDict[posNum]
+ objID = posObjIDDict[posNum]
batObj = batObjMgr.getBatObj(objID)
TurnFightHeroTurnStart(turnFight, batObj, turnNum)
isAction = OnObjAction(turnFight, batObj)
@@ -1747,7 +1770,7 @@
batFaction = turnFight.getBatFaction(faction)
batLineup = batFaction.getBatlineup(num)
batLineup.actionNum = ActionNumStart
- for objID in batLineup.posObjIDDict.values():
+ for objID in batLineup.getAllPosObjIDList():
batObj = batObjMgr.getBatObj(objID)
turnFight.ResetOneActionUseSkillCnt()
TurnPassive.OnTriggerPassiveEffect(turnFight, batObj, ChConfig.TriggerWay_FightStart)
@@ -1765,7 +1788,7 @@
batFaction = turnFight.getBatFaction(faction)
batLineup = batFaction.getBatlineup(num)
batLineup.actionNum = 1
- for objID in batLineup.posObjIDDict.values():
+ for objID in batLineup.getAllPosObjIDList():
batObj = batObjMgr.getBatObj(objID)
if not batObj:
continue
@@ -1792,7 +1815,7 @@
GameWorld.DebugLogEx("回合结束逻辑: turnNum=%s,faction=%s, num=%s", turnNum, faction, num)
batFaction = turnFight.getBatFaction(faction)
batLineup = batFaction.getBatlineup(num)
- for objID in batLineup.posObjIDDict.values():
+ for objID in batLineup.getAllPosObjIDList():
batObj = batObjMgr.getBatObj(objID)
if not batObj:
continue
@@ -2085,7 +2108,7 @@
batFaction = turnFight.getBatFaction(faction)
for lineupNum in batFaction.lineupDict.keys():
batLineup = batFaction.getBatlineup(lineupNum)
- for lineupObjID in batLineup.posObjIDDict.values():
+ for lineupObjID in batLineup.getBatHeroObjIDList():
lineupObj = batObjMgr.getBatObj(lineupObjID)
if not lineupObj.IsAlive():
continue
@@ -2184,10 +2207,10 @@
batLineup.totalHurt = 0
facDRLineupInfo[str(num)] = batLineup.lineupInfo
GameWorld.DebugLogEx("阵容明细: faction=%s,num=%s", faction, num)
- posObjIDList = [[posNum, objID] for posNum, objID in batLineup.posObjIDDict.items()]
- # 命格不算战斗单位,主体视为触发的武将
- # 灵兽
- for posNum, objID in posObjIDList:
+ for posNum, objID in batLineup.getPosObjIDDict().items():
+ if posNum == ChConfig.TFPosNum_Mingge:
+ #命格不统计
+ continue
batObj = batObjMgr.getBatObj(objID)
if not batObj:
continue
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 7f9b175..ef02fab 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -881,6 +881,7 @@
AfterLogic_DelBuff = "DelBuff"
AfterLogic_AddBuff = "AddBuff"
AfterLogic_SyncBuff = "SyncBuff"
+AfterLogic_TriggerAddBuff = "TriggerAddBuff" # 后置处理添加buff后的被动触发
#伤害飘血类型
(
@@ -1313,6 +1314,11 @@
# 回合战斗站位定义, 1~20 以内为战斗武将固定位置
TFPosNum_Mingge = 99 # 命格固定站位
TFPosNum_Lingshou = 101 # 灵兽起始站位 101~xxx
+
+# 战斗对象类型,根据 PosNum 区分
+BatObjType_BatHero = 1 # 主战斗武将
+BatObjType_Mingge = 2 # 命格
+BatObjType_Lingshou = 3 # 灵兽
# 性别
BatObjSex_Male = 1 # 男
@@ -4042,7 +4048,8 @@
TriggerWay_SuckHPOne, # 吸血时(多目标仅触发一次) 57
TriggerWay_EnemyBeControlledHard, # 敌方受控时(硬控) 58
TriggerWay_PursueAtk, # 追击直接攻击时 59
-) = range(1, 1 + 59)
+TriggerWay_Frozen, # 冰冻目标时 60
+) = range(1, 1 + 60)
# 不加载的被动触发方式,一般用于本技能固定触发逻辑用的
TriggerWayNoLoadList = [TriggerWay_CurSkillEff, TriggerWay_CurSkillEffLst]
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/TurnFight.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/TurnFight.py
index ca0a153..80940c1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/TurnFight.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/TurnFight.py
@@ -106,9 +106,10 @@
continue
batFaction = turnFight.getBatFaction(faction)
batLineup = batFaction.getBatlineup(1)
- posNumList = [pNum] if pNum else batLineup.posObjIDDict.keys()
+ posObjIDDict = batLineup.getPosObjIDDict()
+ posNumList = [pNum] if pNum else posObjIDDict.keys()
for posNum in posNumList:
- objID = batLineup.posObjIDDict.get(posNum)
+ objID = posObjIDDict.get(posNum)
batObj = batObjMgr.getBatObj(objID)
if not batObj:
GameWorld.DebugAnswer(curPlayer, "对象不存在:阵营:%s,位置:%s" % (faction, posNum))
@@ -144,8 +145,9 @@
batObjMgr = BattleObj.GetBatObjMgr()
batFaction = turnFight.getBatFaction(faction)
batLineup = batFaction.getBatlineup(1)
+ posObjIDDict = batLineup.getPosObjIDDict()
for posNum in posNumList:
- objID = batLineup.posObjIDDict.get(posNum)
+ objID = posObjIDDict.get(posNum)
if not objID:
continue
batObj = batObjMgr.getBatObj(objID)
@@ -182,7 +184,7 @@
batObjMgr = BattleObj.GetBatObjMgr()
batFaction = turnFight.getBatFaction(faction)
batLineup = batFaction.getBatlineup(1)
- objID = batLineup.posObjIDDict.get(posNum)
+ objID = batLineup.getPosObjIDDict().get(posNum)
batObj = batObjMgr.getBatObj(objID)
if not batObj:
GameWorld.DebugAnswer(curPlayer, "对象不存在:阵营:%s,位置:%s" % (faction, posNum))
@@ -193,7 +195,7 @@
ownerFaction = turnFight.getBatFaction(ownerFaction)
ownerLineup = ownerFaction.getBatlineup(1)
- ownerID = ownerLineup.posObjIDDict.get(ownerPosNum)
+ ownerID = ownerLineup.getPosObjIDDict().get(ownerPosNum)
buffOwner = batObjMgr.getBatObj(ownerID)
if not buffOwner:
GameWorld.DebugAnswer(curPlayer, "对象不存在:阵营:%s,位置:%s" % (ownerFaction, ownerPosNum))
@@ -237,9 +239,19 @@
skillMgr = mgObj.GetSkillManager()
skillIDList = skillMgr.GetSkillIDList()
GameWorld.DebugAnswer(curPlayer, "技能: %s,%s" % (len(skillIDList), skillIDList))
-
+ buffMgr = mgObj.GetBuffManager()
+ GameWorld.DebugAnswer(curPlayer, "Buff: %s" % buffMgr.GetBuffCount())
+ for index in range(buffMgr.GetBuffCount()):
+ buff = buffMgr.GetBuffByIndex(index)
+ buffName = GameWorld.CodeToGbk(buff.GetSkillData().GetSkillName())
+ GameWorld.DebugAnswer(curPlayer, "ID:%s,%s(%s),回合:%s,层:%s,V:%s,来源:%s,光环:%s"
+ % (buff.GetBuffID(), buffName, buff.GetSkillID(), buff.GetRemainTime(), buff.GetLayer(),
+ [buff.GetValue1(), buff.GetValue2(), buff.GetValue3()], buff.GetOwnerID(), buff.GetHaloObjIDList()
+ ))
+
+ posObjIDDict = batLineup.getPosObjIDDict()
for posNum in posNumList:
- objID = batLineup.posObjIDDict.get(posNum)
+ objID = posObjIDDict.get(posNum)
if not objID:
continue
batObj = batObjMgr.getBatObj(objID)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevel.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevel.py
index 9cb53a9..256b80d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevel.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevel.py
@@ -333,7 +333,7 @@
atkObj = None
batFactionA = turnFight.getBatFaction(ChConfig.Def_FactionA)
batLineup = batFactionA.getBatlineup(1)
- for objID in batLineup.posObjIDDict.values():
+ for objID in batLineup.getBatHeroObjIDList():
atkObj = batObjMgr.getBatObj(objID)
if atkObj.IsAlive():
break
@@ -349,7 +349,7 @@
killObjList = []
batFactionB = turnFight.getBatFaction(ChConfig.Def_FactionB)
batLineup = batFactionB.getBatlineup(1)
- for objID in batLineup.posObjIDDict.values():
+ for objID in batLineup.getBatHeroObjIDList():
tagObj = batObjMgr.getBatObj(objID)
if tagObj.IsAlive():
killObjList.append(tagObj)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnline.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnline.py
index c91d54a..8accd71 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnline.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnline.py
@@ -1150,10 +1150,12 @@
faction, num = ChConfig.Def_FactionA, 1 # 主线战斗玩家自己默认阵营A的第1个战斗阵容
batLineup = mainTurnFight.getBatFaction(faction).getBatlineup(num)
batObjMgr = BattleObj.GetBatObjMgr()
- for posNum, objID in batLineup.posObjIDDict.items():
+ for posNum, objID in batLineup.getPosObjIDDict().items():
batObj = batObjMgr.getBatObj(objID)
if not batObj:
continue
+ if batObj.GetBatObjType() != ChConfig.BatObjType_BatHero:
+ continue
lineupHero = presetLineup.GetLineupHero(posNum)
if lineupHero.heroBatAttrDict:
batObj.UpdInitBatAttr(lineupHero.heroBatAttrDict, lineupHero.heroSkillIDList)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5004.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5004.py
index 94ffffa..a7fb563 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5004.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5004.py
@@ -43,7 +43,7 @@
objBuffList = []
batObjMgr = BattleObj.GetBatObjMgr()
- for objID in batLineup.posObjIDDict.values():
+ for objID in batLineup.getBatHeroObjIDList():
tagObj = batObjMgr.getBatObj(objID)
if not tagObj:
continue
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5009.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5009.py
index 8b4260a..6c558c1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5009.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5009.py
@@ -41,7 +41,7 @@
maxLayer = 0
maxLayerBuffList = []
batObjMgr = BattleObj.GetBatObjMgr()
- for objID in batLineup.posObjIDDict.values():
+ for objID in batLineup.getBatHeroObjIDList():
tObj = batObjMgr.getBatObj(objID)
if not tObj:
continue
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5014.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5014.py
index b56481f..6b67705 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5014.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5014.py
@@ -28,7 +28,7 @@
objList = []
batObjMgr = BattleObj.GetBatObjMgr()
- for objID in batLineup.posObjIDDict.values():
+ for objID in batLineup.getBatHeroObjIDList():
batObj = batObjMgr.getBatObj(objID)
if not batObj:
continue
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5015.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5015.py
index 6150af6..2aa0805 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5015.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5015.py
@@ -40,7 +40,7 @@
objList = []
batObjMgr = BattleObj.GetBatObjMgr()
- for objID in batLineup.posObjIDDict.values():
+ for objID in batLineup.getBatHeroObjIDList():
curBatObj = batObjMgr.getBatObj(objID)
if not curBatObj:
continue
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5022.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5022.py
index 0180071..87078df 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5022.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5022.py
@@ -34,7 +34,7 @@
batLineup = batObj.GetTFBatLineup()
countryCnt = 0
batObjMgr = BattleObj.GetBatObjMgr()
- for objID in batLineup.posObjIDDict.values():
+ for objID in batLineup.getBatHeroObjIDList():
batObj = batObjMgr.getBatObj(objID)
if not batObj:
continue
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnBuff.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnBuff.py
index 94ca2a3..b762825 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnBuff.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnBuff.py
@@ -204,20 +204,18 @@
buff.SetLayer(updLayerCnt)
buff.SetBuffValueList(buffValueList)
buff.ResetEffectValueEx()
- if afterLogic and bySkill:
- bySkill.AddAfterLogic(ChConfig.AfterLogic_AddBuff, [batObj, buff, buffOwner])
+ if afterLogic and buffSkill:
+ buffSkill.AddAfterLogic(ChConfig.AfterLogic_AddBuff, [batObj, buff, buffOwner])
elif isSync:
SyncBuffRefresh(turnFight, batObj, buff, relatedSkillID, isNewAdd=True)
RefreshBuffEffect(turnFight, batObj, buff, buffSkill, buffOwner, refreshType=2)
return buff
- newBuff = __addNewBuff(turnFight, batObj, buffMgr, buffSkill, buffValueList, buffOwner, bySkill, afterLogic, setLayerCnt=addLayerCnt, isSync=isSync)
- if skillType == ChConfig.Def_SkillType_Halo and newBuff:
- __addHaloBuffEffObjID(curID, newBuff, skillID, ownerID, haloSrcBuff)
+ newBuff = __addNewBuff(turnFight, batObj, buffMgr, buffSkill, buffValueList, buffOwner, bySkill, afterLogic, setLayerCnt=addLayerCnt, isSync=isSync, haloSrcBuff=haloSrcBuff)
return newBuff
-def __addNewBuff(turnFight, batObj, buffMgr, buffSkill, buffValueList, buffOwner, bySkill=None, afterLogic=False, setLayerCnt=0, isSync=True):
+def __addNewBuff(turnFight, batObj, buffMgr, buffSkill, buffValueList, buffOwner, bySkill=None, afterLogic=False, setLayerCnt=0, isSync=True, haloSrcBuff=None):
curID = batObj.GetID()
skillID = buffSkill.GetSkillID()
buff = buffMgr.AddBuff(skillID)
@@ -242,26 +240,20 @@
if curBuffState:
buffMgr.AddBuffState(curBuffState, buffID)
- if afterLogic and bySkill:
- bySkill.AddAfterLogic(ChConfig.AfterLogic_AddBuff, [batObj, buff, buffOwner])
+ if buffSkill.GetSkillType() == ChConfig.Def_SkillType_Halo:
+ __addHaloBuffEffObjID(curID, buff, skillID, ownerID, haloSrcBuff)
+
+ if afterLogic and buffSkill:
+ buffSkill.AddAfterLogic(ChConfig.AfterLogic_AddBuff, [batObj, buff, buffOwner])
elif isSync:
SyncBuffRefresh(turnFight, batObj, buff, relatedSkillID, isNewAdd=True)
RefreshBuffEffect(turnFight, batObj, buff, buffSkill, buffOwner, refreshType=1)
- #受控时
+ #添加buff时有需要后置处理触发被动的,如受控
if curBuffState and IsControlledHardState(curBuffState):
- TurnPassive.OnTriggerPassiveEffect(turnFight, batObj, ChConfig.TriggerWay_BeControlledHard, tagObj=buffOwner, connSkill=buffSkill, connBuff=buff)
- batObjMgr = BattleObj.GetBatObjMgr()
- ownerBatLineup = buffOwner.GetTFBatLineup()
- for lineupObjID in ownerBatLineup.posObjIDDict.values():
- lineupObj = batObjMgr.getBatObj(lineupObjID)
- if not lineupObj.IsAlive():
- continue
- # 敌方被控时
- if lineupObj.GetFaction() != batObj.GetFaction():
- TurnPassive.OnTriggerPassiveEffect(turnFight, lineupObj, ChConfig.TriggerWay_EnemyBeControlledHard, batObj, connSkill=buffSkill)
-
+ buffSkill.AddAfterLogic(ChConfig.AfterLogic_TriggerAddBuff, [ChConfig.TriggerWay_BeControlledHard, batObj, buff, buffOwner])
+
return buff
def IsControlledHardState(state):
@@ -325,10 +317,7 @@
if not batFaction:
return
batLineup = batFaction.getBatlineup(1)
- if ChConfig.HeroID_Simayi not in batLineup.heroObjIDDict:
- return
- smyObjID = batLineup.heroObjIDDict[ChConfig.HeroID_Simayi]
- smyObj = BattleObj.GetBatObjMgr().getBatObj(smyObjID)
+ smyObj = batLineup.getHeroObj(ChConfig.HeroID_Simayi)
if not smyObj or not smyObj.IsAlive():
return
smySkillID = ChConfig.SkillID_SmyFanzhao
@@ -349,6 +338,7 @@
haloSrcBuff.AddHaloObjID(curID) # 光源先添加新目标
haloObjIDList = haloSrcBuff.GetHaloObjIDList()
newBuff.SetHaloObjIDList(haloObjIDList) # 新buff直接同步设置为光源有效目标
+ newBuff.SetLayer(haloSrcBuff.GetLayer()) # 同步为光源的层级
batObjMgr = BattleObj.GetBatObjMgr()
for haloObjID in haloObjIDList:
@@ -554,7 +544,7 @@
# 重新添加本阵营有效光环
batObjMgr = BattleObj.GetBatObjMgr()
batLineup = batObj.GetTFBatLineup()
- for tagObjID in batLineup.posObjIDDict.values():
+ for tagObjID in batLineup.getAllPosObjIDList():
tagObj = batObjMgr.getBatObj(tagObjID)
if not tagObj.IsAlive():
continue
@@ -571,6 +561,7 @@
GameWorld.DebugLogEx("复活后重新添加本阵营光环: objID=%s,ownerID=%s,haloSkillID=%s", objID, tagObjID, haloSkillID)
haloSkill = tagObj.GetSkillManager().FindSkillByID(haloSkillID)
if not haloSkill:
+ DoAddBuffBySkillID(turnFight, batObj, haloSkillID, buffOwner=tagObj)
continue
OnAddBuff(turnFight, batObj, haloSkill, buffOwner=tagObj)
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 221cfc5..6851048 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py
@@ -398,13 +398,14 @@
colNumList.insert(0, specInColNum)
GameWorld.DebugLogEx("纵排: colNumList=%s,specObjID-PosNum=%s-%s", colNumList, specObjID, specObjPosNum)
+ posObjIDDict = batLineup.getPosObjIDDict()
for col in colNumList:
for row in range(1, 1 + ChConfig.TurnFightRows):
pNum = (row - 1) * ChConfig.TurnFightCols + col
#GameWorld.DebugLogEx(" col=%s,row=%s,pNum=%s", col, row, pNum)
- if pNum not in batLineup.posObjIDDict:
+ if pNum not in posObjIDDict:
continue
- tagObjID = batLineup.posObjIDDict[pNum]
+ tagObjID = posObjIDDict[pNum]
tagBatObj = batObjMgr.getBatObj(tagObjID)
if not __skillTagFilter(curBatObj, tagBatObj, tagAffect, isNoSelf):
continue
@@ -423,13 +424,14 @@
GameWorld.DebugLogEx("全部: colNumList=%s,specObjID-PosNum=%s-%s", colNumList, specObjID, specObjPosNum)
# 按前排优先原则
+ posObjIDDict = batLineup.getPosObjIDDict()
for row in range(1, 1 + ChConfig.TurnFightRows):
for col in colNumList:
pNum = (row - 1) * ChConfig.TurnFightCols + col
#GameWorld.DebugLogEx(" col=%s,row=%s,pNum=%s", col, row, pNum)
- if pNum not in batLineup.posObjIDDict:
+ if pNum not in posObjIDDict:
continue
- tagObjID = batLineup.posObjIDDict[pNum]
+ tagObjID = posObjIDDict[pNum]
tagBatObj = batObjMgr.getBatObj(tagObjID)
if not __skillTagFilter(curBatObj, tagBatObj, tagAffect, isNoSelf):
continue
@@ -561,7 +563,7 @@
batObjMgr = BattleObj.GetBatObjMgr()
for num in lineupNumList:
batLineup = batFaction.getBatlineup(num)
- for tagID in batLineup.posObjIDDict.values():
+ for tagID in batLineup.getBatHeroObjIDList():
tagObj = batObjMgr.getBatObj(tagID)
if tagObj.IsAlive() and tagObj.CheckInState(checkInStates):
return lineupNum, changeTagSet
@@ -597,13 +599,14 @@
GameWorld.DebugLogEx("前后排: rowNumList=%s,colNumList=%s,specObjID-PosNum=%s-%s", rowNumList, colNumList, specObjID, specObjPosNum)
aimObjList = []
+ posObjIDDict = batLineup.getPosObjIDDict()
for row in rowNumList:
for col in colNumList:
pNum = (row - 1) * ChConfig.TurnFightCols + col
#GameWorld.DebugLogEx(" row=%s,col=%s,pNum=%s", row, col, pNum)
- if pNum not in batLineup.posObjIDDict:
+ if pNum not in posObjIDDict:
continue
- tagObjID = batLineup.posObjIDDict[pNum]
+ tagObjID = posObjIDDict[pNum]
tagBatObj = batObjMgr.getBatObj(tagObjID)
if not __skillTagFilter(curBatObj, tagBatObj, tagAffect, isNoSelf):
continue
@@ -630,11 +633,12 @@
batObjMgr = BattleObj.GetBatObjMgr()
batLineup = tagObj.GetTFBatLineup()
aimObjList = []
+ posObjIDDict = batLineup.getPosObjIDDict()
for col in colNumList:
pNum = (row - 1) * ChConfig.TurnFightCols + col
- if pNum not in batLineup.posObjIDDict:
+ if pNum not in posObjIDDict:
continue
- tagObjID = batLineup.posObjIDDict[pNum]
+ tagObjID = posObjIDDict[pNum]
tagBatObj = batObjMgr.getBatObj(tagObjID)
if not tagBatObj.IsAlive():
continue
@@ -659,11 +663,12 @@
batObjMgr = BattleObj.GetBatObjMgr()
batLineup = tagObj.GetTFBatLineup()
aimObjList = []
+ posObjIDDict = batLineup.getPosObjIDDict()
for row in range(1, 1 + ChConfig.TurnFightRows):
pNum = (row - 1) * ChConfig.TurnFightCols + col
- if pNum not in batLineup.posObjIDDict:
+ if pNum not in posObjIDDict:
continue
- tagObjID = batLineup.posObjIDDict[pNum]
+ tagObjID = posObjIDDict[pNum]
tagBatObj = batObjMgr.getBatObj(tagObjID)
if not tagBatObj.IsAlive():
continue
@@ -715,12 +720,13 @@
colNumList.insert(0, inColNum)
# 按前排优先原则
+ posObjIDDict = batLineup.getPosObjIDDict()
for row in range(ChConfig.TurnFightRows):
for col in colNumList:
pNum = row * ChConfig.TurnFightCols + col
- if pNum not in batLineup.posObjIDDict:
+ if pNum not in posObjIDDict:
continue
- tagObjID = batLineup.posObjIDDict[pNum]
+ tagObjID = posObjIDDict[pNum]
tagBatObj = batObjMgr.getBatObj(tagObjID)
if not __skillTagFilter(curBatObj, tagBatObj, tagAffect, isNoSelf=True):
continue
@@ -1415,6 +1421,7 @@
# 优先处理afterLogic,可再预先汇总一些会触发被动的信息
relatedSkillID = useSkill.GetSkillID()
delBuffAfterEffList = [] # buff消失后要触发的被动,一般用于后置处理的逻辑
+ beControlledHardDict = {} # 受控目标 {objID:buff, ...}
afterLogicList = useSkill.GetAfterLogicList()
for logicType, logicData in afterLogicList:
if logicType == ChConfig.AfterLogic_DelBuff:
@@ -1433,6 +1440,13 @@
buff = logicData[1]
TurnBuff.SyncBuffRefresh(turnFight, buffObj, buff, relatedSkillID)
+ # 统计添加buff需要触发的被动
+ elif logicType == ChConfig.AfterLogic_TriggerAddBuff:
+ triggerType, batObj, buff, buffOwner = logicData
+ if buffOwner.GetID() == curID:
+ if triggerType == ChConfig.TriggerWay_BeControlledHard:
+ beControlledHardDict[batObj.GetID()] = buff
+
# 统计击杀
killObjList = [] # 击杀其他阵营目标列表
dieObjList = [] # 死亡的单位列表,包含友方单位或自己
@@ -1575,7 +1589,7 @@
batFaction = turnFight.getBatFaction(faction)
for lineupNum in batFaction.lineupDict.keys():
batLineup = batFaction.getBatlineup(lineupNum)
- for lineupObjID in batLineup.posObjIDDict.values():
+ for lineupObjID in batLineup.getBatHeroObjIDList():
lineupObj = batObjMgr.getBatObj(lineupObjID)
if not lineupObj.IsAlive():
continue
@@ -1674,6 +1688,14 @@
TurnPassive.OnTriggerPassiveEffect(turnFight, curObj, ChConfig.TriggerWay_Stun, tagObj, connSkill=useSkill)
TurnPassive.OnTriggerPassiveEffect(turnFight, tagObj, ChConfig.TriggerWay_BeStun, curObj, connSkill=useSkill)
+ # 控制
+ if tagID in beControlledHardDict:
+ buff = beControlledHardDict[tagID]
+ if buff.GetCurBuffState() == ChConfig.BatObjState_Frozen:
+ if curMGObj:
+ TurnPassive.OnTriggerPassiveEffect(turnFight, curMGObj, ChConfig.TriggerWay_Frozen, tagObj, connSkill=useSkill, byBatObj=curObj)
+ TurnPassive.OnTriggerPassiveEffect(turnFight, tagObj, ChConfig.TriggerWay_BeControlledHard, curObj, connSkill=useSkill, connBuff=buff)
+
# 暴击
if tagID in superHitObjIDList:
TurnPassive.OnTriggerPassiveEffect(turnFight, curObj, ChConfig.TriggerWay_SuperHit, tagObj, connSkill=useSkill)
@@ -1708,8 +1730,8 @@
# 敌友方
- if isAttackDirect or batType in [ChConfig.TurnBattleType_Combo, ChConfig.TurnBattleType_Pursue] or isDotHurt:
- for lineupObjID in curBatLineup.posObjIDDict.values():
+ if isAttackDirect or batType in [ChConfig.TurnBattleType_Combo, ChConfig.TurnBattleType_Pursue] or isDotHurt or tagID in beControlledHardDict:
+ for lineupObjID in curBatLineup.getBatHeroObjIDList():
lineupObj = batObjMgr.getBatObj(lineupObjID)
if not lineupObj.IsAlive():
continue
@@ -1725,6 +1747,10 @@
if not triggerOne:
TurnPassive.OnTriggerPassiveEffect(turnFight, lineupObj, ChConfig.TriggerWay_FriendDotHurt, tagObj, connSkill=useSkill, byFriendObj=curObj)
+ # 敌方被控时
+ if tagID in beControlledHardDict and lineupObj.GetFaction() != tagObj.GetFaction():
+ TurnPassive.OnTriggerPassiveEffect(turnFight, lineupObj, ChConfig.TriggerWay_EnemyBeControlledHard, tagObj, connSkill=useSkill)
+
# 连击
if batType == ChConfig.TurnBattleType_Combo:
TurnPassive.OnTriggerPassiveEffect(turnFight, lineupObj, ChConfig.TriggerWay_FriendCombo, tagObj, connSkill=useSkill, byFriendObj=curObj)
@@ -1749,9 +1775,7 @@
if not batFaction:
return
batLineup = batFaction.getBatlineup(1)
- if ChConfig.HeroID_Dongbai not in batLineup.heroObjIDDict:
- return
- dongbaiObj = BattleObj.GetBatObjMgr().getBatObj(batLineup.heroObjIDDict[ChConfig.HeroID_Dongbai])
+ dongbaiObj = batLineup.getHeroObj(ChConfig.HeroID_Dongbai)
if not dongbaiObj or dongbaiObj.IsAlive():
return
skill = dongbaiObj.GetSkillManager().FindSkillByID(ChConfig.SkillID_DongbaiRevive)
@@ -2618,12 +2642,10 @@
faction, lineupNum, hurtValueDict, immuneHurtDict)
# 按优先级顺序处理拥有分摊效果的武将
for effHeroID in effHeroIDList:
- if effHeroID not in batLineup.heroObjIDDict:
- continue
- objID = batLineup.heroObjIDDict[effHeroID]
- batObj = batObjMgr.getBatObj(objID)
+ batObj = batLineup.getHeroObj(effHeroID)
if not batObj or not batObj.IsAlive():
continue
+ objID = batObj.GetID()
buffMgr = batObj.GetBuffManager()
inHurt = objID in hurtValueDict # 光环里的人员是否有受伤
--
Gitblit v1.8.0