| | |
| | | import BuffSkill
|
| | | import FBLogic
|
| | | import SkillShell
|
| | | import EventShell
|
| | | import PetControl
|
| | | import random
|
| | | import OperControlManager
|
| | |
| | | import NetPackCommon
|
| | | import PassiveBuffEffMng
|
| | | import IpyGameDataPY
|
| | | import TurnAttack
|
| | | #---------------------------------------------------------------------
|
| | | g_skillHurtList = IPY_GameWorld.IPY_HurtList()
|
| | |
|
| | |
| | | else:
|
| | | result = "NormalNPC"
|
| | |
|
| | | elif npcObjType == IPY_GameWorld.gnotTruck: #骠车
|
| | | result = "Truck"
|
| | | |
| | | elif npcObjType == IPY_GameWorld.gnotPet: #宠物
|
| | | result = "Pet"
|
| | |
|
| | |
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def __Sync_AttackResult(attacker, defender, curSkill):
|
| | | battleType = AttackCommon.GetBattleType(attacker, curSkill)
|
| | | turnBattleType = attacker.GetDictByKey(ChConfig.Def_Obj_Dict_TurnBattleType)
|
| | | battleType = turnBattleType * 10 + battleType # 通知的battle修改: 回合攻击战斗类型*10+原战斗类型
|
| | | #普通攻击
|
| | | if not curSkill:
|
| | | #GameWorld.Log("玩家普通攻击成功")
|
| | |
| | | g_skillHurtList.GetHurtCount()))
|
| | | else:
|
| | | curHurt = g_skillHurtList.GetHurtAt(0)
|
| | | attacker.BaseAttack(curHurt.GetObjID(), curHurt.GetObjType(),
|
| | | AttackCommon.GetBattleType(attacker, curSkill),
|
| | | curHurt.GetAttackType(), curHurt.GetHurtHP(), curHurt.GetHurtHPEx(), curHurt.GetCurHP(), curHurt.GetCurHPEx())
|
| | | |
| | | PYView_BaseAttack(attacker, curHurt, battleType)
|
| | | |
| | | #//返回值无意义
|
| | | return
|
| | |
|
| | |
| | | changeSkillID = PassiveBuffEffMng.GetPassiveSkillValueByTriggerTypeEx(attacker, None, curSkill, ChConfig.TriggerType_ChangeSkillEff)
|
| | | if changeSkillID:
|
| | | skillID = changeSkillID
|
| | | battleType = AttackCommon.GetBattleType(attacker, curSkill)
|
| | | |
| | | #无目标类技能
|
| | | if not defender:
|
| | | #玩家处理
|
| | |
| | | # 为了客户端表现特殊处理,冲锋通知地板坐标而不是敌方坐标
|
| | | if curSkill.GetAtkType() == 9:
|
| | | useSkillPosX, useSkillPosY = attacker.GetUseSkillPosX(), attacker.GetUseSkillPosY()
|
| | | PYView_UseSkillPos(attacker, skillID, battleType, useSkillPosX, useSkillPosY, g_skillHurtList, False)
|
| | | PYView_UseSkillPos(attacker, skillID, battleType, useSkillPosX, useSkillPosY, g_skillHurtList, False, defender)
|
| | | PYView_UseSkillPos_NotifySelf(attacker, skillID, battleType, useSkillPosX, useSkillPosY, g_skillHurtList)
|
| | | else:
|
| | | if attacker.GetDictByKey(ChConfig.Def_NPC_Dict_AtkMovePosX):
|
| | |
| | | useSkillPosY = attacker.GetDictByKey(ChConfig.Def_NPC_Dict_AtkMovePosY)
|
| | |
|
| | | # NPC没有C++View_UseSkillPos接口
|
| | | PYView_UseSkillPos(attacker, skillID, battleType, useSkillPosX, useSkillPosY, g_skillHurtList, False)
|
| | | PYView_UseSkillPos(attacker, skillID, battleType, useSkillPosX, useSkillPosY, g_skillHurtList, False, defender)
|
| | |
|
| | | return
|
| | |
|
| | |
| | | if not IsSkipSkillCD(curPlayer, target, curSkill, tick):
|
| | | #设置玩家所学技能冷却CD
|
| | | SkillCommon.SetSkillRemainTime(curPlayerSkill, PlayerControl.GetReduceSkillCDPer(curPlayer), tick, curPlayer)
|
| | | #调用任务触发器
|
| | | #EventShell.EventRespons_UseSkillOK(curPlayer, skillTypeID)
|
| | | #执行连环被动技能处理
|
| | | #__DealWithPassivitySkill( curPlayer, target, curPlayerSkill, tick )
|
| | | #执行被动buff
|
| | |
| | | if not curSkill or (curSkill.GetSkillType() == ChConfig.Def_SkillType_Atk and\
|
| | | curSkill.GetFuncType() in [ChConfig.Def_SkillFuncType_FbSkill,
|
| | | ChConfig.Def_SkillFuncType_PetSkill,
|
| | | ChConfig.Def_SkillFuncType_NormalAttack]):
|
| | | ChConfig.Def_SkillFuncType_NormalAttack,
|
| | | ChConfig.Def_SkillFuncType_TurnNormaAttack]):
|
| | | # 攻击减层级 优先处理,因为同个技能触发buff后,会再处理层级,导致立即减层级
|
| | | PassiveBuffEffMng.OnPassiveBuffTrigger(attacker, defender, curSkill, ChConfig.TriggerType_Buff_AttackSubLayer, tick)
|
| | |
|
| | |
| | |
|
| | | # 属性击晕
|
| | | def AttackFaintRate(attacker, defender, curSkill, tick):
|
| | | if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:
|
| | | return
|
| | | #if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:
|
| | | # return
|
| | |
|
| | | faintRate = PlayerControl.GetFaintRate(attacker)
|
| | | faintRate = GameObj.GetFaintRate(attacker)
|
| | | if not faintRate:
|
| | | #GameWorld.DebugLog("没有击晕概率!", attacker.GetID())
|
| | | return
|
| | |
|
| | | if curSkill:
|
| | | useSkillData = attacker.GetUseSkill()
|
| | | # 非主动性技能不触发
|
| | | if not useSkillData:
|
| | | return
|
| | | if useSkillData.GetSkillID() != curSkill.GetSkillID():
|
| | | return
|
| | | |
| | | if not defender:
|
| | | useSkillTagID = attacker.GetUseSkillTagID()
|
| | | useSkillTagType = attacker.GetUseSkillTagType()
|
| | | defender = GameWorld.GetObj(useSkillTagID, useSkillTagType)
|
| | | if attacker.GetGameObjType() == IPY_GameWorld.gotPlayer:
|
| | | if curSkill:
|
| | | useSkillData = attacker.GetUseSkill()
|
| | | # 非主动性技能不触发
|
| | | if not useSkillData:
|
| | | return
|
| | | if useSkillData.GetSkillID() != curSkill.GetSkillID():
|
| | | return
|
| | | |
| | | if not defender:
|
| | | return
|
| | | useSkillTagID = attacker.GetUseSkillTagID()
|
| | | useSkillTagType = attacker.GetUseSkillTagType()
|
| | | defender = GameWorld.GetObj(useSkillTagID, useSkillTagType)
|
| | | if not defender:
|
| | | return
|
| | | |
| | | if not defender:
|
| | | return
|
| | |
|
| | | if attacker.GetID() == defender.GetID():
|
| | | return
|
| | |
| | | if GameObj.GetHP(defender) <= 0:
|
| | | return
|
| | |
|
| | | tagFaintRate = PlayerControl.GetFaintDefRate(defender) if defender.GetGameObjType() == IPY_GameWorld.gotPlayer else 0
|
| | |
|
| | | tagFaintDefRate = GameObj.GetFaintDefRate(defender)
|
| | | |
| | | # 添加最高60%击晕效果
|
| | | maxRate = IpyGameDataPY.GetFuncCfg("PassiveSkillFaint", 1)
|
| | | rate = min(max(faintRate - tagFaintRate, 0), maxRate)
|
| | | rate = min(max(faintRate - tagFaintDefRate, 0), maxRate)
|
| | | if not GameWorld.CanHappen(rate):
|
| | | return
|
| | |
|
| | |
| | | lastTick = attacker.GetDictByKey(ChConfig.Def_PlayerKey_AttrFaintCD)
|
| | | remainTick = faintCD - (tick - lastTick)
|
| | | if remainTick > 0:
|
| | | GameWorld.DebugLog("击晕CD中! rate=%s,剩余tick=%s" % (rate, remainTick), attacker.GetID())
|
| | | GameWorld.DebugLog(" 击晕CD中! rate=%s,剩余tick=%s,atkID=%s" % (rate, remainTick, attacker.GetID()))
|
| | | return
|
| | | attacker.SetDict(ChConfig.Def_PlayerKey_AttrFaintCD, tick)
|
| | | GameWorld.DebugLog("触发击晕! rate=%s" % rate, attacker.GetID())
|
| | | |
| | | SkillCommon.AddBuffBySkillType(defender, ChConfig.Def_SkillID_AtkerFaint, tick)
|
| | | GameWorld.DebugLog(" 可触发击晕! rate=%s,atkID=%s,defID=%s" % (rate, attacker.GetID(), defender.GetID()))
|
| | | SkillCommon.AddBuffBySkillType(defender, ChConfig.Def_SkillID_AtkerFaint, tick, buffOwner=attacker)
|
| | | return
|
| | |
|
| | |
|
| | |
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 设置玩家属性消耗,如魔法,XP点,HP
|
| | | def SetSkillLostAttr(curPlayer, curSkill, tick):
|
| | | def SetSkillLostAttr(curObj, curSkill, tick):
|
| | | #===========================================================================
|
| | | # #-----------扣魔法
|
| | | # lostMPValue = curSkill.GetMP()
|
| | |
| | | # #自动回魔
|
| | | # 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)
|
| | | #===========================================================================
|
| | | |
| | | #----------扣XP点
|
| | | if SkillCommon.isXPSkill(curSkill):
|
| | | GameObj.SetXP(curObj, 0)
|
| | |
|
| | | #----------扣HP点
|
| | | lostHPValue = curSkill.GetHP()
|
| | | curPlayerHP = GameObj.GetHP(curPlayer)
|
| | | curPlayerHP = GameObj.GetHP(curObj)
|
| | |
|
| | | if curPlayerHP < lostHPValue:
|
| | | GameWorld.ErrLog('释放技能 = %s异常, HP点 = %s不足 = %s' % (
|
| | | curSkill.GetSkillTypeID(), curPlayerHP, lostHPValue))
|
| | |
|
| | | if lostHPValue > 0:
|
| | | GameObj.SetHP(curPlayer, GameObj.GetHP(curPlayer) - lostHPValue)
|
| | | GameObj.SetHP(curObj, GameObj.GetHP(curObj) - lostHPValue)
|
| | |
|
| | | return
|
| | |
|
| | |
| | | #技能使用成功
|
| | | if curSkill:
|
| | | skillTypeID = curSkill.GetSkillTypeID()
|
| | | |
| | | #扣属性,如魔法,XP点
|
| | | SetSkillLostAttr(curNPC, curSkill, tick)
|
| | |
|
| | | #技能使用成功
|
| | | curNPCSkill = curNPC.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
|
| | |
| | | if GameObj.GetHP(curNPC) <= 0:
|
| | | return
|
| | |
|
| | | #排除镖车
|
| | | if curNPC.GetGameNPCObjType() == IPY_GameWorld.gnotTruck:
|
| | | return
|
| | | |
| | | #排除鹿
|
| | | if curNPC.GetType() == IPY_GameWorld.ntDeer:
|
| | | return
|
| | |
| | | #攻击对象
|
| | | curTag = GameWorld.GetObj(objID, curObjType)
|
| | | if not curTag:
|
| | | continue
|
| | | |
| | | #链式攻击不能对镖车释放
|
| | | if curObjType == IPY_GameWorld.gotNPC and curTag.GetGameNPCObjType() == IPY_GameWorld.gnotTruck:
|
| | | continue
|
| | |
|
| | | #具体判定对象是否可攻击
|
| | |
| | | #攻击对象
|
| | | curTag = GameWorld.GetObj(curObj.GetID(), curObjType)
|
| | | if not curTag:
|
| | | continue
|
| | | |
| | | #链式攻击不能对镖车释放
|
| | | if curObjType == IPY_GameWorld.gotNPC and curTag.GetGameNPCObjType() == IPY_GameWorld.gnotTruck:
|
| | | continue
|
| | |
|
| | | if __IsAlreadyAttack(curTag, resultList):
|
| | |
| | | PlayerControl.PyNotifyAll(curPlayer, sendPack, notifySelf=True, notifyCnt=-1)
|
| | | return
|
| | |
|
| | | def PYView_BaseAttack(attacker, curHurt, battleType):
|
| | | #attacker.BaseAttack(curHurt.GetObjID(), curHurt.GetObjType(),
|
| | | # battleType,
|
| | | # curHurt.GetAttackType(), curHurt.GetHurtHP(), curHurt.GetHurtHPEx(), curHurt.GetCurHP(), curHurt.GetCurHPEx())
|
| | | #ChangeAction(laNPCAttack);
|
| | | sendPack = ChNetSendPack.tagObjBaseAttack()
|
| | | sendPack.Clear()
|
| | | sendPack.AttackerID = attacker.GetID()
|
| | | sendPack.AttackerObjType = attacker.GetGameObjType()
|
| | | sendPack.ObjID = curHurt.GetObjID()
|
| | | sendPack.ObjType = curHurt.GetObjType()
|
| | | sendPack.BattleType = battleType
|
| | | sendPack.AttackType = curHurt.GetAttackType()
|
| | | sendPack.Value = curHurt.GetHurtHP()
|
| | | sendPack.ValueEx = curHurt.GetHurtHPEx()
|
| | | sendPack.RemainHP = curHurt.GetCurHP()
|
| | | sendPack.RemainHPEx = curHurt.GetCurHPEx()
|
| | | turnFight = TurnAttack.GetTurnFightMgr().getNPCTurnFight(attacker.GetID())
|
| | | if turnFight:
|
| | | turnFight.addBatPack(sendPack)
|
| | | return
|
| | | attacker.NotifyAll(sendPack.GetBuffer(), sendPack.GetLength())
|
| | | return
|
| | |
|
| | | # py重现View_UseSkillPos效果,对地通知,只用于玩家
|
| | | def PYView_UseSkillPos(attacker, skillID, battleType, useSkillPosX, useSkillPosY, skillHurtList, notifySelf):
|
| | | def PYView_UseSkillPos(attacker, skillID, battleType, useSkillPosX, useSkillPosY, skillHurtList, notifySelf, defender=None):
|
| | | #===========================================================================
|
| | | # C++ 此处代码PY已处理,暂不加入
|
| | | # SetAttackTick(GetGameWorldManager()->GetTick());
|
| | |
| | | # m_LastBattleTick = GetGameWorldManager()->GetTick();
|
| | | #===========================================================================
|
| | |
|
| | | turnFight = TurnAttack.GetTurnFightMgr().getNPCTurnFight(attacker.GetID())
|
| | | if turnFight:
|
| | | sendPack = ChNetSendPack.tagUseSkillAttack()
|
| | | sendPack.ObjID = attacker.GetID()
|
| | | sendPack.ObjType = attacker.GetGameObjType()
|
| | | sendPack.BattleType = battleType
|
| | | sendPack.SkillID = skillID
|
| | | sendPack.AttackID = defender.GetID() if defender else 0 # 主攻击目标
|
| | | sendPack.AttackObjType = defender.GetGameObjType() if defender else 0
|
| | | |
| | | for i in range(skillHurtList.GetHurtCount()):
|
| | | hurtObj = skillHurtList.GetHurtAt(i)
|
| | | hurtList = ChNetSendPack.tagSkillHurtObj()
|
| | | hurtList.ObjType = hurtObj.GetObjType()
|
| | | hurtList.ObjID = hurtObj.GetObjID()
|
| | | hurtList.AttackType = hurtObj.GetAttackType()
|
| | | hurtList.HurtHP = hurtObj.GetHurtHP()
|
| | | hurtList.HurtHPEx = hurtObj.GetHurtHPEx()
|
| | | hurtList.CurHP = hurtObj.GetCurHP()
|
| | | hurtList.CurHPEx = hurtObj.GetCurHPEx()
|
| | | |
| | | sendPack.HurtList.append(hurtList)
|
| | | sendPack.HurtCount = len(sendPack.HurtList)
|
| | | turnFight.addBatPack(sendPack)
|
| | | return
|
| | | |
| | | sendPack = ChNetSendPack.tagUseSkillPos()
|
| | | sendPack.Clear()
|
| | | sendPack.ObjID = attacker.GetID()
|