From 81d4c82d07f4d5aff78c40579049ae70a94163d5 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 06 二月 2024 18:08:13 +0800
Subject: [PATCH] 10019 【砍树】回合战斗(增加道法技能支持;)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py | 10
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AICommon.py | 14 ++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py | 164 ++++++++++++++++++++++----
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/EffGetSet.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py | 4
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py | 32 ++--
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py | 14 --
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py | 37 ++++++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py | 4
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py | 4
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py | 7 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChNetSendPack.py | 10 +
13 files changed, 227 insertions(+), 77 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
index 61c94dc..036a701 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
@@ -2465,7 +2465,7 @@
else:
defObj.SetDict(ChConfig.Def_PlayerKey_LastAttackerObjID, atkObj.GetID())
- TurnAttack.AddTurnObjHurtValue(atkObj, defObj, resultHurtType.HurtType, resultHurtType.RealHurtHP, curSkill)
+ TurnAttack.AddTurnObjHurtValue(atkObj, defObj, resultHurtType.HurtType, resultHurtType.RealHurtHP, resultHurtType.LostHP, curSkill)
return
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 bf59ceb..015f484 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py
@@ -1825,7 +1825,7 @@
# @param tick 当前时间
# @return None
# @remarks 设置玩家属性消耗,如魔法,XP点,HP
-def SetSkillLostAttr(curPlayer, curSkill, tick):
+def SetSkillLostAttr(curObj, curSkill, tick):
#===========================================================================
# #-----------扣魔法
# lostMPValue = curSkill.GetMP()
@@ -1840,31 +1840,26 @@
# #自动回魔
# PlayerControl.PlayerAutoRestoreMP(curPlayer, tick)
#
- # #----------扣XP点
- # lostXPValue = curSkill.GetXP()
- # curPlayerXP = curPlayer.GetXP()
- #
- # if curPlayerXP < lostXPValue:
- # GameWorld.ErrLog('释放技能 = %s异常, XP点 = %s不足 = %s' % (
- # curSkill.GetSkillTypeID(), curPlayerXP, lostXPValue))
- #
- # if lostXPValue > 0:
- # remain = curPlayer.GetXP() - lostXPValue
- # remain = max(0, remain)
- # curPlayer.SetDict(ChConfig.Def_PlayerKey_RecordXPValue, remain)
- # curPlayer.SetXP(remain)
#===========================================================================
-
+
+ #----------扣XP点
+ lostXPValue = curSkill.GetXP()
+ curXP = GameObj.GetXP(curObj)
+ if curXP < lostXPValue:
+ GameWorld.ErrLog('释放技能扣除XP异常! skillID=%s,curXP=%s < lostXPValue=%s' % (curSkill.GetSkillID(), curXP, lostXPValue))
+ if lostXPValue > 0:
+ GameObj.SetXP(curObj, max(0, curXP - lostXPValue))
+
#----------扣HP点
lostHPValue = curSkill.GetHP()
- curPlayerHP = GameObj.GetHP(curPlayer)
+ curPlayerHP = GameObj.GetHP(curObj)
if curPlayerHP < lostHPValue:
GameWorld.ErrLog('释放技能 = %s异常, HP点 = %s不足 = %s' % (
curSkill.GetSkillTypeID(), curPlayerHP, lostHPValue))
if lostHPValue > 0:
- GameObj.SetHP(curPlayer, GameObj.GetHP(curPlayer) - lostHPValue)
+ GameObj.SetHP(curObj, GameObj.GetHP(curObj) - lostHPValue)
return
@@ -1915,6 +1910,9 @@
if curSkill:
skillTypeID = curSkill.GetSkillTypeID()
+ #扣属性,如魔法,XP点
+ SetSkillLostAttr(curNPC, curSkill, tick)
+
#技能使用成功
curNPCSkill = curNPC.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
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 dd30895..833acea 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
@@ -9,7 +9,7 @@
# @date 2023-11-30
# @version 1.0
#
-# 详细描述: 回合制攻击逻辑
+# 详细描述: 回合制攻击逻辑,均使用NPC实例作为战斗主体
#
#-------------------------------------------------------------------------------
#"""Version = 2023-11-30 15:30"""
@@ -174,8 +174,9 @@
playerID = 0
sightLevel, posX, posY = 99, 192, 109 # 系统默认处理的层级及坐标
- objRetA = __SummonFactionObjs(factionInfoA, sightLevel, posX, posY)
- objRetB = __SummonFactionObjs(factionInfoB, sightLevel, posX, posY)
+ factionA, factionB, mainRolePlace = 1, 2, 1
+ objRetA = __SummonFactionObjs(factionA, mainRolePlace, factionInfoA, sightLevel, posX, posY)
+ objRetB = __SummonFactionObjs(factionB, mainRolePlace, factionInfoB, sightLevel, posX, posY)
objA, petObjListA, factionSyncInfoA = objRetA if objRetA else (None, [])
objB, petObjListB, factionSyncInfoB = objRetB if objRetB else (None, [])
if not objA or not objB:
@@ -194,15 +195,13 @@
atkFactionList = [factionListA, factionListB]
# 设置战斗主体
- objA.SetDict(ChConfig.Def_Obj_Dict_TurnFightMainRole, 1)
- objB.SetDict(ChConfig.Def_Obj_Dict_TurnFightMainRole, 1)
objA.SetDict(ChConfig.Def_Obj_Dict_TurnEnemyID, objB.GetID())
objB.SetDict(ChConfig.Def_Obj_Dict_TurnEnemyID, objA.GetID())
# 战斗前初始化,可能会改变攻速,所以先初始化
- for faction, factionObjList in enumerate(atkFactionList, 1):
+ for factionObjList in atkFactionList:
for gameObj in factionObjList:
- TurnFightObjStartInit(playerID, gameObj, faction, tick)
+ TurnFightObjStartInit(playerID, gameObj, tick)
#一个回合攻击顺序,为了后续逻辑统一,都是先确定好顺序
sortType = 2 # 攻击顺序排序方式
@@ -268,7 +267,7 @@
GameWorld.DebugLog("★回合%s.%s %s 行动 : objType-ID-HP(%s-%s-%s),curAtk=%s, tagType-ID-HP(%s-%s-%s)"
% (turnNum, actionNum, objName, objType, objID, curHP, gameObj.GetMaxAtk(), tagObjType, tagObjID, tagHP))
- if not DoAttack(gameObj, tagGameObj, tick):
+ if not DoAttack(gameObj, tagGameObj, tick, checkUseXP=True):
continue
isWin = CheckIswin(objA, objB)
@@ -313,13 +312,17 @@
% (mapID, funcLineID, playerIDA, playerIDB, isWin))
return isWin, turnNum, turnMax, factionTotalHurtDict, playbackID
-def __SummonFactionObjs(factionInfo, sightLevel, posX, posY):
- ## 召唤阵营战斗实例
+def __SummonFactionObjs(faction, mainRolePlace, objInfo, sightLevel, posX, posY):
+ '''召唤阵营战斗实例
+ @param faction: 所属阵营,目前支持两个阵营,1或2
+ @param mainRolePlace: 战斗主体在该阵营上阵位置,1V1时默认1,多对多时,代表所在阵营位置
+ @param objInfo: 该战斗主体出战信息
+ '''
factionSyncInfo = {} # 同步前端的阵营信息,包含主ID、灵宠、其他灵通等
- playerID = factionInfo.get("playerID")
- npcID = factionInfo.get("npcID")
- skillIDList = factionInfo.get("skillIDList") # 技能ID列表
- skillIDExList = factionInfo.get("skillIDExList") # 附加技能ID列表
+ playerID = objInfo.get("playerID")
+ npcID = objInfo.get("npcID")
+ skillIDList = objInfo.get("skillIDList") # 技能ID列表
+ skillIDExList = objInfo.get("skillIDExList") # 附加技能ID列表
if playerID:
npcID = ChConfig.Def_NPCID_PVP
mainObj = NPCCommon.SummonMapNpc(npcID, posX, posY, sightLevel=sightLevel, mirrorPlayerID=playerID, skillIDList=skillIDList, skillIDExList=skillIDExList)
@@ -331,7 +334,9 @@
return
if not mainObj:
return
- petObjList = PetControl.CalloutFightPet(mainObj, factionInfo.get("pet"))
+ GameObj.SetFaction(mainObj, faction)
+ mainObj.SetDict(ChConfig.Def_Obj_Dict_TurnFightMainRolePlace, mainRolePlace)
+ petObjList = PetControl.CalloutFightPet(mainObj, objInfo.get("pet"))
petObjIDList = []
for petObj in petObjList:
if petObj:
@@ -362,7 +367,7 @@
return isWin
def SetKilled(gameObj, killer=None):
- if not gameObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightMainRole):
+ if not gameObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightMainRolePlace):
#GameWorld.DebugLog("非回合战斗主体被击杀: curID=%s" % gameObj.GetID())
return
@@ -406,7 +411,7 @@
if not gameObj:
return
- if not gameObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightMainRole):
+ if not gameObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightMainRolePlace):
# 仅主体可复活
return
@@ -504,6 +509,7 @@
NetPackCommon.SendFakePack(curPlayer, clientPack)
return True
+def GetTurnNum(timeline): return timeline / 100
def SetTimeline(gameObj, turnNum, actionNum):
'''设置回合制战斗所在时间节点
@param turnNum: 第几回合,如果在回合制战斗中,则回合数一定大于0,
@@ -512,17 +518,17 @@
gameObj.SetDict(ChConfig.Def_Obj_Dict_TurnFightTimeline, turnNum * 100 + actionNum)
return
-def TurnFightObjStartInit(playerID, gameObj, faction, tick):
+def TurnFightObjStartInit(playerID, gameObj, tick):
## 回合制战斗实例初始化
if not gameObj:
return
- isMainRole = gameObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightMainRole)
+ mainRolePlace = gameObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightMainRolePlace)
gameObj.SetDict(ChConfig.Def_Obj_Dict_TurnFightID, playerID)
gameObj.SetDict(ChConfig.Def_Obj_Dict_TurnRebornCount, 0)
gameObj.SetDict(ChConfig.Def_Obj_Dict_TurnTotalHurt, 0)
gameObj.SetDict(ChConfig.Def_Obj_Dict_TurnTotalHurtEx, 0)
SetTimeline(gameObj, 1, 0)
- GameObj.SetFaction(gameObj, faction)
+ faction = GameObj.GetFaction(gameObj)
GameObj.SetHPFull(gameObj, True)
gameObj.RefreshView()
@@ -531,10 +537,10 @@
objName = GetObjName(gameObj)
fightPlaceNum = gameObj.GetDictByKey(ChConfig.Def_Obj_Dict_FightPetPlaceNum)
- GameWorld.DebugLog("【 %s 初始化 %s 】 objID=%s,npcID=%s,atkSpeed=%s,isMainRole=%s"
- % (objName, BaseAttack.GetObjAttackName(gameObj), gameObj.GetID(), npcID, GameObj.GetAtkSpeed(gameObj), isMainRole))
- __logGameObjAttr(gameObj)
+ GameWorld.DebugLog("【 %s 初始化 %s 】 objID=%s,npcID=%s,atkSpeed=%s,faction=%s,mainRolePlace=%s"
+ % (objName, BaseAttack.GetObjAttackName(gameObj), gameObj.GetID(), npcID, GameObj.GetAtkSpeed(gameObj), faction, mainRolePlace))
+ haveXPSkill = False
# 重置技能CD、战斗buff
if objType == IPY_GameWorld.gotPlayer:
skillManager = gameObj.GetSkillManager()
@@ -549,6 +555,8 @@
curSkill = skillManager.GetSkillByIndex(i)
if not curSkill:
continue
+ if mainRolePlace and curSkill.GetXP():
+ haveXPSkill = True
skillIDList.append(curSkill.GetSkillID())
if fightPlaceNum:
if curSkill.GetSkillType() != ChConfig.Def_SkillType_Revive:
@@ -557,12 +565,19 @@
curSkill.SetRemainTime(curSkill.GetCoolDownTime())
GameWorld.DebugLog(" NPC技能: npcID=%s,skillIDList=%s" % (npcID, skillIDList))
+ if haveXPSkill:
+ GameObj.SetMaxXP(gameObj, IpyGameDataPY.GetFuncCfg("TurnFightXP", 1))
+ GameObj.SetXP(gameObj, 0) # 进行设置一次通知前端,视为告知前端该实例有XP
+ gameObj.SetDict(ChConfig.Def_Obj_Dict_TurnAtkAddXPCount, 0)
+ gameObj.SetDict(ChConfig.Def_Obj_Dict_TurnXPFullTimeline, 0)
+
+ __logGameObjAttr(gameObj)
return
def __logGameObjAttr(gameObj):
- GameWorld.DebugLog(" HP=%s/%s,atk=%s~%s,Def=%s,atkSpeed=%s"
- % (GameObj.GetHP(gameObj), GameObj.GetMaxHP(gameObj), gameObj.GetMinAtk(), gameObj.GetMaxAtk(),
- gameObj.GetDef(), GameObj.GetAtkSpeed(gameObj)))
+ GameWorld.DebugLog(" HP=%s/%s,atk=%s~%s,Def=%s,atkSpeed=%s,XP=%s/%s"
+ % (GameObj.GetHP(gameObj), GameObj.GetMaxHP(gameObj), gameObj.GetMinAtk(), gameObj.GetMaxAtk(),
+ gameObj.GetDef(), GameObj.GetAtkSpeed(gameObj), GameObj.GetXP(gameObj), GameObj.GetMaxXP(gameObj)))
GameWorld.DebugLog(" 闪(%s,%s),暴(%s,%s),晕(%s,%s),连(%s,%s),反(%s,%s),吸(%s,%s)"
% (GameObj.GetMissRate(gameObj), GameObj.GetMissDefRate(gameObj),
GameObj.GetSuperHitRate(gameObj), GameObj.GetSuperHitRateReduce(gameObj),
@@ -582,6 +597,8 @@
# 重置连击、反击数
gameObj.SetDict(ChConfig.Def_Obj_Dict_TurnComboNum, 0)
gameObj.SetDict(ChConfig.Def_Obj_Dict_TurnAtkBackNum, 0)
+ gameObj.SetDict(ChConfig.Def_Obj_Dict_TurnAtkAddXPCount, 0)
+ gameObj.SetDict(ChConfig.Def_Obj_Dict_TurnXPUseState, 0)
gameObj.SetDict(ChConfig.Def_PlayerKey_AttrFaintCD, 0) # 击晕CD
objType = gameObj.GetGameObjType()
@@ -718,7 +735,7 @@
NPCCommon.SetDeadEx(gameObj)
return
-def AddTurnObjHurtValue(curObj, tagObj, hurtType, hurtValue, curSkill=None):
+def AddTurnObjHurtValue(curObj, tagObj, hurtType, hurtValue, lostHP, curSkill=None):
if not curObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightTimeline):
return
skillID = curSkill.GetSkillID() if curSkill else 0
@@ -728,13 +745,103 @@
curObj.SetDict(ChConfig.Def_Obj_Dict_TurnTotalHurtEx, totalHurt / ChConfig.Def_PerPointValue)
GameWorld.DebugLog(" 伤血: curTD=%s,tagID=%s,skillID=%s,hurtType=%s,hurtValue=%s,totalHurt=%s,tagHP=%s"
% (curObj.GetID(), tagObj.GetID(), skillID, hurtType, hurtValue, totalHurt, GameObj.GetHP(tagObj)))
+
+ if lostHP:
+ AddTurnFightXP(tagObj, __GetAddXP_Defender(tagObj, lostHP), "skillID:%s" % skillID)
+ AddTurnFightXP(curObj, __GetAddXP_Attack(curObj, curSkill), "skillID:%s" % skillID)
return
-def DoAttack(curObj, tagObj, tick, turnBattleType=ChConfig.TurnBattleType_Normal):
+def __GetAddXP_Attack(attack, curSkill):
+ ## 攻击方增加的XP值根据主动攻击次数获得
+ isAddXPSkill = not curSkill or curSkill.GetSkillType() == ChConfig.Def_SkillType_Atk
+ if not isAddXPSkill:
+ return 0
+ atkAddXPCount = attack.GetDictByKey(ChConfig.Def_Obj_Dict_TurnAtkAddXPCount)
+ addXPList = IpyGameDataPY.GetFuncEvalCfg("TurnFightXP", 2)
+ if atkAddXPCount >= len(addXPList):
+ return 0
+ attack.SetDict(ChConfig.Def_Obj_Dict_TurnAtkAddXPCount, atkAddXPCount + 1)
+ return addXPList[atkAddXPCount]
+
+def __GetAddXP_Defender(defender, lostHP):
+ ## 掉血方增加的XP值根据掉血百分比获得
+ maxXP = GameObj.GetMaxXP(defender)
+ if not maxXP:
+ return 0
+ maxHP = GameObj.GetMaxHP(defender)
+ lostHPPer = lostHP / float(maxHP)
+ #GameWorld.DebugLog(" lostHP=%s,lostHPPer=%s" % (lostHP, lostHPPer))
+ return eval(IpyGameDataPY.GetFuncCompileCfg("TurnFightXP", 3))
+
+def AddTurnFightXP(gameObj, addXP, reason=""):
+ ## 回合战斗增加XP
+ if not addXP:
+ #GameWorld.DebugLog(" 没有增加XP! curID=%s" % (gameObj.GetID()))
+ return
+ maxXP = GameObj.GetMaxXP(gameObj)
+ if not maxXP:
+ #GameWorld.DebugLog(" 无最大XP值,不更新! curID=%s" % (gameObj.GetID()))
+ return
+ curXP = GameObj.GetXP(gameObj)
+ if curXP >= maxXP:
+ #GameWorld.DebugLog(" XP值已满,不更新! curID=%s,curXP=%s" % (gameObj.GetID(), curXP))
+ return
+ updXP = min(curXP + addXP, maxXP)
+ GameObj.SetXP(gameObj, updXP)
+ GameWorld.DebugLog(" 更新XP: curID=%s,curXP=%s,addXP=%s,updXP=%s,reason=%s" % (gameObj.GetID(), curXP, addXP, updXP, reason))
+ return
+
+def __CheckUseXPSkill(curObj, tagObj, tick):
+ ## 使用XP技能 - 道法技能
+ maxXP = GameObj.GetMaxXP(curObj)
+ curXP = GameObj.GetXP(curObj)
+ if not maxXP or curXP < maxXP:
+ #GameWorld.DebugLog(" 没有XP或XP未满,无法释放XP! curID=%s,curXP=%s" % (curObj.GetID(), curXP))
+ return
+ turnNum = GetTurnNum(curObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightTimeline))
+ xpFullTurnNum = GetTurnNum(curObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnXPFullTimeline))
+ if turnNum <= xpFullTurnNum:
+ #GameWorld.DebugLog(" XP技能在本回合无法释放! curID=%s, turnNum=%s <= %s" % (curObj.GetID(), turnNum, xpFullTurnNum))
+ return
+
+ curObj.SetDict(ChConfig.Def_Obj_Dict_TurnXPUseState, 1) # 设置可用
+
+ tagDist = 0
+ skillManager = curObj.GetSkillManager()
+ for index in range(0, skillManager.GetSkillCount()):
+ curSkill = skillManager.GetSkillByIndex(index)
+ if not curSkill or curSkill.GetSkillTypeID() == 0:
+ break
+ skillID = curSkill.GetSkillID()
+ #被动技能无法使用
+ if SkillCommon.isPassiveSkill(curSkill):
+ continue
+ #还在冷却时间内无法释放
+ if SkillCommon.RefreshSkillRemainTime(curSkill, tick) != 0:
+ continue
+ needXP = curSkill.GetXP()
+ if not needXP or needXP < curXP:
+ continue
+ curID = curObj.GetID()
+ tagID = tagObj.GetID()
+ if not AICommon.DoNPCUseSkill(curObj, tagObj, curSkill, tagDist, tick):
+ GameWorld.DebugLog(" XP技能攻击失败: curID=%s,tagID=%s,skillID=%s" % (curID, tagID, skillID))
+ continue
+ GameWorld.DebugLog(" XP技能攻击成功: curID=%s,tagID=%s,skillID=%s" % (curID, tagID, skillID))
+ curObj.SetDict(ChConfig.Def_Obj_Dict_TurnXPUseState, 2) # 设置已用
+ return skillID
+
+ return
+
+def DoAttack(curObj, tagObj, tick, turnBattleType=ChConfig.TurnBattleType_Normal, checkUseXP=False):
curID = curObj.GetID()
tagID = tagObj.GetID()
objName = GetObjName(curObj)
GameWorld.DebugLog(" ● %s DoAttack: curID=%s,tagID=%s,turnBattleType=%s" % (objName, curID, tagID, turnBattleType))
+ if checkUseXP:
+ if __CheckUseXPSkill(curObj, tagObj, tick):
+ return True
+
if turnBattleType == ChConfig.TurnBattleType_AtkBack:
PassiveBuffEffMng.OnPassiveSkillTrigger(curObj, tagObj, None, ChConfig.TriggerType_AtkBackBef, tick)
@@ -878,7 +985,6 @@
continue
if not AICommon.DoNPCUseSkill(playerNPC, tagObj, curSkill, tagDist, tick):
- GameWorld.DebugLog(" 技能攻击失败: playerID=%s,tagID=%s,skillID=%s" % (playerID, tagObjID, skillID))
continue
GameWorld.DebugLog(" 技能攻击成功: playerID=%s,tagID=%s,skillID=%s" % (playerID, tagObjID, skillID))
return skillID
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index b39a7c6..53ede96 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3072,7 +3072,7 @@
Def_Obj_Dict_Faction = 'Faction' # 所属阵营
Def_Obj_Dict_TurnFightID = 'TurnFightID' # 回合制战斗所属玩家ID
Def_Obj_Dict_TurnFightTimeline = 'TurnFightTimeline' # 回合制战斗时间线: 回合数*100+行动编号节点
-Def_Obj_Dict_TurnFightMainRole = 'TurnFightMainRole' # 是否回合制战斗主体,最终胜负由主体存活状态决定
+Def_Obj_Dict_TurnFightMainRolePlace = 'TurnFightMainRolePlace' # 回合制战斗主体位置,可用于支持单阵营多主体,最终胜负由主体存活状态决定
Def_Obj_Dict_TurnRebornCount = 'TurnRebornCount' # 回合战斗已复活次数
Def_Obj_Dict_TurnComboNum = 'TurnComboNum' # 本回合已累计连击次数
Def_Obj_Dict_TurnAtkBackNum = 'TurnAtkBackNum' # 本回合已累计反击次数
@@ -3084,6 +3084,9 @@
Def_Obj_Dict_TurnEnemyID = 'TurnEnemyID' # 回合制战斗对手实例ID
Def_Obj_Dict_TurnLowestHP = 'TurnLowestHP' # 本回合战斗中历史最低血量,求余亿部分
Def_Obj_Dict_TurnLowestHPEx = 'TurnLowestHPEx' # 本回合战斗中历史最低血量,整除亿部分
+Def_Obj_Dict_TurnAtkAddXPCount = 'TurnAtkAddXPCount' # 每回合攻击已增加XP次数
+Def_Obj_Dict_TurnXPFullTimeline = 'TurnXPFullTimeline' # XP满时的回合时间点
+Def_Obj_Dict_TurnXPUseState = 'TurnXPUseState' # XP使用状态;0-不可用;1-可用;2-已用
#---NPC字典-------
#每道龙卷风最终坐标
@@ -3304,6 +3307,8 @@
Def_PlayerKey_AttrPerLVAtk = "PerLVAtk" #每1级+%s攻击, 数值取万分率,支持小数算法
Def_PlayerKey_AttrPerLVMaxHP = "PerLVMaxHP" #每1级+%s生命, 数值为固定值
Def_PlayerKey_AttrShieldMPCostRate = "AttrShieldMPCostRate" #魔法盾伤害吸收蓝耗比率
+Def_PlayerKey_AttrXP = "AttrXP" #当前XP
+Def_PlayerKey_AttrMaxXP = "AttrMaxXP" #最大XP值
Def_PlayerKey_AttrXPRestorePer = "AttrXPRestorePer" #自动恢复XP值比率
Def_PlayerKey_MarkLoadMapTick = "LoadMapTickVIP" #记录切换地图后的tick,VIP
Def_PlayerKey_MTFreeOnlineRefreshTick = "MTFreeOnlineRTick" # 寻宝在线计算时间
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChNetSendPack.py
index 509aa40..0831979 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChNetSendPack.py
@@ -787,8 +787,9 @@
("SubCmd", c_ubyte),
("ObjID", c_int),
("ObjType", c_ubyte),
- ("RefreshType", c_ubyte),
+ ("RefreshType", c_ushort),
("Value", c_int),
+ ("ValueEx", c_int),
]
def __init__(self):
@@ -809,6 +810,7 @@
self.ObjType = 0
self.RefreshType = 0
self.Value = 0
+ self.ValueEx = 0
return
def GetLength(self):
@@ -824,7 +826,8 @@
ObjID:%d,
ObjType:%d,
RefreshType:%d,
- Value:%d
+ Value:%d,
+ ValueEx:%d
'''\
%(
self.Cmd,
@@ -832,7 +835,8 @@
self.ObjID,
self.ObjType,
self.RefreshType,
- self.Value
+ self.Value,
+ self.ValueEx
)
return DumpString
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py
index 44d6085..9699a74 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py
@@ -18,6 +18,8 @@
import IpyGameDataPY
import SkillCommon
import PlayerControl
+import ChNetSendPack
+import GameWorld
# 关于血量的函数这里只包装最简单的超DWORD处理
@@ -67,6 +69,29 @@
return
def GetLowestHP(gameObj):
return gameObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnLowestHP) + gameObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnLowestHPEx) * ShareDefine.Def_PerPointValue
+
+def GetMaxXP(gameObj): return gameObj.GetDictByKey(ChConfig.Def_PlayerKey_AttrMaxXP)
+def SetMaxXP(gameObj, value): gameObj.SetDict(ChConfig.Def_PlayerKey_AttrMaxXP, value)
+def GetXP(gameObj): return gameObj.GetDictByKey(ChConfig.Def_PlayerKey_AttrXP)
+def SetXP(gameObj, value):
+ ## XP值,用作妖气值
+ befXP = GetXP(gameObj)
+ maxXP = GetMaxXP(gameObj)
+ value = min(value, maxXP)
+ gameObj.SetDict(ChConfig.Def_PlayerKey_AttrXP, value)
+ NotifyObjInfoRefresh(gameObj, IPY_GameWorld.CDBPlayerRefresh_XP, value)
+ timeline = gameObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightTimeline)
+ if timeline:
+ if befXP < maxXP and value >= maxXP:
+ GameWorld.DebugLog(" XP已满: curID=%s,timeline=%s" % (gameObj.GetID(), timeline))
+ gameObj.SetDict(ChConfig.Def_Obj_Dict_TurnXPFullTimeline, timeline) # 设置XP满时的回合
+ elif value < maxXP:
+ gameObj.SetDict(ChConfig.Def_Obj_Dict_TurnXPFullTimeline, 0)
+ return
+
+#---自动恢复XP值比率----
+def GetXPRestorePer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrXPRestorePer)
+def SetXPRestorePer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrXPRestorePer, value)
def GetAngryValue(curAngry):
return curAngry.GetAngryValue() + curAngry.GetAngryValueEx() * ShareDefine.Def_PerPointValue
@@ -379,3 +404,15 @@
if gameObj.GetGameObjType() == IPY_GameWorld.gotPlayer:
PlayerControl.SendPropertyRefresh(gameObj, ShareDefine.CDBPlayerRefresh_CureDefPer, value)
return
+
+def NotifyObjInfoRefresh(gameObj, refreshType, value):
+ ##0418通知对象属性刷新
+ sendPack = ChNetSendPack.tagObjInfoRefresh()
+ sendPack.Clear()
+ sendPack.ObjID = gameObj.GetID()
+ sendPack.ObjType = gameObj.GetGameObjType()
+ sendPack.RefreshType = refreshType
+ sendPack.Value = value % ShareDefine.Def_PerPointValue
+ sendPack.ValueEx = value / ShareDefine.Def_PerPointValue
+ gameObj.NotifyAll(sendPack.GetBuffer(), sendPack.GetLength())
+ return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AICommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AICommon.py
index 25098df..01292fe 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AICommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AICommon.py
@@ -306,7 +306,8 @@
return False
#CD时间
- if curNPC.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightTimeline):
+ turnFightTimeline = curNPC.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightTimeline)
+ if turnFightTimeline:
if useSkill.GetRemainTime():
#GameWorld.Log('技能回合CD中 = %s, %s'%(useSkill.GetSkillName(), useSkill.GetRemainTime()))
return False
@@ -315,6 +316,17 @@
#GameWorld.Log('检查CD时间触发失败 = %s'%(useSkill.GetSkillName()))
return False
+ #检查XP点数是否够用这个技能
+ curSkillNeedXP = useSkill.GetXP()
+ if curSkillNeedXP:
+ if GameObj.GetXP(curNPC) < curSkillNeedXP:
+ #GameWorld.DebugLog("XP点数不够该技能释放")
+ return False
+ if turnFightTimeline:
+ if curNPC.GetDictByKey(ChConfig.Def_Obj_Dict_TurnXPUseState) != 1:
+ #GameWorld.DebugLog("XP技能非回合可用状态")
+ return False
+
curSkillUseTag = SkillShell.GetSkillAffectTag(useSkill)
if curSkillUseTag == ChConfig.Def_UseSkillTag_CanAttackPlayer:
if curTag.GetGameObjType() != IPY_GameWorld.gotPlayer:
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
index 2bcdc62..6bbafac 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -2360,6 +2360,7 @@
curSummon.SetBornTime(tick)
InitNPC(curSummon)
curSummon.SetSightLevel(gameObj.GetSightLevel())
+ GameObj.SetFaction(curSummon, GameObj.GetFaction(gameObj))
curSummon.Reborn(rebornX, rebornY, False)
#有指定的技能,重新学习
@@ -4248,7 +4249,7 @@
curNPC.SetDict(ChConfig.Def_NPC_Dict_SpeedPer, speedPer)
if GameWorld.GetMap().GetMapID() == ChConfig.Def_FBMapID_GatherSoul:
#目前只在聚魂副本里通知
- NPCSpeedChangeNotify(curNPC, curNPC.GetSpeed())
+ GameObj.NotifyObjInfoRefresh(curNPC, IPY_GameWorld.CDBPlayerRefresh_Speed, curNPC.GetSpeed())
return
@@ -6576,17 +6577,6 @@
msgStr = str([mapID, lineID, shuntPlayerDict])
GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "WorldBossShuntInfo", msgStr, len(msgStr))
GameWorld.DebugLog("通知GameServer地图Boss分流信息: mapID=%s,lineID=%s,shuntPlayerDict=%s" % (mapID, lineID, shuntPlayerDict), lineID)
- return
-
-def NPCSpeedChangeNotify(curNPC, speed):
- ##通知NPC速度
- sendPack = ChNetSendPack.tagObjInfoRefresh()
- sendPack.Clear()
- sendPack.ObjID = curNPC.GetID()
- sendPack.ObjType = curNPC.GetGameObjType()
- sendPack.RefreshType = IPY_GameWorld.CDBPlayerRefresh_Speed
- sendPack.Value = speed
- curNPC.NotifyAll(sendPack.GetBuffer(), sendPack.GetLength())
return
def UpdateNPCAttackCount(curPlayer, npcID, attackCount, maxCount=0):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
index a550b5f..22babe4 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -7137,10 +7137,6 @@
#---受伤计算百分比----
def GetHurtPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrHurtPer)
def SetHurtPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrHurtPer, value)
-
-#---自动恢复XP值比率----
-def GetXPRestorePer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrXPRestorePer)
-def SetXPRestorePer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrXPRestorePer, value)
#---魔法盾伤害吸收蓝耗比率----
def GetShieldMPCostRate(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrShieldMPCostRate)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py
index d6966cf..aa21f06 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/BuffSkill.py
@@ -442,8 +442,8 @@
PassiveBuffEffMng.GetValueByPassiveBuffTriggerType(curObj, buffOwner, curSkill, ChConfig.TriggerType_AddBuffOver, False)
# 击晕触发
- if curSkill.GetSkillTypeID() == ChConfig.Def_SkillID_AtkerFaint:
- GameWorld.DebugLog(" 击晕目标: atkID=%s,curID=%s" % (buffOwner.GetID(), curObj.GetID()))
+ if SkillCommon.GetBuffStateType(curSkill) == ChConfig.Def_PlayerState_Stun:
+ GameWorld.DebugLog(" 击晕目标: atkID=%s,curID=%s,buffSkillID=%s" % (buffOwner.GetID(), curObj.GetID(), curSkill.GetSkillID()))
PassiveBuffEffMng.OnPassiveSkillTrigger(buffOwner, curObj, None, ChConfig.TriggerType_Faint, tick)
#是否是持续性技能
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/EffGetSet.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/EffGetSet.py
index 8cf1a63..462b3c9 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/EffGetSet.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/EffGetSet.py
@@ -108,7 +108,7 @@
[lambda curObj:PlayerControl.GetAtkBackMPPer(curObj), lambda curObj, value:PlayerControl.SetAtkBackMPPer(curObj, value), 0, 0, 0], # 攻击回复蓝量比率
[lambda curObj:PlayerControl.GetAddBackHPPer(curObj), lambda curObj, value:PlayerControl.SetAddBackHPPer(curObj, value), 0, 0, 0], # 暂无用
[lambda curObj:PlayerControl.GetReduceBackHPPer(curObj), lambda curObj, value:PlayerControl.SetReduceBackHPPer(curObj, value), 0, 0, 0], # 暂无用
- [lambda curObj:PlayerControl.GetXPRestorePer(curObj), lambda curObj, value:PlayerControl.SetXPRestorePer(curObj, value), 0, 0, 0], # 自动恢复XP值比率
+ [lambda curObj:GameObj.GetXPRestorePer(curObj), lambda curObj, value:GameObj.SetXPRestorePer(curObj, value), 0, 0, 0], # 自动恢复XP值比率
[lambda curObj:PlayerControl.GetReduceSkillCDPer(curObj), lambda curObj, value:PlayerControl.SetReduceSkillCDPer(curObj, value), IPY_PlayerDefine.CDBPlayerRefresh_BattleValEx3, 1, 0], # 减技能CD比例
[lambda curObj:curObj.GetSkillAtkRate(), lambda curObj, value:curObj.SetSkillAtkRate(value), IPY_PlayerDefine.CDBPlayerRefresh_SkillAtkRate, 1, 0], # 技能攻击比例加成
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 319816a..1a436c0 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
@@ -1361,6 +1361,8 @@
else:
# 已广播的不重复
GameObj.SetHP(curObj, remainHP, not view)
+
+ lostHP = curObjHP_BeforeAttack - GameObj.GetHP(curObj) # 实际掉血量
AttackCommon.WriteHurtLog(buffOwner, curObj, curSkill, lostValue, hurtType, "持续掉血")
if view:
@@ -1414,7 +1416,7 @@
elif curObjType == IPY_GameWorld.gotNPC:
AttackCommon.NPCAddObjInHurtList(attackerOwner, curObj, curObjHP_BeforeAttack, lostValue)
- TurnAttack.AddTurnObjHurtValue(buffOwner, curObj, hurtType, lostValue, curSkill)
+ TurnAttack.AddTurnObjHurtValue(buffOwner, curObj, hurtType, lostValue, lostHP, curSkill)
#统一调用攻击结束动作
if isDoAttackResult:
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
index 0cd2d55..de17cde 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
@@ -3403,11 +3403,11 @@
#--- 3. 计算概率触发技能---
#几率
- rate = GetSkillOfSeriesHitRate(attacker, defender, exSkill)
-
- if not GameWorld.CanHappen(rate, ChConfig.Def_MaxRateValue):
- #几率未触发
- return False
+ if not SkillCommon.IsBuff(exSkill): # buff在添加buff时有判断概率,这里不重复判断
+ rate = GetSkillOfSeriesHitRate(attacker, defender, exSkill)
+ if not GameWorld.CanHappen(rate, ChConfig.Def_MaxRateValue):
+ #几率未触发
+ return False
# #特殊全局型主动增益buff,需要添加特殊间隔
# if attacker.GetGameObjType() == IPY_GameWorld.gotPlayer and useSkill.GetSkillTypeID() in ChConfig.Def_SkillID_Trig:
--
Gitblit v1.8.0