| | |
| | | return callFunc(attacker, defender, skill, tick)
|
| | |
|
| | |
|
| | | def GetSkillHurtList():
|
| | | global g_skillHurtList
|
| | | return g_skillHurtList
|
| | |
|
| | |
|
| | | def GetFirstHurtObj():
|
| | | global g_skillHurtList
|
| | | if g_skillHurtList.GetHurtCount():
|
| | |
| | | # 触发型技能根据伤血类型触发被动技能,群攻只触发一次,放在伤血列表被清之前
|
| | | # 只处理 isEnhanceSkill的情况,对应 OnHurtTypeTriggerSkill
|
| | | def OnHurtTypeTriggerPassiveSkill(attacker, target, curSkill, tick):
|
| | | AttackCommon.ClearFirstDefender(attacker)
|
| | |
|
| | | skillHurtLists = [] # 内部触发清除g_skillHurtList
|
| | | for i in xrange(g_skillHurtList.GetHurtCount()):
|
| | |
| | | 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])
|
| | |
| | | # @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:
|
| | |
| | | if GameObj.GetHP(defender) <= 0:
|
| | | defender.SetDict(ChConfig.Def_NPCDead_KillerType, attacker.GetGameObjType())
|
| | | defender.SetDict(ChConfig.Def_NPCDead_KillerID, attacker.GetID())
|
| | | PlayerGeTui.TJGDead(defender, attacker.GetName())
|
| | | #PlayerGeTui.TJGDead(defender, attacker.GetName())
|
| | | if defender.GetGameObjType() == IPY_GameWorld.gotNPC:
|
| | | skillID = 0 if not useSkill else useSkill.GetSkillID()
|
| | | # 记录死亡原因
|
| | |
| | |
|
| | | # 根据触发技能的特点决定是触发一次还是 触发多次
|
| | | # 群体BUFF的请参考IsPlayerUseSkill 客户端决定对象,一样可以实现同样效果
|
| | | for enhanceSkillID in [curSkill.GetSkillEnhance1(), curSkill.GetSkillEnhance2()]:
|
| | | if GetIsEnhanceSkillGroup(curSkill, enhanceSkillID):
|
| | | for defObj in attackList:
|
| | | SkillShell.SkillTrigSkill(attacker, defObj, curSkill, enhanceSkillID, tick)
|
| | | else:
|
| | | SkillShell.SkillTrigSkill(attacker, defender, curSkill, enhanceSkillID, tick)
|
| | | if curSkill:
|
| | | for enhanceSkillID in [curSkill.GetSkillEnhance1(), curSkill.GetSkillEnhance2()]:
|
| | | if GetIsEnhanceSkillGroup(curSkill, enhanceSkillID):
|
| | | for defObj in attackList:
|
| | | SkillShell.SkillTrigSkill(attacker, defObj, curSkill, enhanceSkillID, tick)
|
| | | else:
|
| | | SkillShell.SkillTrigSkill(attacker, defender, curSkill, enhanceSkillID, tick)
|
| | | else:
|
| | | OnHurtTypeTriggerPassiveSkill(attacker, defender, curSkill, tick)
|
| | |
|
| | |
| | | curTag = None
|
| | | if attacker.GetAttackMode() == IPY_GameWorld.amContest:
|
| | | # 单一目标锁定模式
|
| | | curTag = GameWorld.GetObj(attacker.SetDict(ChConfig.Def_PlayerKey_SelectObjID), |
| | | attacker.SetDict(ChConfig.Def_PlayerKey_SelectObjType))
|
| | | curTag = GameWorld.GetObj(attacker.GetDictByKey(ChConfig.Def_PlayerKey_SelectObjID), |
| | | attacker.GetDictByKey(ChConfig.Def_PlayerKey_SelectObjType))
|
| | |
|
| | | if not curTag:
|
| | | useSkillTagID = attacker.GetUseSkillTagID()
|
| | |
| | | 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)
|
| | |
|
| | |
| | |
|
| | | #不在影响对象列表中
|
| | | if curObjType not in hurtTypeList:
|
| | | return None, None
|
| | | |
| | | if attacker.GetSightLevel() != curObj.GetSightLevel():
|
| | | return None, None
|
| | |
|
| | | #攻击对象
|
| | |
| | |
|
| | | #技能攻击
|
| | | skillID = curSkill.GetSkillID()
|
| | | changeSkillID = PassiveBuffEffMng.GetPassiveSkillValueByTriggerTypeEx(attacker, None, curSkill, ChConfig.TriggerType_ChangeSkillEff)
|
| | | if changeSkillID:
|
| | | skillID = changeSkillID
|
| | | battleType = AttackCommon.GetBattleType(attacker, curSkill)
|
| | | #无目标类技能
|
| | | if not defender:
|
| | |
| | | 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,
|
| | | ChConfig.Def_SkillFuncType_PassiveSkillWithSP]:
|
| | | UseSkillOver(curPlayer, target, curSkill, tick)
|
| | | else:
|
| | | OnHurtTypeTriggerPassiveSkill(curPlayer, target, curSkill, tick)
|
| | | return True
|
| | | |
| | | AttackCommon.ClearFirstDefender(curPlayer)
|
| | |
|
| | | #玩家进入战斗状态
|
| | | #技能是光环, 不进入战斗状态 ,无对象,不进入战斗状态
|
| | |
| | |
|
| | | if curPlayerSkill:
|
| | |
|
| | | if not IsSkipSkillCD:
|
| | | if not IsSkipSkillCD(curPlayer, target, curSkill, tick):
|
| | | #设置玩家所学技能冷却CD
|
| | | SkillCommon.SetSkillRemainTime(curPlayerSkill, PlayerControl.GetReduceSkillCDPer(curPlayer), tick, curPlayer)
|
| | | #调用任务触发器
|
| | |
| | | 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()])
|
| | |
|
| | | #命中个数记录特殊处理
|
| | | PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(attacker, target, curSkill, ChConfig.TriggerType_HitValue)
|
| | | |
| | | # #持续攻击类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 hurtList[2] == ChConfig.Def_HurtType_Zhansha:
|
| | | if objType == IPY_GameWorld.gotPlayer:
|
| | | if hurtType == ChConfig.Def_HurtType_Zhansha:
|
| | | defender.SetDict(ChConfig.Def_PlayerKey_Zhansha, 1)
|
| | | elif hurtList[2] == ChConfig.Def_HurtType_ZhognjiZhansha:
|
| | | 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 hurtList[2] in [ChConfig.Def_HurtType_Zhansha, ChConfig.Def_HurtType_ZhognjiZhansha]:
|
| | | if hurtType in [ChConfig.Def_HurtType_Zhansha, ChConfig.Def_HurtType_ZhognjiZhansha]:
|
| | | defender.SetDict(ChConfig.Def_PlayerKey_Zhansha, 0)
|
| | | continue
|
| | |
|
| | |
| | | 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)
|
| | | PassiveBuffEffMng.OnPetPassiveSkillTrigger(defender, attacker, None, ChConfig.TriggerType_BeSuperHit, tick)
|
| | | elif hurtList[2] == ChConfig.Def_HurtType_Miss:
|
| | | elif hurtType == ChConfig.Def_HurtType_Miss:
|
| | | PassiveBuffEffMng.OnPassiveSkillTrigger(defender, attacker, None, ChConfig.TriggerType_MissSkill, tick)
|
| | | elif hurtList[2] == ChConfig.Def_HurtType_LuckyHit:
|
| | | elif hurtType == ChConfig.Def_HurtType_LuckyHit:
|
| | | PassiveBuffEffMng.OnPetPassiveSkillTrigger(defender, attacker, None, ChConfig.TriggerType_BeLuckyHit, tick)
|
| | |
|
| | | if hurtList[2] in ChConfig.Def_RealAttack_Type:
|
| | | if hurtType in ChConfig.Def_RealAttack_Type:
|
| | | # 被攻击处理层级
|
| | | PassiveBuffEffMng.OnPassiveBuffTrigger(defender, attacker, None, ChConfig.TriggerType_Buff_BeAttackSubLayer, tick)
|
| | |
|
| | |
| | | # 攻击减层级 优先处理,因为同个技能触发buff后,会再处理层级,导致立即减层级
|
| | | PassiveBuffEffMng.OnPassiveBuffTrigger(attacker, defender, curSkill, ChConfig.TriggerType_Buff_AttackSubLayer, tick)
|
| | |
|
| | | # 普攻和对敌技能
|
| | | if not curSkill or curSkill.GetSkillType() in ChConfig.Def_CanAttackSkill_List:
|
| | | # 普攻和对敌技能, 此处暂且特殊处理Def_SkillFuncType_PassiveSkillWithSP,待优化
|
| | | if not curSkill or curSkill.GetSkillType() in ChConfig.Def_CanAttackSkill_List or curSkill.GetFuncType() == ChConfig.Def_SkillFuncType_PassiveSkillWithSP:
|
| | | PassiveBuffEffMng.OnPassiveSkillTrigger(attacker, defender, curSkill, ChConfig.TriggerType_AttackOver, tick)
|
| | | PassiveBuffEffMng.OnPassiveBuffTrigger(attacker, defender, curSkill, ChConfig.TriggerType_AttackOver, tick)
|
| | |
|
| | |
| | | AttackFaintRate(attacker, defender, curSkill, 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
|
| | |
|
| | |
| | | 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)
|
| | | #执行群攻 并取得被攻击对象列表
|
| | |
| | | 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.HurtList.append(hurtList)
|
| | |
|
| | | sendPack.HurtCount = len(sendPack.HurtList)
|
| | |
|
| | | sendPack.SkillElementID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SkillElementID % skillID)
|
| | | PlayerControl.PyNotifyAll(curPlayer, sendPack, notifySelf=True, notifyCnt=-1)
|
| | | return
|
| | |
|
| | |
|
| | | # py重现View_UseSkillPos效果,对地通知,只用于玩家
|
| | |
| | | # ChangeAction(paAttack);
|
| | | # m_LastBattleTick = GetGameWorldManager()->GetTick();
|
| | | #===========================================================================
|
| | | |
| | | sendPack = ChNetSendPack.tagUseSkillPos()
|
| | | sendPack.Clear()
|
| | | sendPack.ObjID = attacker.GetID()
|
| | |
| | |
|
| | | sendPack.HurtCount = len(sendPack.HurtList)
|
| | | if attacker.GetGameObjType() == IPY_GameWorld.gotPlayer:
|
| | | sendPack.SkillElementID = attacker.NomalDictGetProperty(ChConfig.Def_PDict_SkillElementID % skillID)
|
| | | PlayerControl.PyNotifyAll(attacker, sendPack, notifySelf, -1)
|
| | | else:
|
| | | attacker.NotifyAll(sendPack.GetBuffer(), sendPack.GetLength())
|
| | |
| | | sendPack.HurtList.append(hurtList)
|
| | |
|
| | | sendPack.HurtCount = len(sendPack.HurtList)
|
| | | sendPack.SkillElementID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SkillElementID % skillID)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
|