10019 【砍树】回合战斗(副本回合制NPC支持配置精怪技能、神通技能;增加属性强化治疗215、弱化治疗216;NPC支持触发被动效果;被动效果触发方式增加按回合触发-效果ID5000;)
| | |
| | | WORD _LineID; //功能线路ID
|
| | | DWORD NPCID; //NPCID
|
| | | list PetNPCIDList; //灵宠NPCID列表
|
| | | list ElfSkillIDList; //精怪技能ID列表
|
| | | list STSkillIDList; //神通技能ID列表
|
| | | list AwardItemListFirst; //首次过关奖励列表[[物品ID,个数,是否拍品], ...]
|
| | | list AwardItemList; //再次过关奖励列表[[物品ID,个数,是否拍品], ...]
|
| | | };
|
| | |
| | | Def_Effect_AtkBackDefRate = 212 # 抗反击概率
|
| | | Def_Effect_SuckHPPer = 213 # 吸血比率
|
| | | Def_Effect_SuckHPDefPer = 214 # 抗吸血比率
|
| | | Def_Effect_CurePer = 215 # 强化治疗
|
| | | Def_Effect_CureDefPer = 216 # 弱化治疗
|
| | |
|
| | | #增加%d物理伤害值,其中a值为伤害值
|
| | | Def_Effect_AddAtk = 1005
|
| | |
| | | CDBPlayerRefresh_SuckHPPer, # 吸血比率 252
|
| | | CDBPlayerRefresh_SuckHPDefPer, # 抗吸血比率 253
|
| | | CDBPlayerRefresh_Xiantao, # 仙桃 254
|
| | | ) = range(146, 255)
|
| | | CDBPlayerRefresh_CurePer, # 强化治疗 255
|
| | | CDBPlayerRefresh_CureDefPer, # 弱化治疗 256
|
| | | ) = range(146, 257)
|
| | |
|
| | | TYPE_Price_Gold_Paper_Money = 5 # 金钱类型,(先用礼券,再用金子)
|
| | | TYPE_Price_Family_Contribution = 6 # 战盟贡献度(活跃度转换得来)
|
| | |
| | | suckHPByPer = int(hurtValue * suckHPPerFinal*1.0 / ChConfig.Def_MaxRateValue)
|
| | |
|
| | | suckHPTotal = suckHPByPer + suckHP
|
| | | #GameWorld.DebugLog(" 吸血: atkID=%s,suckHPPer=%s,defID=%s,suckHPDefPer=%s,suckHPPerFinal=%s,suckHPByPer=%s,hurtValue=%s,suckHP=%s" |
| | | # % (atkObj.GetID(), suckHPPer, defObj.GetID(), suckHPDefPer, suckHPPerFinal, suckHPByPer, hurtValue, suckHP))
|
| | | if suckHPTotal <= 0:
|
| | | return
|
| | |
|
| | | GameObj.SetHP(atkObj, min(GameObj.GetMaxHP(atkObj), GameObj.GetHP(atkObj) + suckHPTotal), False)
|
| | | GameObj.SetHP(atkObj, min(GameObj.GetMaxHP(atkObj), GameObj.GetHP(atkObj) + suckHPTotal), False) |
| | |
|
| | | ChangeHPView(atkObj, None, 0, suckHPTotal, ChConfig.Def_HurtTYpe_Recovery)
|
| | | GameWorld.DebugLog(" 吸血: atkID=%s,defID=%s,最终比例=%s(%s-%s),伤血=%s,总吸血=%s(%s+%s),HP=%s" |
| | | % (atkObj.GetID(), defObj.GetID(), suckHPPerFinal, suckHPPer, suckHPDefPer, hurtValue, suckHPTotal, suckHPByPer, suckHP, GameObj.GetHP(atkObj)))
|
| | | return
|
| | |
|
| | | ## 攻击者回蓝逻辑
|
| | |
| | | import BuffSkill |
| | | import FBCommon |
| | | import ItemControler |
| | | import PlayerPet |
| | | import PassiveBuffEffMng |
| | | |
| | | # 回合战斗流程状态 |
| | | ( |
| | |
| | | |
| | | def DoTrunFight(curPlayer, mapID, funcLineID, tagPlayerID, tick): |
| | | playerID = curPlayer.GetPlayerID() |
| | | |
| | | PlayerViewCacheTube.UpdPlayerPropPlusCache(curPlayer) # 强制刷一下自己的镜像缓存 |
| | | factionInfoA = {"playerID":playerID, "pet":PlayerPet.GetPetCacheInfo(curPlayer)} |
| | | factionInfoB = {} |
| | | factionInfoA = GetPlayerFactionInfoByCache(playerID) |
| | | ipyData = None |
| | | if tagPlayerID: |
| | | PlusData = PlayerViewCacheTube.GetPlayerPropPlusDictByID(tagPlayerID)[1] # 从缓存中获取 |
| | | factionInfoB = {"playerID":tagPlayerID, "pet":PlusData.get("Pet")} |
| | | factionInfoB = GetPlayerFactionInfoByCache(tagPlayerID) |
| | | else: |
| | | ipyData = IpyGameDataPY.GetIpyGameData("FBTurn", mapID, funcLineID) |
| | | if not ipyData: |
| | |
| | | petCacheInfo = [] # 从配表中读取组合,技能默认取NPC表配置的 |
| | | for state, petNPCID in enumerate(petNPCIDList, 1): |
| | | petCacheInfo.append({"npcID":petNPCID, "state":state, "quality":0}) |
| | | factionInfoB = {"npcID":npcID, "pet":petCacheInfo} |
| | | skillIDExList = [] # NPC为附加技能,因为NPC表本身可能有配置技能 |
| | | skillIDExList.extend(ipyData.GetElfSkillIDList()) |
| | | skillIDExList.extend(ipyData.GetSTSkillIDList()) |
| | | factionInfoB = {"npcID":npcID, "pet":petCacheInfo, "skillIDExList":skillIDExList} |
| | | |
| | | ret = ProcessAutoTurnFight(mapID, funcLineID, factionInfoA, factionInfoB, tick, curPlayer) |
| | | if not ret: |
| | |
| | | playbackID and overMsg.update({"playbackID":playbackID}) |
| | | SyncTurnFightState(curPlayer, mapID, funcLineID, tagPlayerID, FightState_Award, turnNum, turnMax, overMsg) |
| | | return |
| | | |
| | | def GetPlayerFactionInfoByCache(playerID): |
| | | ## 根据玩家缓存数据获取对阵玩家阵营信息字典 |
| | | _, PlusDict = PlayerViewCacheTube.GetPlayerPropPlusDictByID(playerID, True) # 从缓存中获取,强刷一次最新属性 |
| | | skillIDList = [] |
| | | SkillInfo = PlusDict.get("SkillInfo", {}) |
| | | for _, skillLVDict in SkillInfo.items(): |
| | | for skillID, _ in skillLVDict.items(): |
| | | skillID = GameWorld.ToIntDef(skillID) |
| | | skillData = GameWorld.GetGameData().GetSkillBySkillID(skillID) |
| | | if not skillData: |
| | | continue |
| | | skillIDList.append(skillID) |
| | | return {"playerID":playerID, "pet":PlusDict.get("Pet"), "skillIDList":skillIDList} |
| | | |
| | | def ProcessAutoTurnFight(mapID, funcLineID, factionInfoA, factionInfoB, tick, syncPlayer=None, isSavePlayback=False): |
| | | ''' 处理自动回合战斗过程,仅做战斗流程处理,不做及其他功能逻辑 |
| | |
| | | # 设置战斗主体 |
| | | 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 gameObj in fightObjList: |
| | | TurnFightObjPerTurnStart(gameObj, turnNum, tick) |
| | | if not gameObj: |
| | | continue |
| | | faction = GameObj.GetFaction(gameObj) |
| | | tagGameObj = objB if faction == 1 else objA |
| | | TurnFightObjPerTurnStart(gameObj, tagGameObj, turnNum, tick) |
| | | |
| | | isWin = CheckIswin(objA, objB) |
| | | if isWin != None: |
| | |
| | | factionSyncInfo = {} # 同步前端的阵营信息,包含主ID、灵宠、其他灵通等 |
| | | playerID = factionInfo.get("playerID") |
| | | npcID = factionInfo.get("npcID") |
| | | skillIDList = factionInfo.get("skillIDList") # 技能ID列表 |
| | | skillIDExList = factionInfo.get("skillIDExList") # 附加技能ID列表 |
| | | if playerID: |
| | | npcID = ChConfig.Def_NPCID_PVP |
| | | mainObj = NPCCommon.SummonMapNpc(npcID, posX, posY, sightLevel=sightLevel, mirrorPlayerID=playerID) |
| | | mainObj = NPCCommon.SummonMapNpc(npcID, posX, posY, sightLevel=sightLevel, mirrorPlayerID=playerID, skillIDList=skillIDList, skillIDExList=skillIDExList) |
| | | factionSyncInfo["playerID"] = playerID |
| | | elif npcID: |
| | | mainObj = NPCCommon.SummonMapNpc(npcID, posX, posY, sightLevel=sightLevel) |
| | | mainObj = NPCCommon.SummonMapNpc(npcID, posX, posY, sightLevel=sightLevel, skillIDList=skillIDList, skillIDExList=skillIDExList) |
| | | factionSyncInfo["npcID"] = npcID |
| | | else: |
| | | return |
| | |
| | | clientPack.ObjType = gameObj.GetGameObjType() |
| | | NetPackCommon.SendFakePack(curPlayer, clientPack) |
| | | return True |
| | | |
| | | def GetEnemyCureDefPer(gameObj): |
| | | ## 获取敌对方弱化治疗值 |
| | | tagID = gameObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnEnemyID) |
| | | if not tagID: |
| | | return 0 |
| | | tagObj = GameWorld.FindNPCByID(tagID) |
| | | if not tagObj: |
| | | return 0 |
| | | cureDefPer = GameObj.GetCureDefPer(tagObj) |
| | | #其他的... |
| | | return cureDefPer |
| | | |
| | | def GetRebornTypeInfo(gameObj): |
| | | ''' 获取可复活的方式信息 |
| | |
| | | objName = GetObjName(gameObj) |
| | | fightPlaceNum = gameObj.GetDictByKey(ChConfig.Def_Obj_Dict_FightPetPlaceNum) |
| | | |
| | | GameWorld.DebugLog("【 %s 初始化 %s 】 objID=%s,npcID=%s,atkSpeed=%s,HP=%s,Atk=%s,Def=%s,isMainRole=%s" |
| | | % (objName, BaseAttack.GetObjAttackName(gameObj), gameObj.GetID(), npcID, |
| | | GameObj.GetAtkSpeed(gameObj), GameObj.GetHP(gameObj), gameObj.GetMaxAtk(), gameObj.GetDef(), isMainRole)) |
| | | 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), |
| | | GameObj.GetFaintRate(gameObj), GameObj.GetFaintDefRate(gameObj), |
| | | GameObj.GetComboRate(gameObj), GameObj.GetComboDefRate(gameObj), |
| | | GameObj.GetAtkBackRate(gameObj), GameObj.GetAtkBackDefRate(gameObj), |
| | | GameObj.GetSuckHPPer(gameObj), GameObj.GetSuckHPDefPer(gameObj), |
| | | )) |
| | | 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) |
| | | |
| | | # 重置技能CD、战斗buff |
| | | if objType == IPY_GameWorld.gotPlayer: |
| | |
| | | |
| | | return |
| | | |
| | | def TurnFightObjPerTurnStart(gameObj, turnNum, tick): |
| | | def __logGameObjAttr(gameObj): |
| | | GameWorld.DebugLog(" HP=%s,Atk=%s,Def=%s,atkSpeed=%s" % (GameObj.GetHP(gameObj), gameObj.GetMaxAtk(), gameObj.GetDef(), GameObj.GetAtkSpeed(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), |
| | | GameObj.GetFaintRate(gameObj), GameObj.GetFaintDefRate(gameObj), |
| | | GameObj.GetComboRate(gameObj), GameObj.GetComboDefRate(gameObj), |
| | | GameObj.GetAtkBackRate(gameObj), GameObj.GetAtkBackDefRate(gameObj), |
| | | GameObj.GetSuckHPPer(gameObj), GameObj.GetSuckHPDefPer(gameObj), |
| | | )) |
| | | return |
| | | |
| | | def TurnFightObjPerTurnStart(gameObj, tagObj, turnNum, tick): |
| | | ## 回合制战斗实例 - 每回合开始时处理 |
| | | if not gameObj: |
| | | return |
| | |
| | | |
| | | # 刷新定时处理的buff效果 |
| | | SkillShell.ProcessPersistBuff(gameObj, tick) |
| | | |
| | | PassiveBuffEffMng.OnPassiveSkillTrigger(gameObj, tagObj, None, ChConfig.TriggerType_TurnNum, tick) |
| | | |
| | | __logGameObjAttr(gameObj) |
| | | return |
| | | |
| | | def TurnFightObjPerTurnActionnum(turnNum, actionNum, gameObj, tick): |
| | |
| | | Def_BuffValue_Count = 3 # buff记录的value个数
|
| | |
|
| | | #游戏对象属性--------------------------------------------
|
| | | Def_Calc_AllAttrType_MAX = 171
|
| | | Def_Calc_AllAttrType_MAX = 172
|
| | | #基本属性BUFF计算,顺序与 ObjProperty_AttrByIndex 对应,同时也为buff效果ID同步通知策划
|
| | | TYPE_Calc_AttrList = (
|
| | | TYPE_Calc_Metal, # 金 1
|
| | |
| | | TYPE_Calc_MissSucessRate, # 闪避成功率
|
| | | TYPE_Calc_AtkInterval, # NPC攻击频率
|
| | | TYPE_Calc_FuncDef, # 功能层防御
|
| | | TYPE_Calc_CurePer, # 治疗效果加成,默认100% 115
|
| | | TYPE_Calc_CurePer, # 强化治疗 115
|
| | | TYPE_Calc_BeHurtPer, # 加深受到伤害百分比
|
| | | TYPE_Calc_HorseAtkPer, # 坐骑攻击百分比
|
| | | TYPE_Calc_StoneBasePer, # 宝石基础属性百分比
|
| | |
| | | TYPE_Calc_AtkBackDefRate, # 抗反击概率
|
| | | TYPE_Calc_SuckHPPer, # 吸血比率
|
| | | TYPE_Calc_SuckHPDefPer, # 抗吸血比率 170
|
| | | TYPE_Calc_CureDefPer, # 弱化对方治疗效果
|
| | | ) = range(1, Def_Calc_AllAttrType_MAX)
|
| | |
|
| | | ## 支持大数值属性,超过20E
|
| | |
| | | Def_Obj_Dict_TurnTotalHurtEx = 'TurnTotalHurtEx' # 本回合制战斗总伤害,整除亿部分
|
| | | Def_Obj_Dict_FightPetPlaceNum = 'FightPetPlaceNum' # 出战灵宠上阵位置,1~n
|
| | | Def_Obj_Dict_FightPetQuality = 'FightPetQuality' # 出战灵宠品质
|
| | | Def_Obj_Dict_TurnEnemyID = 'TurnEnemyID' # 回合制战斗对手实例ID
|
| | |
|
| | | #---NPC字典-------
|
| | | #每道龙卷风最终坐标
|
| | |
| | | Def_PlayerKey_PVPAtkBackHP = "PVPAtkBackHP" # PVP攻击回血
|
| | | Def_PlayerKey_HitSucessRate = "HitSucessRate" # 命中成功率
|
| | | Def_PlayerKey_MissSucessRate = "MissSucessRate" # 闪避成功率
|
| | | Def_PlayerKey_CurePer = "CurePer" # 治疗加成 默认百分百
|
| | | Def_PlayerKey_BeHurtPer = "BeHurtPer" # 加深受到伤害百分比
|
| | | Def_PlayerKey_HorseAtkPer = "HorseAtkPer" # 坐骑攻击百分比
|
| | | Def_PlayerKey_HorseMaxHPPer = "HorseMaxHPPer" # 坐骑生命加成
|
| | |
| | | AttrName_AtkBackDefRate = "AtkBackDefRate" # 抗反击概率
|
| | | AttrName_SuckHPPer = "SuckHPPer" # 吸血比率
|
| | | AttrName_SuckHPDefPer = "SuckHPDefPer" # 抗吸血比率
|
| | | AttrName_CurePer = "CurePer" # 强化治疗
|
| | | AttrName_CureDefPer = "CureDefPer" # 弱化治疗
|
| | |
|
| | | #物品效果(ID或指定类型)对应的属性计算信息 {效果(ID/指定类型):[[属性索引, ...], 是否基础属性,(非)线性]}
|
| | | #对应 Def_Calc_AllAttrType_MAX
|
| | |
| | | AttrName_SuckHPPer:[[TYPE_Calc_SuckHPPer], False, TYPE_Linear],
|
| | | ShareDefine.Def_Effect_SuckHPDefPer:[[TYPE_Calc_SuckHPDefPer], False, TYPE_Linear],
|
| | | AttrName_SuckHPDefPer:[[TYPE_Calc_SuckHPDefPer], False, TYPE_Linear],
|
| | | ShareDefine.Def_Effect_CurePer:[[TYPE_Calc_CurePer], False, TYPE_Linear],
|
| | | ShareDefine.Def_Effect_CureDefPer:[[TYPE_Calc_CureDefPer], False, TYPE_Linear],
|
| | |
|
| | | #战斗非线性
|
| | | ShareDefine.Def_Effect_SuperHitPer:[[TYPE_Calc_SuperHit], False, TYPE_NoLinear],
|
| | |
| | | TriggerType_ThumpSkillValue, # 重击增加技能固定值伤害 88
|
| | | TriggerType_HitValue, # 记录命中个数 89
|
| | | TriggerType_ChangeSkillEff, # 改变技能特效广播 90
|
| | | ) = range(1, 91)
|
| | | TriggerType_TurnNum, # 回合触发 91
|
| | | ) = range(1, 92)
|
| | |
|
| | |
|
| | | #不可以佩戴翅膀的地图
|
| | |
| | | else:
|
| | | gameObj.SetDict(ChConfig.AttrName_AtkBackHP, value)
|
| | | return
|
| | |
|
| | | def GetCurePer(gameObj): return gameObj.GetDictByKey(ChConfig.AttrName_CurePer)
|
| | | def SetCurePer(gameObj, value):
|
| | | ## 强化治疗
|
| | | gameObj.SetDict(ChConfig.AttrName_CurePer, value)
|
| | | if gameObj.GetGameObjType() == IPY_GameWorld.gotPlayer:
|
| | | PlayerControl.SendPropertyRefresh(gameObj, ShareDefine.CDBPlayerRefresh_CurePer, value)
|
| | | return
|
| | | def GetCureDefPer(gameObj): return gameObj.GetDictByKey(ChConfig.AttrName_CureDefPer)
|
| | | def SetCureDefPer(gameObj, value):
|
| | | ## 弱化治疗
|
| | | gameObj.SetDict(ChConfig.AttrName_CureDefPer, value)
|
| | | if gameObj.GetGameObjType() == IPY_GameWorld.gotPlayer:
|
| | | PlayerControl.SendPropertyRefresh(gameObj, ShareDefine.CDBPlayerRefresh_CureDefPer, value)
|
| | | return
|
| | |
| | | ("WORD", "LineID", 1),
|
| | | ("DWORD", "NPCID", 0),
|
| | | ("list", "PetNPCIDList", 0),
|
| | | ("list", "ElfSkillIDList", 0),
|
| | | ("list", "STSkillIDList", 0),
|
| | | ("list", "AwardItemListFirst", 0),
|
| | | ("list", "AwardItemList", 0),
|
| | | ),
|
| | |
| | | self.LineID = 0
|
| | | self.NPCID = 0
|
| | | self.PetNPCIDList = []
|
| | | self.ElfSkillIDList = []
|
| | | self.STSkillIDList = []
|
| | | self.AwardItemListFirst = []
|
| | | self.AwardItemList = [] |
| | | return |
| | |
| | | def GetLineID(self): return self.LineID # 功能线路ID
|
| | | def GetNPCID(self): return self.NPCID # NPCID
|
| | | def GetPetNPCIDList(self): return self.PetNPCIDList # 灵宠NPCID列表
|
| | | def GetElfSkillIDList(self): return self.ElfSkillIDList # 精怪技能ID列表
|
| | | def GetSTSkillIDList(self): return self.STSkillIDList # 神通技能ID列表
|
| | | def GetAwardItemListFirst(self): return self.AwardItemListFirst # 首次过关奖励列表[[物品ID,个数,是否拍品], ...]
|
| | | def GetAwardItemList(self): return self.AwardItemList # 再次过关奖励列表[[物品ID,个数,是否拍品], ...] |
| | | |
| | |
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def OnNPCDie(curNPC,HurtType,HurtID):
|
| | | PassiveBuffEffMng.GetPassiveEffManager().RemovePassiveEff((curNPC.GetID(), IPY_GameWorld.gotNPC))
|
| | |
|
| | | # 召唤NPC死亡触发被动技能
|
| | | owner = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curNPC)
|
| | |
| | | import PlayerVip
|
| | | import GameObj
|
| | | import ChNPC
|
| | | import PassiveBuffEffMng
|
| | |
|
| | | import random
|
| | | import math
|
| | |
| | | # @param aiType: AI类型
|
| | | # @return 如果召唤失败返回None 否则返回召唤的NPC的实例
|
| | | # @remarks 在地图里召唤NPC 根据NPCID 出生点 AI类型 和TICK
|
| | | def SummonMapNpc(npcId, rebornX, rebornY, aiType=0, lastTime=0, playerID=0, sightLevel=0, refreshID=0, mirrorPlayerID=0):
|
| | | def SummonMapNpc(npcId, rebornX, rebornY, aiType=0, lastTime=0, playerID=0, sightLevel=0, refreshID=0, mirrorPlayerID=0, skillIDList=None, skillIDExList=None):
|
| | | npcData = GameWorld.GetGameData().FindNPCDataByID(npcId)
|
| | | if not npcData:
|
| | | GameWorld.ErrLog("找不到该NPCID: %s" % npcId)
|
| | |
| | | curSummon.SetDict(ChConfig.Def_NPC_Dict_MirrorPlayerID, mirrorPlayerID)
|
| | |
|
| | | curSummon.Reborn(rebornX, rebornY, False)
|
| | | skillManager = curSummon.GetSkillManager()
|
| | | #有指定的技能,重新学习
|
| | | if skillIDList:
|
| | | #GameWorld.DebugLog("指定召唤兽技能: npcID=%s,skillIDList=%s" % (npcID, skillIDList))
|
| | | skillManager.ResetSkill()
|
| | | for skillID in skillIDList:
|
| | | skillManager.LVUPSkillByID(skillID)
|
| | | #附加学习技能
|
| | | if skillIDExList:
|
| | | for skillID in skillIDExList:
|
| | | if not skillManager.FindSkillBySkillID(skillID):
|
| | | skillManager.LVUPSkillByID(skillID)
|
| | | NPCControl(curSummon).DoNPCRebornCommLogic(tick)
|
| | |
|
| | | FBLogic.DoFBRebornSummonNPC(curSummon, tick)
|
| | | #__NotifyMapPlayerSummonMapNPC(npcId, rebornX, rebornY)
|
| | | if skillIDList or skillIDExList:
|
| | | learnSkillIDList = []
|
| | | for index in range(0, skillManager.GetSkillCount()):
|
| | | useSkill = skillManager.GetSkillByIndex(index)
|
| | | learnSkillIDList.append(useSkill.GetSkillID())
|
| | | GameWorld.DebugLog("召唤的NPC所有技能: curID=%s,npcID=%s,skill=%s" % (curSummon.GetID(), npcId, learnSkillIDList))
|
| | | return curSummon
|
| | |
|
| | | def SummonNPC(gameObj, npcID, rebornX, rebornY, skillIDList=None):
|
| | |
| | | PyGameData.g_playerPriWoodPileNPCDict.pop(priWoodPilePlayerID)
|
| | | break
|
| | |
|
| | | PassiveBuffEffMng.GetPassiveEffManager().RemovePassiveEff((curNPC.GetID(), IPY_GameWorld.gotNPC))
|
| | | |
| | | # C++设置npc死亡
|
| | | curNPC.SetDead(curNPC.GetDictByKey(ChConfig.Def_NPCDead_Reason),
|
| | | curNPC.GetDictByKey(ChConfig.Def_NPCDead_KillerType),
|
| | |
| | | #
|
| | | # #清空禁止
|
| | | # curNPC.ForbiddenSkillTypeList_Clear()
|
| | | |
| | | #宠物特殊处理
|
| | | if PetControl.RefurbishPetAttr(curNPC):
|
| | | return
|
| | |
|
| | | isPetNPC = PetControl.IsPetNPC(curNPC)
|
| | | mirrorPlayerID = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_MirrorPlayerID)
|
| | | if mirrorPlayerID:
|
| | | #宠物特殊处理
|
| | | if isPetNPC:
|
| | | PetControl.RefurbishPetAttr(curNPC)
|
| | | elif mirrorPlayerID:
|
| | | self.SetMirrorPlayerNPCAttr(mirrorPlayerID, isReborn)
|
| | | else:
|
| | | DoNPCAttrStrengthen(curNPC, isReborn)
|
| | |
| | | #客户端自己算血量上限
|
| | | # if GameObj.GetMaxHP(curNPC) != curNPCMaxHP_Before:
|
| | | # curNPC.Notify_MaxHP()
|
| | | |
| | | |
| | | PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curNPC)
|
| | | return
|
| | |
|
| | | def SetMirrorPlayerNPCAttr(self, mirrorPlayerID, isReborn):
|
| | | ## 设置镜像玩家NPC属性
|
| | | PropDict, PlusDict = PlayerViewCacheTube.GetPlayerPropPlusDictByID(mirrorPlayerID)
|
| | | PropDict, _ = PlayerViewCacheTube.GetPlayerPropPlusDictByID(mirrorPlayerID)
|
| | | if not PropDict:
|
| | | return
|
| | | curNPC = self.__Instance
|
| | |
| | | GameObj.SetAtkBackDefRate(curNPC, PropDict.get("AtkBackDefRate", 0))
|
| | | GameObj.SetSuckHPPer(curNPC, PropDict.get("SuckHPPer", 0))
|
| | | GameObj.SetSuckHPDefPer(curNPC, PropDict.get("SuckHPDefPer", 0))
|
| | | GameObj.SetCurePer(curNPC, PropDict.get("CurePer", 0))
|
| | | GameObj.SetCureDefPer(curNPC, PropDict.get("CureDefPer", 0))
|
| | |
|
| | | if not isReborn:
|
| | | return
|
| | |
|
| | | skillManager = curNPC.GetSkillManager()
|
| | | SkillInfo = PlusDict.get("SkillInfo", {})
|
| | | for _, skillLVDict in SkillInfo.items():
|
| | | for skillID, _ in skillLVDict.items():
|
| | | skillID = GameWorld.ToIntDef(skillID)
|
| | | skillData = GameWorld.GetGameData().GetSkillBySkillID(skillID)
|
| | | if not skillData:
|
| | | continue
|
| | | skillManager.LearnSkillByID(skillID)
|
| | | |
| | | learnSkillIDList = []
|
| | | for index in range(0, skillManager.GetSkillCount()):
|
| | | useSkill = skillManager.GetSkillByIndex(index)
|
| | | learnSkillIDList.append(useSkill.GetSkillID())
|
| | | GameWorld.DebugLog("设置镜像玩家: objID=%s,NPCID=%s,mirrorPlayerID=%s,maxHP=%s,learnSkillIDList=%s" |
| | | % (curNPC.GetID(), curNPC.GetNPCID(), mirrorPlayerID, GameObj.GetMaxHP(curNPC), learnSkillIDList))
|
| | | GameWorld.DebugLog("设置镜像玩家: objID=%s,NPCID=%s,mirrorPlayerID=%s,maxHP=%s" |
| | | % (curNPC.GetID(), curNPC.GetNPCID(), mirrorPlayerID, GameObj.GetMaxHP(curNPC)))
|
| | | return
|
| | |
|
| | | def SetHelpBattleRobotRebornAttr(self, fightPower):
|
| | |
| | |
|
| | | def RefurbishPetAttr(curPet):
|
| | | ##刷新宠物的属性,仅支持召唤兽,废弃原 IPY_GameWorld.gnotPet
|
| | | if not IsPetNPC(curPet):
|
| | | return
|
| | | petOwner = GetPetNPCOwner(curPet)
|
| | | if not petOwner:
|
| | | return
|
| | |
| | | return
|
| | | rolePetSkillManager.LearnSkillByID(leSkillID)
|
| | |
|
| | | PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(rolePet)
|
| | | #PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(rolePet)
|
| | | #rolePet.Sync_PetInfo()
|
| | | #rolePet.Sync_SkillList()
|
| | | return
|
| | |
| | | ChConfig.TYPE_Calc_AttrGameExpRate:GameWorld.GetGameWorld().GetExpRate(),
|
| | | ChConfig.TYPE_Calc_AttrPetExpRate:GameWorld.GetGameWorld().GetExpRate(),
|
| | | ChConfig.TYPE_Calc_HitSucessRate:ChConfig.Def_MaxRateValue,
|
| | | ChConfig.TYPE_Calc_CurePer:ChConfig.Def_MaxRateValue,
|
| | | #ChConfig.TYPE_Calc_CurePer:ChConfig.Def_MaxRateValue,
|
| | | ChConfig.TYPE_Calc_YinjiTime:IpyGameDataPY.GetFuncCfg('Yinji', 1), # 每X秒自动消失一个印记
|
| | | }
|
| | |
|
| | |
| | | # 闪避成功率
|
| | | def GetMissSucessRate(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MissSucessRate)
|
| | | def SetMissSucessRate(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_MissSucessRate, value)
|
| | |
|
| | | # 治疗加成 默认百分百
|
| | | def GetCurePer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_CurePer)
|
| | | def SetCurePer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_CurePer, value)
|
| | |
|
| | | # 加深受到伤害百分比
|
| | | def GetBeHurtPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_BeHurtPer)
|
| | |
| | | curPlayerPropDict["SuckHPDefPer"] = GameObj.GetSuckHPDefPer(curPlayer) # 抗吸血比率
|
| | | curPlayerPropDict["AtkBackHP"] = GameObj.GetAtkBackHP(curPlayer) # 攻击回复血量固定值
|
| | | curPlayerPropDict["PVPAtkBackHP"] = PlayerControl.GetPVPAtkBackHP(curPlayer) # PVP攻击回血
|
| | | curPlayerPropDict["CurePer"] = GameObj.GetCurePer(curPlayer) # 强化治疗
|
| | | curPlayerPropDict["CureDefPer"] = GameObj.GetCureDefPer(curPlayer) # 弱化治疗
|
| | |
|
| | | #-----------
|
| | | #扩展属性缓存
|
| | |
| | | Def_Effect_AtkBackDefRate = 212 # 抗反击概率
|
| | | Def_Effect_SuckHPPer = 213 # 吸血比率
|
| | | Def_Effect_SuckHPDefPer = 214 # 抗吸血比率
|
| | | Def_Effect_CurePer = 215 # 强化治疗
|
| | | Def_Effect_CureDefPer = 216 # 弱化治疗
|
| | |
|
| | | #增加%d物理伤害值,其中a值为伤害值
|
| | | Def_Effect_AddAtk = 1005
|
| | |
| | | CDBPlayerRefresh_SuckHPPer, # 吸血比率 252
|
| | | CDBPlayerRefresh_SuckHPDefPer, # 抗吸血比率 253
|
| | | CDBPlayerRefresh_Xiantao, # 仙桃 254
|
| | | ) = range(146, 255)
|
| | | CDBPlayerRefresh_CurePer, # 强化治疗 255
|
| | | CDBPlayerRefresh_CureDefPer, # 弱化治疗 256
|
| | | ) = range(146, 257)
|
| | |
|
| | | TYPE_Price_Gold_Paper_Money = 5 # 金钱类型,(先用礼券,再用金子)
|
| | | TYPE_Price_Family_Contribution = 6 # 战盟贡献度(活跃度转换得来)
|
| | |
| | | [lambda curObj:PlayerControl.GetMissSucessRate(curObj), lambda curObj, value:PlayerControl.SetMissSucessRate(curObj, value), 0, 0, 0], # 命中成功率
|
| | | [lambda curObj:curObj.GetAtkInterval(), lambda curObj, value:curObj.SetAtkInterval(value), IPY_PlayerDefine.CDBPlayerRefresh_AtkInterval, 0, 0], # NPC攻击频率
|
| | | [lambda curObj:PlayerControl.GetFuncDef(curObj), lambda curObj, value:PlayerControl.SetFuncDef(curObj, value), ShareDefine.CDBPlayerRefresh_FuncDef, 1, 0], # 功能层防御
|
| | | [lambda curObj:PlayerControl.GetCurePer(curObj), lambda curObj, value:PlayerControl.SetCurePer(curObj, value), 0, 0, 0], # 治疗加成百分比 默认百分百
|
| | | [lambda curObj:GameObj.GetCurePer(curObj), lambda curObj, value:GameObj.SetCurePer(curObj, value), ShareDefine.CDBPlayerRefresh_CurePer, 1, 0], # 强化治疗
|
| | | [lambda curObj:PlayerControl.GetBeHurtPer(curObj), lambda curObj, value:PlayerControl.SetBeHurtPer(curObj, value), 0, 0, 0], # 加深受到伤害百分比
|
| | | [lambda curObj:PlayerControl.GetHorseAtkPer(curObj), lambda curObj, value:PlayerControl.SetHorseAtkPer(curObj, value), 0, 0, 0], # 坐骑攻击百分比
|
| | | [lambda curObj:PlayerControl.GetStoneBasePer(curObj), lambda curObj, value:PlayerControl.SetStoneBasePer(curObj, value), 0, 0, 0], # 宝石基础属性百分比
|
| | |
| | | [lambda curObj:GameObj.GetAtkBackDefRate(curObj), lambda curObj, value:GameObj.SetAtkBackDefRate(curObj, value), ShareDefine.CDBPlayerRefresh_AtkBackDefRate, 1, 0], # 抗反击概率
|
| | | [lambda curObj:GameObj.GetSuckHPPer(curObj), lambda curObj, value:GameObj.SetSuckHPPer(curObj, value), ShareDefine.CDBPlayerRefresh_SuckHPPer, 1, 0], # 吸血比率
|
| | | [lambda curObj:GameObj.GetSuckHPDefPer(curObj), lambda curObj, value:GameObj.SetSuckHPDefPer(curObj, value), ShareDefine.CDBPlayerRefresh_SuckHPDefPer, 1, 0], # 抗吸血比率
|
| | | [lambda curObj:GameObj.GetCureDefPer(curObj), lambda curObj, value:GameObj.SetCureDefPer(curObj, value), ShareDefine.CDBPlayerRefresh_CureDefPer, 1, 0], # 弱化对方治疗
|
| | | ]
|
| | |
|
| | | ## 通过索引获得属性值
|
| | |
| | | return
|
| | |
|
| | | # 治疗加成
|
| | | curePer = PlayerControl.GetCurePer(curObj) if curObjType == IPY_GameWorld.gotPlayer else ChConfig.Def_MaxRateValue |
| | | addValue = int(addValue*curePer*1.0/ChConfig.Def_MaxRateValue)
|
| | | curePer = GameObj.GetCurePer(curObj) + ChConfig.Def_MaxRateValue
|
| | | curePerReduce = TurnAttack.GetEnemyCureDefPer(curObj) # 弱化治疗,取对方的
|
| | | curePerFinal = max(0, curePer - curePerReduce)
|
| | | addValueFianl = int(addValue*curePerFinal*1.0/ChConfig.Def_MaxRateValue)
|
| | |
|
| | | maxHP = GameObj.GetMaxHP(curObj)
|
| | |
|
| | |
| | | if curHP == maxHP:
|
| | | #广播加血类型
|
| | | if isNotify:
|
| | | AttackCommon.ChangeHPView(curObj, curObj, skillTypeID, addValue, ChConfig.Def_HurtTYpe_Recovery)
|
| | | return
|
| | | AttackCommon.ChangeHPView(curObj, curObj, skillTypeID, addValueFianl, ChConfig.Def_HurtTYpe_Recovery)
|
| | | GameWorld.DebugLog(" 治疗时已满血: curID=%s,skillTypeID=%s,maxHP=%s" % (curObj.GetID(), skillTypeID, maxHP))
|
| | | return addValueFianl
|
| | |
|
| | | remainHP = min(curHP + addValue, maxHP)
|
| | | remainHP = min(curHP + addValueFianl, maxHP)
|
| | |
|
| | | #---玩家处理---
|
| | | if curObjType == IPY_GameWorld.gotPlayer:
|
| | | GameObj.SetHP(curObj, remainHP, not isNotify)
|
| | | FBLogic.OnFBAddHP(curObj, addValue)
|
| | | FBLogic.OnFBAddHP(curObj, addValueFianl)
|
| | |
|
| | | #---NPC处理---
|
| | | elif curObjType == IPY_GameWorld.gotNPC:
|
| | |
| | |
|
| | | #广播加血类型
|
| | | if isNotify:
|
| | | AttackCommon.ChangeHPView(curObj, curObj, skillTypeID, addValue, ChConfig.Def_HurtTYpe_Recovery)
|
| | | |
| | | return
|
| | | AttackCommon.ChangeHPView(curObj, curObj, skillTypeID, addValueFianl, ChConfig.Def_HurtTYpe_Recovery)
|
| | | |
| | | GameWorld.DebugLog(" 治疗: curID=%s,skillTypeID=%s,curePerFinal=%s(%s-%s),addValue=%s,addValueFianl=%s,HP=%s" |
| | | % (curObj.GetID(), skillTypeID, curePerFinal, curePer, curePerReduce, addValue, addValueFianl, remainHP))
|
| | | return addValueFianl
|
| | |
|
| | | ## 直接扣血不走公式
|
| | | # view 是否广播客户端飘血
|
| | |
| | |
|
| | | if addValue <= 0:
|
| | | return
|
| | | SkillCommon.SkillAddHP(defender, curSkill.GetSkillTypeID(), addValue, isEnhanceSkill)
|
| | | addValue = SkillCommon.SkillAddHP(defender, curSkill.GetSkillTypeID(), addValue, isEnhanceSkill)
|
| | | if addValue == None:
|
| | | return
|
| | | if isEnhanceSkill:
|
| | | return True
|
| | |
|
New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package Skill.PassiveBuff.PassiveSkill_5000
|
| | | #
|
| | | # @todo:回合触发
|
| | | # @author hxp
|
| | | # @date 2024-01-17
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 回合触发
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2024-01-17 16:00"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import ChConfig
|
| | |
|
| | | # 进入XX buff状态触发技能
|
| | | def CheckCanHappen(attacker, defender, effect, curSkill):
|
| | | #A-回合编号(0-每回合,>=1-第x回合);B-判断方式(0-等于,1-大于等于,2-小于等于);C-
|
| | | timeLine = attacker.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightTimeline)
|
| | | if not timeLine:
|
| | | return False
|
| | | |
| | | checkTurnNum = effect.GetEffectValue(0)
|
| | | checkType = effect.GetEffectValue(1)
|
| | | if checkTurnNum:
|
| | | turnNum = timeLine / 100
|
| | | if checkType == 0:
|
| | | if turnNum != checkTurnNum:
|
| | | return False
|
| | | elif checkType == 1:
|
| | | if turnNum < checkTurnNum:
|
| | | return False
|
| | | elif checkType == 2:
|
| | | if turnNum > checkTurnNum:
|
| | | return False
|
| | | else:
|
| | | return False
|
| | | |
| | | # 其他逻辑...
|
| | | |
| | | return True
|
| | | |
| | |
| | | 4108:ChConfig.TriggerType_SkillSuccess, # 使用技能成功后不触发技能 处理消耗等问题用 87
|
| | | 4109:ChConfig.TriggerType_SkillValue, # 增加技能伤害固定值 82
|
| | | 4110:ChConfig.TriggerType_ChangeSkillEff, # 改变技能特效
|
| | | 5000:ChConfig.TriggerType_TurnNum, # 回合触发 91
|
| | | }
|
| | | return tdict.get(effectID, -1)
|
| | | #===========================================================================
|
| | |
| | | # 那么ntElf执行人物的伤害计算和被动触发效果
|
| | | # 被动技能只处理玩家,宠物,和灵
|
| | | def FindRealAttacker(attacker):
|
| | | if attacker.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightTimeline):
|
| | | # 回合制下都代表自己
|
| | | return attacker
|
| | | |
| | | if attacker.GetGameObjType() != IPY_GameWorld.gotNPC:
|
| | | # --玩家
|
| | | return attacker
|
| | |
| | |
|
| | | skillAim = GetSkillFireAim(curSkill)
|
| | | affectTag = GetSkillAffectTag(curSkill)
|
| | | GameWorld.DebugLog("释放被动触发技能 : %s- %s"%(skillAim, curSkill.GetSkillID()))
|
| | | GameWorld.DebugLog("释放被动触发技能 : atkID=%s,skillID=%s(%s)" % (attacker.GetID(), curSkill.GetSkillID(), curSkill.GetSkillName()))
|
| | |
|
| | | if skillAim == ChConfig.Def_UseSkillAim_None:
|
| | | if curSkill.GetSkillType() in ChConfig.Def_CanAttackSkill_List and affectTag != ChConfig.Def_UseSkillTag_Self:
|