| | |
| | | import GameObj
|
| | | import BuffSkill
|
| | | import PlayerState
|
| | | import MirrorAttack
|
| | | import ChPyNetSendPack
|
| | | import NPCHurtManager
|
| | | import NetPackCommon
|
| | | import FamilyRobBoss
|
| | | import FBCommon
|
| | | import ChNPC
|
| | | import BossHurtMng
|
| | | import NPCHurtMgr
|
| | | import ChNetSendPack
|
| | | import TurnAttack
|
| | |
|
| | |
| | | #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 defender 当前玩家(被攻击了)
|
| | |
| | |
|
| | | curObjType = curObj.GetGameObjType()
|
| | | if curObjType == IPY_GameWorld.gotPlayer:
|
| | | #BossHurtMng.BossAddPlayerInHurtList(curObj, curTagObj, hurtHP)
|
| | | FamilyRobBoss.OnPlayerHurtFamilyOwnerBoss(curObj, curTagObj, hurtHP)
|
| | | if curTagObj.GetGameObjType() == IPY_GameWorld.gotNPC:
|
| | | FBLogic.DoFB_Player_HurtNPC(curObj, curTagObj, hurtHP)
|
| | | if GameObj.GetHP(curTagObj) == 0:
|
| | | curTagObj.SetDict(ChConfig.Def_PlayerKey_LastHurt, curObj.GetPlayerID())
|
| | |
|
| | | if NPCHurtManager.AddHurtValue(curObj, curTagObj, hurtHP, isBounce):
|
| | | return
|
| | | |
| | | if NPCHurtMgr.AddHurtValue(curObj, curTagObj, hurtHP, isBounce):
|
| | | return
|
| | | |
| | | curTeam = curObj.GetTeam()
|
| | | if curTeam == None:
|
| | | #无队伍,添加个人伤害
|
| | |
| | | #if not CheckAttackNPCByCnt(attacker, defender):
|
| | | # return False
|
| | |
|
| | | #击杀次数判断
|
| | | if not NPCHurtManager.IsAssistPlayer(attacker.GetPlayerID(), defender) and not CheckKillNPCByCnt(attacker, defender):
|
| | | return False
|
| | | |
| | | #仙盟归属NPC判断
|
| | | if not CheckCanAttackFamilyOwnerNPC(attacker, defender):
|
| | | return False
|
| | |
| | | #if not CheckAttackNPCByCnt(defender, attacker, False):
|
| | | # return False
|
| | |
|
| | | #击杀次数判断
|
| | | if not CheckKillNPCByCnt(defender, attacker, False) and not NPCHurtManager.IsAssistPlayer(defender.GetPlayerID(), attacker):
|
| | | return False
|
| | | |
| | | #仙盟归属NPC判断
|
| | | if not CheckCanAttackFamilyOwnerNPC(defender, attacker, False):
|
| | | return False
|
| | |
| | | # NPC打NPC
|
| | | elif atkObjType == IPY_GameWorld.gotNPC and defObjType == IPY_GameWorld.gotNPC:
|
| | | if PetControl.IsPet(attacker) or attacker.GetGameNPCObjType()== IPY_GameWorld.gnotSummon:
|
| | | #击杀次数判断
|
| | | if not CheckKillNPCByCnt(attacker, defender, False):
|
| | | ownerPlayer = GetAttackPlayer(attacker)[0]
|
| | | if ownerPlayer and not NPCHurtManager.IsAssistPlayer(ownerPlayer.GetPlayerID(), defender):
|
| | | return False
|
| | | ##击杀次数判断
|
| | | #if not CheckKillNPCByCnt(attacker, defender, False):
|
| | | # ownerPlayer = GetAttackPlayer(attacker)[0]
|
| | | # if ownerPlayer and not NPCHurtManager.IsAssistPlayer(ownerPlayer.GetPlayerID(), defender):
|
| | | # return False
|
| | |
|
| | | #仙盟归属NPC判断
|
| | | if not CheckCanAttackFamilyOwnerNPC(attacker, defender, False):
|
| | |
| | | if not GameFuncComm.GetFuncCanUse(atkPlayer, funcID):
|
| | | PlayerControl.NotifyCode(atkPlayer, funcSysMark)
|
| | | return
|
| | | canKillCnt = BossHurtMng.GetCanKillBossCnt(atkPlayer, index)[0]
|
| | | |
| | | if canKillCnt <= 0:
|
| | | #if BossHurtMng.GetPlayerBossHurt(atkPlayer, defender):
|
| | | # GameWorld.DebugLog("攻击过该boss可继续攻击")
|
| | | # return True
|
| | | #次数不足
|
| | | # 实际攻击者类型None则需要提示玩家
|
| | | if npcObjType is None:
|
| | | if isNotify:
|
| | | sysMark = IpyGameDataPY.GetFuncEvalCfg('KillBossCntLimit', 3, {}).get(index, '')
|
| | | PlayerControl.NotifyCode(atkPlayer, sysMark)
|
| | | return False
|
| | | |
| | | npcDataEx = NPCCommon.GetNPCDataEx(npcID)
|
| | | if npcDataEx and npcDataEx.GetFightPowerLackAtkLimit():
|
| | | if npcDataEx.GetSuppressFightPower() > PlayerControl.GetFightPower(atkPlayer):
|
| | | if isNotify:
|
| | | PlayerControl.NotifyCode(atkPlayer, "BossFightPowerHint") |
| | | #GameWorld.DebugLog("战力不足,无法攻击boss! npcID=%s,SuppressFightPower=%s > playerFightPower=%s" |
| | | # % (npcID, npcDataEx.GetSuppressFightPower(), PlayerControl.GetFightPower(atkPlayer))) |
| | | return False
|
| | | |
| | | #npcDataEx = NPCCommon.GetNPCDataPy(npcID)
|
| | | #if npcDataEx and npcDataEx.GetFightPowerLackAtkLimit():
|
| | | # if npcDataEx.GetSuppressFightPower() > PlayerControl.GetFightPower(atkPlayer):
|
| | | # if isNotify:
|
| | | # PlayerControl.NotifyCode(atkPlayer, "BossFightPowerHint") |
| | | # #GameWorld.DebugLog("战力不足,无法攻击boss! npcID=%s,SuppressFightPower=%s > playerFightPower=%s" |
| | | # # % (npcID, npcDataEx.GetSuppressFightPower(), PlayerControl.GetFightPower(atkPlayer))) |
| | | # return False
|
| | |
|
| | | return True
|
| | |
|
| | |
| | | hasAttackCnt = atkPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WorldBoss_HurtCnt, 0)
|
| | |
|
| | | if hasAttackCnt >= limitCnt:
|
| | | #if BossHurtMng.GetPlayerBossHurt(atkPlayer, defender):
|
| | | # GameWorld.DebugLog("攻击过该boss可继续攻击")
|
| | | # return True
|
| | | #次数不足
|
| | | # 实际攻击者类型None则需要提示玩家
|
| | | if npcObjType is None:
|
| | |
| | | aBurnValue = atkwargs.get('burnValue', 0)
|
| | | aBurnPer = atkwargs.get('burnPer', 0)
|
| | | hurtFormulaKey = atkwargs.get('hurtFormulaKey', None)
|
| | | #if hurtFormulaKey == "Burn":
|
| | | # pass
|
| | | #else:
|
| | | hurtValue = eval(IpyGameDataPY.GetFuncCompileCfg("DOTFormula", 1))
|
| | | elif not curSkill:
|
| | | hurtValue = eval(IpyGameDataPY.GetFuncCompileCfg("HurtFormula", 3))
|
| | |
| | | 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)
|
| | |
| | | # GameWorld.DebugLog("不能攻击,不反弹")
|
| | | # return
|
| | | #杀怪次数判断
|
| | | if not CheckKillNPCByCnt(defObj, atkObj, False) and not NPCHurtManager.IsAssistPlayer(defObj.GetPlayerID(), atkObj):
|
| | | #GameWorld.DebugLog("不能攻击,不反弹")
|
| | | return
|
| | | #if not CheckKillNPCByCnt(defObj, atkObj, False) and not NPCHurtManager.IsAssistPlayer(defObj.GetPlayerID(), atkObj):
|
| | | # #GameWorld.DebugLog("不能攻击,不反弹")
|
| | | # return
|
| | |
|
| | | #没有反弹退出
|
| | | defObj_DamageBackRate = defObj.GetDamageBackRate()
|
| | |
| | | '''
|
| | | #关系有3层,无-友好-敌人
|
| | |
|
| | | #镜像PK下,无视PK区域、PK模式等,仅验证双方是否同一阵营
|
| | | curBattleID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MirrorBattleID)
|
| | | tagBattleID = tagPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MirrorBattleID)
|
| | | if curBattleID and curBattleID == tagBattleID:
|
| | | battle = MirrorAttack.GetMirrorBattleByID(curBattleID)
|
| | | if battle.batState != ChConfig.Def_MirrorBatState_Fight:
|
| | | return ChConfig.Type_Relation_None, ChConfig.Def_PASysMessage_None
|
| | | if curPlayer.GetFaction() != tagPlayer.GetFaction():
|
| | | return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
|
| | | return ChConfig.Type_Relation_Friend, ChConfig.Def_PASysMessage_None
|
| | | |
| | | #判断是否可释放(增/减)技能或普攻
|
| | | if CheckPlayersRelationInFB_IsNone(curPlayer, tagPlayer):
|
| | | return ChConfig.Type_Relation_None, ChConfig.Def_PASysMessage_None
|
| | |
| | | elif curPlayerAttackMode == IPY_GameWorld.amAll:
|
| | | pass
|
| | |
|
| | | # 协助关系不可攻击
|
| | | if NPCHurtManager.IsAssistRelation(curPlayer, tagPlayer):
|
| | | return ChConfig.Type_Relation_Friend, ChConfig.Def_PASysMessage_NotAttackTeam
|
| | | |
| | | # 以下为所属区域的一些特殊处理
|
| | | #普通区
|
| | | if curPlayerAreaType == IPY_GameWorld.gatNormal:
|
| | |
| | | if GameObj.GetHP(curObjDetel) > 0:
|
| | | return
|
| | |
|
| | | if TurnAttack.SetTurnObjKilled(curObjDetel, atkObj):
|
| | | return
|
| | | #if TurnAttack.SetTurnObjKilled(curObjDetel, atkObj):
|
| | | # return
|
| | |
|
| | | #---玩家处理---
|
| | | if curObjDetel.GetGameObjType() == IPY_GameWorld.gotPlayer:
|
| | |
| | | srcID, srcType = 0, 0
|
| | | if srcObj:
|
| | | srcID, srcType = srcObj.GetID(), srcObj.GetGameObjType()
|
| | | turnFight = TurnAttack.GetTurnFightMgr().getNPCTurnFight(curObj.GetID())
|
| | | turnFight = TurnAttack.GetTurnFightMgr().getTurnFight(curObj.GetTFGUID())
|
| | | if turnFight:
|
| | | clientPack = ChNetSendPack.tagObjPropertyRefreshView()
|
| | | clientPack.ObjID = curObj.GetID()
|