| | |
| | | import IPY_GameWorld
|
| | | import PlayerControl
|
| | | import NPCCommon
|
| | | #import ItemControler
|
| | | import SkillCommon
|
| | | import EffGetSet
|
| | | import FBLogic
|
| | | import EventShell
|
| | | import ReadChConfig
|
| | | import PetControl
|
| | | import GameMap
|
| | | import PlayerTruck
|
| | | #import PlayerPrestigeSys
|
| | | import PlayerFamily
|
| | | #import BossHurtMng
|
| | | import PassiveBuffEffMng
|
| | | import PlayerSuccess
|
| | | import GameFuncComm
|
| | | import ShareDefine
|
| | | import SkillShell
|
| | | import PlayerVip
|
| | | import FormulaControl
|
| | | import IpyGameDataPY
|
| | | import PyGameData
|
| | |
| | | import ChNPC
|
| | | import BossHurtMng
|
| | | import NPCHurtMgr
|
| | | import ChNetSendPack
|
| | | import TurnAttack
|
| | |
|
| | | import datetime
|
| | | import math
|
| | |
| | | curTagPlayer.GameServer_AddEnemy(curPlayer.GetID(), curPlayer.GetName())
|
| | | return
|
| | |
|
| | |
|
| | | ## 当玩家杀死镖车的时候触发
|
| | | # @param curPlayer 杀人者
|
| | | # @param defender 被杀者
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def OnPlayerKillTruck(curPlayer, curTruck, tick):
|
| | | |
| | | if curPlayer == None or curTruck == None:
|
| | | return
|
| | | |
| | | #区域
|
| | | curPlayerAreaType = GameMap.GetAreaTypeByMapPos(curPlayer.GetPosX(), curPlayer.GetPosY())
|
| | | truckAreaType = GameMap.GetAreaTypeByMapPos(curTruck.GetPosX(), curTruck.GetPosY())
|
| | | |
| | | #自由区域,合法,返回True
|
| | | if curPlayerAreaType == IPY_GameWorld.gatFreePK or truckAreaType == IPY_GameWorld.gatFreePK: |
| | | return
|
| | | |
| | | #家族区域,PK不是同一家族的玩家或其宠物,合法,返回True
|
| | | if curPlayerAreaType == IPY_GameWorld.gatFamilyPK or truckAreaType == IPY_GameWorld.gatFamilyPK:
|
| | | return
|
| | | |
| | | #已经死亡了,不变色
|
| | | if GameObj.GetHP(curPlayer) <= 0:
|
| | | return
|
| | | |
| | | curPlayerNameColor = curPlayer.GetPlayerNameColor()
|
| | | #自己如果不是白名就不变色
|
| | | if curPlayerNameColor != IPY_GameWorld.pncNormal:
|
| | | return
|
| | | |
| | | curTruckNameColor = PlayerTruck.GetTruckNameColor(curTruck)
|
| | | if curTruckNameColor != IPY_GameWorld.pncNormal:
|
| | | #目标玩家不是白名就不变色
|
| | | return
|
| | | |
| | | #灰名(9)
|
| | | #SkillCommon.AddBuffBySkillType(curPlayer , ChConfig.Def_SkillID_Gray , tick)
|
| | | return
|
| | |
|
| | |
|
| | | ## 当玩家杀死玩家的时候触发
|
| | | # @param curPlayer 杀人者
|
| | | # @param defender 被杀者
|
| | |
| | | def OnPlayerKillPlayer(curPlayer, defender, tick):
|
| | |
|
| | | PlayerState.SetPKStateTick(curPlayer, tick)
|
| | | |
| | | #触发击杀玩家事件
|
| | | EventShell.EventResponse_OnKillEnemy(curPlayer, defender)
|
| | | |
| | | #触发被杀事件
|
| | | EventShell.EventResponse_OnEnemyKill(defender, curPlayer)
|
| | |
|
| | | #֪ͨ
|
| | | PlayerControl.NotifyCode(defender, "PK_lhs_318691", [curPlayer.GetName()])
|
| | |
| | | # @return 攻击类型 如 IPY_GameWorld.ghtPhy
|
| | | # @remarks 获取攻击类型
|
| | | def GetBattleType(attack, attackUseSkill):
|
| | | # GetHurtType用法改成 pvp pve标识
|
| | | return IPY_GameWorld.ghtPhy
|
| | | # #---技能攻击, 读表获取攻击类型---
|
| | | # if attackUseSkill != None:
|
| | | # return attackUseSkill.GetHurtType()
|
| | | #
|
| | | # #---普通攻击---
|
| | | #
|
| | | # #玩家算普通攻击
|
| | | # if attack.GetGameObjType() == IPY_GameWorld.gotPlayer:
|
| | | # return IPY_GameWorld.ghtPhy
|
| | | #
|
| | | # #NPC读表取
|
| | | # return attack.GetHurtType()
|
| | | # GetHurtType 个位数用法改成 pvp pve标识,十位数-物攻法攻 IPY_GameWorld.ghtPhy = 1
|
| | | #---技能攻击, 读表获取攻击类型---
|
| | | if attackUseSkill != None:
|
| | | ght = attackUseSkill.GetHurtType() / 10
|
| | | if ght == IPY_GameWorld.ghtMag: # 做配置兼容用,优先验证法伤,否则默认物伤
|
| | | return IPY_GameWorld.ghtMag
|
| | | return IPY_GameWorld.ghtPhy
|
| | | |
| | | #---普通攻击---
|
| | |
|
| | | #玩家算普通攻击
|
| | | if attack.GetGameObjType() == IPY_GameWorld.gotPlayer:
|
| | | return IPY_GameWorld.ghtPhy
|
| | | |
| | | #NPC读表取
|
| | | return attack.GetHurtType()
|
| | |
|
| | | def GetAtkDistType(curObj):
|
| | | ## 获取是近战还是远程,默认近战
|
| | | if curObj.GetGameObjType() != IPY_GameWorld.gotNPC:
|
| | | return ChConfig.AtkDistType_Short
|
| | | |
| | | playerID = curObj.GetDictByKey(ChConfig.Def_Obj_Dict_LineupPlayerID)
|
| | | if not playerID:
|
| | | return ChConfig.AtkDistType_Short
|
| | | |
| | | heroID = curObj.GetDictByKey(ChConfig.Def_Obj_Dict_HeroID)
|
| | | if heroID:
|
| | | heroIpyData = IpyGameDataPY.GetIpyGameData("Hero", heroID)
|
| | | if heroIpyData:
|
| | | return heroIpyData.GetAtkDistType()
|
| | | |
| | | npcID = curObj.GetNPCID()
|
| | | npcDataEx = NPCCommon.GetNPCDataEx(npcID)
|
| | | if npcDataEx:
|
| | | return npcDataEx.GetAtkDistType()
|
| | | |
| | | return ChConfig.AtkDistType_Short
|
| | |
|
| | | ## 输入基础数值,返回增强后的值 - 技能加强
|
| | | # @param value 基础值
|
| | |
| | | return
|
| | |
|
| | | curTeam = curObj.GetTeam()
|
| | | |
| | | #2012-04-23 jiang 攻击镖车只算个人伤害
|
| | | if curTagObj.GetGameObjType() == IPY_GameWorld.gotNPC and \
|
| | | curTagObj.GetGameNPCObjType() == IPY_GameWorld.gnotTruck or curTeam == None:
|
| | | if curTeam == None:
|
| | | #无队伍,添加个人伤害
|
| | | AddHurtValue(curTagObj, curObj.GetPlayerID(), ChConfig.Def_NPCHurtTypePlayer, hurtHP)
|
| | | return True
|
| | |
| | | # @return True or False
|
| | | # @remarks 函数详细说明.
|
| | | def CheckNPCAttackDist(curNPC, curTag, skill):
|
| | | #获取距离
|
| | | dist = GameWorld.GetDist(curNPC.GetPosX(), curNPC.GetPosY(),
|
| | | curTag.GetPosX(), curTag.GetPosY())
|
| | | #普通攻击
|
| | | if skill == None:
|
| | | if dist > curNPC.GetAtkDist():
|
| | | return
|
| | | #技能攻击
|
| | | elif dist > skill.GetAtkDist():
|
| | | return
|
| | | |
| | | #卡牌暂不限制
|
| | | return True
|
| | | # #获取距离
|
| | | # dist = GameWorld.GetDist(curNPC.GetPosX(), curNPC.GetPosY(),
|
| | | # curTag.GetPosX(), curTag.GetPosY())
|
| | | # #普通攻击
|
| | | # if skill == None:
|
| | | # if dist > curNPC.GetAtkDist():
|
| | | # return
|
| | | # #技能攻击
|
| | | # elif dist > skill.GetAtkDist():
|
| | | # return
|
| | | # |
| | | # return True
|
| | |
|
| | | ## 检查被攻击后,特殊Buff消失
|
| | | # @param curTagPlayer 被攻击方
|
| | |
| | | hurtType = ChConfig.Def_HurtType_Normal
|
| | | # 伤害类型结果信息, 默认值{伤害类型:[是否触发, 伤害计算值, 触发时防守方的伤害减免值], ...}
|
| | | hurtTypeResultDict = {
|
| | | ChConfig.Def_HurtType_LuckyHit:[False, 0, 0],
|
| | | #ChConfig.Def_HurtType_LuckyHit:[False, 0, 0],
|
| | | ChConfig.Def_HurtType_SuperHit:[False, 0, 0],
|
| | | ChConfig.Def_HurtType_Parry:[False, 0, 0],
|
| | | ChConfig.Def_HurtType_Zhuxian:[False, 0, 0],
|
| | | ChConfig.Def_HurtType_DeadlyHit:[False, 0, 0],
|
| | | #ChConfig.Def_HurtType_Zhuxian:[False, 0, 0],
|
| | | #ChConfig.Def_HurtType_DeadlyHit:[False, 0, 0],
|
| | | ChConfig.Def_HurtType_ThumpHit:[False, 0, 0],
|
| | | }
|
| | |
|
| | | calcTypeList = []
|
| | | if atkObjType == IPY_GameWorld.gotPlayer:
|
| | | calcTypeList += [ChConfig.Def_HurtType_LuckyHit, ChConfig.Def_HurtType_SuperHit, |
| | | ChConfig.Def_HurtType_Zhuxian, ChConfig.Def_HurtType_DeadlyHit,
|
| | | ChConfig.Def_HurtType_ThumpHit]
|
| | | if defObjType == IPY_GameWorld.gotPlayer:
|
| | | calcTypeList += [ChConfig.Def_HurtType_Parry]
|
| | | # 暂时只计算玩家
|
| | | #calcTypeList = []
|
| | | #if atkObjType == IPY_GameWorld.gotPlayer:
|
| | | # calcTypeList += [ChConfig.Def_HurtType_LuckyHit, ChConfig.Def_HurtType_SuperHit, |
| | | # ChConfig.Def_HurtType_Zhuxian, ChConfig.Def_HurtType_DeadlyHit,
|
| | | # ChConfig.Def_HurtType_ThumpHit]
|
| | | #if defObjType == IPY_GameWorld.gotPlayer:
|
| | | # calcTypeList += [ChConfig.Def_HurtType_Parry]
|
| | | calcTypeList = [ChConfig.Def_HurtType_SuperHit, ChConfig.Def_HurtType_Parry]
|
| | | if not calcTypeList:
|
| | | return hurtType, hurtTypeResultDict
|
| | |
|
| | | # 优先级列表, 互斥列表
|
| | | priorityList, mutexList = ReadChConfig.GetEvalChConfig("CalcHurtTypeInfo")
|
| | | # 优先级列表
|
| | | priorityList = [ChConfig.Def_HurtType_Parry, ChConfig.Def_HurtType_SuperHit]
|
| | | mutexList = [] # 互斥列表
|
| | | happenFunc = {
|
| | | ChConfig.Def_HurtType_LuckyHit:__HurtTypeHappen_LuckyHit,
|
| | | #ChConfig.Def_HurtType_LuckyHit:__HurtTypeHappen_LuckyHit,
|
| | | ChConfig.Def_HurtType_SuperHit:__HurtTypeHappen_SuperHit,
|
| | | ChConfig.Def_HurtType_Parry:__HurtTypeHappen_Parry,
|
| | | #ChConfig.Def_HurtType_Zhuxian:__HurtTypeHappen_Zhuxian,
|
| | | ChConfig.Def_HurtType_DeadlyHit:__HurtTypeHappen_Deadly,
|
| | | ChConfig.Def_HurtType_ThumpHit:__HurtTypeHappen_ThumpHit,
|
| | | #ChConfig.Def_HurtType_DeadlyHit:__HurtTypeHappen_Deadly,
|
| | | #ChConfig.Def_HurtType_ThumpHit:__HurtTypeHappen_ThumpHit,
|
| | | }
|
| | |
|
| | | hadCheckList = [] # 已经处理过的伤害类型列表
|
| | |
| | | '''
|
| | |
|
| | | if IsHappenStateByType(happenState, ChConfig.Def_Skill_HappenState_SuperHit):
|
| | | return True, atkObj.GetSuperHit(), PlayerControl.GetSuperHitReduce(defObj)
|
| | | return True, atkObj.GetSuperHit(), GameObj.GetSuperHitReduce(defObj)
|
| | |
|
| | | aSuperHitRate = atkObj.GetSuperHitRate()
|
| | | dSuperHitRateReduce = PlayerControl.GetSuperHitRateReduce(defObj)
|
| | | dSuperHitRateReduce = GameObj.GetSuperHitRateReduce(defObj)
|
| | | superHitRate = eval(ReadChConfig.GetChConfig("CalcSuperHitRate"))
|
| | | superHitRate += PassiveBuffEffMng.GetValueByPassiveBuffTriggerType(atkObj, defObj, curSkill,
|
| | | ChConfig.TriggerType_Buff_AddSuperHitRate)
|
| | |
| | | if superHitRate <= 0:
|
| | | return
|
| | | if GameWorld.CanHappen(superHitRate):
|
| | | return True, atkObj.GetSuperHit(), PlayerControl.GetSuperHitReduce(defObj)
|
| | | return True, atkObj.GetSuperHit(), GameObj.GetSuperHitReduce(defObj)
|
| | | return
|
| | |
|
| | | def __HurtTypeHappen_Parry(atkObj, defObj, happenState, curSkill):
|
| | |
| | | def __HurtTypeHappen_ThumpHit(atkObj, defObj, happenState, curSkill):
|
| | |
|
| | | if IsHappenStateByType(happenState, ChConfig.Def_Skill_HappenState_ThumpHit):
|
| | | return True, int(atkObj.GetSuperHit()*1.5), PlayerControl.GetSuperHitReduce(defObj)
|
| | | return True, int(atkObj.GetSuperHit()*1.5), GameObj.GetSuperHitReduce(defObj)
|
| | |
|
| | | thumpHitRate = 0
|
| | | thumpHitRate += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, defObj, curSkill,
|
| | |
| | | if thumpHitRate <= 0:
|
| | | return
|
| | | if GameWorld.CanHappen(thumpHitRate):
|
| | | return True, atkObj.GetSuperHit()*2, PlayerControl.GetSuperHitReduce(defObj)
|
| | | return True, atkObj.GetSuperHit()*2, GameObj.GetSuperHitReduce(defObj)
|
| | | return
|
| | |
|
| | |
|
| | |
| | | return
|
| | |
|
| | | if curSkill and curSkill.GetFuncType() not in [ChConfig.Def_SkillFuncType_FbSkill,
|
| | | ChConfig.Def_SkillFuncType_NormalAttack]:
|
| | | ChConfig.Def_SkillFuncType_TurnNormaAttack]:
|
| | | return
|
| | |
|
| | | if attacker.GetDictByKey(ChConfig.Def_PlayerKey_FirstDefender):
|
| | |
| | | #设置宠物剩余血量
|
| | | PetControl.SetPetHP(defObj, remainHP)
|
| | |
|
| | | elif defObj.GetGameNPCObjType() == IPY_GameWorld.gnotTruck:
|
| | | remainHP = max(PlayerTruck.GetTruckDestroyMinHP(defObj), remainHP)
|
| | | GameObj.SetHP(defObj, remainHP)
|
| | | |
| | | elif defObj.GetType() == ChConfig.ntHelpBattleRobot:
|
| | | remainHP = min(dHP, max(GameObj.GetMaxHP(defObj)/2, remainHP)) # 助战机器人剩余血量不能少于一半
|
| | | GameObj.SetHP(defObj, remainHP)
|
| | |
| | | # 计算攻击伤害
|
| | | # maxHurt参数用于模拟计算最大伤害,防范客户端攻击伤害过高
|
| | | def CalcHurtHP(atkObj, defObj, curSkill, atkSkillValue, atkSkillPer, tick, happenState=None, **atkwargs):
|
| | | # 翻滚闪避特殊处理
|
| | | if tick - defObj.GetDictByKey(ChConfig.Def_PlayerKey_SomersaultTime) < 500:
|
| | | return 0, ChConfig.Def_HurtType_Miss
|
| | |
|
| | | multiValue = 1 # 伤害倍值
|
| | | summonAtkPer = 1 # 召唤继承提高基础攻击力,取表
|
| | |
| | |
|
| | | atkObjType = atkObj.GetGameObjType()
|
| | | defObjType = defObj.GetGameObjType()
|
| | |
|
| | | aRealmLV, dRealmLV = GetPVERealmLVs(atkObj, defObj, atkObjType, defObjType) # 获取境界
|
| | | if defObjType == IPY_GameWorld.gotNPC and ChConfig.IsGameBoss(defObj) and dRealmLV > aRealmLV:
|
| | | aRealmIpyData = IpyGameDataPY.GetIpyGameDataNotLog("Realm", aRealmLV)
|
| | | dRealmIpyData = IpyGameDataPY.GetIpyGameDataNotLog("Realm", dRealmLV)
|
| | | aRealmLVLarge = aRealmIpyData.GetLvLarge() if aRealmIpyData else 0
|
| | | dRealmLVLarge = dRealmIpyData.GetLvLarge() if dRealmIpyData else 0
|
| | | if dRealmLVLarge > aRealmLVLarge:
|
| | | if atkObjType == IPY_GameWorld.gotPlayer:
|
| | | GameWorld.DebugLog("BossRealmHint%s-%s"%(dRealmLV, aRealmLV))
|
| | | PlayerControl.NotifyCode(atkObj, 'BossRealmHint', [dRealmLVLarge])
|
| | | |
| | | # 攻击高境界的BOSS 伤害固定为1
|
| | | return 1, ChConfig.Def_HurtType_Normal
|
| | | |
| | | |
| | | atkType = GetBattleType(atkObj, curSkill)
|
| | | happenState = happenState if happenState else SkillShell.GetHappenState(curSkill)
|
| | | happenState += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, defObj, curSkill, ChConfig.TriggerType_HappenState)
|
| | |
|
| | | aLV = atkObj.GetLV() # 攻击方等级
|
| | | dLV = defObj.GetLV() # 防守方等级
|
| | |
|
| | | aHit = atkObj.GetHit()
|
| | | if curSkill and atkObjType == IPY_GameWorld.gotPlayer and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_NormalAttack:
|
| | | aHit = aHit*IpyGameDataPY.GetFuncCfg("FightHappenRate", 2)
|
| | | |
| | | aHitSuccessRate = PlayerControl.GetHitSucessRate(atkObj) if atkObjType == IPY_GameWorld.gotPlayer else ChConfig.Def_MaxRateValue
|
| | | aHitSuccessRate += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, defObj, curSkill, ChConfig.TriggerType_HitSuccess)
|
| | | dMiss = defObj.GetMiss()
|
| | | |
| | | atkID = atkObj.GetID()
|
| | | defID = defObj.GetID()
|
| | | #aLV = atkObj.GetLV() # 攻击方等级
|
| | | #dLV = defObj.GetLV() # 防守方等级
|
| | | |
| | | aHit = GameObj.GetMissDefRate(atkObj)#atkObj.GetHit() # 抗闪避率 - 命中
|
| | | #aHitSuccessRate = PlayerControl.GetHitSucessRate(atkObj) if atkObjType == IPY_GameWorld.gotPlayer else ChConfig.Def_MaxRateValue
|
| | | #aHitSuccessRate += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, defObj, curSkill, ChConfig.TriggerType_HitSuccess)
|
| | | dMiss = GameObj.GetMissRate(defObj)#defObj.GetMiss()
|
| | | dMiss += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(defObj, atkObj, None, ChConfig.TriggerType_MissPer)
|
| | | dMissSuccessRate = PlayerControl.GetMissSucessRate(defObj) if defObjType == IPY_GameWorld.gotPlayer else 0
|
| | | dMissSuccessRate += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(defObj, atkObj, None, ChConfig.TriggerType_MissSuccessPer)
|
| | | #dMissSuccessRate = PlayerControl.GetMissSucessRate(defObj) if defObjType == IPY_GameWorld.gotPlayer else 0
|
| | | #dMissSuccessRate += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(defObj, atkObj, None, ChConfig.TriggerType_MissSuccessPer)
|
| | | skillID = curSkill.GetSkillID() if curSkill else 0
|
| | |
|
| | | |
| | | atkIsBoss = 0 # 攻击方是否boss
|
| | | suppressValueLV = 0 # 等级最终压制值, 由压制规则及相关参数计算得出,可作为伤害公式计算参数使用
|
| | | suppressValueFP = 0 # 战力最终压制值, 由压制规则及相关参数计算得出,可作为伤害公式计算参数使用
|
| | | suppressLV, suppressFightPower = 0, 0 # 压制等级差、战力差
|
| | | suppressReMaxHP = 0 # NPC压制等级生命值, 等级表中NPC等级对应的数据, 压制等级差大于0时才有值
|
| | | suppressNPCFightPower = 0 # 压制NPC战力
|
| | | fbFightPower, fbBaseHurt = 0, 0 # 副本战力, 副本保底伤害
|
| | | #当攻击方为NPC,防守方为玩家时,计算压制等级 及 压制战力
|
| | | if atkObjType == IPY_GameWorld.gotNPC and defObjType == IPY_GameWorld.gotPlayer:
|
| | | |
| | | if curSkill and curSkill.GetFuncType() == ChConfig.Def_SkillFuncType_RealmSuppress:
|
| | | # 境界压制技能不对高等级境界玩家产生攻击
|
| | | aRealmLV, dRealmLV = GetPVERealmLVs(atkObj, defObj, atkObjType, defObjType)
|
| | | if aRealmLV <= dRealmLV:
|
| | | return 0, ChConfig.Def_HurtType_Immune # 免疫
|
| | | |
| | | atkIsBoss = 1 if ChConfig.IsGameBoss(atkObj) else 0
|
| | | if NPCCommon.GetIsLVSuppress(atkObj):
|
| | | suppressLV = max(0, aLV - dLV)
|
| | | if suppressLV:
|
| | | suppressLVIpyData = PlayerControl.GetPlayerLVIpyData(aLV)
|
| | | suppressReMaxHP = 0 if not suppressLVIpyData else suppressLVIpyData.GetReMaxHP()
|
| | | suppressNPCFightPower = NPCCommon.GetSuppressFightPower(atkObj)
|
| | | if suppressNPCFightPower:
|
| | | suppressFightPower = max(0, suppressNPCFightPower - PlayerControl.GetFightPower(defObj))
|
| | | |
| | | mustHit = False
|
| | | helpBattleFormatKey = ""
|
| | | if atkObjType == IPY_GameWorld.gotNPC and atkObj.GetType() == ChConfig.ntHelpBattleRobot:
|
| | | mustHit = True
|
| | | suppressNPCFightPower = NPCCommon.GetSuppressFightPower(atkObj)
|
| | | fbFightPower = GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.FBPD_HelpBattleFBFightPower)
|
| | | fbBaseHurt = GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.FBPD_HelpBattleFBBaseHurt)
|
| | | helpBattleFormatKey = "HelpRobot_Atk"
|
| | | if defObjType == IPY_GameWorld.gotNPC and defObj.GetType() == ChConfig.ntHelpBattleRobot:
|
| | | mustHit = True
|
| | | suppressNPCFightPower = NPCCommon.GetSuppressFightPower(defObj)
|
| | | fbFightPower = GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.FBPD_HelpBattleFBFightPower)
|
| | | fbBaseHurt = GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.FBPD_HelpBattleFBBaseHurt)
|
| | | helpBattleFormatKey = "HelpRobot_Def"
|
| | | |
| | | #命中公式 攻击方类型不同,公式不同
|
| | | hitFormula = ReadChConfig.GetChConfig('CalcCanHit')
|
| | | angerOverflow = 0 # 怒气溢出值
|
| | |
|
| | | turnFightPosInfo = atkObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightPosInfo)
|
| | | mustHit = False
|
| | | if SkillCommon.isXPSkill(curSkill):
|
| | | mustHit = True
|
| | | GameWorld.DebugLog(" XP必命中")
|
| | | angerOverflow = max(GameObj.GetXP(atkObj) - IpyGameDataPY.GetFuncCfg("AngerXP", 2), 0)
|
| | | |
| | | if not mustHit:
|
| | | if IsHappenStateByType(happenState, ChConfig.Def_Skill_HappenState_HitOn):
|
| | | mustHit = True
|
| | | GameWorld.DebugLog(" 技能必命中: skillID=%s" % skillID)
|
| | | |
| | | pow = math.pow
|
| | | #命中公式 攻击方类型不同,公式不同
|
| | | if not mustHit and not PassiveBuffEffMng.GetValueByPassiveBuffTriggerType(atkObj, defObj, curSkill,
|
| | | ChConfig.TriggerType_Buff_MustBeHit):
|
| | | # 技能对指定BOSS无效果的返回MISS
|
| | | if defObjType == IPY_GameWorld.gotNPC and defObj.GetIsBoss() not in ChConfig.Def_SkillAttack_NPCIsBoss \
|
| | | and SkillCommon.GetSkillBattleType(curSkill) == ChConfig.Def_BattleRelationType_CommNoBoss and SkillShell.IsNPCSkillResist(defObj):
|
| | | return 0, ChConfig.Def_HurtType_Miss
|
| | | #if defObjType == IPY_GameWorld.gotNPC and defObj.GetIsBoss() not in ChConfig.Def_SkillAttack_NPCIsBoss \
|
| | | #and SkillCommon.GetSkillBattleType(curSkill) == ChConfig.Def_BattleRelationType_CommNoBoss and SkillShell.IsNPCSkillResist(defObj):
|
| | | # return 0, ChConfig.Def_HurtType_Miss
|
| | |
|
| | | #攻击方处于嘲讽,防守方处于免疫嘲讽者攻击则miss
|
| | | if GameObj.GetPyPlayerState(atkObj, ChConfig.Def_PlayerState_Sneer) and \
|
| | | GameObj.GetPyPlayerState(defObj, ChConfig.Def_PlayerState_MissSneerAtk):
|
| | | #if GameObj.GetPyPlayerState(atkObj, ChConfig.Def_PlayerState_Sneer) and \
|
| | | #GameObj.GetPyPlayerState(defObj, ChConfig.Def_PlayerState_MissSneerAtk):
|
| | | # return 0, ChConfig.Def_HurtType_Miss
|
| | | |
| | | missNum = defObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnMissNum)
|
| | | missRate = eval(IpyGameDataPY.GetFuncCompileCfg("MissCfg", 1))
|
| | | if GameWorld.CanHappen(missRate):
|
| | | return 0, ChConfig.Def_HurtType_Miss
|
| | |
|
| | | #添加是否必命中
|
| | | if not IsHappenStateByType(happenState, ChConfig.Def_Skill_HappenState_HitOn) \
|
| | | and eval(hitFormula) < 0:
|
| | | return 0, ChConfig.Def_HurtType_Miss
|
| | | |
| | |
|
| | | hurtType, hurtTypeResultDict = CalcHurtTypeResult(atkObj, defObj, atkObjType, defObjType, happenState, curSkill)
|
| | | #GameWorld.DebugLog("GetHurtHP hurtType=%s, hurtTypeResultDict=%s" % (hurtType, hurtTypeResultDict))
|
| | | isLuckyHit, aLuckyHit, dLuckyHitReduce = hurtTypeResultDict[ChConfig.Def_HurtType_LuckyHit] # 幸运一击
|
| | |
|
| | | # 重击和暴击互斥,并且使用同一个参数
|
| | | isSuperHit, aSuperHit, dSuperHitReduce = hurtTypeResultDict[ChConfig.Def_HurtType_ThumpHit]
|
| | |
| | | aSuperHit = aSuperHit*(thumpPer + ChConfig.Def_MaxRateValue)/ChConfig.Def_MaxRateValue
|
| | |
|
| | | dDamChanceDef = hurtTypeResultDict[ChConfig.Def_HurtType_Parry][2] # 抵御, 大于0代表触发抵御效果
|
| | | isZhuxianHit, aZhuxianHurtPer, dZhuxianReducePer = hurtTypeResultDict[ChConfig.Def_HurtType_Zhuxian] # 诛仙一击
|
| | | isDeadlyHit, deadlyHitMultiValue, _ = hurtTypeResultDict[ChConfig.Def_HurtType_DeadlyHit] # 致命一击
|
| | |
|
| | | #isZhuxianHit, aZhuxianHurtPer, dZhuxianReducePer = hurtTypeResultDict[ChConfig.Def_HurtType_Zhuxian] # 诛仙一击
|
| | | #isDeadlyHit, deadlyHitMultiValue, _ = hurtTypeResultDict[ChConfig.Def_HurtType_DeadlyHit] # 致命一击
|
| | | |
| | | if PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(defObj, atkObj, None, ChConfig.TriggerType_OneDamage):
|
| | | return 1, hurtType
|
| | | |
| | | wReFightPower = 0
|
| | | worldLV = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
|
| | | if worldLV:
|
| | | wLVIpyData = PlayerControl.GetPlayerLVIpyData(worldLV)
|
| | | wReFightPower = 0 if not wLVIpyData else wLVIpyData.GetReFightPower() # 当前世界等级参考战力
|
| | |
|
| | | # 改变技能伤害
|
| | | atkSkillPer, atkSkillValue = ChangeSkillHurt(atkObj, defObj, curSkill, atkSkillPer, atkSkillValue)
|
| | |
| | |
|
| | | # --- 新增普通攻击的数值和技能攻击的数值,根据类型各自计算
|
| | | if atkObjType == IPY_GameWorld.gotPlayer:
|
| | | if not curSkill or curSkill.GetFuncType() == ChConfig.Def_SkillFuncType_NormalAttack:
|
| | | if not curSkill or curSkill.GetFuncType() == ChConfig.Def_SkillFuncType_TurnNormaAttack:
|
| | | atkSkillPer += PlayerControl.GetNormalHurtPer(atkObj)
|
| | | atkSkillValue += PlayerControl.GetNormalHurt(atkObj)
|
| | | elif curSkill.GetFuncType() in [ChConfig.Def_SkillFuncType_FbSkill, ChConfig.Def_SkillFuncType_FbPassiveSkill]:
|
| | |
| | | PassiveBuffEffMng.OnPassiveBuffTrigger(atkObj, defObj, curSkill, ChConfig.TriggerType_SuperHitSubLayer, tick)
|
| | | elif hurtType == ChConfig.Def_HurtType_ThumpHit:
|
| | | atkSkillValue += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, defObj, curSkill, ChConfig.TriggerType_ThumpSkillValue)
|
| | |
|
| | | if isLuckyHit:
|
| | | # 会心一击时增加会心伤害固定值 |
| | | aLuckyHit += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, defObj, curSkill, ChConfig.TriggerType_LuckyHit)
|
| | | aLuckyHit -= PassiveBuffEffMng.GetValueByPassiveBuffTriggerType(defObj, atkObj, curSkill, ChConfig.TriggerType_BeLuckyHitSubPer)
|
| | | aLuckyHit = max(aLuckyHit, 0)
|
| | | |
| | | |
| | | #参与运算的数值
|
| | | rand = random.random() #种子数 0~1
|
| | |
|
| | | #------- 攻击方
|
| | | aMinAtk = atkObj.GetMinAtk() * summonAtkPer # 攻击方最小攻击
|
| | | aMaxAtk = atkObj.GetMaxAtk() * summonAtkPer # 攻击方最大攻击
|
| | | #aMinAtk = atkObj.GetMinAtk() * summonAtkPer # 攻击方最小攻击
|
| | | aAtk = atkObj.GetMaxAtk() * summonAtkPer # 攻击方最大攻击
|
| | |
|
| | | aIceAtk = atkObj.GetIceAtk() # 冰攻, 元素真伤, 玩家及NPC通用
|
| | | aIceAtk += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, defObj, curSkill, ChConfig.TriggerType_AddIceAtk)
|
| | | #------- 防守方
|
| | | dMinAtk = defObj.GetMinAtk() # 防守方最小攻击
|
| | | dMaxAtk = defObj.GetMaxAtk() # 防守方最大攻击
|
| | | #dMinAtk = defObj.GetMinAtk() # 防守方最小攻击
|
| | | #dAtk = defObj.GetMaxAtk() # 防守方最大攻击
|
| | | dDef = defObj.GetDef() # 防守方防御力
|
| | | dHP = GameObj.GetHP(defObj) # 防守方当前血量
|
| | | dMaxHP = GameObj.GetMaxHP(defObj) # 防守方最大血量
|
| | | #dHP = GameObj.GetHP(defObj) # 防守方当前血量
|
| | | #dMaxHP = GameObj.GetMaxHP(defObj) # 防守方最大血量
|
| | | dIceDef = defObj.GetIceDef() # 冰防, 元素真防, 玩家及NPC通用
|
| | |
|
| | | # 攻击方
|
| | | aNormalAtkPer = 0
|
| | | aFinalHurtPer = GameObj.GetFinalHurtPer(atkObj) # 最外层伤害加成, 可能为负值
|
| | | aFinalHurtPer += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, defObj, curSkill, ChConfig.TriggerType_AttackAddFinalPer)
|
| | | if atkObjType == IPY_GameWorld.gotPlayer:
|
| | | aIgnoreDefRate = atkObj.GetIgnoreDefRate() # 无视防御比率
|
| | | aSkillAtkRate = atkObj.GetSkillAtkRate() # 技能攻击力加成
|
| | |
| | | aNPCHurtAddPer = PlayerControl.GetNPCHurtAddPer(atkObj) # PVE伤害加成
|
| | | aDamagePerPVP = PlayerControl.GetDamagePerPVP(atkObj) # 外层PVP伤害加成
|
| | | aDamagePerPVP += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, defObj, curSkill, ChConfig.TriggerType_AddPVPDamagePer)
|
| | | aFinalHurtPer = PlayerControl.GetFinalHurtPer(atkObj) # 最外层伤害加成, 可能为负值
|
| | | aFinalHurtPer += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, defObj, curSkill, ChConfig.TriggerType_AttackAddFinalPer)
|
| | |
|
| | | aFinalHurt = PlayerControl.GetFinalHurt(atkObj) # 最终固定伤害
|
| | | # 被动增加最终伤害
|
| | |
| | |
|
| | | aOnlyFinalHurt = PlayerControl.GetOnlyFinalHurt(atkObj) # 额外固定伤害
|
| | | aFightPower = PlayerControl.GetFightPower(atkObj)
|
| | | |
| | | |
| | | |
| | | else:
|
| | | aIgnoreDefRate = 0 # 无视防御比率
|
| | | aFinalHurtPer = GameObj.GetPetDamPer(atkObj) # 最外层伤害加成, 可能为负值
|
| | | aSkillAtkRate = NPCCommon.GetSkillAtkRate(atkObj) # 技能攻击力加成
|
| | | if atkObjType == IPY_GameWorld.gotNPC and atkObj.GetGameNPCObjType() == IPY_GameWorld.gnotPet:
|
| | | aSkillAtkRate += atkObj.GetSkillAtkRate()
|
| | |
| | | aDamagePVP = 0 # PVP固定伤害
|
| | | aDamagePVE = 0 # PVE固定伤害
|
| | | aFinalHurt = NPCCommon.GetFinalHurt(atkObj) # 最终固定伤害
|
| | | aOnlyFinalHurt = 0 # 额外固定伤害
|
| | | aFightPower = NPCCommon.GetSuppressFightPower(atkObj)
|
| | |
|
| | | #防守方的类型
|
| | | dNormalAtkDefPer = 0
|
| | | dFinalHurtReducePer = GameObj.GetFinalHurtReducePer(defObj)
|
| | | dFinalHurtReducePer += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(defObj, atkObj, curSkill, ChConfig.TriggerType_dFinalHurtReducePer)
|
| | | if defObjType == IPY_GameWorld.gotPlayer:
|
| | | dIgnoreDefRateReduce = PlayerControl.GetIgnoreDefRateReduce(defObj) # 无视防御比率抗性
|
| | | dSkillAtkRateReduce = PlayerControl.GetSkillAtkRateReduce(defObj) # 技能攻击力减少
|
| | |
| | | dFinalHurtReduce = PlayerControl.GetFinalHurtReduce(defObj) # 最终固定伤害减少
|
| | | dBeHurtPer = PlayerControl.GetBeHurtPer(defObj) # 加深受到伤害百分比
|
| | | dFightPower = PlayerControl.GetFightPower(defObj)
|
| | | dFinalHurtReducePer = PlayerControl.GetFinalHurtReducePer(defObj)
|
| | | dFinalHurtReducePer += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(defObj, atkObj, curSkill, ChConfig.TriggerType_dFinalHurtReducePer)
|
| | |
|
| | | else:
|
| | | dIgnoreDefRateReduce = 0 # 无视防御比率抗性
|
| | |
| | | dFinalHurtReduce = 0 # 最终固定伤害减少
|
| | | dBeHurtPer = 0
|
| | | dFightPower = NPCCommon.GetSuppressFightPower(defObj)
|
| | | dFinalHurtReducePer = 0 # 最终伤害减少百分比 默认0
|
| | |
|
| | | #攻击字典 { 攻击类型 : '公式' }
|
| | | mapID = FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID())
|
| | | hurtDist = ReadChConfig.GetEvalChConfig('CalcAttackValue')
|
| | |
|
| | | if suppressLV:
|
| | | suppressFormulaKeyLV = "SuppressValueLV_%s" % (atkIsBoss)
|
| | | if suppressFormulaKeyLV in hurtDist:
|
| | | suppressLVFormula = hurtDist[suppressFormulaKeyLV]
|
| | | suppressValueLV = eval(FormulaControl.GetCompileFormula(suppressFormulaKeyLV, suppressLVFormula))
|
| | | |
| | | if suppressFightPower:
|
| | | suppressFormulaKeyFP = "SuppressValueFP_%s" % (atkIsBoss)
|
| | | if suppressFormulaKeyFP in hurtDist:
|
| | | suppressFPFormula = hurtDist[suppressFormulaKeyFP]
|
| | | suppressValueFP = eval(FormulaControl.GetCompileFormula(suppressFormulaKeyFP, suppressFPFormula))
|
| | | aPMHurtPer = 0 # 物法增伤
|
| | | dPMHurtReduce = 0 # 物法减伤
|
| | | if atkType == IPY_GameWorld.ghtMag: # 法伤
|
| | | pass
|
| | | else: # 物伤
|
| | | pass
|
| | |
|
| | | # 境界压制规则
|
| | | # 1. 其中一方无境界等级则无效, 如普通NPC
|
| | | # 2. 宠物和召唤兽(如水元素)有效, 取主人
|
| | | # 3. 玩家地境界低于BOSS则伤害固定为1 (在函数入口处已处理)
|
| | | # 4. 其他情况统一境界压制 境界差*2%
|
| | | if aRealmLV == 0 or dRealmLV == 0:
|
| | | SuppressValueRealmRate = 10000
|
| | | else:
|
| | | suppressRealmRateMapKey = "SuppressValueRealm_%s" % mapID
|
| | | if suppressRealmRateMapKey not in hurtDist:
|
| | | suppressRealmRateMapKey = "SuppressValueRealm"
|
| | | SuppressValueRealmRate = int(eval(FormulaControl.GetCompileFormula(suppressRealmRateMapKey, hurtDist[suppressRealmRateMapKey])))
|
| | | |
| | | # 骑宠争夺最终伤害衰减
|
| | | if defObjType == IPY_GameWorld.gotNPC and FamilyRobBoss.IsHorsePetRobBoss(defObj.GetNPCID()):
|
| | | ownerPlayer, npcObjType = GetAttackPlayer(atkObj)
|
| | | |
| | | if ownerPlayer:
|
| | | findBuff = SkillCommon.FindBuffByID(ownerPlayer, ChConfig.Def_SkillID_HorsePetRobBossKillCntBuff)[0]
|
| | | if findBuff:
|
| | | reduceFinalHurtPer = findBuff.GetSkill().GetEffect(0).GetEffectValue(0)
|
| | | aFinalHurtPer -= reduceFinalHurtPer
|
| | | # 所有万分率参数统一除10000.0
|
| | | atkSkillPer /= 10000.0
|
| | | aNormalAtkPer /= 10000.0
|
| | | dNormalAtkDefPer /= 10000.0
|
| | | aFinalHurtPer /= 10000.0
|
| | | dFinalHurtReducePer /= 10000.0
|
| | |
|
| | | # 仙盟boss最终伤害加成
|
| | | if atkObjType == IPY_GameWorld.gotPlayer and mapID == ChConfig.Def_FBMapID_FamilyBossMap:
|
| | | aFinalHurtPer += PlayerControl.GetFamilyBossHurtPer(atkObj)
|
| | | |
| | | if atkObjType == IPY_GameWorld.gotPlayer and defObjType == IPY_GameWorld.gotNPC and ChConfig.IsGameBoss(defObj):
|
| | | killBossCntLimitDict = IpyGameDataPY.GetFuncEvalCfg('KillBossCntLimit') |
| | | limitIndex = GameWorld.GetDictValueByKey(killBossCntLimitDict, defObj.GetNPCID())
|
| | | if limitIndex != None:
|
| | | aFinalHurtPer += PlayerControl.GetBossFinalHurtPer(atkObj)
|
| | | |
| | | atkStateMark = GetObjAtkStateMark(atkObj)
|
| | | defStateMark = GetObjAtkStateMark(defObj)
|
| | | hurtFormulaKey = "%sV%s_%s" % (atkStateMark, defStateMark, atkType)
|
| | | #PVP PVE 之后再扩展
|
| | | #atkStateMark = GetObjAtkStateMark(atkObj)
|
| | | #defStateMark = GetObjAtkStateMark(defObj)
|
| | |
|
| | | suppressLVGroup = 0 # NPC压制等级组编号
|
| | | mapHurtKey = "%s_%s" % (hurtFormulaKey, mapID)
|
| | | if mapHurtKey in hurtDist:
|
| | | hurtFormulaKey = mapHurtKey
|
| | | elif atkStateMark == "E" and defStateMark == "P":
|
| | | suppressLVGroup = NPCCommon.GetIsLVSuppress(atkObj)
|
| | | elif atkStateMark == "P" and defStateMark == "E":
|
| | | suppressLVGroup = NPCCommon.GetIsLVSuppress(defObj)
|
| | | |
| | | if suppressLVGroup:
|
| | | suppressLVHurtKey = "%s_%s" % (hurtFormulaKey, suppressLVGroup)
|
| | | if suppressLVHurtKey in hurtDist:
|
| | | hurtFormulaKey = suppressLVHurtKey
|
| | | GameWorld.DebugLog("伤血计算: atkID=%s,defID=%s,skillID=%s,atkSkillPer=%s,aAtk=%s,dDef=%s,dHP=%s" |
| | | % (atkID, defID, skillID, atkSkillPer, aAtk, dDef, GameObj.GetHP(defObj)))
|
| | |
|
| | | # 助战机器人特殊伤血key
|
| | | if helpBattleFormatKey:
|
| | | hurtFormulaKey = helpBattleFormatKey
|
| | | |
| | | if hurtFormulaKey not in hurtDist:
|
| | | GameWorld.ErrLog("CalcAttackValue.txt 伤害公式未配置, key=%s" % (hurtFormulaKey))
|
| | | return 0, ChConfig.Def_HurtType_Miss
|
| | | |
| | | if atkwargs.get('hurtFormulaKey', None):
|
| | | # 指定公式
|
| | | if "hurtFormulaKey" in atkwargs:
|
| | | aBurnValue = atkwargs.get('burnValue', 0)
|
| | | aBurnPer = atkwargs.get('burnPer', 0)
|
| | | hurtFormulaKey = atkwargs.get('hurtFormulaKey', None)
|
| | |
|
| | | hurtFormula = hurtDist[hurtFormulaKey]
|
| | | |
| | | hurtValue = int(eval(FormulaControl.GetCompileFormula(hurtFormulaKey, hurtFormula)))
|
| | | if isDeadlyHit:
|
| | | hurtValue *= deadlyHitMultiValue
|
| | | |
| | | if atkObjType == IPY_GameWorld.gotPlayer and defObjType == IPY_GameWorld.gotNPC and mapID == ChConfig.Def_FBMapID_CrossBattlefield:
|
| | | multiValue = FBLogic.GetFBPlayerHurtNPCMultiValue(atkObj, defObj)
|
| | | #if hurtFormulaKey == "Burn":
|
| | | # pass
|
| | | #else:
|
| | | hurtValue = eval(IpyGameDataPY.GetFuncCompileCfg("DOTFormula", 1))
|
| | | elif not curSkill:
|
| | | hurtValue = eval(IpyGameDataPY.GetFuncCompileCfg("HurtFormula", 3))
|
| | | GameWorld.DebugLog(" 普攻伤害=%s" % (hurtValue))
|
| | | elif SkillCommon.isTurnNormalAtkSkill(curSkill):
|
| | | hurtValue = eval(IpyGameDataPY.GetFuncCompileCfg("HurtFormula", 1))
|
| | | GameWorld.DebugLog(" 普攻技能伤害=%s" % (hurtValue))
|
| | | elif SkillCommon.isXPSkill(curSkill):
|
| | | hurtValue = eval(IpyGameDataPY.GetFuncCompileCfg("HurtFormula", 2))
|
| | | GameWorld.DebugLog(" 怒气技能伤害=%s" % (hurtValue))
|
| | | else:
|
| | | hurtValue = eval(IpyGameDataPY.GetFuncCompileCfg("HurtFormula", 4))
|
| | | GameWorld.DebugLog(" 其他伤害=%s" % (hurtValue))
|
| | |
|
| | | if multiValue != 1:
|
| | | hurtValue = int(hurtValue * multiValue)
|
| | | |
| | | #hurtValue = min(max(hurtValue, 0), ChConfig.Def_UpperLimit_DWord)
|
| | | hurtValue = int(hurtValue)
|
| | |
|
| | | if hurtType == ChConfig.Def_HurtType_Normal and atkSkillPerYinji > 0:
|
| | | return hurtValue, ChConfig.Def_HurtType_Yinji
|
| | | elif hurtType == ChConfig.Def_HurtType_Normal and SuppressValueRealmRate > 10000:
|
| | | # 存在压制
|
| | | return hurtValue, ChConfig.Def_HurtType_RealmSupress
|
| | |
|
| | | return hurtValue, hurtType
|
| | |
|
| | |
| | | atkObj.SetDict(ChConfig.Def_PlayerKey_LastHurtNPCObjID, defObj.GetID())
|
| | | else:
|
| | | defObj.SetDict(ChConfig.Def_PlayerKey_LastAttackerObjID, atkObj.GetID())
|
| | | |
| | | TurnAttack.AddTurnObjHurtValue(atkObj, defObj, resultHurtType.HurtType, resultHurtType.RealHurtHP, resultHurtType.LostHP, curSkill)
|
| | | |
| | | #if resultHurtType.RealHurtHP:
|
| | | # PassiveBuffEffMng.OnPassiveSkillTrigger(defObj, atkObj, None, ChConfig.TriggerType_BeHurt, tick)
|
| | | |
| | | return
|
| | |
|
| | |
|
| | |
| | | return "P"
|
| | |
|
| | | if objType == IPY_GameWorld.gotNPC:
|
| | | if obj.GetDictByKey(ChConfig.Def_Obj_Dict_LineupPlayerID):
|
| | | return "P"
|
| | | if obj.GetType() == ChConfig.ntRobot:
|
| | | return "Robot"
|
| | | if obj.GetType() == ChConfig.ntHelpBattleRobot:
|
| | |
| | | return (taget.GetPlayerAction() == IPY_GameWorld.paDie)
|
| | |
|
| | | elif tagetType == IPY_GameWorld.gotNPC:
|
| | | if taget.GetGameNPCObjType() == IPY_GameWorld.gnotTruck:
|
| | | #镖车判定是否可以攻击( 损坏的镖车是无敌的 GetCanAttack = 0 )
|
| | | return (not taget.GetCanAttack())
|
| | | |
| | | return (taget.GetCurAction() == IPY_GameWorld.laNPCDie)
|
| | |
|
| | | GameWorld.Log('###GetIsDead = %s ' % (tagetType))
|
| | |
| | | #敌人关系,可PK,可加减益buff
|
| | | return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
|
| | |
|
| | | #def GetPeaceBuff(curPlayer):
|
| | | # return SkillCommon.FindBuffByID(curPlayer, ChConfig.Def_SkillID_Peace)[0]
|
| | |
|
| | | ## 获取玩家和镖车的关系
|
| | | # @param curPlayer: 攻击方实例
|
| | | # @param curTagTruck: 镖车实例
|
| | | # @return: 可否攻击
|
| | | def GetPlayerAndTruckRelation(curPlayer, curTagTruck):
|
| | | |
| | | if curPlayer == None or curTagTruck == None:
|
| | | return ChConfig.Type_Relation_None, ChConfig.Def_PASysMessage_None
|
| | | |
| | | #攻击方玩家区域
|
| | | curPlayerAreaType = GameMap.GetAreaTypeByMapPos(curPlayer.GetPosX(), curPlayer.GetPosY())
|
| | | |
| | | #镖车所在区域
|
| | | truckAreaType = GameMap.GetAreaTypeByMapPos(curTagTruck.GetPosX(), curTagTruck.GetPosY())
|
| | | |
| | | #攻击方或镖车在安全区
|
| | | if curPlayerAreaType == IPY_GameWorld.gatSafe or truckAreaType == IPY_GameWorld.gatSafe:
|
| | | return ChConfig.Type_Relation_None, ChConfig.Def_PASysMessage_IsSafeArea
|
| | | |
| | | #攻守双方不在同一区域,不可PK,不可加增益buff
|
| | | if curPlayerAreaType != truckAreaType:
|
| | | return ChConfig.Type_Relation_None, ChConfig.Def_PASysMessage_CurAreaNotPK
|
| | | |
| | | curTagPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curTagTruck)
|
| | | if curTagPlayer:
|
| | | if curPlayer.GetID() == curTagPlayer.GetID():
|
| | | #不能攻击自己的镖车
|
| | | return ChConfig.Type_Relation_None, ChConfig.Def_PASysMessage_None
|
| | |
|
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Truck):
|
| | | #Truck_hgg_31379:功能未开启,不能攻击镖车
|
| | | PlayerControl.NotifyCode(curPlayer, "Truck_hgg_31379", [GameFuncComm.GetFuncLimitLV(ShareDefine.GameFuncID_Truck)]) |
| | | return ChConfig.Type_Relation_None, ChConfig.Def_PASysMessage_None
|
| | | |
| | | curTruckOTeamID = PlayerTruck.GetTruckTeamID(curTagTruck)
|
| | | curTruckFamilyID = PlayerTruck.GetTruckFamilyID(curTagTruck)
|
| | | curTruckNameColor = PlayerTruck.GetTruckNameColor(curTagTruck)
|
| | | |
| | | #普通区域
|
| | | if curPlayerAreaType == IPY_GameWorld.gatNormal:
|
| | | #和平模式
|
| | | if curPlayer.GetAttackMode() == IPY_GameWorld.amPeace :
|
| | | #如镖车主人不是红名也不是黄名,则给系统提示:不可攻击
|
| | | if curTruckNameColor not in [IPY_GameWorld.pncGray, IPY_GameWorld.pncRed]:
|
| | | return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_CurAreaNotPK
|
| | | |
| | | curPlayerTeamID = curPlayer.GetTeamID() # 攻击方队伍ID
|
| | | curPlayerFamilyID = curPlayer.GetFamilyID() # 攻击方家族ID
|
| | | if curPlayerTeamID and curTruckOTeamID and curTruckOTeamID == curPlayerTeamID:
|
| | | #攻击方和镖车主人同队伍
|
| | | return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_NotAttackTeam
|
| | | |
| | | if curTruckFamilyID and curPlayerFamilyID and curTruckFamilyID == curPlayerFamilyID:
|
| | | #攻击方和镖车主人同家族
|
| | | return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_NotAttackFamily
|
| | | |
| | | return ChConfig.Type_Relation_Enemy, ChConfig.Def_PASysMessage_None
|
| | |
|
| | | def IsPKProtectTime():
|
| | | ## 是否是PK保护时间段
|
| | | pkProtecTimeList = IpyGameDataPY.GetFuncEvalCfg("PKConfig", 1)
|
| | |
| | | if GameObj.GetHP(curObjDetel) > 0:
|
| | | return
|
| | |
|
| | | if TurnAttack.SetTurnObjKilled(curObjDetel, atkObj):
|
| | | return
|
| | | |
| | | #---玩家处理---
|
| | | if curObjDetel.GetGameObjType() == IPY_GameWorld.gotPlayer:
|
| | | playerControl = PlayerControl.PlayerControl(curObjDetel)
|
| | |
| | | defendPkValue = defender.GetPKValue() # 防守者pk值
|
| | | defendFightPower = PlayerControl.GetFightPower(defender) # 防守者战斗力
|
| | |
|
| | | # #今日杀人获得威望值
|
| | | # prestigeByDay = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_KillPlayerAddPrestige)
|
| | | # |
| | | # addPrestige = int(eval(ReadChConfig.GetChConfig("KillPlayerPrestige")))
|
| | | # if addPrestige > 0:
|
| | | # maxPrestigeByDay = ReadChConfig.GetEvalChConfig("KillPlayerMaxPrestigeByDay")
|
| | | # if prestigeByDay < maxPrestigeByDay:
|
| | | # #没超过每日杀人获得威望最大值, 给予威望
|
| | | # addPrestige = min(addPrestige, maxPrestigeByDay - prestigeByDay)
|
| | | # PlayerPrestigeSys.AddPrestigeOffcialLV(curPlayer, addPrestige, ChConfig.Def_AddPrestige_Kill)
|
| | | # PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_KillPlayerAddPrestige, prestigeByDay + addPrestige)
|
| | | # else:
|
| | | # #GeRen_wll_0:今日获得威望已达上限
|
| | | # PlayerControl.NotifyCode(curPlayer, "PK_liubo_372238")
|
| | | # |
| | | # elif addPrestige < 0:
|
| | | # GameWorld.ErrLog("KillPlayerPrestige计算结果:%s" % addPrestige)
|
| | | |
| | | #恶名值
|
| | | curPlayer.SetInfamyValue(min(attackNotoriety + ChConfig.Def_KillValue_Notoriety,
|
| | | ChConfig.Def_UpperLimit_DWord))
|
| | |
|
| | | #活跃度
|
| | | # activeByDay = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_KillPlayerAddActive)
|
| | | # addActiveValue = int(eval(ReadChConfig.GetChConfig("KillPlayerFamilyAvtive")))
|
| | | # if addActiveValue > 0 and curPlayer.GetFamilyID() != 0:
|
| | | # maxAvtiveByDay = ReadChConfig.GetEvalChConfig("KillPlayerMaxAvtiveByDay")
|
| | | # if activeByDay < maxAvtiveByDay:
|
| | | # addActiveValue = min(addActiveValue, maxAvtiveByDay - activeByDay)
|
| | | # PlayerFamily.AddPlayerFamilyActiveValue(curPlayer, addActiveValue, True, \
|
| | | # PlayerFamily.Def_AddFAVReason_KillPlayer)
|
| | | # PlayerControl.NotifyCode(curPlayer, "GeRen_admin_425673", [addActiveValue])
|
| | | # PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_KillPlayerAddActive, activeByDay + addActiveValue)
|
| | | # else:
|
| | | # PlayerControl.NotifyCode(curPlayer, "PK_liubo_161795") |
| | | #
|
| | | # elif addActiveValue < 0:
|
| | | # GameWorld.ErrLog("KillPlayerFamilyAvtive计算结果:%s" % addActiveValue)
|
| | |
|
| | | #---防守者
|
| | | #威望值
|
| | | # lostPrestige = int(eval(ReadChConfig.GetChConfig("BeKilledPlayerPrestige")))
|
| | | # if lostPrestige > 0:
|
| | | # PlayerPrestigeSys.SubPrestigeOffcialLV(defender, lostPrestige, ChConfig.Def_SubPrestige_BeKilled)
|
| | | # elif lostPrestige < 0:
|
| | | # GameWorld.ErrLog("BeKilledPlayerPrestige计算结果:%s" % lostPrestige)
|
| | | |
| | | #恶名值
|
| | | defender.SetInfamyValue(max(defendNotoriety - ChConfig.Def_BeKilledValue_Notoriety, 0))
|
| | | return
|
| | |
| | | srcID, srcType = 0, 0
|
| | | if srcObj:
|
| | | srcID, srcType = srcObj.GetID(), srcObj.GetGameObjType()
|
| | | turnFight = TurnAttack.GetTurnFightMgr().getNPCTurnFight(curObj.GetID())
|
| | | if turnFight:
|
| | | clientPack = ChNetSendPack.tagObjPropertyRefreshView()
|
| | | clientPack.ObjID = curObj.GetID()
|
| | | clientPack.ObjType = curObj.GetGameObjType()
|
| | | clientPack.SkillID = skillID
|
| | | clientPack.DiffValue = changeHP % ShareDefine.Def_PerPointValue
|
| | | clientPack.DiffValueEx = changeHP / ShareDefine.Def_PerPointValue
|
| | | clientPack.AttackType = changType
|
| | | clientPack.SrcObjID = srcID
|
| | | clientPack.SrcObjType = srcType
|
| | | clientPack.HP = curObj.GetHP()
|
| | | clientPack.HPEx = curObj.GetHPEx()
|
| | | turnFight.addBatPack(clientPack)
|
| | | return
|
| | | curObj.ChangeHPView(skillID, changeHP % ShareDefine.Def_PerPointValue, changeHP / ShareDefine.Def_PerPointValue,
|
| | | changType, srcID, srcType, curObj.GetHP(), curObj.GetHPEx())
|
| | | return |