| | |
| | | import PlayerControl
|
| | | import NPCCommon
|
| | | import ChConfig
|
| | | import ChEquip
|
| | | import SkillCommon
|
| | | import AttackLogic
|
| | | import ItemControler
|
| | |
| | | import OperControlManager
|
| | | import DataRecordPack
|
| | | import ChItem
|
| | | import ReadChConfig
|
| | | import GameObj
|
| | | import ChPyNetSendPack
|
| | | import ChNetSendPack
|
| | |
| | | import PlayerGeTui
|
| | | #---------------------------------------------------------------------
|
| | | g_skillHurtList = IPY_GameWorld.IPY_HurtList()
|
| | |
|
| | |
|
| | | # 特殊处理搜索范围,一般用于副本
|
| | | Def_SearchMap_NPC = 200 # 本线全图搜索NPC
|
| | | Def_SearchMap_Player = 201 # 本线全图搜索玩家
|
| | |
|
| | | #伤害结构体
|
| | | #hurtTypeIndance = None
|
| | |
| | | # global hurtTypeIndance
|
| | | # hurtTypeIndance = indance
|
| | | #
|
| | | ### 获得本次攻击是否是致命一击
|
| | | ### 获得本次攻击是否是暴击
|
| | | ## @param 无参数
|
| | | ## @return True or False
|
| | | ## @remarks 函数详细说明.
|
| | |
| | |
|
| | | return None
|
| | |
|
| | |
|
| | | |
| | | # 触发型技能根据伤血类型触发被动技能,群攻只触发一次,放在伤血列表被清之前
|
| | | # 只处理 isEnhanceSkill的情况,对应 OnHurtTypeTriggerSkill
|
| | | def OnHurtTypeTriggerPassiveSkill(attacker, target, curSkill, tick):
|
| | | AttackCommon.ClearFirstDefender(attacker)
|
| | | |
| | | skillHurtLists = [] # 内部触发清除g_skillHurtList
|
| | | for i in xrange(g_skillHurtList.GetHurtCount()):
|
| | | hurtObj = g_skillHurtList.GetHurtAt(i)
|
| | | if not hurtObj:
|
| | | continue
|
| | | |
| | | skillHurtLists.append([hurtObj.GetObjID(), hurtObj.GetObjType(), hurtObj.GetAttackType()])
|
| | | |
| | | #只对第一目标造成某伤害类型时触发技能, 需先存储 skillHurtLists
|
| | | OnHurtTypeTriggerSkillFirstObj(attacker, curSkill, tick)
|
| | | |
| | | |
| | | for hurtList in skillHurtLists:
|
| | | defender = GameWorld.GetObj(hurtList[0], hurtList[1])
|
| | | if not defender:
|
| | | continue
|
| | | |
| | | if GameObj.GetHP(defender) > 0:
|
| | | continue
|
| | | |
| | | if hurtList[1] == IPY_GameWorld.gotPlayer:
|
| | | if hurtList[2] == ChConfig.Def_HurtType_Zhansha:
|
| | | defender.SetDict(ChConfig.Def_PlayerKey_Zhansha, 1)
|
| | | elif hurtList[2] == ChConfig.Def_HurtType_ZhognjiZhansha:
|
| | | defender.SetDict(ChConfig.Def_PlayerKey_Zhansha, 2)
|
| | | |
| | | # 濒死状态触发技能, 不能在GetHurtHP内部触发技能,否则会导致原技能的伤血列表异常
|
| | | PassiveBuffEffMng.OnPassiveSkillTrigger(defender, attacker, None, ChConfig.TriggerType_WillDead, tick)
|
| | | PassiveBuffEffMng.OnPassiveBuffTrigger(defender, attacker, None, ChConfig.TriggerType_WillDead, tick)
|
| | | if hurtList[2] in [ChConfig.Def_HurtType_Zhansha, ChConfig.Def_HurtType_ZhognjiZhansha]:
|
| | | defender.SetDict(ChConfig.Def_PlayerKey_Zhansha, 0)
|
| | |
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | ## 攻击通用函数
|
| | | # @param attacker 攻击Obj
|
| | |
| | | # @param isEnhanceSkill 是否为附加技能
|
| | | # @return True 攻击成功 None 不可攻击
|
| | | # @remarks 通过调用 Obj_Attack_Obj.GetTagRelation 获取返回值
|
| | | def Attack(attacker, defender, useSkill, tick, skillPercent=1, skillEnhance=0, attackTime=1, isEnhanceSkill=False):
|
| | | def Attack(attacker, defender, useSkill, tick, skillPercent=10000, skillEnhance=0, attackTime=1, isEnhanceSkill=False):
|
| | | global g_skillHurtList
|
| | |
|
| | | if attacker.GetGameObjType() == IPY_GameWorld.gotNPC:
|
| | |
| | | __AttackSuccess(attacker, attackerHP, defender, useSkill, tick)
|
| | | #调用触发附加技能
|
| | | SkillShell.DoLogic_UseEnhanceSkill(attacker, defender, useSkill, tick, destX, destY)
|
| | | else:
|
| | | OnHurtTypeTriggerPassiveSkill(attacker, defender, useSkill, tick)
|
| | |
|
| | | #因攻击结束动作中,法宝攻击将导致目标死亡。要判定后在次调用,避免2次->AttackResult
|
| | | if AttackCommon.GetIsDead(defender):
|
| | |
| | | #关系
|
| | | relation = GetTagRelation(attacker, defender, curSkill, tick)
|
| | | return relation[0] == ChConfig.Type_Relation_Friend
|
| | | elif curSkillUseTag == ChConfig.Def_UseSkillTag_AppointNPC:
|
| | | if defender and GameObj.GetHP(defender) > 0 :
|
| | | return True
|
| | | return False
|
| | |
|
| | | return __CheckCanAttack(attacker , defender , curSkill , tick)
|
| | |
|
| | |
| | | # 防守者自己通知
|
| | | __Sync_AttackResult(defender, defender, curSkill)
|
| | |
|
| | |
|
| | | OnHurtTypeTriggerPassiveSkill(attacker, defender, curSkill, tick)
|
| | | DoLogic_AttackResult(attacker, defender, curSkill, tick)
|
| | |
|
| | | return True
|
| | |
| | | SkillShell.SkillTrigSkill(attacker, defObj, curSkill, enhanceSkillID, tick)
|
| | | else:
|
| | | SkillShell.SkillTrigSkill(attacker, defender, curSkill, enhanceSkillID, tick)
|
| | |
|
| | | else:
|
| | | OnHurtTypeTriggerPassiveSkill(attacker, defender, curSkill, tick)
|
| | | |
| | | for defObj in attackList:
|
| | |
|
| | | #因攻击结束动作中,法宝攻击将导致目标死亡。要判定后在次调用,避免2次->AttackResult
|
| | |
| | | if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:
|
| | | return None
|
| | |
|
| | | useSkillTagID = attacker.GetUseSkillTagID()
|
| | | useSkillTagType = attacker.GetUseSkillTagType()
|
| | | |
| | | curTag = GameWorld.GetObj(useSkillTagID, useSkillTagType)
|
| | | curTag = None
|
| | | if attacker.GetAttackMode() == IPY_GameWorld.amContest:
|
| | | # 单一目标锁定模式
|
| | | curTag = GameWorld.GetObj(attacker.GetDictByKey(ChConfig.Def_PlayerKey_SelectObjID), |
| | | attacker.GetDictByKey(ChConfig.Def_PlayerKey_SelectObjType))
|
| | | |
| | | if not curTag:
|
| | | return None
|
| | | useSkillTagID = attacker.GetUseSkillTagID()
|
| | | useSkillTagType = attacker.GetUseSkillTagType()
|
| | | |
| | | curTag = GameWorld.GetObj(useSkillTagID, useSkillTagType)
|
| | | if not curTag:
|
| | | return None
|
| | |
|
| | | if SkillShell.GetSkillAffectTag(curSkill) == ChConfig.Def_UseSkillTag_CanAttackNPC:
|
| | | if NPCCommon.GetNpcObjOwnerIsPlayer(curTag):
|
| | |
| | | if not curTag:
|
| | | continue
|
| | |
|
| | | if curSkillUseTag == ChConfig.Def_UseSkillTag_CanAttackNPC:
|
| | | if NPCCommon.GetNpcObjOwnerIsPlayer(curTag):
|
| | | #npc主人是玩家不能攻击
|
| | | #非自定义场景才需要判断
|
| | | if not attacker.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
|
| | | if curSkillUseTag == ChConfig.Def_UseSkillTag_CanAttackNPC:
|
| | | if NPCCommon.GetNpcObjOwnerIsPlayer(curTag):
|
| | | #npc主人是玩家不能攻击
|
| | | continue
|
| | | |
| | | if GameWorld.GetDist(curTag.GetPosX(), curTag.GetPosY(), attacker.GetPosX(), attacker.GetPosY()) > attacker.GetSight():
|
| | | # 最远距离防范
|
| | | GameWorld.DebugLog("#--- 最远距离防范[%s-%s]"%(attacker.GetID(), curTag.GetID()))
|
| | | continue
|
| | | |
| | | if GameWorld.GetDist(curTag.GetPosX(), curTag.GetPosY(), attacker.GetPosX(), attacker.GetPosY()) > attacker.GetSight():
|
| | | # 最远距离防范
|
| | | GameWorld.DebugLog("#--- 最远距离防范[%s-%s]"%(attacker.GetID(), curTag.GetID()))
|
| | | continue
|
| | | |
| | | if CheckFunc != None:
|
| | | #检查是否受影响
|
| | | if not CheckFunc(attacker, curTag, curSkill, tick):
|
| | | continue
|
| | | |
| | | if CheckFunc != None:
|
| | | #检查是否受影响
|
| | | if not CheckFunc(attacker, curTag, curSkill, tick):
|
| | | continue
|
| | |
|
| | | resultList.append(curTag)
|
| | |
|
| | |
| | | GameWorld.ErrLog("Def_Dict_UseSkillTag_ObjType 没有对应项 %s" % curSkillUseTag)
|
| | | return resultList
|
| | |
|
| | | gameMap = GameWorld.GetMap()
|
| | | |
| | | if skillMatrix == None:
|
| | | #作用范围 作用矩阵
|
| | | attackDis = curSkill.GetAtkRadius()
|
| | | skillMatrix = ChConfig.MatrixDict.get(attackDis)
|
| | | if skillMatrix == None:
|
| | | skillMatrix = ChConfig.MatrixDict.get(attackDis, None)
|
| | | if skillMatrix == None and attackDis not in [Def_SearchMap_Player, Def_SearchMap_NPC]:
|
| | | GameWorld.ErrLog("CheckAreaObj skillId=%s, attakDis=%s not in matrixDict=%s"
|
| | | % (curSkill.GetSkillID(), attackDis, ChConfig.MatrixDict))
|
| | | return resultList
|
| | |
| | | #技能攻击最大数量
|
| | | hurtCount = SkillCommon.GetSkillArea_Atk_Count(attacker, curSkill)
|
| | |
|
| | | ownerTag = None
|
| | | ownerPlayerID = 0
|
| | | isSummonNPCAtker = attacker.GetGameObjType() == IPY_GameWorld.gotNPC and NPCCommon.IsSummonNPC(attacker)
|
| | | if isSummonNPCAtker:
|
| | |
| | | if attackAim:
|
| | | hurtCount -= 1
|
| | | resultList.append(attackAim)
|
| | | |
| | | |
| | | if skillMatrix:
|
| | | # 按范围搜索
|
| | | resultList = ServerByPos(attacker, curSkill, tick, skillMatrix, hurtCount, |
| | | srcPosX, srcPosY, hurtTypeList, attackAim, curSkillUseTag, CheckFunc,
|
| | | ownerPlayerID, isSummonNPCAtker, resultList)
|
| | | elif attackDis == Def_SearchMap_Player:
|
| | | # 搜索本地图当前线路玩家
|
| | | ServerByMapPlayer(attacker, curSkill, tick, hurtTypeList, attackAim, curSkillUseTag, CheckFunc,
|
| | | ownerPlayerID, isSummonNPCAtker, resultList, hurtCount)
|
| | | elif attackDis == Def_SearchMap_NPC:
|
| | | # 搜索本地图当前线路NPC
|
| | | ServerByMapNPC(attacker, curSkill, tick, hurtTypeList, attackAim, curSkillUseTag, CheckFunc,
|
| | | ownerPlayerID, isSummonNPCAtker, resultList, hurtCount)
|
| | | return resultList
|
| | |
|
| | |
|
| | | # 按范围搜索目标对象
|
| | | def ServerByPos(attacker, curSkill, tick, skillMatrix, hurtCount, |
| | | srcPosX, srcPosY, hurtTypeList, attackAim, curSkillUseTag, CheckFunc,
|
| | | ownerPlayerID, isSummonNPCAtker, resultList):
|
| | | ownerTag = None
|
| | | gameMap = GameWorld.GetMap()
|
| | | for curPos in skillMatrix:
|
| | | #伤害次数到了
|
| | | if hurtCount <= 0:
|
| | |
| | | break
|
| | |
|
| | | curObj = mapObj.GetObjByIndex(i)
|
| | | curObjType = curObj.GetGameObjType()
|
| | | |
| | | #不在影响对象列表中
|
| | | if curObjType not in hurtTypeList:
|
| | | continue
|
| | | |
| | | #攻击对象
|
| | | curTag = GameWorld.GetObj(curObj.GetID(), curObjType)
|
| | | curTag, ownerTag = __SearchCheck(attacker, curSkill, tick, curObj, hurtTypeList, attackAim, curSkillUseTag, |
| | | CheckFunc, ownerPlayerID, isSummonNPCAtker, resultList)
|
| | | if not curTag:
|
| | | if ownerTag:
|
| | | hurtCount -= 1
|
| | | continue
|
| | |
|
| | | if attackAim and attackAim.GetID() == curTag.GetID():
|
| | | # 不在攻击主目标
|
| | | continue
|
| | | |
| | | #群攻技能不能对镖车释放, 永恒版本屏蔽此限制
|
| | | #if curObjType == IPY_GameWorld.gotNPC and curTag.GetGameNPCObjType() == IPY_GameWorld.gnotTruck:
|
| | | # continue
|
| | | |
| | | if curSkillUseTag == ChConfig.Def_UseSkillTag_CanAttackNPC:
|
| | | if NPCCommon.GetNpcObjOwnerIsPlayer(curTag):
|
| | | #npc主人是玩家不能攻击
|
| | | continue
|
| | | |
| | | if CheckFunc != None:
|
| | | #检查是否受影响
|
| | | if not CheckFunc(attacker, curTag, curSkill, tick):
|
| | | continue
|
| | | |
| | | # 如果攻击者是召唤兽 且 攻击的是主人玩家,则把主人放在最后面一个处理伤害目标,防止先处理后如果主人死亡将导致后续的逻辑异常
|
| | | if ownerPlayerID > 0 and curObjType == IPY_GameWorld.gotPlayer and isSummonNPCAtker and ownerPlayerID == curObj.GetID():
|
| | | ownerTag = curTag
|
| | | continue
|
| | | hurtCount -= 1
|
| | | resultList.append(curTag)
|
| | | |
| | | if ownerTag:
|
| | | resultList.append(ownerTag)
|
| | | return resultList
|
| | |
|
| | |
|
| | | def __SearchCheck(attacker, curSkill, tick, curObj, hurtTypeList, attackAim, curSkillUseTag, CheckFunc,
|
| | | ownerPlayerID, isSummonNPCAtker, resultList, curTag=None):
|
| | | curObjType = curObj.GetGameObjType()
|
| | | |
| | | #不在影响对象列表中
|
| | | if curObjType not in hurtTypeList:
|
| | | return None, None
|
| | | |
| | | if attacker.GetSightLevel() != curObj.GetSightLevel():
|
| | | return None, None
|
| | | |
| | | #攻击对象
|
| | | if not curTag:
|
| | | curTag = GameWorld.GetObj(curObj.GetID(), curObjType)
|
| | | if not curTag:
|
| | | return None, None
|
| | | |
| | | if attackAim and attackAim.GetID() == curTag.GetID():
|
| | | # 不在攻击主目标
|
| | | return None, None
|
| | | |
| | | if curSkillUseTag == ChConfig.Def_UseSkillTag_CanAttackNPC:
|
| | | if NPCCommon.GetNpcObjOwnerIsPlayer(curTag):
|
| | | #npc主人是玩家不能攻击
|
| | | return None, None
|
| | | |
| | | if CheckFunc != None:
|
| | | #检查是否受影响
|
| | | if not CheckFunc(attacker, curTag, curSkill, tick):
|
| | | return None, None
|
| | | |
| | | # 如果攻击者是召唤兽 且 攻击的是主人玩家,则把主人放在最后面一个处理伤害目标,防止先处理后如果主人死亡将导致后续的逻辑异常
|
| | | if ownerPlayerID > 0 and curObjType == IPY_GameWorld.gotPlayer and isSummonNPCAtker and ownerPlayerID == curObj.GetID():
|
| | | ownerTag = curTag
|
| | | return None, ownerTag
|
| | | return curTag, None
|
| | |
|
| | |
|
| | | # 搜索本地图当前线路NPC
|
| | | def ServerByMapNPC(attacker, curSkill, tick, hurtTypeList, attackAim, curSkillUseTag, CheckFunc,
|
| | | ownerPlayerID, isSummonNPCAtker, resultList, hurtCount):
|
| | | gameNPCManager = GameWorld.GetNPCManager()
|
| | | for index in xrange(gameNPCManager.GetNPCCount()):
|
| | | curNPC = gameNPCManager.GetNPCByIndex(index)
|
| | | if curNPC == None or curNPC.GetID() == 0:
|
| | | continue
|
| | | |
| | | curTag, ownerTag = __SearchCheck(attacker, curSkill, tick, curNPC, hurtTypeList, attackAim, curSkillUseTag, CheckFunc,
|
| | | ownerPlayerID, isSummonNPCAtker, resultList, curTag=curNPC)
|
| | | if not curTag:
|
| | | if ownerTag:
|
| | | hurtCount -= 1
|
| | | continue
|
| | | |
| | | hurtCount -= 1
|
| | | resultList.append(curTag)
|
| | | |
| | | if ownerTag:
|
| | | resultList.append(ownerTag)
|
| | | |
| | | return resultList
|
| | |
|
| | |
|
| | | # 搜索本地图当前线路玩家
|
| | | def ServerByMapPlayer(attacker, curSkill, tick, hurtTypeList, attackAim, curSkillUseTag, CheckFunc,
|
| | | ownerPlayerID, isSummonNPCAtker, resultList, hurtCount):
|
| | | copyMapPlayerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | for i in range(copyMapPlayerManager.GetPlayerCount()):
|
| | | curPlayer = copyMapPlayerManager.GetPlayerByIndex(i)
|
| | | |
| | | if curPlayer == None or curPlayer.IsEmpty():
|
| | | continue
|
| | | |
| | | curTag, ownerTag = __SearchCheck(attacker, curSkill, tick, curPlayer, hurtTypeList, attackAim, curSkillUseTag, CheckFunc,
|
| | | ownerPlayerID, isSummonNPCAtker, resultList, curTag=curPlayer)
|
| | | if not curTag:
|
| | | if ownerTag:
|
| | | hurtCount -= 1
|
| | | continue
|
| | | |
| | | hurtCount -= 1
|
| | | resultList.append(curTag)
|
| | |
|
| | | if ownerTag:
|
| | | resultList.append(ownerTag)
|
| | |
| | | PYView_UseSkillPos(attacker, skillID, battleType, useSkillPosX, useSkillPosY, g_skillHurtList, False)
|
| | |
|
| | | return
|
| | |
|
| | | # 通知客户端表现封包 无其他作用
|
| | | def Sync_AttackResult(attacker, curSkill):
|
| | | global g_skillHurtList
|
| | | g_skillHurtList.Clear()
|
| | | |
| | | defender = None
|
| | | if SkillShell.GetSkillFireAim(curSkill) == ChConfig.Def_UseSkillAim_Obj:
|
| | | useSkillTagID = attacker.GetUseSkillTagID()
|
| | | useSkillTagType = attacker.GetUseSkillTagType()
|
| | | defender = GameWorld.GetObj(useSkillTagID, useSkillTagType)
|
| | | |
| | | __Sync_AttackResult(attacker, defender, curSkill)
|
| | |
|
| | |
|
| | | ##############################主动攻击成功#############################
|
| | | ## 玩家攻击成功
|
| | | # @param curPlayer 攻击Obj
|
| | |
| | | if curPlayerSkill:
|
| | | SkillCommon.SetSkillRemainTime(curPlayerSkill, PlayerControl.GetReduceSkillCDPer(curPlayer), tick, curPlayer)
|
| | |
|
| | | if curSkill.GetFuncType() == ChConfig.Def_SkillFuncType_GiftSkill:
|
| | | if curSkill.GetFuncType() in [ChConfig.Def_SkillFuncType_GiftSkill, ChConfig.Def_SkillFuncType_FbSPSkill]:
|
| | | UseSkillOver(curPlayer, target, curSkill, tick)
|
| | | else:
|
| | | OnHurtTypeTriggerPassiveSkill(curPlayer, target, curSkill, tick)
|
| | | return True
|
| | | |
| | | AttackCommon.ClearFirstDefender(curPlayer)
|
| | |
|
| | | #玩家进入战斗状态
|
| | | #技能是光环, 不进入战斗状态 ,无对象,不进入战斗状态
|
| | |
| | | curPlayerSkill = curPlayer.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
|
| | |
|
| | | if curPlayerSkill:
|
| | |
|
| | | #设置玩家所学技能冷却CD
|
| | | SkillCommon.SetSkillRemainTime(curPlayerSkill, PlayerControl.GetReduceSkillCDPer(curPlayer), tick, curPlayer)
|
| | | |
| | | if not IsSkipSkillCD(curPlayer, target, curSkill, tick):
|
| | | #设置玩家所学技能冷却CD
|
| | | SkillCommon.SetSkillRemainTime(curPlayerSkill, PlayerControl.GetReduceSkillCDPer(curPlayer), tick, curPlayer)
|
| | | #调用任务触发器
|
| | | #EventShell.EventRespons_UseSkillOK(curPlayer, skillTypeID)
|
| | | #执行连环被动技能处理
|
| | |
| | | # 普攻和对敌技能
|
| | | UseSkillOver(curPlayer, target, curSkill, tick)
|
| | | return True
|
| | |
|
| | | # 无冷却状态
|
| | | def IsSkipSkillCD(curPlayer, target, curSkill, tick):
|
| | | # 暴击情况下
|
| | | isSuperHit = False
|
| | | for i in xrange(g_skillHurtList.GetHurtCount()):
|
| | | hurtObj = g_skillHurtList.GetHurtAt(i)
|
| | | if not hurtObj:
|
| | | continue
|
| | | |
| | | if hurtObj.GetAttackType() == ChConfig.Def_HurtType_SuperHit:
|
| | | isSuperHit = True
|
| | | break
|
| | |
|
| | | if isSuperHit:
|
| | | if PassiveBuffEffMng.GetValueByPassiveBuffTriggerType(curPlayer, None, curSkill, ChConfig.TriggerType_SuperHitSkipCD):
|
| | | return True
|
| | | if PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(curPlayer, None, curSkill, ChConfig.TriggerType_SuperHitSkipCD):
|
| | | return True
|
| | | return False
|
| | | |
| | | ### 不管什么技能都会到此处
|
| | | #只对第一目标造成某伤害类型时触发技能
|
| | | def OnHurtTypeTriggerSkillFirstObj(attacker, curSkill, tick):
|
| | | if g_skillHurtList.GetHurtCount() == 0:
|
| | | return
|
| | | |
| | | hurtObj = g_skillHurtList.GetHurtAt(0)
|
| | | if not hurtObj:
|
| | | return
|
| | | |
| | | objID, objType, hurtType = hurtObj.GetObjID(), hurtObj.GetObjType(), hurtObj.GetAttackType() |
| | | |
| | | defender = GameWorld.GetObj(objID, objType)
|
| | | if not defender:
|
| | | return
|
| | | if hurtType == ChConfig.Def_HurtType_SuperHit:
|
| | | PassiveBuffEffMng.OnPassiveSkillTrigger(attacker, defender, curSkill, ChConfig.TriggerType_SuperHit, tick)
|
| | | PassiveBuffEffMng.OnPassiveBuffTrigger(attacker, defender, curSkill, ChConfig.TriggerType_SuperHit, tick)
|
| | | elif hurtType == ChConfig.Def_HurtType_ThumpHit:
|
| | | PassiveBuffEffMng.OnPassiveSkillTrigger(attacker, defender, curSkill, ChConfig.TriggerType_ThumpHit, tick)
|
| | | return
|
| | |
|
| | |
|
| | | # 根据伤血类型触发技能,群攻只触发一次,放在伤血列表被清之前
|
| | | def OnHurtTypeTriggerSkill(attacker, target, curSkill, tick):
|
| | | isSuperHit = False
|
| | | usePassiveSkillResult = True # 第一次判断不能调用,即代表都不可用无需循环
|
| | | usePassiveSkillResultOnSuperHit = True # 暴击对象1V1触发,第一次判断不能调用,即代表都不可用无需循环
|
| | |
|
| | |
| | |
|
| | | skillHurtLists.append([hurtObj.GetObjID(), hurtObj.GetObjType(), hurtObj.GetAttackType()])
|
| | |
|
| | | # #持续攻击类BUFF 类剑刃风暴是先给自身一个持续性buff,这一次不算伤害不可触发
|
| | | if curSkill and ChConfig.Def_SkillType_LstPlsBuffAtk != curSkill.GetSkillType():
|
| | | #只对第一目标造成某伤害类型时触发技能, 需先存储 skillHurtLists
|
| | | OnHurtTypeTriggerSkillFirstObj(attacker, curSkill, tick)
|
| | |
|
| | | skillIDSet = set()
|
| | | for hurtList in skillHurtLists:
|
| | | if not isSuperHit and hurtList[2] == ChConfig.Def_HurtType_SuperHit:
|
| | | # 暴击只对主目标做处理
|
| | | PassiveBuffEffMng.OnPassiveSkillTrigger(attacker, target, curSkill, ChConfig.TriggerType_SuperHit, tick)
|
| | | isSuperHit = True
|
| | | |
| | | defender = GameWorld.GetObj(hurtList[0], hurtList[1])
|
| | | objID, objType, hurtType = hurtList
|
| | | defender = GameWorld.GetObj(objID, objType)
|
| | | if not defender:
|
| | | continue
|
| | |
|
| | | if GameObj.GetHP(defender) <= 0:
|
| | | if hurtList[1] == IPY_GameWorld.gotPlayer:
|
| | | if objType == IPY_GameWorld.gotPlayer:
|
| | | if hurtType == ChConfig.Def_HurtType_Zhansha:
|
| | | defender.SetDict(ChConfig.Def_PlayerKey_Zhansha, 1)
|
| | | elif hurtType == ChConfig.Def_HurtType_ZhognjiZhansha:
|
| | | defender.SetDict(ChConfig.Def_PlayerKey_Zhansha, 2)
|
| | | # 濒死状态触发技能, 不能在GetHurtHP内部触发技能,否则会导致原技能的伤血列表异常
|
| | | PassiveBuffEffMng.OnPassiveSkillTrigger(defender, attacker, None, ChConfig.TriggerType_WillDead, tick)
|
| | | PassiveBuffEffMng.OnPassiveBuffTrigger(defender, attacker, None, ChConfig.TriggerType_WillDead, tick)
|
| | | if hurtType in [ChConfig.Def_HurtType_Zhansha, ChConfig.Def_HurtType_ZhognjiZhansha]:
|
| | | defender.SetDict(ChConfig.Def_PlayerKey_Zhansha, 0)
|
| | | continue
|
| | |
|
| | | if usePassiveSkillResult:
|
| | | usePassiveSkillResult = PassiveBuffEffMng.OnPassiveSkillTrigger(attacker, defender, curSkill,
|
| | | ChConfig.TriggerType_HurtObjAddBuff, tick, skillIDSet=skillIDSet)
|
| | |
|
| | | if usePassiveSkillResultOnSuperHit and hurtList[2] == ChConfig.Def_HurtType_SuperHit:
|
| | | if usePassiveSkillResultOnSuperHit and hurtType == ChConfig.Def_HurtType_SuperHit:
|
| | | # 暴击对目标一一触发被动
|
| | | usePassiveSkillResultOnSuperHit = PassiveBuffEffMng.OnPassiveSkillTrigger(attacker, defender, curSkill,
|
| | | ChConfig.TriggerType_SuperHitOneByOne, tick, skillIDSet=skillIDSet)
|
| | | if hurtList[2] == ChConfig.Def_HurtType_SuperHit:
|
| | | if hurtType == ChConfig.Def_HurtType_SuperHit:
|
| | | #被暴击触发技能
|
| | | PassiveBuffEffMng.OnPassiveSkillTrigger(defender, attacker, None, ChConfig.TriggerType_BeSuperHit, tick)
|
| | | elif hurtList[2] == ChConfig.Def_HurtType_Miss:
|
| | | PassiveBuffEffMng.OnPetPassiveSkillTrigger(defender, attacker, None, ChConfig.TriggerType_BeSuperHit, tick)
|
| | | elif hurtType == ChConfig.Def_HurtType_Miss:
|
| | | PassiveBuffEffMng.OnPassiveSkillTrigger(defender, attacker, None, ChConfig.TriggerType_MissSkill, tick)
|
| | | |
| | |
|
| | | if hurtList[2] in ChConfig.Def_RealAttack_Type:
|
| | | elif hurtType == ChConfig.Def_HurtType_LuckyHit:
|
| | | PassiveBuffEffMng.OnPetPassiveSkillTrigger(defender, attacker, None, ChConfig.TriggerType_BeLuckyHit, tick)
|
| | | |
| | | if hurtType in ChConfig.Def_RealAttack_Type:
|
| | | # 被攻击处理层级
|
| | | PassiveBuffEffMng.OnPassiveBuffTrigger(defender, attacker, None, ChConfig.TriggerType_Buff_BeAttackSubLayer, tick)
|
| | |
|
| | |
| | | else:
|
| | | PassiveBuffEffMng.OnPassiveSkillTrigger(attacker, defender, curSkill, ChConfig.TriggerType_SkillOverNoAttack, tick)
|
| | |
|
| | | #释放技能即可处理的 不区分攻击和非攻击
|
| | | PassiveBuffEffMng.OnPassiveSkillTrigger(attacker, defender, curSkill, ChConfig.TriggerType_SkillSuccess, tick)
|
| | | PassiveBuffEffMng.OnPassiveSkillTrigger(attacker, defender, curSkill, ChConfig.TriggerType_SkillSuccessExpend, tick)
|
| | | |
| | | return
|
| | |
|
| | |
|
| | |
| | |
|
| | | tagFaintRate = PlayerControl.GetFaintDefRate(defender) if defender.GetGameObjType() == IPY_GameWorld.gotPlayer else 0
|
| | |
|
| | | rate = max(PlayerControl.GetFaintRate(attacker) - tagFaintRate, 0)
|
| | | # 添加最高60%击晕效果
|
| | | rate = min(max(PlayerControl.GetFaintRate(attacker) - tagFaintRate, 0), 6000)
|
| | | if not GameWorld.CanHappen(rate):
|
| | | return
|
| | |
|
| | |
| | | # @return None
|
| | | # @remarks 设置玩家属性消耗,如魔法,XP点,HP
|
| | | def SetSkillLostAttr(curPlayer, curSkill, tick):
|
| | | #-----------扣魔法
|
| | | lostMPValue = curSkill.GetMP()
|
| | | curPlayerMP = curPlayer.GetMP()
|
| | | |
| | | if curPlayerMP < lostMPValue:
|
| | | GameWorld.ErrLog('释放技能 = %s异常, 魔法 = %s不足 = %s' % (
|
| | | curSkill.GetSkillTypeID(), curPlayerMP, lostMPValue))
|
| | | |
| | | if lostMPValue > 0:
|
| | | curPlayer.SetMP(curPlayer.GetMP() - lostMPValue)
|
| | | #自动回魔
|
| | | 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)
|
| | | #===========================================================================
|
| | | # #-----------扣魔法
|
| | | # lostMPValue = curSkill.GetMP()
|
| | | # curPlayerMP = curPlayer.GetMP()
|
| | | # |
| | | # if curPlayerMP < lostMPValue:
|
| | | # GameWorld.ErrLog('释放技能 = %s异常, 魔法 = %s不足 = %s' % (
|
| | | # curSkill.GetSkillTypeID(), curPlayerMP, lostMPValue))
|
| | | # |
| | | # if lostMPValue > 0:
|
| | | # curPlayer.SetMP(curPlayer.GetMP() - lostMPValue)
|
| | | # #自动回魔
|
| | | # 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)
|
| | | #===========================================================================
|
| | |
|
| | | #----------扣HP点
|
| | | lostHPValue = curSkill.GetHP()
|
| | |
| | |
|
| | | # 暂且只有玩家被攻击触发
|
| | | if not curSkill or curSkill.GetSkillType() in ChConfig.Def_CanAttackSkill_List:
|
| | | # 优先触发,如无敌可以抵挡后续的被动伤害技能
|
| | | PassiveBuffEffMng.DelayUsePassiveTriggerSkill(curPlayer, curSkill, attacker, tick)
|
| | | |
| | | PassiveBuffEffMng.OnPassiveSkillTrigger(curPlayer, attacker, None, ChConfig.TriggerType_BeAttackOver, tick)
|
| | | PassiveBuffEffMng.OnPassiveBuffTrigger(curPlayer, attacker, None, ChConfig.TriggerType_BeAttackOver, tick)
|
| | | # 由主人条件触发宠物被动技能
|
| | | PassiveBuffEffMng.OnPetPassiveSkillTrigger(curPlayer, attacker, None, ChConfig.TriggerType_BeAttackOver, tick)
|
| | | return
|
| | |
|
| | | ## NPC被攻击(当前NPC,技能,当前时间)
|
| | |
| | | dist = GameWorld.GetDist(tagObj.GetPosX(), tagObj.GetPosY(),
|
| | | defender.GetPosX(), defender.GetPosY())
|
| | |
|
| | | skillPer = (skillPercent - dist * changePer) / float(ChConfig.Def_MaxRateValue)
|
| | | skillPer = (skillPercent - dist * changePer)
|
| | |
|
| | | #GameWorld.Log("skillPer :%s"%skillPer)
|
| | | #执行群攻 并取得被攻击对象列表
|
| | |
| | | #===========================================================================
|
| | | Sync_SkillHurtList(attacker, curSkill.GetSkillID(), srcPosX, srcPosY, g_skillHurtList)
|
| | |
|
| | | OnHurtTypeTriggerPassiveSkill(attacker, None, curSkill, tick)
|
| | | skillIDSet = set()
|
| | | #攻击结果 不处理触发逻辑
|
| | | for defObj in attackList:
|
| | |
| | | isEnhanceSkill=False, skillIDSet=skillIDSet)
|
| | |
|
| | | DoLogic_AttackResult(attacker, defObj, curSkill, tick)
|
| | | skillEffect = SkillCommon.GetSkillEffectByEffectID(curSkill, ChConfig.Def_Skill_Effect_ProcessAttack)
|
| | | if skillEffect:
|
| | | skillID = skillEffect.GetEffectValue(2)
|
| | | if skillID != 0:
|
| | | triggerSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)
|
| | | if not triggerSkill:
|
| | | continue
|
| | | SkillShell.UsePassiveTriggerSkill(attacker, triggerSkill, defObj, tick)
|
| | | #=======================================================================
|
| | | # #受攻击对象1V1触发技能,本技能效果自身附带,非被动,非触发技能
|
| | | # skillEffect = SkillCommon.GetSkillEffectByEffectID(curSkill, ChConfig.Def_Skill_Effect_ProcessAttack)
|
| | | # if skillEffect:
|
| | | # skillID = skillEffect.GetEffectValue(2)
|
| | | # if skillID != 0:
|
| | | # triggerSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)
|
| | | # if not triggerSkill:
|
| | | # continue
|
| | | # SkillShell.UsePassiveTriggerSkill(attacker, triggerSkill, defObj, tick)
|
| | | #=======================================================================
|
| | |
|
| | | # 一一触发技能需要在最后设置CD
|
| | | for skillTypeID in skillIDSet:
|
| | |
| | | if not hurtEffect:
|
| | |
|
| | | continue
|
| | | hurtPer = hurtEffect.GetEffectValue(0)*1.0/ChConfig.Def_MaxRateValue # 单层伤害
|
| | | hurtPer = hurtEffect.GetEffectValue(0) # 单层伤害
|
| | |
|
| | | # 伤害乘以层
|
| | | skillPercent = hurtPer * max(buff.GetLayer(), 1)
|
| | |
| | |
|
| | | sendPack.HurtCount = len(sendPack.HurtList)
|
| | |
|
| | | PlayerControl.PyNotifyAll(curPlayer, sendPack, notifySelf=True, notifyCnt=0)
|
| | | PlayerControl.PyNotifyAll(curPlayer, sendPack, notifySelf=True, notifyCnt=-1)
|
| | |
|
| | |
|
| | | # py重现View_UseSkillPos效果,对地通知,只用于玩家
|