| | |
| | | #---------------------------------------------------------------------
|
| | | g_skillHurtList = IPY_GameWorld.IPY_HurtList()
|
| | |
|
| | |
|
| | | # 特殊处理搜索范围,一般用于副本
|
| | | Def_SearchMap_NPC = 200 # 本线全图搜索NPC
|
| | | Def_SearchMap_Player = 201 # 本线全图搜索玩家
|
| | |
|
| | | #伤害结构体
|
| | | #hurtTypeIndance = None
|
| | | #---------------------------------------------------------------------
|
| | |
| | | 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 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)
|
| | |
|
| | | return resultList
|
| | |
|