10019 【砍树】回合战斗(NPC战斗属性统一放到NPC扩展表;每回合开始处理减技能CD、buff持续时间、刷新buff,每回合等同于常规时间1秒;NPC支持击晕;)
|  |  |  | 
|---|
|  |  |  | BYTE        FightPowerLackAtkLimit;    //战力不足限制攻击 | 
|---|
|  |  |  | DWORD        SuppressFightPower;    //推荐/压制战力 | 
|---|
|  |  |  | DWORD        AtkSpeed;    //攻击速度 | 
|---|
|  |  |  | DWORD        MissRate;    //闪避概率 | 
|---|
|  |  |  | DWORD        MissDefRate;    //抗闪避概率 | 
|---|
|  |  |  | DWORD        SuperHitRate;    //暴击概率 | 
|---|
|  |  |  | DWORD        SuperHitRateReduce;    //抗暴击概率 | 
|---|
|  |  |  | DWORD        FaintRate;    //击晕概率 | 
|---|
|  |  |  | DWORD        FaintDefRate;    //抗击晕概率 | 
|---|
|  |  |  | 
|---|
|  |  |  | WORD        _LineID;    //功能线路ID | 
|---|
|  |  |  | DWORD        NPCID;    //NPCID | 
|---|
|  |  |  | DWORD        SummerNPCID;    //召唤兽ID | 
|---|
|  |  |  | list        AwardItemList;    //过关奖励列表,[[物品ID,个数,是否拍品], ...] | 
|---|
|  |  |  | list        AwardItemListFirst;    //首次过关奖励列表[[物品ID,个数,是否拍品], ...] | 
|---|
|  |  |  | list        AwardItemList;    //再次过关奖励列表[[物品ID,个数,是否拍品], ...] | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //副本助战表 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 属性击晕 | 
|---|
|  |  |  | def AttackFaintRate(attacker, defender, curSkill, tick): | 
|---|
|  |  |  | if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | #if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer: | 
|---|
|  |  |  | #    return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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 attacker.GetID() == defender.GetID(): | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if GameObj.GetHP(defender) <= 0: | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | tagFaintRate = GameObj.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 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | GameWorld.DebugLog("击晕CD中! rate=%s,剩余tick=%s" % (rate, remainTick), attacker.GetID()) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | attacker.SetDict(ChConfig.Def_PlayerKey_AttrFaintCD, tick) | 
|---|
|  |  |  | GameWorld.DebugLog("触发击晕! rate=%s" % rate, attacker.GetID()) | 
|---|
|  |  |  | GameWorld.DebugLog("触发击晕! rate=%s,tagID=%s" % (rate, defender.GetID()), attacker.GetID()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SkillCommon.AddBuffBySkillType(defender, ChConfig.Def_SkillID_AtkerFaint, tick) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 回合开始: 做一些每回合重置逻辑或者某些根据回合触发的效果等 | 
|---|
|  |  |  | for gameObj in fightObjList: | 
|---|
|  |  |  | TurnFightObjPerTurnStart(gameObj, turnNum) | 
|---|
|  |  |  | TurnFightObjPerTurnStart(gameObj, turnNum, tick) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 回合战斗: 轮流依次攻击 | 
|---|
|  |  |  | for actNum, gameObj in enumerate(fightObjList, 1): | 
|---|
|  |  |  | 
|---|
|  |  |  | tagObjID = tagGameObj.GetID() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | GameWorld.DebugLog("    行动: turnNum=%s,actNum=%s,faction=%s,objType=%s,objID=%s,tagObjType=%s,tagObjID=%s" | 
|---|
|  |  |  | % (turnNum, actNum, faction, objType, objID, tagObjType, tagObjID), playerID) | 
|---|
|  |  |  | % (turnNum, actNum, faction, objType, objID, tagObjType, tagObjID)) | 
|---|
|  |  |  | DoAttack(gameObj, tagGameObj, tick) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | playerDead = GameObj.GetHP(curPlayer) <= 0 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objType = gameObj.GetGameObjType() | 
|---|
|  |  |  | npcID = gameObj.GetNPCID() if objType == IPY_GameWorld.gotNPC else 0 | 
|---|
|  |  |  | GameWorld.DebugLog("    初始化实例: objID=%s,npcID=%s,faction=%s,atkSpeed=%s,HP=%s" | 
|---|
|  |  |  | % (gameObj.GetID(), npcID, GameObj.GetFaction(gameObj), GameObj.GetAtkSpeed(gameObj), GameObj.GetHP(gameObj))) | 
|---|
|  |  |  | GameWorld.DebugLog("初始化实例: objID=%s,npcID=%s,faction=%s,atkSpeed=%s,HP=%s,Atk=%s,Def=%s" | 
|---|
|  |  |  | % (gameObj.GetID(), npcID, GameObj.GetFaction(gameObj), GameObj.GetAtkSpeed(gameObj), GameObj.GetHP(gameObj), gameObj.GetMaxAtk(), gameObj.GetDef())) | 
|---|
|  |  |  | GameWorld.DebugLog("    闪命(%s,%s),闪避(%s,%s),暴击(%s,%s),击晕(%s,%s),连击(%s,%s),反击(%s,%s),吸血(%s,%s)" | 
|---|
|  |  |  | % (gameObj.GetMiss(), gameObj.GetHit(), | 
|---|
|  |  |  | GameObj.GetMissRate(gameObj), GameObj.GetMissDefRate(gameObj), | 
|---|
|  |  |  | GameObj.GetSuperHitRate(gameObj), GameObj.GetSuperHitRateReduce(gameObj), | 
|---|
|  |  |  | GameObj.GetFaintRate(gameObj), GameObj.GetFaintDefRate(gameObj), | 
|---|
|  |  |  | GameObj.GetComboRate(gameObj), GameObj.GetComboDefRate(gameObj), | 
|---|
|  |  |  | GameObj.GetAtkBackRate(gameObj), GameObj.GetAtkBackDefRate(gameObj), | 
|---|
|  |  |  | GameObj.GetSuckHPPer(gameObj), GameObj.GetSuckHPDefPer(gameObj), | 
|---|
|  |  |  | )) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 重置技能CD、战斗buff | 
|---|
|  |  |  | if objType == IPY_GameWorld.gotPlayer: | 
|---|
|  |  |  | 
|---|
|  |  |  | pass | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def TurnFightObjPerTurnStart(gameObj, turnNum): | 
|---|
|  |  |  | def TurnFightObjPerTurnStart(gameObj, turnNum, tick): | 
|---|
|  |  |  | ## 回合制战斗实例 - 每回合开始时处理 | 
|---|
|  |  |  | if not gameObj: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | 
|---|
|  |  |  | # 重置连击、反击数 | 
|---|
|  |  |  | gameObj.SetDict(ChConfig.Def_Obj_Dict_TurnComboNum, 0) | 
|---|
|  |  |  | gameObj.SetDict(ChConfig.Def_Obj_Dict_TurnAtkBackNum, 0) | 
|---|
|  |  |  | gameObj.SetDict(ChConfig.Def_PlayerKey_AttrFaintCD, 0) # 击晕CD | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objType = gameObj.GetGameObjType() | 
|---|
|  |  |  | objID = gameObj.GetID() | 
|---|
|  |  |  | GameWorld.DebugLog("ObjPerTurnStart: faction=%s,objType=%s,objID=%s,turnNum=%s,HP=%s" % (GameObj.GetFaction(gameObj), objType, objID, turnNum, GameObj.GetHP(gameObj))) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 每回合开始减技能CD | 
|---|
|  |  |  | skillManager = gameObj.GetSkillManager() | 
|---|
|  |  |  | for i in range(skillManager.GetSkillCount()): | 
|---|
|  |  |  | skill = skillManager.GetSkillByIndex(i) | 
|---|
|  |  |  | remainTime = skill.GetRemainTime() | 
|---|
|  |  |  | if not remainTime: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | skillID = skill.GetSkillID() | 
|---|
|  |  |  | updRemainTime = max(0, remainTime - ChConfig.Def_PerTurnTick) | 
|---|
|  |  |  | skill.SetRemainTime(updRemainTime) | 
|---|
|  |  |  | GameWorld.DebugLog("    skillID=%s,remainTime=%s,updRemainTime=%s" % (skillID, remainTime, updRemainTime)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if objType == IPY_GameWorld.gotPlayer: | 
|---|
|  |  |  | pass | 
|---|
|  |  |  |  | 
|---|
|  |  |  | gameObj.SetTickByType(ChConfig.TYPE_Player_Tick_Buff, 0) | 
|---|
|  |  |  | gameObj.SetPersistBuffTick(0) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #刷新玩家Buff | 
|---|
|  |  |  | reFlashBuff = PlayerState.ProcessRefreshBuffState(gameObj, tick) | 
|---|
|  |  |  | #刷新玩家场景buff效果 | 
|---|
|  |  |  | PlayerState.ProcessPlayerBuffEffect(gameObj, tick) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | attrBuffResult, actBuffResult = PlayerState.ProcessRefreshActionBuffState(gameObj, tick) | 
|---|
|  |  |  | playerControl = PlayerControl.PlayerControl(gameObj) | 
|---|
|  |  |  | if actBuffResult: | 
|---|
|  |  |  | playerControl.RefreshPlayerActionState() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #此处才是真正的刷新人物属性值,需刷属性逻辑应在此行前调用 | 
|---|
|  |  |  | if not playerControl.RefreshPlayerAttrStateEx(): | 
|---|
|  |  |  | if reFlashBuff or attrBuffResult: | 
|---|
|  |  |  | playerControl.RefreshPlayerAttrByBuff() | 
|---|
|  |  |  | # 只刷BUFF情况 | 
|---|
|  |  |  | playerControl.RefreshPlayerAttrByBuffEx() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | elif objType == IPY_GameWorld.gotNPC: | 
|---|
|  |  |  | pass | 
|---|
|  |  |  |  | 
|---|
|  |  |  | gameObj.SetTickByType(ChConfig.TYPE_NPC_Tick_Buff, 0) | 
|---|
|  |  |  | gameObj.SetTickByType(ChConfig.TYPE_NPC_Tick_Buff_Timely, 0) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | npcControl = NPCCommon.NPCControl(gameObj) | 
|---|
|  |  |  | npcControl.RefreshBuffState(tick) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def TurnFightObjOverReset(gameObj): | 
|---|
|  |  |  | 
|---|
|  |  |  | curID = curObj.GetID() | 
|---|
|  |  |  | tagID = tagObj.GetID() | 
|---|
|  |  |  | if curObj.GetGameObjType() == IPY_GameWorld.gotPlayer: | 
|---|
|  |  |  | atkRet = PlayerAttack(curObj, tagObj, tick) | 
|---|
|  |  |  | atkOK = PlayerAttack(curObj, tagObj, tick) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | atkRet = NPCAttack(curObj, tagObj, tick) | 
|---|
|  |  |  | atkOK = NPCAttack(curObj, tagObj, tick) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | turnBattleType = curObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnBattleType) | 
|---|
|  |  |  | curObj.SetDict(ChConfig.Def_Obj_Dict_TurnBattleType, 0) # 无论攻击成功与否都重置战斗类型 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not atkRet: | 
|---|
|  |  |  | if not atkOK: | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if turnBattleType == ChConfig.TurnBattleType_Combo: | 
|---|
|  |  |  | 
|---|
|  |  |  | curObj.SetDict(ChConfig.Def_Obj_Dict_TurnAtkBackNum, atkBackNum) | 
|---|
|  |  |  | GameWorld.DebugLog("            反击: atkBackID=%s,atkBackNum=%s" % (curID, atkBackNum)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | GameWorld.DebugLog("            curID-HP=(%s-%s),tagID-HP=(%s-%s)" % (curID, GameObj.GetHP(curObj), tagID, GameObj.GetHP(tagObj))) | 
|---|
|  |  |  | curHP = GameObj.GetHP(curObj) | 
|---|
|  |  |  | tagHP = GameObj.GetHP(tagObj) | 
|---|
|  |  |  | GameWorld.DebugLog("            curID-HP=(%s-%s),tagID-HP=(%s-%s)" % (curID, curHP, tagID, tagHP)) | 
|---|
|  |  |  | if tagHP <= 0 or curHP <= 0: | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 反击,反击可打断连击,所以优先判断 | 
|---|
|  |  |  | if CanAtkBack(curObj, tagObj): | 
|---|
|  |  |  | 
|---|
|  |  |  | if not curObj: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | tagDist = 0 | 
|---|
|  |  |  | atkRet = AICommon.DoAutoUseSkill(curObj, tagObj, tagDist, tick) | 
|---|
|  |  |  | atkOK = AICommon.DoAutoUseSkill(curObj, tagObj, tagDist, tick) | 
|---|
|  |  |  | #---优先释放技能--- | 
|---|
|  |  |  | if not atkRet: | 
|---|
|  |  |  | if not atkOK: | 
|---|
|  |  |  | #普通攻击 | 
|---|
|  |  |  | atkRet = BaseAttack.Attack(curObj, tagObj, None, tick) | 
|---|
|  |  |  | if atkRet: | 
|---|
|  |  |  | GameWorld.DebugLog("        NPC普通攻击: curID=%s,tagID=%s,atkRet=%s" % (curObj.GetID(), tagObj.GetID(), atkRet)) | 
|---|
|  |  |  | atkOK = BaseAttack.Attack(curObj, tagObj, None, tick) | 
|---|
|  |  |  | if atkOK: | 
|---|
|  |  |  | GameWorld.DebugLog("        NPC普通攻击: curID=%s,tagID=%s,atkOK=%s" % (curObj.GetID(), tagObj.GetID(), atkOK)) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | GameWorld.DebugLog("        NPC攻击失败: curID=%s,tagID=%s,atkRet=%s" % (curObj.GetID(), tagObj.GetID(), atkRet)) | 
|---|
|  |  |  | GameWorld.DebugLog("        NPC攻击失败: curID=%s,tagID=%s,atkOK=%s" % (curObj.GetID(), tagObj.GetID(), atkOK)) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | GameWorld.DebugLog("        NPC技能攻击: curID=%s,tagID=%s,atkRet=%s" % (curObj.GetID(), tagObj.GetID(), atkRet)) | 
|---|
|  |  |  | return atkRet | 
|---|
|  |  |  | GameWorld.DebugLog("        NPC技能攻击: curID=%s,tagID=%s,atkOK=%s" % (curObj.GetID(), tagObj.GetID(), atkOK)) | 
|---|
|  |  |  | return atkOK | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def PlayerAttack(curPlayer, tagObj, tick): | 
|---|
|  |  |  | ## 玩家攻击, 参考技能使用 #def UseSkillEx(index, clientData, tick): | 
|---|
|  |  |  | 
|---|
|  |  |  | curPlayer.SetUseSkill(curSkill.GetSkillData()) | 
|---|
|  |  |  | useSkillData = curPlayer.GetUseSkill() | 
|---|
|  |  |  | if not PlayerState.__DoClientUseSkillEx(curPlayer, useSkillData, tick): | 
|---|
|  |  |  | GameWorld.DebugLog("        技能攻击失败%s" % skillID, playerID) | 
|---|
|  |  |  | GameWorld.DebugLog("        玩家技能攻击失败: playerID=%s,tagID=%s,skillID=%s" % (playerID, tagObjID, skillID)) | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | useSkillResult = True | 
|---|
|  |  |  | GameWorld.DebugLog("        技能攻击成功%s" % skillID, playerID) | 
|---|
|  |  |  | GameWorld.DebugLog("        玩家技能攻击成功: playerID=%s,tagID=%s,skillID=%s" % (playerID, tagObjID, skillID)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | break | 
|---|
|  |  |  |  | 
|---|
|  |  |  | curPlayer.ClearUseSkillRec() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not useSkillResult: | 
|---|
|  |  |  | #普通攻击 | 
|---|
|  |  |  | atkOK = BaseAttack.Attack(curPlayer, tagObj, None, tick) | 
|---|
|  |  |  | if atkOK: | 
|---|
|  |  |  | useSkillResult = True | 
|---|
|  |  |  | GameWorld.DebugLog("        玩家普通攻击: curID=%s,tagID=%s,atkOK=%s" % (playerID, tagObjID, atkOK)) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | GameWorld.DebugLog("        玩家攻击失败: curID=%s,tagID=%s,atkOK=%s" % (playerID, tagObjID, atkOK)) | 
|---|
|  |  |  | return useSkillResult | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def SyncTurnFightState(curPlayer, mapID, funcLineID, tagPlayerID, state, turnNum=0, turnMax=0): | 
|---|
|  |  |  | 
|---|
|  |  |  | TurnBattleType_AtkBack, # 反击 | 
|---|
|  |  |  | ) = range(3) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Def_PerTurnTick = 1000 # 每回合等同于常规tick时长 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #---Obj字典------- | 
|---|
|  |  |  | Def_Obj_Dict_Faction = 'Faction' # 所属阵营 | 
|---|
|  |  |  | Def_Obj_Dict_TurnFightNum = 'TurnFightNum' # 回合制战斗当前轮次 | 
|---|
|  |  |  | 
|---|
|  |  |  | gameObj.SetDict(ChConfig.AttrName_AtkSpeed, value) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #---暴击概率---- 都是用 gameObj.GetSuperHitRate() gameObj.SetSuperHitRate() | 
|---|
|  |  |  | def GetMissRate(gameObj): return gameObj.GetMiss() | 
|---|
|  |  |  | def SetMissRate(gameObj, value): | 
|---|
|  |  |  | ## 闪避概率 | 
|---|
|  |  |  | gameObj.SetMiss(value) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | def GetMissDefRate(gameObj): return gameObj.GetHit() | 
|---|
|  |  |  | def SetMissDefRate(gameObj, value): | 
|---|
|  |  |  | ## 抗闪避率 = 命中 | 
|---|
|  |  |  | gameObj.SetHit(value) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | def GetSuperHitRate(gameObj): return gameObj.GetSuperHitRate() | 
|---|
|  |  |  | def SetSuperHitRate(gameObj, value): | 
|---|
|  |  |  | ## 暴击概率 | 
|---|
|  |  |  | gameObj.SetSuperHitRate(value) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | def GetSuperHitRateReduce(gameObj): return gameObj.GetDictByKey(ChConfig.Def_PlayerKey_SuperHitRateReduce) | 
|---|
|  |  |  | def SetSuperHitRateReduce(gameObj, value): | 
|---|
|  |  |  | ## 抗暴击概率 | 
|---|
|  |  |  | 
|---|
|  |  |  | ("BYTE", "FightPowerLackAtkLimit", 0), | 
|---|
|  |  |  | ("DWORD", "SuppressFightPower", 0), | 
|---|
|  |  |  | ("DWORD", "AtkSpeed", 0), | 
|---|
|  |  |  | ("DWORD", "MissRate", 0), | 
|---|
|  |  |  | ("DWORD", "MissDefRate", 0), | 
|---|
|  |  |  | ("DWORD", "SuperHitRate", 0), | 
|---|
|  |  |  | ("DWORD", "SuperHitRateReduce", 0), | 
|---|
|  |  |  | ("DWORD", "FaintRate", 0), | 
|---|
|  |  |  | ("DWORD", "FaintDefRate", 0), | 
|---|
|  |  |  | 
|---|
|  |  |  | ("WORD", "LineID", 1), | 
|---|
|  |  |  | ("DWORD", "NPCID", 0), | 
|---|
|  |  |  | ("DWORD", "SummerNPCID", 0), | 
|---|
|  |  |  | ("list", "AwardItemListFirst", 0), | 
|---|
|  |  |  | ("list", "AwardItemList", 0), | 
|---|
|  |  |  | ), | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | self.FightPowerLackAtkLimit = 0 | 
|---|
|  |  |  | self.SuppressFightPower = 0 | 
|---|
|  |  |  | self.AtkSpeed = 0 | 
|---|
|  |  |  | self.MissRate = 0 | 
|---|
|  |  |  | self.MissDefRate = 0 | 
|---|
|  |  |  | self.SuperHitRate = 0 | 
|---|
|  |  |  | self.SuperHitRateReduce = 0 | 
|---|
|  |  |  | self.FaintRate = 0 | 
|---|
|  |  |  | self.FaintDefRate = 0 | 
|---|
|  |  |  | 
|---|
|  |  |  | def GetFightPowerLackAtkLimit(self): return self.FightPowerLackAtkLimit # 战力不足限制攻击 | 
|---|
|  |  |  | def GetSuppressFightPower(self): return self.SuppressFightPower # 推荐/压制战力 | 
|---|
|  |  |  | def GetAtkSpeed(self): return self.AtkSpeed # 攻击速度 | 
|---|
|  |  |  | def GetMissRate(self): return self.MissRate # 闪避概率 | 
|---|
|  |  |  | def GetMissDefRate(self): return self.MissDefRate # 抗闪避概率 | 
|---|
|  |  |  | def GetSuperHitRate(self): return self.SuperHitRate # 暴击概率 | 
|---|
|  |  |  | def GetSuperHitRateReduce(self): return self.SuperHitRateReduce # 抗暴击概率 | 
|---|
|  |  |  | def GetFaintRate(self): return self.FaintRate # 击晕概率 | 
|---|
|  |  |  | def GetFaintDefRate(self): return self.FaintDefRate # 抗击晕概率 | 
|---|
|  |  |  | 
|---|
|  |  |  | self.LineID = 0 | 
|---|
|  |  |  | self.NPCID = 0 | 
|---|
|  |  |  | self.SummerNPCID = 0 | 
|---|
|  |  |  | self.AwardItemListFirst = [] | 
|---|
|  |  |  | self.AwardItemList = [] | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | def GetLineID(self): return self.LineID # 功能线路ID | 
|---|
|  |  |  | def GetNPCID(self): return self.NPCID # NPCID | 
|---|
|  |  |  | def GetSummerNPCID(self): return self.SummerNPCID # 召唤兽ID | 
|---|
|  |  |  | def GetAwardItemList(self): return self.AwardItemList # 过关奖励列表,[[物品ID,个数,是否拍品], ...] | 
|---|
|  |  |  | def GetAwardItemListFirst(self): return self.AwardItemListFirst # 首次过关奖励列表[[物品ID,个数,是否拍品], ...] | 
|---|
|  |  |  | def GetAwardItemList(self): return self.AwardItemList # 再次过关奖励列表[[物品ID,个数,是否拍品], ...] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 副本助战表 | 
|---|
|  |  |  | class IPY_FBHelpBattle(): | 
|---|
|  |  |  | 
|---|
|  |  |  | #GameWorld.DebugLog('技能使用顺序 = useSkillList%s' % str(useSkillList), curNPC.GetID()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for useCnt, index, useSkill in useSkillList: | 
|---|
|  |  |  | skillID = useSkill.GetSkillID() | 
|---|
|  |  |  | if DoNPCUseSkill(curNPC, curTag, useSkill, tagDist, tick): | 
|---|
|  |  |  | return True | 
|---|
|  |  |  | return skillID | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #无技能可以释放 | 
|---|
|  |  |  | return False | 
|---|
|  |  |  | 
|---|
|  |  |  | npcDataEx = GetNPCDataEx(curNPC.GetNPCID()) | 
|---|
|  |  |  | if npcDataEx: | 
|---|
|  |  |  | GameObj.SetAtkSpeed(curNPC, npcDataEx.GetAtkSpeed()) | 
|---|
|  |  |  | GameObj.SetMissRate(curNPC, npcDataEx.GetMissRate()) | 
|---|
|  |  |  | GameObj.SetMissDefRate(curNPC, npcDataEx.GetMissDefRate()) | 
|---|
|  |  |  | GameObj.SetSuperHitRate(curNPC, npcDataEx.GetSuperHitRate()) | 
|---|
|  |  |  | GameObj.SetSuperHitRateReduce(curNPC, npcDataEx.GetSuperHitRateReduce()) | 
|---|
|  |  |  | GameObj.SetFaintRate(curNPC, npcDataEx.GetFaintRate()) | 
|---|
|  |  |  | GameObj.SetFaintDefRate(curNPC, npcDataEx.GetFaintDefRate()) | 
|---|
|  |  |  | 
|---|
|  |  |  | curNPC.SetMaxAtk(PropDict["MaxAtk"]) | 
|---|
|  |  |  | curNPC.SetDef(PropDict["Def"]) | 
|---|
|  |  |  | GameObj.SetMaxHP(curNPC, PropDict["MaxHP"]) | 
|---|
|  |  |  | curNPC.SetHit(PropDict["Hit"]) | 
|---|
|  |  |  | curNPC.SetMiss(PropDict["Miss"]) | 
|---|
|  |  |  | GameObj.SetAtkSpeed(curNPC, PropDict.get("AtkSpeed", 0)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | curNPC.SetSuperHitRate(PropDict["SuperHitRate"]) | 
|---|
|  |  |  | GameObj.SetMissRate(curNPC, PropDict["Miss"]) | 
|---|
|  |  |  | GameObj.SetMissDefRate(curNPC, PropDict["Hit"]) | 
|---|
|  |  |  | GameObj.SetSuperHitRate(curNPC, PropDict["SuperHitRate"]) | 
|---|
|  |  |  | GameObj.SetSuperHitRateReduce(curNPC, PropDict["SuperHitRateReduce"]) | 
|---|
|  |  |  | GameObj.SetFaintRate(curNPC, PropDict["FaintRate"]) | 
|---|
|  |  |  | GameObj.SetFaintDefRate(curNPC, PropDict["FaintDefRate"]) | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __GetIsInRefreshPoint(self, curPosX, curPosY, refreshPoint): | 
|---|
|  |  |  | if not refreshPoint: | 
|---|
|  |  |  | curNPC = self.curNPC | 
|---|
|  |  |  | if curNPC.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightNum): | 
|---|
|  |  |  | return True | 
|---|
|  |  |  | if self.logDetail: | 
|---|
|  |  |  | GameWorld.Log("        not refreshPoint=%s" % refreshPoint, self.npcID, self.lineID) | 
|---|
|  |  |  | return False | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | index = 0 | 
|---|
|  |  |  | isPlayerTJG = (curObj.GetGameObjType() == IPY_GameWorld.gotPlayer and PlayerTJG.GetIsTJG(curObj)) | 
|---|
|  |  |  | turnNum = curObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightNum) # 回合编号,大于0同时也代表回合制中 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | skillIDListInDelBuff = []   # buff消失中需要处理添加buff,外层处理避免错乱 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | remainTime = curBuffRemainTime - ( tick - curBuff.GetCalcStartTick() ) | 
|---|
|  |  |  | if turnNum > 0: | 
|---|
|  |  |  | remainTime -= ChConfig.Def_PerTurnTick | 
|---|
|  |  |  | GameWorld.DebugLog("    刷新buff时间: objID=%s,skillID=%s,remainTime=%s,turnNum=%s" % (curObj.GetID(), curSkill.GetSkillID(), remainTime, turnNum)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #还有剩余时间 | 
|---|
|  |  |  | if remainTime > 0: | 
|---|
|  |  |  | curBuff.SetCalcStartTick( tick ) | 
|---|
|  |  |  | 
|---|
|  |  |  | if not buffStateCount: | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | turnNum = curObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightNum) # 回合编号,大于0同时也代表回合制中 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #buff持续效果 | 
|---|
|  |  |  | for i in range(0, buffStateCount): | 
|---|
|  |  |  | curBuff = buffState.GetBuff(i) | 
|---|
|  |  |  | 
|---|
|  |  |  | processBuffTick = GetProcessBuffTick(curBuffSkill, curObj) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #---验证触发间隔TICK--- | 
|---|
|  |  |  | if tick - curBuff.GetProcessInterval() <= processBuffTick: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | if turnNum > 0: | 
|---|
|  |  |  | GameWorld.DebugLog("    buffProcess: objID=%s,skillID=%s,turnNum=%s" % (curObj.GetID(), curBuffSkill.GetSkillID(), turnNum)) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | if tick - curBuff.GetProcessInterval() <= processBuffTick: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | curBuff.SetProcessInterval(tick) | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|