| | |
| | | # @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:
|
| | |
| | | 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):
|
| | |
| | |
|
| | | #不在影响对象列表中
|
| | | if curObjType not in hurtTypeList:
|
| | | return None, None
|
| | | |
| | | if attacker.GetSightLevel() != curObj.GetSightLevel():
|
| | | return None, None
|
| | |
|
| | | #攻击对象
|
| | |
| | | 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
|
| | | return False
|
| | |
|
| | |
|
| | | ### 不管什么技能都会到此处
|
| | | #只对第一目标造成某伤害类型时触发技能
|
| | | def OnHurtTypeTriggerSkillFirstObj(attacker, curSkill, tick):
|
| | | if g_skillHurtList.GetHurtCount() == 0:
|
| | |
| | | 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):
|
| | | usePassiveSkillResult = True # 第一次判断不能调用,即代表都不可用无需循环
|
| | |
| | |
|
| | | # 根据伤血类型触发技能,群攻只触发一次,放在伤血列表被清之前
|
| | | OnHurtTypeTriggerSkill(attacker, defender, curSkill, tick)
|
| | | #释放技能即可处理的 不区分攻击和非攻击
|
| | | PassiveBuffEffMng.OnPassiveSkillTrigger(attacker, defender, curSkill, ChConfig.TriggerType_SkillSuccess, tick)
|
| | |
|
| | | # 普通或者可以主动释放的攻击性技能
|
| | | if not curSkill or (curSkill.GetSkillType() == ChConfig.Def_SkillType_Atk and\
|
| | |
| | | else:
|
| | | PassiveBuffEffMng.OnPassiveSkillTrigger(attacker, defender, curSkill, ChConfig.TriggerType_SkillOverNoAttack, tick)
|
| | |
|
| | | #释放技能即可处理的 不区分攻击和非攻击
|
| | | PassiveBuffEffMng.OnPassiveSkillTrigger(attacker, defender, curSkill, ChConfig.TriggerType_SkillSuccess, 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)
|
| | | #执行群攻 并取得被攻击对象列表
|
| | |
| | | if not hurtEffect:
|
| | |
|
| | | continue
|
| | | hurtPer = hurtEffect.GetEffectValue(0)*1.0/ChConfig.Def_MaxRateValue # 单层伤害
|
| | | hurtPer = hurtEffect.GetEffectValue(0) # 单层伤害
|
| | |
|
| | | # 伤害乘以层
|
| | | skillPercent = hurtPer * max(buff.GetLayer(), 1)
|