#!/usr/bin/python # -*- coding: GBK -*- # ##@package E:/GameSVN/U3DGame/ProjectSServer/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py # @todo: # # @author: Alee # @date 2017-10-24 ÏÂÎç08:46:55 # @version 1.0 # # @note: # #--------------------------------------------------------------------- import ChConfig import NPCCommon import GameWorld import IPY_GameWorld import PlayerControl import GameSkills import BuffSkill import AttackCommon import GameMap import EffGetSet import FBLogic import ReadChConfig import random import BaseAttack import PetControl import SkillShell import DataRecordPack import ChPyNetSendPack import NetPackCommon import ShareDefine import GameObj import PassiveBuffEffMng import IpyGameDataPY #--------------------------------------------------------------------- #--------------------------------------------------------------------- ## ͨ¹ýÀàÐÍ»ñȡĿ±êµÄbuff¹ÜÀíÆ÷ # @param curObj Ä¿±ê # @param buffType buffÀàÐÍ # @return ¹ÜÀíÆ÷£¬×î´ó¸öÊý£¬Ð§¹ûÊÇ·ñ¿Éµþ¼Ó def GetBuffManagerByBuffType(curObj, buffType): # ͳһֻÓÃÒ»¸ö Def_Max_Buff_Count if buffType == IPY_GameWorld.bfBuff: return (curObj.GetBuffState(), ChConfig.Def_Max_Buff_Count, False) elif buffType == IPY_GameWorld.bfDeBuff: return (curObj.GetDeBuffState(), ChConfig.Def_Max_Buff_Count, False) elif buffType == IPY_GameWorld.bfAura: return (curObj.GetAura(), ChConfig.Def_Max_Buff_Count, False) elif buffType == IPY_GameWorld.bfIncBuff: return (curObj.GetIncBuff(), ChConfig.Def_Max_Buff_Count, True) elif buffType == IPY_GameWorld.bfEquipBuff: return (curObj.GetEquipBuff(), ChConfig.Def_Max_Buff_Count, True) elif buffType == IPY_GameWorld.bfMapBuff: return (curObj.GetMapBuff(), ChConfig.Def_Max_Buff_Count, False) elif buffType == IPY_GameWorld.btPassiveBuf: return (curObj.GetPassiveBuf(), ChConfig.Def_Max_Buff_Count, True) elif buffType == IPY_GameWorld.bfActionBuff: return (curObj.GetActionBuffManager(), ChConfig.Def_Max_Buff_Count, False) elif buffType == IPY_GameWorld.bfProcessBuff: return (curObj.GetProcessBuffState(), ChConfig.Def_Max_Buff_Count, False) elif buffType == IPY_GameWorld.bfProcessDeBuff: return (curObj.GetProcessDeBuffState(), ChConfig.Def_Max_Buff_Count, False) #ÎÊÌâÇë²éÕÒDef_SkillType_CountºÍDef_SkillBuffListÕâ2Õűí GameWorld.ErrLog('ÎÞ·¨»ñÈ¡¼¼ÄÜÀàÐÍ = %s' % (buffType)) return () ## ÅжÏÊÇ·ñΪBuff: # @param curSkill ¼¼ÄÜ # @return True or False # @remarks º¯ÊýÏêϸ˵Ã÷. def IsBuff(curSkill): return ChConfig.Def_SkillBuffList.has_key(curSkill.GetSkillType()) ## ·µ»ØBuffÀàÐÍ # @param ¼¼ÄÜ # @return buffÀàÐÍ # @remarks º¯ÊýÏêϸ˵Ã÷. def GetBuffType(curSkill): return ChConfig.Def_SkillBuffList.get(curSkill.GetSkillType()) def GetBuffStateType(curSkill): # buffËùÊôµÄ״̬ÀàÐÍ£¬¶ÔÓ¦ ChConfig.Def_PlayerStateList curEffect = GetSkillEffectByEffectID(curSkill, ChConfig.Def_Skill_Effect_BuffState) if curEffect == None: return ChConfig.Def_PlayerState_Normal return curEffect.GetEffectValue(0) ## ÉèÖõ±Ç°¼¼ÄܵÄÊ£Óàʱ¼ä(ÔÚ¼¼Äܳɹ¦µÄʱºòµ÷ÓÃ) # @param curSkill µ±Ç°¼¼ÄÜ # @param tick µ±Ç°Ê±¼ä # @return None # @remarks º¯ÊýÏêϸ˵Ã÷. def SetSkillRemainTime(curSkill, reduceSkillCDPer, tick, atkObj=None): #GameWorld.Log(GameWorld.GetScript().OutputTrace()) curSkill.SetLastUseTick(tick) coolDownTime = curSkill.GetCoolDownTime() remainTime = coolDownTime skillTypeID = curSkill.GetSkillTypeID() if atkObj and skillTypeID in IpyGameDataPY.GetFuncEvalCfg("SkillCD", 1): reduceSkillCDPer += PlayerControl.GetTheFBSkillsCD(atkObj) if isPassiveSkill(curSkill): if curSkill.GetFuncType() == ChConfig.Def_SkillFuncType_GiftSkill: # Ì츳ÓмõCDЧ¹û reduceSkillCDPer += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, None, curSkill, ChConfig.TriggerType_GiftReduceCD) # ¼õCD±ÈÂÊ if reduceSkillCDPer > 0: remainTime = int(remainTime * max(0, ShareDefine.Def_MaxRateValue - reduceSkillCDPer) / ShareDefine.Def_MaxRateValue) # ±»¶¯¼¼ÄܵĴ¦ÀíºÍÖ÷¶¯¼¼ÄÜÇø·Ö curSkill.SetRemainTime(remainTime) return # ¼õCD¹Ì¶¨Öµ #if skillData and skillData.GetCoolDownTime() < remainTime: # remainTime = skillData.GetCoolDownTime() reduceSkillCDPer += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, None, curSkill, ChConfig.TriggerType_ReduceCD) # ¼õCD±ÈÂÊ if reduceSkillCDPer > 0: remainTime = int(remainTime * max(0, ShareDefine.Def_MaxRateValue - reduceSkillCDPer) / ShareDefine.Def_MaxRateValue) curSkill.SetRemainTime(remainTime) if coolDownTime != remainTime: curSkill.Sync_Skill() #GameWorld.Log("¼¼ÄÜ: %s Ê£Óàʱ¼ä:¡¡%d"%(curSkill.GetSkillName(), curSkill.GetRemainTime())) return ## ˢе±Ç°¼¼ÄÜÊ£Óàʱ¼ä # @param curSkill µ±Ç°¼¼ÄÜ # @param tick µ±Ç°Ê±¼ä # @return µ±Ç°¼¼ÄÜÊ£Óàʱ¼ä:ºÁÃë # @remarks º¯ÊýÏêϸ˵Ã÷. def RefreshSkillRemainTime(curSkill, tick): #GameWorld.Log("ˢм¼ÄÜ: %s Ê£Óàʱ¼ä:¡¡%d %s %s"%(curSkill.GetSkillName(), curSkill.GetRemainTime(), tick, curSkill.GetLastUseTick())) remainTime_Old = curSkill.GetRemainTime() #´Ë¼¼ÄÜÒѾ­ÎÞÀäÈ´CDÁË if remainTime_Old == 0: return remainTime_Old remainTime_New = max(0, remainTime_Old - (tick - curSkill.GetLastUseTick())) curSkill.SetLastUseTick(tick) curSkill.SetRemainTime(remainTime_New) return remainTime_New ## Ë¢ÐÂÍæ¼ÒËùÓм¼ÄܵÄÊ£Óàʱ¼ä(ÏÂÏß) # @param curPlayer µ±Ç°Íæ¼Ò # @param tick µ±Ç°Ê±¼ä # @return None # @remarks º¯ÊýÏêϸ˵Ã÷. def RefreshAllSkillRemainTime(curPlayer, tick): #ˢм¼ÄÜÊ£Óàʱ¼ä skillManager = curPlayer.GetSkillManager() for i in range(0, skillManager.GetSkillCount()): curSkill = skillManager.GetSkillByIndex(i) if curSkill.GetRemainTime() == 0 : continue RefreshSkillRemainTime(curSkill, tick) return ## Íæ¼ÒÇл»µØÍ¼£¬Ë¢Ð¼¼ÄÜCD # @param curPlayer µ±Ç°Íæ¼Ò # @param tick µ±Ç°Ê±¼ä # @return None # @remarks º¯ÊýÏêϸ˵Ã÷. def PlayerChangeMapUpdateSkillCD(curPlayer, tick): skillManager = curPlayer.GetSkillManager() for i in range(0, skillManager.GetSkillCount()): curSkill = skillManager.GetSkillByIndex(i) if curSkill.GetRemainTime() == 0 : continue #GameWorld.Log("Çл»µØÍ¼, ¼¼ÄÜ%s³ÖÐøÊ±¼ä = %d"%(curSkill.GetSkillName(), skillRemainTime) , curPlayer.GetPlayerID()) curSkill.SetLastUseTick(tick) return def GivePlayerSkillByJobSkill(curPlayer, jobSkillInfo): ## ¸ù¾ÝÖ°Òµ¼¼ÄÜID¸øÍæ¼Ò¼¼ÄÜ£¬ Ö§³Ö×Öµä{"job":[skillID, ...], ...} {job:[skillID, ...], ...} »ò Áбí[skillID, ...] if not jobSkillInfo: return jobSkillList = [] if isinstance(jobSkillInfo, dict): job = curPlayer.GetJob() if job in jobSkillInfo: jobSkillList = jobSkillInfo[job] elif str(job) in jobSkillInfo: jobSkillList = jobSkillInfo[str(job)] elif isinstance(jobSkillInfo, list) or isinstance(jobSkillInfo, tuple): jobSkillList = jobSkillInfo jobSkillList = list(jobSkillList) if not jobSkillList: return isLearnNew = False skillManager = curPlayer.GetSkillManager() playerControl = PlayerControl.PlayerControl(curPlayer) GameWorld.DebugLog("¸øÍæ¼Ò¼¼ÄÜ: %s" % jobSkillList) for skillID in jobSkillList: skillData = GameWorld.GetGameData().GetSkillBySkillID(skillID) if skillData == None: continue if not CheckSkillJob(curPlayer, skillData): continue if not SkillShell.CheckLearnSkillCondition(curPlayer, skillData): continue if skillManager.FindSkillBySkillID(skillID): #GameWorld.DebugLog("ÒѾ­Óиü¼ÄÜ!skillID=%s" % skillID) continue isLearnNew = True skillLV = skillData.GetSkillLV() skillTypeID = skillData.GetSkillTypeID() beforeFightPower = 0 if skillLV > 1: befSkill = skillManager.FindSkillBySkillTypeID(skillTypeID) beforeFightPower = 0 if not befSkill else befSkill.GetFightPower() skillManager.LVUPSkillByID(skillID) GameWorld.DebugLog(" ¸øÍæ¼Ò¼¼ÄÜ: skillTypeID=%s,skillID=%s,skillLV=%s" % (skillTypeID, skillID, skillLV), curPlayer.GetID()) DataRecordPack.DR_LearnORUPSkill(curPlayer, skillTypeID, skillLV) if isPassiveSkill(skillData): pass #PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer, skillTypeID) playerControl.RefreshSkillFightPowerEx(skillID, beforeFightPower, isRefreshState=False) if isLearnNew: playerControl.RefreshPlayerAttrState() return isLearnNew ## Íæ¼ÒµÇ¼¼ì²éѧϰ¼¼ÄÜ(ÉÏÏß) # @param curPlayer µ±Ç°Íæ¼Ò # @return None def PlayerLoginCheckLearnSkill(curPlayer): jobLearnSkillDict = ReadChConfig.GetEvalChConfig("LoginLearnSkill") jobType = ChConfig.JOB_TYPE_DICT[curPlayer.GetJob()] if jobType not in jobLearnSkillDict: return learnSkillList = jobLearnSkillDict[jobType] skillManager = curPlayer.GetSkillManager() gameData = GameWorld.GetGameData() for skillID in learnSkillList: curSkill = gameData.GetSkillBySkillID(skillID) if not curSkill: GameWorld.ErrLog('DataBase No SkillId:%d' % skillID) continue curSkillTypeID = curSkill.GetSkillTypeID() # ÒÑѧϰ if skillManager.FindSkillBySkillTypeID(curSkillTypeID): continue skillManager.LVUpSkillBySkillTypeID(curSkillTypeID) DataRecordPack.DR_LearnORUPSkill(curPlayer, curSkillTypeID, 1) GameWorld.Log("ÉÏÏßѧϰ¼¼ÄÜ£º%s" % curSkillTypeID, curPlayer.GetPlayerID()) return ## Íæ¼ÒµÇ½¿ç·þ·þÎñÆ÷¼¼ÄÜÏà¹Ø´¦Àí def PlayerLoginMergeServerSkillLogic(curPlayer, tick): playerID = curPlayer.GetPlayerID() if not GameWorld.IsCrossServer(): GameWorld.DebugLog("·Ç¿ç·þ·þÎñÆ÷ÉÏÏß²»Çå³ýbuff...", playerID) return #ClearBuffSkillTypeIDList = ReadChConfig.GetEvalChConfig("ClearBuffSkillTypeID") ClearBuffSkillTypeIDList = [] # ¿ç·þ·þÎñÆ÷ÉÏÏßÇå³ýÔöÒæ/¼õÒæbuff GameWorld.Log("¿ç·þ·þÎñÆ÷ÉÏÏßÇå³ýbuff...", playerID) clearBuffList = [] # ÏÈ»ã×ÜÔÙÇå³ý£¬²»È»Ë÷Òý»á±ä¸ü for buffType in range(IPY_GameWorld.bfBuff, IPY_GameWorld.btBufMax): buffTuple = GetBuffManagerByBuffType(curPlayer, buffType) if buffTuple == (): GameWorld.DebugLog(" buffTuple == () buffType=%s" % buffType) continue buffState = buffTuple[0] buffCnt = buffState.GetBuffCount() if buffCnt <= 0: continue GameWorld.Log(" buffType=%s,buffCnt=%s" % (buffType, buffCnt), playerID) for i in range(buffCnt): curBuff = buffState.GetBuff(i) if not curBuff: GameWorld.DebugLog(" buffType=%s,i=%s not curBuff" % (buffType, i)) continue curSkill = curBuff.GetSkill() if not curSkill: GameWorld.DebugLog(" buffType=%s,i=%s not curSkill" % (buffType, i)) continue skillTypeID = curSkill.GetSkillTypeID() skillName = curSkill.GetSkillName() if skillTypeID not in ClearBuffSkillTypeIDList: GameWorld.DebugLog(" buffType=%s,i=%s,skillTypeID=%s,skillName=%s not in clearList" % (buffType, i, skillTypeID, skillName), playerID) continue clearBuffList.append(curSkill.GetSkillID()) GameWorld.Log(" addClearBuff buffType=%s,i=%s,skillName=%s,skillID=%d,skillTypeID=%d" % (buffType, i, skillName, curSkill.GetSkillID(), skillTypeID), playerID) # Çå³ýbuff #GameWorld.DebugLog(" clearBuffDict=%s" % str(clearBuffDict), playerID) for skillID in clearBuffList: BuffSkill.DelBuffBySkillID(curPlayer, skillID, tick) GameWorld.DebugLog(" delBuff skillID=%d" % (skillID), playerID) skillManager = curPlayer.GetSkillManager() # ÖØÖÃËùÓм¼ÄÜCD for i in range(0, skillManager.GetSkillCount()): curSkill = skillManager.GetSkillByIndex(i) if curSkill.GetRemainTime() != 0: curSkill.SetRemainTime(0) GameWorld.DebugLog(" SetRemainTime 0 skillName=%s,skillTypeID=%s" % (curSkill.GetSkillName(), curSkill.GetSkillTypeID()), playerID) return def ResetAllSkillCD(curPlayer): skillManager = curPlayer.GetSkillManager() for i in xrange(skillManager.GetSkillCount()): skill = skillManager.GetSkillByIndex(i) if skill.GetRemainTime() != 0: skill.SetRemainTime(0) skill.Sync_Skill() return ## Ë¢ÐÂÍæ¼ÒËùÓм¼ÄܵÄÊ£Óàʱ¼ä(ÉÏÏß) # @param curPlayer µ±Ç°Íæ¼Ò # @param tick µ±Ç°Ê±¼ä # @return None # @remarks º¯ÊýÏêϸ˵Ã÷. def PlayerLoginUpdateSkillCD(curPlayer, tick): #»ñÈ¡Íæ¼ÒÀ뿪µØÍ¼Ê±¼ä leaveServerSeconds = PlayerControl.GetPlayerLeaveServerSecond(curPlayer) if leaveServerSeconds <= 0: return skillManager = curPlayer.GetSkillManager() #=========================================================================== # #ËùÓм¼ÄÜCDÖ»±£´æ1Ìì(³¬¹ýÒ»Ììʱ¼ä,È«²¿Çå¿Õ) # if leaveServerMinute > 24 * 60: # #Èç¹ûÌìÊý²»Îª0, Çå¿ÕËùÓÐÊ£Óàʱ¼ä # for i in range(0, skillManager.GetSkillCount()): # curSkill = skillManager.GetSkillByIndex(i) # curSkill.SetRemainTime(0) # # return #=========================================================================== #ÏÂÏßʱ¼ä²»×ãÒ»Ìì, ½«¼¼ÄܵÄCDÉèÖÃΪ, ¼¼ÄÜÊ£ÓàCD-ÏÂÏßʱ¼ä for i in range(0, skillManager.GetSkillCount()): curSkill = skillManager.GetSkillByIndex(i) #Ê£Óàʱ¼äΪºÁÃë skillRemainTime = curSkill.GetRemainTime() #¼¼ÄÜCDʱ¼äΪ0µÄ¼¼Äܲ»Ë¢Ð if skillRemainTime == 0: continue lastTime = skillRemainTime - leaveServerSeconds * 1000 if lastTime <= 0: curSkill.SetRemainTime(0) continue curSkill.SetLastUseTick(tick) curSkill.SetRemainTime(lastTime) return ## ÕÙ»½·ÇÖ÷È˵ÄNPC # @param curPlayer µ±Ç°Íæ¼Ò # @param curSkill ¼¼ÄÜʵÀý # @param tick µ±Ç°Ê±¼ä # @return ÊÇ·ñ³É¹¦ # @remarks ÕÙ»½·ÇÖ÷È˵ÄNPC def SummonMapNPCBySkill(attacker, curSkill, tick): curPosX = attacker.GetPosX() curPosY = attacker.GetPosY() curEffect = GetSkillEffectByEffectID(curSkill, ChConfig.Def_Skill_Effect_SummonMapNPC) if curEffect == None: GameWorld.ErrLog("ûÓÐÕÒµ½ÏàÓ¦µÄЧ¹ûID %s" % ChConfig.Def_Skill_Effect_SummonMapNPC) return False #±éÀúËùÓеÄЧ¹û ÕÒµ½ÕÙ»½µÄЧ¹û Ч¹û1ֵΪNPCID 2ֵΪ´æÔÚʱ¼ä aiÀàÐÍÓÉNPCµÄID¾ö¶¨ npcID = curEffect.GetEffectValue(0) curNPC = GameWorld.GetGameData().FindNPCDataByID(npcID) if curNPC == None: GameWorld.ErrLog("ûÓÐNPC %s" % npcID) return False aiType = curNPC.GetAIType() if aiType <= 0: GameWorld.ErrLog("AIÀàÐͲ»¶Ô %s" % aiType) return False lastTime = curSkill.GetLastTime() #ÕÙÔÚ×Ô¼ºÉí±ßÖ÷ÒªÓÃÓÚ NPC×Ô¼ºËÀµÄʱºòÕÙ³öÁíÒ»¸ö #GameWorld.Log('summon map NPC: '+str([i, npcId, aiType, lastTime])) curNpc = NPCCommon.SummonMapNpc(npcID, curPosX, curPosY, aiType, lastTime) curNpc.SetIsNeedProcess(True) return True ## ÕÙ»½NPC´æÔÚ¹æÔò # @param curPlayer µ±Ç°Íæ¼Ò # @param summonNPCID ÕÙ»½NPCID # @param tick µ±Ç°Ê±¼ä # @return True or False # @remarks º¯ÊýÏêϸ˵Ã÷. def SummonNPCOccurRule(curPlayer, summonNPCID, tick): #»ñµÃÍæ¼ÒÕÙ»½ÊÞÊýÁ¿ summonCount = curPlayer.GetSummonCount() if summonCount == 0 : return True curSummon = GameWorld.GetGameData().FindNPCDataByID(summonNPCID) if curSummon == None : GameWorld.Log("¼¼ÄÜÌî±í´íÎó,ÎÞ´ËNPC,summonNPCID = %s" % (summonNPCID) , curPlayer.GetPlayerID()) return False curSummonType = curSummon.GetType() summonList, maxBornIndex = __GetSummonByFuncTypeList(curPlayer, summonCount, curSummonType, tick) if len(summonList) == 0: #ÎÞͬÀàÕÙ»½ÊÞ return True #---2010-06-07 chenxuewei Ó¦²ß»®³Â½ð³ÉÐèÇó£ºÕÙ»½NPCÊôÓÚͬһ¸ö¹¦ÄÜÀàÐÍÔòÕÙ»½ÊýÁ¿½öÒ»Ö»£»·ñÔò¿ÉÒÔͬʱ´æÔÚ£»--- curSummonFunctionType = curSummon.GetFunctionType() for summonNPC in summonList: if summonNPC.GetFunctionType() == curSummonFunctionType : npcControl = NPCCommon.NPCControl(summonNPC) npcControl.SetKilled() #GameWorld.Log("´æÔÚÏàͬµÄÁé,½«Ô­ÏÈÏàͬÁéɾ³ý") return False return True ## »ñµÃÒÑÕÙ»½µÄͬÀàÐÍNPC # @param curPlayer µ±Ç°Íæ¼Ò # @param summonCount ÕÙ»½ÊÞÊýÁ¿ # @param curSummonType µ±Ç°ÕÙ»½ÊÞÀàÐÍ # @param tick µ±Ç°Ê±¼ä # @return summonNPClist , maxBornIndex ͬÀàÕÙ»½ÊÞ def __GetSummonByFuncTypeList(curPlayer, summonCount, curSummonType, tick): #»º´æµÄͬÀàÕÙ»½ÊÞºÍË÷Òý summonNPCList = [] list_Index = 0 #»º´æ×î´ó´æÔÚʱ¼ä,ºÍÁбíË÷Òý maxBornTime = 0 maxBornIndex = 0 for i in range(0, summonCount): summonNPC = curPlayer.GetSummonNPCAt(i) if summonNPC.GetType() != curSummonType: continue #ÊÇϵͳÕÙ»½ÊÞ #if __IsSystemSummonNPC(summonNPC): # continue #ÕÒµ½Í¬ÀàµÄÕÙ»½ÊÞ summonNPCList.append(summonNPC) #µ±Ç°NPCÒѾ­´æÔÚµÄʱ¼ä summonNPC_BeingTime = tick - summonNPC.GetBornTime() #Óиü¾Ã´æÔÚµÄNPC if summonNPC_BeingTime > maxBornTime: maxBornTime = summonNPC_BeingTime maxBornIndex = list_Index #½«±£´æÕÙ»½ÊÞµÄÁбíÊýÁ¿+1 list_Index += 1 return summonNPCList, maxBornIndex ## »ñµÃ³ÖÐøÐÔ¼¼ÄܵÄ×ÜÁ¿(¼¼ÄÜÀàÐÍ -> 12,13) # @param curPlayer µ±Ç°Íæ¼Ò # @param curSkill µ±Ç°¼¼ÄÜ # @param skillPlus ,¼¼ÄÜÔöÒæ # @return value # @remarks º¯ÊýÏêϸ˵Ã÷. def GetLastSkillMaxValue(curPlayer , curSkill , skillPlus=None): #¸ù¾ÝÔ¼¶¨,×ÜÁ¿Ò»¶¨ÊǵÚ0¸öЧ¹û curEffect = curSkill.GetEffect(0) index = curEffect.GetEffectValue(0) skillPer = curEffect.GetEffectValue(1) effect = curEffect.GetEffectValue(2) maxValue = EffGetSet.GetValueByEffIndex(curPlayer, index) #GameWorld.Log("³ÖÐøÉ˺¦×ÜÖµÉèÖÃcurSkill = %s,maxValue = %s skillPer = %s,effect = %s"%(curSkill.GetSkillName(),maxValue,skillPer,effect)) if maxValue == None: GameWorld.Log("¼ÆË㸽¼Ó¼¼ÄÜ×ÜÁ¿´íÎó,skillID = %s,index = %s" % (curSkill.GetSkillID(), index) , curPlayer.GetPlayerID()) return effect #×ÜÖµ value = 0 if skillPlus == None : value = (maxValue * skillPer / ChConfig.Def_MaxRateValue) + effect #GameWorld.Log("³ÖÐøÉ˺¦×ÜÖµÉèÖà value = %s"%value) else: plus = 1 + skillPlus / float(ChConfig.Def_MaxRateValue) value = (maxValue * (skillPer * plus) / ChConfig.Def_MaxRateValue) + effect #GameWorld.Log("³ÖÐøÉ˺¦×ÜÖµÉèÖà value = %s ¼¼Äܸ½¼Ó = %s"%(value,plus)) return int(value) ## Íæ¼ÒÕÙ»½NPC(µ±Ç°Íæ¼Ò,ÕÙ»½¼¼ÄÜ,ÕÙ»½ÊÞID,ÕÙ»½ÊÞÊôÐÔÁбí, ÕÙ»½ÊÞÀë×Ô¼ºµÄ¾àÀë, µ±Ç°Ê±¼ä) # @param curPlayer µ±Ç°Íæ¼Ò # @param curSkill ÕÙ»½¼¼ÄÜ # @param summonID ÕÙ»½ÊÞID # @param summonDist ÕÙ»½ÊÞÀë×Ô¼ºµÄ¾àÀë # @param tick µ±Ç°Ê±¼ä # @param isAppointBornPos ÊÇ·ñÖ¸¶¨ÕÙ»½NPCµÄ³öÉúµã # @param bornPosX ÕÙ»½NPCµÄ³öÉúµã×ø±êX # @param bornPosY ÕÙ»½NPCµÄ³öÉúµã×ø±êY # @return None # @remarks º¯ÊýÏêϸ˵Ã÷. def PlayerSummonNPC(curPlayer, curSkill, summonID, summonDist, tick, isAppointBornPos=False, bornPosX=0, bornPosY=0): #½«ÒªÕÙ»½³öµÄNPC summonNPC = curPlayer.SummonNewNPC() #ÉèÖÃÕÙ»½ÊÞ»ù´¡ÐÅÏ¢ summonNPC.SetNPCTypeID(summonID) lvSummonNPC = curPlayer.GetLV() summonNPC.SetLV(lvSummonNPC) summonNPC.SetCountry(curPlayer.GetCountry()) summonNPC.SetDict(ChConfig.Def_NpcDictKey_CampType, curPlayer.GetFaction()) summonNPC.GetNPCAngry().Init(ChConfig.Def_SummonNPC_Angry_Count) #ÉèÖÃÕÙ»½ÊÞÊôÐÔ SetSummonNPCProperty(curPlayer, summonNPC, curSkill) #³õʼ»¯ NPCCommon.InitNPC(summonNPC) #Íæ¼ÒÕÙ»½ÊÞÁбíÌí¼ÓÕÙ»½ÊÞ,ÕÙ»½ÊÞÌí¼ÓÖ÷ÈË summonNPC.SetOwner(curPlayer) summonNPC.SetDict(ChConfig.Def_NPC_Dict_SummonMapNPCPlayerID, curPlayer.GetPlayerID()) #½«ÕÙ»½ÊÞÕÙ»½³öÀ´ if isAppointBornPos: #Ö¸¶¨³öÉúµã summonNPC.Reborn(bornPosX, bornPosY) else: #Íæ¼ÒÖÜÎ§Ëæ»ú³öÉúµã #¼¼ÄÜÕÙ»½×ø±ê ChConfig.Def_SummonAppearDist summonPos = GameMap.GetEmptyPlaceInArea(curPlayer.GetPosX(), curPlayer.GetPosY(), summonDist) summonNPC.Reborn(summonPos.GetPosX(), summonPos.GetPosY()) summonNPC.SetBornTime(tick) # ¼Ì³Ð¼¼Äܵȼ¶ SetSummonNPCSkillLV(summonNPC, curSkill) if curSkill: summonNPC.SetLastTime(curSkill.GetLastTime()) #----ÉèÖÃΪÎÞµÐ,ÔÚAIÖнâ³ýÎ޵Р#----Õâ¸öÂß¼­ÔÚÓÐÖ÷¶¯Î޵м¼ÄÜ»òbuffµÄʱºò»á³ö´í! summonNPC.SetCanAttack(False) return # ÕÙ»½ÊÞ¼¼Äܼ̳У¬Íæ¼ÒÊͷż¼Äܵĵȼ¶ def SetSummonNPCSkillLV(summonNPC, curSkill): if curSkill.GetEffect(0).GetEffectValue(1) == 0: return skillLV = curSkill.GetSkillLV() - 1 if skillLV == 0: return skillManager = summonNPC.GetSkillManager() learnSkillIDList =[] for index in range(0, skillManager.GetSkillCount()): useSkill = skillManager.GetSkillByIndex(index) #ÒѾ­µ½Î²²¿ÁË if not useSkill or useSkill.GetSkillTypeID() == 0: break useSkillTypeID = useSkill.GetSkillTypeID() # ÕÒµ½¿ÉѧϰµÄ¼¼ÄÜ learnSkillID = useSkillTypeID + skillLV findSkill = GameWorld.GetGameData().GetSkillBySkillID(learnSkillID) if not findSkill: continue if findSkill.GetSkillTypeID() != useSkillTypeID: # ²»ÊÇͬһ¸ö¼¼ÄÜ continue learnSkillIDList.append(learnSkillID) for skillID in learnSkillIDList: skillManager.LearnSkillByID(skillID, False) return ## ÉèÖÃÕÙ»½ÊÞÊôÐÔ # @param curPlayer µ±Ç°Íæ¼Ò # @param summonNPC µ±Ç°ÕÙ»½ÊÞ # @return None # @remarks º¯ÊýÏêϸ˵Ã÷. def SetSummonNPCProperty(curPlayer, summonNPC, curSkill=None): # Èç¹ûÊÇÒÔÕÙ»½¼¼Äܾö¶¨ÕÙ»½ÊÞÊôÐÔ°Ù·Ö±ÈµÄ if curSkill: Calc_Summon_BaseEffectBySkillPer(curPlayer, summonNPC, curSkill) return # #ͬһ¸öÕÙ»½ÊÞÓÐ10¸öµÈ¼¶, ËùÒÔ±ØÐëÓÃGetFunctionTypeÀ´¾ö¶¨ÕÙ»½ÊÞµÄÀàÐÍ # summonID = summonNPC.GetFunctionType() # # summonList = None # if ChConfig.Def_SummonProperty.has_key(summonID): # summonList = ChConfig.Def_SummonProperty[summonID] # # #ÉèÖÃÍæ¼Ò±»¶¯¼¼ÄܶÔÕÙ»½ÊÞÊôÐÔµÄÓ°Ïì # __PassiveSkill_AddSummonAttribute(curPlayer, summonNPC, summonID) # # if summonList != None: # lvSummonNPC = summonNPC.GetLV() # #ÉèÖÃÕÙ»½ÊÞÕ½¶·ÐÅÏ¢ # __CalcSummonEffectValue(lvSummonNPC, summonNPC, summonList) #¼ÆËã»ù´¡×ÜÖµ Calc_Summon_BaseEffect(summonNPC) return ## NPCʹÓü¼ÄÜÕÙ»½NPC£¬ÓÃÓÚÍâ²ãÑ­»·ÕÙ»½£¬ÐèÒªÉèÖÃÕÙ»½ÊÞÊôÐÔ # @param curNPC µ±Ç°npc # @param curSkill µ±Ç°¼¼ÄÜ # @param summonCount ÕÙ»½ÊýÁ¿ # @param maxAngryCount ×î´óÅ­Öµ # @param summonNPCID ÕÙ»½ÊÞID # @param tick µ±Ç°Ê±¼ä # @param addAngry ÊÇ·ñÔö¼ÓÅ­Öµ # @return ÕÙ»½ÊÞʵÀý def DoLogic_NPC_UseSkill_SummonNPCSingle(curNPC, curSkill, summonCount, maxAngryCount, summonNPCID, tick, addAngry=False): count = 0 # ¼ÆËãÒÑÕÙ»½¸öÊý isAddCount = True # ÊÇ·ñÐÂÔöÕÙ»½ÊýÁ¿ index = -1 # ÕÙ»½ÊÞË÷Òý #ѰÕÒÒ»¸ö¿ÉÒÔÕÙ»½µÄNPC for i in range(0, curNPC.GetSummonCount()): summonNPC = curNPC.GetSummonNPCAt(i) if not summonNPC: continue if summonNPC.GetNPCID() != summonNPCID: continue if count >= summonCount: #×ã¹»ÁËÍ˳ö return None #ÕÙ»½ÊýÁ¿¼Ó1 count += 1 #ÒÑÕÙ»½ if GameObj.GetHP(summonNPC) > 0: continue #ÉèÖÃΪ²»ÐÂÔö isAddCount = False index = i if isAddCount: #Ìí¼ÓÕÙ»½ÊýÁ¿1Ö» curNPC.AddSummonCount(1, summonNPCID, maxAngryCount) #È¡ÐÂÔöµÄÒ»Ö»£¬×îºóÒ»¸ö index = curNPC.GetSummonCount() - 1 npcID = curNPC.GetNPCID() skillID = curSkill.GetSkillID() if index == -1: GameWorld.ErrLog("AddSummonErr NPCID=%s£¬ skillID=%s summonID=%s" % (npcID, skillID, summonNPCID)) return None summonNPC = curNPC.GetSummonNPCAt(index) if not summonNPC: GameWorld.ErrLog("SummonErr NPCID=%s£¬ skillID=%s summonID=%s" % (npcID, skillID, summonNPCID)) return None return SummonNPCByInstance(curNPC, summonNPC, curSkill, tick, addAngry) #=============================================================================== # NPC ÕÙ»½½Ó¿Ú˵Ã÷ # AddSummonCount(*args) Ìí¼ÓNPCµÄÕÙ»½¸öÊý£¬¿ÉÖ¸¶¨NPCID # SetSummonCount(*args) ÉèÖÃNPCµÄÕÙ»½¸öÊý£¬¿ÉÖ¸¶¨NPCID£¬»áÇå¿ÕÒÑÓеÄÕÙ»½ÐÅÏ¢ # GetSummonCount(*args) »ñµÃÕÙ»½×ÜÊýÁ¿ # GetSummonNPCAt(*args) »ñµÃÖ¸¶¨Ë÷ÒýµÄÕÙ»½ÊÞ # FindSummonByID(*args) ͨ¹ýÖ¸¶¨µÄµØÍ¼ÖеÄNPCID£¨·ÇÊý¾Ý¿âNPCID£©²éÕÒÖ÷ÈË£¨NPC£©µÄÕÙ»½ÊÞ # # ÕÙ»½ÊÞËÀÍö»á´ÓÖ÷È˵ÄÕÙ»½´æ´¢ÌåÖÐÇå³ý GetSummonCountÊýÁ¿¼õÒ» # δÕÙ»½µÄÕÙ»½ÊÞ£¬³õʼHPΪ0 #=============================================================================== ##ͨ¹ýÊý¾Ý¿âµÄNPCID»ñµÃNPCµÄÕÙ»½ÊÞ¸öÊý£¨°üÀ¨ÒÑÕÙºÍδÕÙ£© # @param curNPC NPCʵÀý # @param summonID ÕÙ»½ÊÞµÄNPCID # @return ÕÙ»½ÊÞÊýÁ¿ def GetSummonCountByNPCID(gameObj, summonID): count = 0 for i in range(0, gameObj.GetSummonCount()): summonNPC = gameObj.GetSummonNPCAt(i) if not summonNPC: continue if summonNPC.GetNPCID() == summonID: count += 1 return count ## NPCʹÓü¼ÄÜÕÙ»½NPC(¿ÉÓÃÓÚÕÙ»½²»Í¬IDµÄÕÙ»½ÊÞ),Ò»´ÎÕÙÍê # @param curNPC µ±Ç°npc # @param curSkill µ±Ç°¼¼ÄÜ # @param summonNPCID ÕÙ»½ÊÞID # @param summonCount ÕÙ»½ÊýÁ¿ # @param maxAngryCount ³ðºÞ¸öÊý # @param tick µ±Ç°Ê±¼ä # @param addAngry ÊÇ·ñÔö¼ÓÅ­Öµ # @return None def DoLogic_NPC_UseSkill_SummonNPCAll(curNPC, curSkill, summonNPCID, summonCount, maxAngryCount, tick, addAngry=False): #»ñµÃ»¹ÐèÌí¼ÓµÄÕÙ»½¸öÊý addCount = max(summonCount - GetSummonCountByNPCID(curNPC, summonNPCID), 0) #ÐÂÔöÕÙ»½ÊÞ ÕÒ²»µ½ÔòÌí¼Ó if addCount != 0: curNPC.AddSummonCount(addCount, summonNPCID, maxAngryCount) count = 0 #ѰÕÒÒ»¸ö¿ÉÒÔÕÙ»½µÄNPC for i in range(0, curNPC.GetSummonCount()): summonNPC = curNPC.GetSummonNPCAt(i) if not summonNPC: continue if summonNPC.GetNPCID() != summonNPCID: continue #×ã¹»ÁËÍ˳ö if count >= summonCount: return #ÕÙ»½ÊýÁ¿¼Ó1 count += 1 #ÒÑÕÙ»½ if GameObj.GetHP(summonNPC) > 0: continue SummonNPCByInstance(curNPC, summonNPC, curSkill, tick, addAngry) ## NPCʹÓü¼ÄÜÕÙ»½NPC(¿ÉÓÃÓÚÕÙ»½²»Í¬IDµÄÕÙ»½ÊÞ)(µ¥´ÎÕÙ»½) # @param curNPC µ±Ç°npc # @param curSkill µ±Ç°¼¼ÄÜ # @param summonNPCID ÕÙ»½ÊÞID # @param summonAllCount ÕÙ»½×ÜÊýÁ¿ # @param maxAngryCount ³ðºÞ¸öÊý # @param tick µ±Ç°Ê±¼ä # @param addAngry ÊÇ·ñÔö¼ÓÅ­Öµ # @param posX ÕÙ»½ÊÞ³õÊ¼×ø±ê # @param posY ÕÙ»½ÊÞ³õÊ¼×ø±ê # @return None def DoLogic_NPC_UseSkill_SummonNPC(curNPC, curSkill, summonNPCID, summonAllCount, maxAngryCount, tick, addAngry=False, dist=ChConfig.Def_DropItemDist, rebornPosX=0, rebornPosY=0): if GetSummonCountByNPCID(curNPC, summonNPCID) >= summonAllCount: #ÒѾ­´ïµ½×ÜÊýÁ¿ return #»ñµÃ»¹ÐèÌí¼ÓµÄÕÙ»½¸öÊý addCount = min(summonAllCount - GetSummonCountByNPCID(curNPC, summonNPCID), 1) #ÐÂÔöÕÙ»½ÊÞ ÕÒ²»µ½ÔòÌí¼Ó if addCount != 0: curNPC.AddSummonCount(addCount, summonNPCID, maxAngryCount) for i in range(0, curNPC.GetSummonCount()): summonNPC = curNPC.GetSummonNPCAt(i) if not summonNPC: continue if summonNPC.GetNPCID() != summonNPCID: continue #ÒÑÕÙ»½ if GameObj.GetHP(summonNPC) > 0: continue return SummonNPCByInstance(curNPC, summonNPC, curSkill, tick, addAngry, dist, rebornPosX, rebornPosY) return ## NPCʹÓü¼ÄÜÕÙ»½NPC(¿ÉÓÃÓÚÕÙ»½²»Í¬IDµÄÕÙ»½ÊÞ),Ò»´ÎÕÙÍê # @param curNPC µ±Ç°npc # @param summonNPC ÕÙ»½ÊÞʵÀý # @param curSkill µ±Ç°¼¼ÄÜ # @param tick µ±Ç°Ê±¼ä # @param addAngry ÊÇ·ñÔö¼ÓÅ­Öµ # @param dist ÕÙ»½·¶Î§ # @return ÕÙ»½ÊÞʵÀý def SummonNPCByInstance(curNPC, summonNPC, curSkill, tick, addAngry=False, dist=ChConfig.Def_DropItemDist, posX=0, posY=0): #ÉèÖÃÕâ¸öNPCÊôÐÔ£¬²¢ÕÙ»½³öÕâ¸öNPC NPCCommon.InitNPC(summonNPC) # ÊôÐÔ±ä¸üºó֪ͨ³öÏÖ if posX != 0 and posY != 0: summonNPC.Reborn(posX, posY, False) else: resultPos = GameMap.GetEmptyPlaceInArea(curNPC.GetPosX(), curNPC.GetPosY(), dist) summonNPC.Reborn(resultPos.GetPosX() , resultPos.GetPosY(), False) summonNPC.SetBornTime(tick) summonNPC.SetLastTime(curSkill.GetLastTime()) summonNPC.SetIsNeedProcess(True) atkper = 1 findEffect = GetSkillEffectByEffectID(curSkill, ChConfig.Def_Skill_Effect_SummonAttr) if findEffect: atkper = float(findEffect.GetEffectValue(0))/ChConfig.Def_MaxRateValue maxHPPer = float(findEffect.GetEffectValue(2))/ChConfig.Def_MaxRateValue if atkper: summonNPC.SetBaseMinAtk(int(curNPC.GetMinAtk()*atkper)) summonNPC.SetBaseMaxAtk(int(curNPC.GetMaxAtk()*atkper)) if maxHPPer: GameObj.SetMaxHP(summonNPC, int(GameObj.GetMaxHP(curNPC)*maxHPPer)) GameObj.SetHP(summonNPC, int(GameObj.GetMaxHP(curNPC)*maxHPPer)) else: NPCCommon.DoNPCAttrStrengthen(summonNPC, True) FBLogic.DoFBRebornSummonNPC(summonNPC, tick) if not addAngry: #·µ»ØÖµ,¼¼ÄÜÊͷųɹ¦ return summonNPC #--------------¼Ì³ÐÕÙ»½ÕßNPCµÄ³ðºÞ summonNPCAngry = summonNPC.GetNPCAngry() curNPCAngry = curNPC.GetNPCAngry() for i in range(0 , curNPCAngry.GetAngryCount()): angryValue = curNPCAngry.GetAngryValueTag(i) angryValue_ID = angryValue.GetObjID() if not angryValue_ID: continue summonNPCAngry.AddAngry(angryValue_ID, angryValue.GetObjType(), angryValue.GetAngryValue(), angryValue.GetAngryValueEx()) summonNPC.NotifyAppear() # ×îÖÕͳһ֪ͨNPC³öÏÖ #·µ»ØÖµ,¼¼ÄÜÊͷųɹ¦ return summonNPC ## ÕÙ»½ÊÞʹÓü¼ÄÜÕÙ»½ # @param curNPC µ±Ç°NPC # @param curSkill µ±Ç°¼¼ÄÜ # @param maxSummonCount ×î´óÕÙ»½ÊýÁ¿ # @param maxAngryCount ×î´óÅ­ÖµÊýÁ¿ # @param posX ÖØÉú×ø±êX # @param posY ÖØÉú×ø±êY # @param tick µ±Ç°Ê±¼ä # @return ÕÙ»½ÊÞ # @remarks º¯ÊýÏêϸ˵Ã÷. #def SummonNPC_UseSkill_SummonNPC(curNPC, curSkill , maxSummonCount , maxAngryCount , posX, posY, tick): # #»ñµÃÕÙ»½ÊÞID # summonNPCID = curSkill.GetEffect(0).GetEffectValue(0) # # if not summonNPCID: # return # # #µÚÒ»´ÎÕÙ»½µÄʱºò£¬ÐèÒª³õʼ»¯×î´óÕÙ»½¸öÊý # if not curNPC.GetSummonCount() : # curNPC.SetSummonCount(maxSummonCount, summonNPCID, maxAngryCount) # # #ÕÙ»½ÊÞÕÙ»½²¹×ã # elif curNPC.GetGameNPCObjType() == IPY_GameWorld.gnotSummon and maxSummonCount > curNPC.GetSummonCount(): # curNPC.AddSummonCount(maxSummonCount - curNPC.GetSummonCount(), summonNPCID, maxAngryCount) # # #ѰÕÒÒ»¸ö¿ÉÒÔÕÙ»½µÄNPC # summonIsFull = True # summonNPC = None # # for i in range(0, curNPC.GetSummonCount()): # summonNPC = curNPC.GetSummonNPCAt(i) # if GameObj.GetHP(summonNPC) > 0: # continue # # summonIsFull = False # break # # #ÒѾ­Ã»ÓпÉÕÙ»½ÊÞµÄÕÙ»½ÊÞ,ÂúÁË # if summonIsFull: # return # # #ÉèÖÃÕâ¸öNPCÊôÐÔ£¬²¢ÕÙ»½³öÕâ¸öNPC # NPCCommon.InitNPC(summonNPC) # # summonNPC.Reborn(posX , posY) # summonNPC.SetBornTime(tick) # summonNPC.SetLastTime(curSkill.GetLastTime()) # # #·µ»ØsummonNPC,¼¼ÄÜÊͷųɹ¦ # return summonNPC ## ÉèÖÃÍæ¼Ò±»¶¯¼¼ÄܶÔÕÙ»½ÊÞÊôÐÔµÄÓ°Ïì # @param curPlayer µ±Ç°Íæ¼Ò # @param summonNPC µ±Ç°ÕÙ»½ÊÞ # @param summonID ÕÙ»½ÊÞID # @return None # @remarks º¯ÊýÏêϸ˵Ã÷. def __PassiveSkill_AddSummonAttribute(curPlayer, summonNPC, summonID): return ## ¸ù¾ÝЧ¹û»ñµÃÖµ # @param valueList # @param curSkill µ±Ç°¼¼ÄÜ # @return Ч¹ûÖµÐòÁÐ # @remarks º¯ÊýÏêϸ˵Ã÷. def GetValueBySkillEffect(valueList, curSkill): effCount = len(valueList) returnList = [] for index in range(0 , effCount) : effValue = curSkill.GetEffect(index).GetEffectValue(0) value = valueList[index] * effValue / ChConfig.Def_MaxRateValue returnList.append(value) return returnList ## ¼ÆËãNPCÊôÐÔЧ¹û # @param lvSummonNPC Íæ¼Ò # @param summonNPC Ч¹û # @param summonList NPC # @return True # @remarks º¯ÊýÏêϸ˵Ã÷. def __CalcSummonEffectValue(lvSummonNPC, summonNPC, summonList): for value in summonList: curValue = EffGetSet.GetValueByEffIndex(summonNPC, value[0]) #GameWorld.Log("µ±ÆÚÊôÐÔ = %s index = %s"%(curValue,value[0])) #GameWorld.Log("ÉèÖÃÊôÐÔ = %s"%(curValue + value[1] * lvSummonNPC)) EffGetSet.SetValueByEffIndex(summonNPC, value[0], curValue + value[1] * lvSummonNPC) return True ## ÉèÖÃÕâ¸öÕÙ»½Ê޵Ļù´¡ÊôÐÔ # @param summonNPC ÕÙ»½ÊÞ # @return None # @remarks º¯ÊýÏêϸ˵Ã÷. def Calc_Summon_BaseEffectBySkillPer(curPlayer, summonNPC, curSkill): curEffect = curSkill.GetEffect(0) if curEffect == None: GameWorld.Log("ÕÙ»½¼¼ÄÜÎÞЧ¹û,skillID = %s" % curSkill.GetSkillID(), curPlayer.GetPlayerID()) return False skillPer = curEffect.GetEffectValue(1) if not skillPer: GameWorld.Log("¼¼ÄÜ %sÌî±í´íÎó,ÕÙ»½¼¼ÄÜÊôÐÔ°Ù·Ö±ÈΪ0" % curSkill.GetSkillID(), curPlayer.GetPlayerID()) return False skillPer = skillPer / float(ChConfig.Def_MaxRateValue) #ÉèÖÃÕâ¸öÕÙ»½Ê޵Ļù´¡ÊôÐÔ summonNPC.SetBaseMinAtk(int(curPlayer.GetMinAtk() * skillPer)) #×îС¹¥»÷Á¦ summonNPC.SetBaseMaxAtk(int(curPlayer.GetMaxAtk() * skillPer)) #×î´ó¹¥»÷Á¦ summonNPC.SetBaseDef(int(curPlayer.GetDef() * skillPer)) #·ÀÓùÁ¦ summonNPC.SetBaseHit(int(curPlayer.GetHit() * skillPer)) #ÃüÖÐ summonNPC.SetBasePoisionAtk(int(curPlayer.GetPoisionAtk() * skillPer)) summonNPC.SetBaseFireAtk(int(curPlayer.GetFireAtk() * skillPer)) summonNPC.SetBaseIceAtk(int(curPlayer.GetIceAtk() * skillPer)) summonNPC.SetBaseThunderAtk(int(curPlayer.GetThunderAtk() * skillPer)) summonNPC.SetBaseWindAtk(int(curPlayer.GetWindAtk() * skillPer)) summonNPC.SetBasePoisionDef(int(curPlayer.GetPoisionDef() * skillPer)) summonNPC.SetBaseFireDef(int(curPlayer.GetFireDef() * skillPer)) summonNPC.SetBaseIceDef(int(curPlayer.GetIceDef() * skillPer)) summonNPC.SetBaseThunderDef(int(curPlayer.GetThunderDef() * skillPer)) summonNPC.SetBaseWindDef(int(curPlayer.GetWindDef() * skillPer)) #summonNPC.SetBaseAtkInterval(int(curPlayer.GetAtkInterval() * skillPer)) summonNPC.SetBaseMissRate(int(curPlayer.GetMiss() * skillPer)) summonNPC.SetBaseSuperHiteRate(int(curPlayer.GetSuperHitRate() * skillPer)) GameObj.SetBaseMaxHP(summonNPC, int(GameObj.GetMaxHP(curPlayer) * skillPer)) #summonNPC.SetBaseHPRestore(int(curPlayer.GetHPRestoreSetting() * skillPer)) #summonNPC.SetOrgSpeed(int(curPlayer.GetOrgSpeed() * skillPer)) return ## ÉèÖÃÕâ¸öÕÙ»½Ê޵Ļù´¡ÊôÐÔ # @param summonNPC ÕÙ»½ÊÞ # @return None # @remarks º¯ÊýÏêϸ˵Ã÷. def Calc_Summon_BaseEffect(summonNPC): #ÉèÖÃÕâ¸öÕÙ»½Ê޵Ļù´¡ÊôÐÔ summonNPC.SetBaseMinAtk(summonNPC.GetMinAtk()) #×îС¹¥»÷Á¦ summonNPC.SetBaseMaxAtk(summonNPC.GetMaxAtk()) #×î´ó¹¥»÷Á¦ summonNPC.SetBaseDef(summonNPC.GetDef()) #·ÀÓùÁ¦ summonNPC.SetBaseHit(summonNPC.GetHit()) #ÃüÖÐ summonNPC.SetBasePoisionAtk(summonNPC.GetPoisionAtk()) summonNPC.SetBaseFireAtk(summonNPC.GetFireAtk()) summonNPC.SetBaseIceAtk(summonNPC.GetIceAtk()) summonNPC.SetBaseThunderAtk(summonNPC.GetThunderAtk()) summonNPC.SetBaseWindAtk(summonNPC.GetWindAtk()) summonNPC.SetBasePoisionDef(summonNPC.GetPoisionDef()) summonNPC.SetBaseFireDef(summonNPC.GetFireDef()) summonNPC.SetBaseIceDef(summonNPC.GetIceDef()) summonNPC.SetBaseThunderDef(summonNPC.GetThunderDef()) summonNPC.SetBaseWindDef(summonNPC.GetWindDef()) summonNPC.SetBaseAtkInterval(summonNPC.GetAtkInterval()) summonNPC.SetBaseMissRate(summonNPC.GetMiss()) summonNPC.SetBaseSuperHiteRate(summonNPC.GetSuperHitRate()) GameObj.SetBaseMaxHP(summonNPC, GameObj.GetMaxHP(summonNPC)) summonNPC.SetBaseHPRestore(summonNPC.GetHPRestore()) #summonNPC.SetOrgSpeed( summonNPC.GetOrgSpeed( )) return #-----------------------------------------NPCÀà ## »ñµÃȺ¹¥¼¼ÄÜ,¹¥»÷·¶Î§ÄڵĶÓÎé³ÉÔ± # @param curPlayer µ±Ç°Íæ¼Ò # @param srcPosX ÆðµãX # @param srcPosY ÆðµãY # @param skillMatrix ¼¼Äܹ¥»÷Êý×é # @param area ×é¶ÓÇøÓò # @return None # @remarks º¯ÊýÏêϸ˵Ã÷. def GetSkillAreaTeamPlayer(curPlayer, srcPosX, srcPosY, skillMatrix, area): gameMap = GameWorld.GetMap() curPlayerTeam = curPlayer.GetTeam() #»ñµÃÖ¸¶¨·¶Î§ÄÚ¶ÓÎé³ÉÔ± teamPlayerList = PlayerControl.GetAreaTeamMember(curPlayerTeam, srcPosX, srcPosY, area) #½«×é¶ÓÍæ¼ÒÁбíת»»³ÉIDÁбí teamIDList = [] for teamPlayer in teamPlayerList: teamIDList.append(teamPlayer.GetID()) #ÔÚÇøÓòÄڵĶÓÔ±ÊýÁ¿ inAreaTeamPlayerList = [] for curPos in skillMatrix: #¼ì²éÓÐûÓжÔÏóÔÚÕâÒ»µãÉÏ mapObj = gameMap.GetPosObj(srcPosX + curPos[0], srcPosY + curPos[1]) if not mapObj: continue #±éÀúµ±Ç°µã¶ÔÏó for i in range(0, mapObj.GetObjCount()): curObj = mapObj.GetObjByIndex(i) curObjType = curObj.GetGameObjType() #NPC²»´¦Àí if curObjType != IPY_GameWorld.gotPlayer : continue #²»ÊÇÕÙ»½ÊÞµÄÖ÷ÈË,²¢ÇÒ²»ÊǶÓÓÑ curObjID = curObj.GetID() if curObjID != curPlayer.GetID() and \ curObjID not in teamIDList: continue #ÕÒµ½Õâ¸öÓÎÏ·¶ÔÏóʵÀý curObj = GameWorld.GetObj(curObjID, curObjType) if curObj == None: continue inAreaTeamPlayerList.append(curObj) return inAreaTeamPlayerList ## ²éÕÒÖ¸¶¨¼¼ÄܵÄЧ¹û # @param curPlayer Íæ¼Ò # @param skillType ¼¼ÄÜÀàÐÍ # @return None # @remarks º¯ÊýÏêϸ˵Ã÷. def GetSkillEff(curPlayer, skillType): skill = curPlayer.GetSkillManager().FindSkillBySkillTypeID(skillType) if skill == None : return 0 effect = skill.GetEffect(0).GetEffectValue(0) return effect ## ¼¼Äָܻ´À¶ # @param curObj µ±Ç°¶ÔÏó # @param skillTypeID ¼¼ÄÜÀàÐÍID # @param addValue Ìí¼ÓÖµ # @return None # @remarks ¼¼Äָܻ´À¶ def SkillAddMP(curObj, skillTypeID, addValue): #=============================================================================== # if addValue <= 0: # GameWorld.Log('###¼¼Äܻظ´Ä§·¨Òì³£,ÊýÖµ´íÎó = %s,¼¼ÄÜÀàÐÍID = %s' % (addValue , skillTypeID)) # return # # curHP = GameObj.GetHP(curObj) # # #ËÀÍö¾Í²»ÈûØÀ¶ÁË # if curHP <= 0: # return # # #¹ã²¥»ØÄ§ # if skillTypeID > 0: # curObj.ChangeHPView(skillTypeID, addValue, ChConfig.Def_HurtTYpe_Recovery) # # curMP = curObj.GetMP() # maxMP = curObj.GetMaxMP() # # #À¶ÒÑ×î´óÖµ£¬²»ÔÙ»Ö¸´£¬Ìø³ö # if curMP == maxMP: # return # # curObj.SetMP(min(curMP + addValue, maxMP)) #=============================================================================== return ## ¼¼ÄÜÏûÀ¶ # @param curObj µ±Ç°¶ÔÏó # @param skillTypeID ¼¼ÄÜÀàÐÍID # @param skillOwner buffÓµÓÐÕß # @param lostValue ¶ªÊ§Öµ # @param tick µ±Ç°Ê±¼ä # @param view ÊÇ·ñ¹ã²¥ # @param reduce ÊÇ·ñ¿ÛÀ¶ # @return None # @remarks ¼¼ÄÜÏûÀ¶ def SkillLostMP(curObj, skillTypeID, skillOwner, lostValue, tick, view=True, reduce=True): #=========================================================================== # if lostValue <= 0: # GameWorld.Log('###¼¼ÄÜÉ˺¦ÑªÁ¿Òì³£,ÊýÖµ´íÎó = %s,¼¼ÄÜÀàÐÍID = %s' % (lostValue, skillTypeID)) # return # # curObjType = curObj.GetGameObjType() # if curObjType == IPY_GameWorld.gotNPC: # return # # #´«Èë¶ÔÏóʵÀýÖ´Ðй¥»÷½á¹û # curObjDetel = GameWorld.GetObj(curObj.GetID(), curObjType) # # if not curObjDetel: # GameWorld.ErrLog('SkillLostMP nofind ObjID = %s, ObjType = %s' % (curObj.GetID(), curObjType)) # return # # if view : # #¹ã²¥ÉËѪÀàÐÍ # curObj.ChangeHPView(skillTypeID, lostValue, ChConfig.Def_HurtType_Normal) # # curObjBeforeMP = curObj.GetMP() # # if reduce : # #Ê£ÓàѪÁ¿ # remainMP = max(curObjBeforeMP - lostValue , 0) # curObj.SetMP(remainMP) # # #ͳһµ÷Óù¥»÷½áÊø¶¯×÷ # BaseAttack.DoLogic_AttackResult(skillOwner, curObjDetel, None, tick) #=========================================================================== return ## ¼¼Äָܻ´ÑªÁ¿ # @param curObj µ±Ç°¶ÔÏó # @param skillTypeID ¼¼ÄÜÀàÐÍID # @param addValue Ìí¼ÓÖµ # @return None # @remarks º¯ÊýÏêϸ˵Ã÷. def SkillAddHP(curObj, skillTypeID, addValue, isNotify=True): curObjType = curObj.GetGameObjType() #======================================================================= # if curObj.GetMapID() in ChConfig.CanNotRecoverMapIDList and skillTypeID not in ChConfig.ForceRecoverSkillList: # GameWorld.DebugLog("¸ÃµØÍ¼ÎÞ·¨Ê¹Óü¼Äָܻ´ÑªÁ¿!") # return #======================================================================= if GameObj.GetPyPlayerState(curObj, ChConfig.Def_PlayerState_LimitAddHP): #GameWorld.DebugLog("µ±Ç°½ûÁÆ×´Ì¬Ï£¬ÎÞ·¨»Ö¸´!") return if addValue <= 0: GameWorld.Log('###¼¼Äܻظ´ÑªÁ¿Òì³£,ÊýÖµ´íÎó = %s,¼¼ÄÜÀàÐÍID = %s' % (addValue , skillTypeID)) return curHP = GameObj.GetHP(curObj) #ËÀÍö¾Í²»ÈûØÑªÁË if curHP <= 0: return if PassiveBuffEffMng.GetValueByPassiveBuffTriggerType(curObj, None, None, ChConfig.TriggerType_ForbidenCure): # ½ûÖ¹ÖÎÁÆ return # ÖÎÁÆ¼Ó³É curePer = PlayerControl.GetCurePer(curObj) if curObjType == IPY_GameWorld.gotPlayer else ChConfig.Def_MaxRateValue addValue = int(addValue*curePer*1.0/ChConfig.Def_MaxRateValue) maxHP = GameObj.GetMaxHP(curObj) #ѪÒÑ×î´óÖµ£¬²»ÔÙ»Ö¸´£¬Ìø³ö if curHP == maxHP: #¹ã²¥¼ÓѪÀàÐÍ if isNotify: AttackCommon.ChangeHPView(curObj, curObj, skillTypeID, addValue, ChConfig.Def_HurtTYpe_Recovery) return remainHP = min(curHP + addValue, maxHP) #---Íæ¼Ò´¦Àí--- if curObjType == IPY_GameWorld.gotPlayer: GameObj.SetHP(curObj, remainHP, not isNotify) FBLogic.OnFBAddHP(curObj, addValue) #---NPC´¦Àí--- elif curObjType == IPY_GameWorld.gotNPC: #³èÎï»ØÑª if curObj.GetGameNPCObjType() == IPY_GameWorld.gnotPet: PetControl.SetPetHP(curObj, remainHP) #ÆÕͨNPC»ØÑª else: GameObj.SetHP(curObj, remainHP) if not isNotify: #Òѹ㲥µÄ²»Öظ´ curObj.Notify_HP() #¹ã²¥¼ÓѪÀàÐÍ if isNotify: AttackCommon.ChangeHPView(curObj, curObj, skillTypeID, addValue, ChConfig.Def_HurtTYpe_Recovery) return ## Ö±½Ó¿ÛѪ²»×ß¹«Ê½ # view ÊÇ·ñ¹ã²¥¿Í»§¶ËƮѪ # isDoAttackResult ÊÇ·ñÁ¢¼´´¦Àí½á¹û£¬ÎªFalse±ØÐëÍâ²ãÓд¦Àí # hurtType ƮѪÀàÐÍ # skillAffect ĬÈÏTrue »á±»¸÷ÖÖ¼¼ÄÜBUFF¶ÜµÈÓ°ÏìÉËѪÊýÖµ # False´ú±íÒ»Ð©ÌØÊâ´¦Àí´¿¹Ì¶¨É˺¦Æ®×Ö£¨Èç²É¼¯¹Ì¶¨µô1µãѪ£© def SkillLostHP(curObj, skillTypeID, buffOwner, lostValue, tick, view=True, isDoAttackResult=True, hurtType=ChConfig.Def_HurtType_Normal, skillAffect=True): if lostValue <= 0: GameWorld.Log('###¼¼ÄÜÉ˺¦ÑªÁ¿Òì³£,ÊýÖµ´íÎó = %s,¼¼ÄÜÀàÐÍID = %s' % (lostValue, skillTypeID)) return if not curObj.GetCanAttack(): # Î޵в»µôѪ ## ºóÐøÓÐÆäËûÇé¿öÒ²Ó¦¿¼ÂǽøÀ´£¬ÈçïÚ³µÊÇ·ñij״̬²»µôѪ return curObjType = curObj.GetGameObjType() curSkill = GameWorld.GetGameData().FindSkillByType(skillTypeID, 1) atkObjType = buffOwner.GetGameObjType() if buffOwner else -1 # ¼¼ÄܶÔÖ¸¶¨BOSSÎÞЧ¹û----------------- if curObjType == IPY_GameWorld.gotNPC and curObj.GetIsBoss() not in ChConfig.Def_SkillAttack_NPCIsBoss: if curSkill and GetSkillBattleType(curSkill) == ChConfig.Def_BattleRelationType_CommNoBoss and SkillShell.IsNPCSkillResist(curObj): return notifyLostValue = lostValue curObjHP_BeforeAttack = GameObj.GetHP(curObj) if curObjHP_BeforeAttack == 0: # ûÓÐѪÁ¿²»ÄÜÔÙ´¥·¢ return if buffOwner: aRealmLV, dRealmLV = AttackCommon.GetPVERealmLVs(buffOwner, curObj, atkObjType, curObjType) # »ñÈ¡¾³½ç if curObjType == IPY_GameWorld.gotNPC and ChConfig.IsGameBoss(curObj) and dRealmLV > aRealmLV: # ¹¥»÷¸ß¾³½çµÄBOSS É˺¦¹Ì¶¨Îª1 lostValue = 1 if skillAffect: lostValue = AttackCommon.CalcHurtHPWithBuff(buffOwner, curObj, lostValue, curSkill, tick) #Ê£ÓàѪÁ¿ remainHP = max(curObjHP_BeforeAttack - lostValue , 0) #NPC´¦Àí if curObjType == IPY_GameWorld.gotNPC: #³èÎïÌØÊâ´¦Àí if curObj.GetGameNPCObjType() == IPY_GameWorld.gnotPet: PetControl.SetPetHP(curObj, remainHP) else: timeLostHPIpyData = IpyGameDataPY.GetIpyGameDataNotLog("NPCTimeLostHP", curObj.GetNPCID()) if timeLostHPIpyData: AttackCommon.UpdateTimeMonsterHP(curObj, timeLostHPIpyData, tick) else: GameObj.SetHP(curObj, remainHP) if not view : # Òѹ㲥µÄ²»Öظ´ curObj.Notify_HP() #ÆäËû¶ÔÏóÂß¼­´¦Àí else: # Òѹ㲥µÄ²»Öظ´ GameObj.SetHP(curObj, remainHP, not view) AttackCommon.WriteHurtLog(buffOwner, curObj, curSkill, lostValue, hurtType, "³ÖÐøµôѪ") if view: #¹ã²¥ÉËѪÀàÐÍ AttackCommon.ChangeHPView(curObj, buffOwner, skillTypeID, notifyLostValue, hurtType) if buffOwner: PassiveBuffEffMng.OnPassiveSkillTrigger(buffOwner, curObj, curSkill, ChConfig.TriggerType_AttackOverPassive, tick) # ±ôËÀ״̬´¥·¢¼¼ÄÜ if GameObj.GetHP(curObj) == 0: PassiveBuffEffMng.OnPassiveSkillTrigger(curObj, None, curSkill, ChConfig.TriggerType_WillDead, tick) PassiveBuffEffMng.OnPassiveBuffTrigger(curObj, None, curSkill, ChConfig.TriggerType_WillDead, tick) #ÎÞ·¨ÕÒµ½BuffÓµÓÐÕß if not buffOwner: AttackCommon.DoLogic_ObjDead(None, curObj, curSkill, tick) return #NPCÐèÒªÊÖ¶¯Ìí¼ÓÉËѪºÍ³ðºÞ, ÒòΪÎÞµ÷ÓÃDoAttack if curObjType == IPY_GameWorld.gotNPC: attackerOwner = None #---¸ù¾ÝBUFFÖ÷ÈËÀàÐ;ö¶¨ÊÇ·ñ¸ø¹¥»÷ÕßÖ÷È˳ðºÞ--- if atkObjType == IPY_GameWorld.gotNPC: attackerOwner = NPCCommon.GetNpcObjOwnerDetail(buffOwner) #Ìí¼Ó³ðºÞ if GameObj.GetHP(curObj) > 0: curNPCControl = NPCCommon.NPCControl(curObj) #Ìí¼Ó³ðºÞ curNPCControl.AddObjToAngryList(buffOwner, lostValue) if attackerOwner != None: #¸øÖ÷ÈËÌí¼Ó1µã³ðºÞ£¬±ÜÃâÍÑÀë״̬ curNPCControl.AddObjToAngryList(attackerOwner, 1) # ¼ÓÉËѪ if atkObjType == IPY_GameWorld.gotNPC: attackerOwner = NPCCommon.GetNpcObjOwnerDetail(buffOwner) else: attackerOwner = buffOwner # 2013-1-3,È¥³ýnpc¹¥»÷Ôì³ÉµÄÉËѪ¼Ç¼ if attackerOwner != None and attackerOwner.GetGameObjType() == IPY_GameWorld.gotPlayer: #CheckAddPoisonAtkBuff(skillTypeID, attackerOwner, curObj, tick) if curObjType == IPY_GameWorld.gotPlayer: AttackCommon.OnPVPDamage(attackerOwner, lostValue, curObj, "SkillLostHP") elif curObjType == IPY_GameWorld.gotNPC: AttackCommon.NPCAddObjInHurtList(attackerOwner, curObj, curObjHP_BeforeAttack, lostValue) #ͳһµ÷Óù¥»÷½áÊø¶¯×÷ if isDoAttackResult: BaseAttack.DoLogic_AttackResult(buffOwner, curObj, None, tick) return ## ¼ì²éÔö¼Ó´ã¶¾buff # @param skillTypeID ʹÓõļ¼ÄÜtypeID # @return ÎÞ def CheckAddPoisonAtkBuff(skillTypeID, attacker, defObj, tick): attackerObjType = attacker.GetGameObjType() defObjType = defObj.GetGameObjType() if attackerObjType != IPY_GameWorld.gotPlayer or defObjType != IPY_GameWorld.gotPlayer: return # Óö¾ÈÐɱËÀµÄ(¶¾Èм¼Äܱ¾Éí¼°Öж¾Ð§¹û) if skillTypeID in [5380, 5340] and GameObj.GetHP(defObj) <= 0: poisionAtkBuffID = ChConfig.Def_SkillID_PoisonAtkBuff curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(poisionAtkBuffID) if curSkill: SkillShell.DoLogic_UseSkill(attacker, attacker, curSkill, tick) return ## ֪ͨ¿Í»§¶ËѪÌõ # @param curObj µ±Ç°ÓÎÏ·¶ÔÏó # @return ÎÞ # @remarks ֪ͨ¿Í»§¶ËѪÌõ def NotifyNPCHP(curObj): #NPC´¦Àí if curObj.GetGameObjType() != IPY_GameWorld.gotNPC: return #³èÎïÌØÊâ´¦Àí if curObj.GetGameNPCObjType() == IPY_GameWorld.gnotPet: pass #curObj.Sync_RefreshProp(IPY_GameWorld.PetInfoRefresh_HP, GameObj.GetHP(curObj), True) else: curObj.Notify_HP() ## »ñµÃ¼¼ÄÜbuffµÄÓµÓÐÕß # @param buff # @return Obj # @remarks º¯ÊýÏêϸ˵Ã÷. def GetBuffOwner(buff): buffOwnerID = buff.GetOwnerID() buffOwnerType = buff.GetOwnerType() if buffOwnerID == 0 or buffOwnerType == 0: #GameWorld.Log("-------²éÕÒ³ÖÐøbuffID´íÎó buffOwnerID = %s ,buffOwnerType = %s"%(buffOwnerID, buffOwnerType)) return return GameWorld.GetObj(buffOwnerID, buffOwnerType) ## »ñµÃ³ÖÐøÐÍbuffµÄµ¥´ÎѪÁ¿±ä»¯ # @param curBuff µ±Ç°buff # @param refuTime ˢмä¸ô # @param tick µ±Ç°Ê±¼ä # @return lostValue # @remarks »ñµÃ³ÖÐøÐÍbuffµÄµ¥´ÎѪÁ¿±ä»¯ £¨¼Ó/¼õѪ£© def GetProcessBuffChangeHp_Time(curBuff, refuTime, tick): #Ê£Óà¸Ä±äÖµ value = curBuff.GetValue() #Ê£Óàʱ¼ä remainTime = curBuff.GetRemainTime() #»¹Äܹ»³ÖÐøµÄ´ÎÊý lostTime = GameWorld.GetIntUpper(remainTime, refuTime) #GameWorld.Log(" lostTime = %s ,value = %s , remainTime = %s , refuTime = %s"%( lostTime, value, remainTime, refuTime ) ) if lostTime <= 0: GameWorld.ErrLog(" skillID = %s, lostTime = %s ,value = %s , remainTime = %s , refuTime = %s" % (curBuff.GetSkill().GetSkillTypeID(), lostTime, value, remainTime, refuTime)) return 0 lostValue = value / lostTime curBuff.SetValue(max(0, value - lostValue)) return lostValue ## ¼ì²é¹â»·¼¼ÄܶÔÖÜΧ¶ÔÏó¼Ó¹â»·buff # @param curObjDetel µ±Ç°¶ÔÏóʵÀý # @param tick µ±Ç°Ê±¼ä # @return ²¼¶ûÖµ(ÊÇ·ñˢгɹ¦) # @remarks ¼ì²é¹â»·¼¼ÄÜ def CheckAddAuraSkill(curObjDetel, tick): #µ±Ç°¶ÔÏóÏà¹Ø²ÎÊý curObjType = curObjDetel.GetGameObjType() buffManager = curObjDetel.GetAura() #ÓµÓеĹ⻷Áбí auraBuffList = [] for index in range(0, buffManager.GetBuffCount()): auraBuff = buffManager.GetBuff(index) if not auraBuff: continue auraBuffList.append(auraBuff) if not auraBuffList: return #---Ö´Ðй⻷Âß¼­--- for auraBuff in auraBuffList: buffOwnerID = auraBuff.GetOwnerID() buffOwnerType = auraBuff.GetOwnerType() if buffOwnerID == 0: continue buffOwner = GameWorld.GetObj(buffOwnerID, buffOwnerType) if buffOwner == None: continue buffOwnerObjType = buffOwner.GetGameObjType() if curObjType != buffOwnerObjType: continue # ·Ç¹âÔ´Ö÷È˲»´¦Àí if (curObjType == IPY_GameWorld.gotPlayer and buffOwnerID != curObjDetel.GetPlayerID()) or \ (curObjType == IPY_GameWorld.gotNPC and buffOwnerID != curObjDetel.GetID()): continue BaseAttack.SkillAddAuraBuff(curObjDetel, auraBuff.GetSkill(), tick) return ## ¼ì²é¹â»·¼¼ÄÜ # @param curObjDetel µ±Ç°¶ÔÏóʵÀý # @param tick µ±Ç°Ê±¼ä # @return ²¼¶ûÖµ(ÊÇ·ñˢгɹ¦) # @remarks ¼ì²é¹â»·¼¼ÄÜ def CheckAuraSkill(curObjDetel, tick): #µ±Ç°¶ÔÏóÏà¹Ø²ÎÊý curObjType = curObjDetel.GetGameObjType() buffManager = curObjDetel.GetAura() #ÓµÓеĹ⻷Áбí auraBuffList = [] #ÊÇ·ñË¢ÐÂÊôÐÔ reFlash = False for index in range(0, buffManager.GetBuffCount()): auraBuff = buffManager.GetBuff(index) if not auraBuff: continue auraBuffList.append(auraBuff) #---Ö´Ðй⻷Âß¼­--- for auraBuff in auraBuffList: buffSkill = auraBuff.GetSkill() buffSkillID = buffSkill.GetSkillID() auraSkillTypeID = buffSkill.GetSkillTypeID() buffOwnerID = auraBuff.GetOwnerID() buffOwnerType = auraBuff.GetOwnerType() if buffOwnerID == 0: continue buffOwner = GameWorld.GetObj(buffOwnerID, buffOwnerType) #---ÎÞÖ÷µÄ¹â»·É¾³ý--- if buffOwner == None : BuffSkill.DelBuffBySkillID(curObjDetel, buffSkillID, tick) reFlash = True continue #---¼ì²é¾àÀë--- atkRadius = buffSkill.GetAtkRadius() dist = GameWorld.GetDist(curObjDetel.GetPosX(), curObjDetel.GetPosY(), buffOwner.GetPosX(), buffOwner.GetPosY()) if atkRadius and dist > atkRadius + 3: BuffSkill.DelBuffBySkillID(curObjDetel, buffSkillID, tick) reFlash = True continue #BuffÓµÓÐÕßÏà¹Ø²ÎÊý buffOwnerSkillMgr = buffOwner.GetSkillManager() #---NPC--- if buffOwnerType == IPY_GameWorld.gotNPC: #NPC²»¿É¼ûɾ³ý if not buffOwner.GetVisible(): BuffSkill.DelBuffBySkillID(curObjDetel, buffSkillID, tick) reFlash = True continue #δ·¢ÏÖÆäÓµÓм¼ÄÜ if not buffOwnerSkillMgr.FindSkillBySkillTypeID(auraSkillTypeID): BuffSkill.DelBuffBySkillID(curObjDetel, buffSkillID, tick) reFlash = True continue #---ÌØÊâ¼¼ÄÜÑéÖ¤--- #ÐþÌìÕæÑÔ, ÑéÖ¤¶ÓÎé if auraSkillTypeID == ChConfig.Def_SkillID_XuanTianZhenYan: if curObjType != IPY_GameWorld.gotPlayer: continue petOwner = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, buffOwner) if petOwner == None: continue #Ö÷È˲»É¾³ý if GameWorld.IsSameObj(petOwner, curObjDetel): continue #ͬ×é¶ÓÎ鲻ɾ³ý if petOwner.GetTeamID() != 0 and petOwner.GetTeamID() == curObjDetel.GetTeamID(): continue BuffSkill.DelBuffBySkillID(curObjDetel, buffSkillID, tick) reFlash = True continue #---Íæ¼Ò--- elif buffOwnerType == IPY_GameWorld.gotPlayer: #Ïȼì²éа¶ñµÄ¶«Î÷(Áú»¢Áî,ÎïÆ·´¥·¢¹â»·,ÓÀ¾Ã´æÔÚ) if auraSkillTypeID in ChConfig.Def_SuperBuffList: continue #ÒòΪ¾ôλÊÇ×°±¸,ËùÒÔÒª¿¼Âǵ½ÊÇ·ñ×°±¸¾ôλ if not buffOwnerSkillMgr.FindSkillBySkillTypeID(auraSkillTypeID): gankBuff = buffOwner.GetEquipBuff().FindBuff(auraSkillTypeID) #ÒòΪ¾ôλµÄ¼¼ÄÜÀàÐÍIDÏàͬ,ËùÒÔÒªÔÙÕÒÒ»´Î if gankBuff != None and gankBuff.GetSkill().GetSkillID() == buffSkillID: #ÔÚÍæ¼ÒÉíÉÏÕÒµ½ÁËÕâ¸öBuff continue BuffSkill.DelBuffBySkillID(curObjDetel, buffSkillID, tick) reFlash = True continue #---δ֪ÀàÐÍ--- else: BuffSkill.DelBuffBySkillID(curObjDetel, buffSkillID, tick) reFlash = True GameWorld.Log('###¹â»·Òì³£,ÎÞ·¨²éÕÒ¹âÔ´ÀàÐÍ = %s' % (buffOwnerType)) continue return reFlash ## ²éÕÒ¼¼Äܲ¢Ìí¼Óbuff # @param curObj Ä¿±êobj # @param skillType ¼¼ÄÜÀàÐÍ # @param tick µ±Ç°Ê±¼ä # @param skillLV ¼¼Äܵȼ¶ # @return None or True # @remarks º¯ÊýÏêϸ˵Ã÷. def AddBuffBySkillType(curObj , skillType , tick , skillLV=None): curSkill = None if skillLV == None : curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillType) else: curSkill = GameWorld.GetGameData().FindSkillByType(skillType , skillLV) if curSkill == None: GameWorld.Log("Ìí¼Óbuffʧ°Ü,Êý¾Ý¿â²éÕÒ¼¼ÄÜ = %s,ʧ°Ü!skillLV=%s" % (skillType, skillLV)) return buffType = GetBuffType(curSkill) if not CheckCanAddBuff(curObj , buffType , curSkill.GetSkillTypeID(), curSkill.GetSkillLV()): return #---Ìí¼ÓµÄBuffÖµ--- addBuffValue = 0 #=========================================================================== # #ÊÇ·ñÊdzÖÐøÐÔ¼¼ÄÜ # if curSkill.GetSkillType() in ChConfig.Def_LstBuff_List: # callFunc = GameWorld.GetExecFunc(GameSkills, "SkillBuff_AddBuffValue.AddBuffValue") # # if callFunc != None: # addBuffValue = int(callFunc(curObj, None, curSkill, tick)) # else: # GameWorld.ErrLog("SkillBuff_AddBuffValue.AddBuffValue") #=========================================================================== return BuffSkill.DoAddBuff(curObj , buffType, curSkill , tick, [addBuffValue]) ## ²éÕÒ¼¼Äܲ¢Ìí¼Óbuff(²»Ë¢ÐÂ) # @param curObj Ä¿±ê # @param skillType ¼¼ÄÜÀàÐÍ # @param tick µ±Ç°Ê±¼ä # @param skillLV ¼¼Äܵȼ¶ # @return None or True # @remarks º¯ÊýÏêϸ˵Ã÷. def AddBuffBySkillType_NoRefurbish(curObj, skillType, tick, skillLV=None, plusValueList=[], buffOwner=None): curSkill = None if skillLV == None : curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillType) else: curSkill = GameWorld.GetGameData().FindSkillByType(skillType , skillLV) if curSkill == None: GameWorld.Log("Ìí¼Óbuffʧ°Ü,Êý¾Ý¿â²éÕÒ¼¼ÄÜ = %s,ʧ°Ü!skillLV=%s" % (skillType, skillLV)) return buffType = GetBuffType(curSkill) if not CheckCanAddBuff(curObj , buffType , curSkill.GetSkillTypeID(), curSkill.GetSkillLV()): return return BuffSkill.AddBuffNoRefreshState(curObj, buffType, curSkill, tick, plusValueList, buffOwner) ## ¼ì²éÊÇ·ñ¿ÉÒÔÌí¼ÓÕâ¸öbuff # @param curObj Ìí¼ÓµÄ¶ÔÏó # @param buffType buffÀàÐÍ # @param curSkillTypeID ¼¼ÄÜID # @param curSkillLV ¼¼Äܵȼ¶ # @return None or True # @remarks º¯ÊýÏêϸ˵Ã÷. def CheckCanAddBuff(curObj , buffType , curSkillTypeID, curSkillLV): buffTuple = GetBuffManagerByBuffType(curObj, buffType) #ͨ¹ýÀàÐÍ»ñȡĿ±êµÄbuff¹ÜÀíÆ÷Ϊ¿Õ£¬ÔòÌø³ö if buffTuple == (): return curObjBuffManager = buffTuple[0] if curObjBuffManager == None: GameWorld.Log("###Òì³£,ÎÞ·¨²éÕÒÕâÀ༼ÄÜ = %s,buffÀàÐÍ = %s" % (curSkillTypeID , buffType)) return True curObjBuff = curObjBuffManager.FindBuff(curSkillTypeID) if curObjBuff == None: #ÎÞÕâÀàbuff return True if buffType == IPY_GameWorld.bfIncBuff: # ÔöÖµÀàBUFFµÍ¼¶¿ÉÒÔ¸²¸Ç¸ß¼¶ return True buffSkill = curObjBuff.GetSkill() if buffType == IPY_GameWorld.bfAura: if buffSkill.GetSkillLV() >= curSkillLV: #GameWorld.DebugLog("¹â»·¼¼ÄÜÖ»Ìí¼Ó¸ü¸ß¼¶µÄЧ¹û!") return #buff¸ù¾ÝÇé¿ö¿ÉÒÔµþ¼ÓµÍ¼¶£¬»òÕߵͼ¶¸²¸Ç¸ß¼¶ # buffSkillLV = buffSkill.GetSkillLV() # # #ÒÑ´æÔÚ¸üÇ¿´óµÄЧ¹û # if buffSkillLV > curSkillLV: # return if not buffSkill.GetLastTime(): #GameWorld.DebugLog("ÎÞʱ¼äÏÞÖÆbuff£¬Ö»Òª´æÔÚbuff£¬ÔòÎÞÐèÖØ¸´Ìí¼Ó") return return True ## ´ÓBUFF¹ÜÀíÆ÷£¬Í¨¹ýЧ¹ûIDÕÒµ½BUFF # @param buffManager buff¹ÜÀíÆ÷ # @param effectID Ч¹ûID # @return None or Buff # @remarks º¯ÊýÏêϸ˵Ã÷. def FindBuff_BuffM_EffID(buffManager, effectID): for i in range(0, buffManager.GetBuffCount()): findBuff = buffManager.GetBuff(i) if not findBuff: continue buffSkill = findBuff.GetSkill() if buffSkill.GetEffect(0).GetEffectID() == effectID: return findBuff ## ͨ¹ý¼¼ÄÜÀàÐÍid£¬Ð§¹ûIDÕÒµ½BUFF # @param curPlayer Íæ¼ÒʵÀý # @param skillTypeID Ч¹ûID # @param effectID Ч¹ûID # @return None or Buff def FindBuffEff(curPlayer, skillTypeID, effID): curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillTypeID) if curSkill == None: GameWorld.ErrLog("FindBuffBySkillAndEffID skillTypeID= %s DBNoFind" % (skillTypeID)) return buffTuple = GetBuffManagerByBuffType(curPlayer, GetBuffType(curSkill)) if buffTuple == (): GameWorld.ErrLog("FindBuffBySkillAndEffID skillTypeID= %s IsNoBuff" % (skillTypeID)) return buffManager = buffTuple[0] return buffManager.FindEffect(effID) ## ͨ¹ý¼¼ÄÜidÕÒµ½BUFF # @param curPlayer Íæ¼ÒʵÀý # @param skillTypeID ¼¼ÄÜid # @return findBuff, buffManager, buffType, findSkill def FindBuffByID(tagObj, skillTypeID): # findBuff, buffManager, buffType, findSkill returnInfo = [None, None, None, None] findSkill = GameWorld.GetGameData().GetSkillBySkillID(skillTypeID) if not findSkill: GameWorld.ErrLog("FindBuff skillTypeID= %s DBNoFind" % (skillTypeID)) return returnInfo buffType = GetBuffType(findSkill) buffTuple = GetBuffManagerByBuffType(tagObj, buffType) returnInfo[3] = findSkill returnInfo[2] = buffType #ͨ¹ýÀàÐÍ»ñȡĿ±êµÄbuff¹ÜÀíÆ÷Ϊ¿Õ£¬ÔòÌø³ö if buffTuple == (): return returnInfo buffManager = buffTuple[0] findBuff = buffManager.FindBuff(findSkill.GetSkillTypeID()) returnInfo[1] = buffManager returnInfo[0] = findBuff return returnInfo def FindBuffByOwner(gameObj, skillTypeID, ownerID, ownerType): findSkill = GameWorld.GetGameData().GetSkillBySkillID(skillTypeID) buffType = GetBuffType(findSkill) buffTuple = GetBuffManagerByBuffType(gameObj, buffType) if buffTuple == (): return None buffManager = buffTuple[0] for i in range(0, buffManager.GetBuffCount()): curBuff = buffManager.GetBuff(i) if not curBuff: continue #ÅжÏÊÇ·ñÓµÓÐͬһÀàÐ͵ļ¼ÄÜ if curBuff.GetSkill().GetSkillTypeID() != skillTypeID: continue #ÅжÏÊÇ·ñÓµÓÐͬһÀàÐ͵ļ¼ÄÜ if curBuff.GetOwnerID() != ownerID: continue if curBuff.GetOwnerType() != ownerType: continue return curBuff return None def FindBuffByOwnerEx(gameObj, skillTypeID, ownerID, ownerType): findSkill = GameWorld.GetGameData().GetSkillBySkillID(skillTypeID) buffType = GetBuffType(findSkill) buffTuple = GetBuffManagerByBuffType(gameObj, buffType) if buffTuple == (): return None, None, None, None buffManager = buffTuple[0] for i in range(0, buffManager.GetBuffCount()): curBuff = buffManager.GetBuff(i) if not curBuff: continue #ÅжÏÊÇ·ñÓµÓÐͬһÀàÐ͵ļ¼ÄÜ if curBuff.GetSkill().GetSkillTypeID() != skillTypeID: continue #ÅжÏÊÇ·ñÓµÓÐͬһÀàÐ͵ļ¼ÄÜ if curBuff.GetOwnerID() != ownerID: continue if curBuff.GetOwnerType() != ownerType: continue return curBuff, buffManager, buffType, findSkill return None, None, None, None #--------------------------------------------------------------------- ## Ö´ÐÐÇå¿ÕÃüÁî ²ÎÊý£ºÍæ¼Ò, ±£Áô¼¼ÄÜÀàÐÍÁбí # @param curPlayer Íæ¼Ò # @param saveSkillTypeList ±£Áô¼¼ÄÜÀàÐÍÁбí # @return ¿ÕÏм¼Äܵã # @remarks º¯ÊýÏêϸ˵Ã÷. def DoLogic_ReSetSkill(curPlayer , saveSkillTypeList=[]): #Çå¿ÕbuffЧ¹û curPlayer.GetBuffState().Clear() #ɱËÀÍæ¼ÒËùÓеÄÕÙ»½ÊÞ PlayerControl.KillPlayerSummonNPC(curPlayer) #»ñµÃÍæ¼ÒʹÓùýµÄ¼¼Äܵã savePoint = GetPlayerUseSkillPoint(curPlayer) #ÖØÖü¼ÄÜ ClearSkillManager(curPlayer , saveSkillTypeList) #ÉèÖÿÕÏм¼Äܵã curPlayer.SetFreeSkillPoint(curPlayer.GetFreeSkillPoint() + savePoint) return savePoint ## »ñµÃÍæ¼Òµ±Ç°Ò»¹²Í¶ÈëµÄ¼¼Äܵã # @param curPlayer µ±Ç°Íæ¼Ò # @return ¼¼Äܵã # @remarks º¯ÊýÏêϸ˵Ã÷. def GetPlayerUseSkillPoint(curPlayer): usePoints = 0 #»ñµÃÍæ¼Ò¼¼ÄܹÜÀíÆ÷ skillManager = curPlayer.GetSkillManager() #²»ÄÜ»ñµÃ¼¼ÄܵãµÄ¼¼ÄÜÀàÐÍÁбí noPoints_SkillType_List = ReadChConfig.GetEvalChConfig('NoSkillPointSkill') #±éÀúÍæ¼ÒµÄ¼¼ÄÜÊýÁ¿ for i in range(0, skillManager.GetSkillCount()): curSkill = skillManager.GetSkillByIndex(i) if curSkill.GetSkillTypeID() in noPoints_SkillType_List: continue usePoints = usePoints + curSkill.GetSkillLV() return usePoints ## Çå¿Õ¼¼ÄܹÜÀíÆ÷¡£ # @param curPlayer Íæ¼Ò # @param saveSkillTypeList ±£ÁôÁбí # @return None # @remarks º¯ÊýÏêϸ˵Ã÷. def ClearSkillManager(curPlayer , saveSkillTypeList): #ÏÈÇå¿Õ, ÔÚѧÉÏ playerHasSaveList = [] skillManager = curPlayer.GetSkillManager() for i in range(0, skillManager.GetSkillCount()): curSkill = skillManager.GetSkillByIndex(i) curSkillType = curSkill.GetSkillTypeID() #²»ÔÚ±£ÁôÁбíÖÐ, Ö±½Óɾ³ý if curSkillType not in saveSkillTypeList: continue playerHasSaveList.append(curSkill.GetSkillID()) #Çå¿Õ¹ÜÀíÆ÷ skillManager.ResetSkill() #²¹Éϱ£ÁôµÄÁбí for skillID in playerHasSaveList: skillManager.LVUPSkillByID(skillID) return def GetSkillBattleType(curSkill): if not curSkill: return ChConfig.Def_BattleRelationType_Comm #0ͨӴ 1 PVPÀàÐÍ 2PVEÀàÐÍ return curSkill.GetHurtType() ## ¼ì²é¼¼ÄÜÊÇ·ñΪ±»¶¯¼¼ÄÜ, ÓÃÓÚ¿ØÖƲ»¿ÉÊͷż¼ÄÜ def isPassiveSkill(curSkill): return curSkill.GetSkillType() in [ChConfig.Def_SkillType_Passive, ChConfig.Def_SkillType_PassiveBuff, ChConfig.Def_SkillType_AttrSkill, ChConfig.Def_SkillType_PassivePlsBuff, #±»¶¯´¥·¢ÔöÒæÀàbuff 16 ChConfig.Def_SkillType_PassiveDepBuff, #±»¶¯´¥·¢¼õÒæÀàbuff 17 ChConfig.Def_SkillType_PassiveActionBuff, #±»¶¯´¥·¢µÄ¿ØÖÆÀàbuff 18 ChConfig.Def_SkillType_PassiveLstPlsBuff, #±»¶¯´¥·¢³ÖÐøÔöÒæÀàbuff 21 ChConfig.Def_SkillType_PassiveLstDepBuff, #±»¶¯´¥·¢³ÖÐø¼õÒæÀàbuff 22 ChConfig.Def_SkillType_PassiveLstPlsBuffAtk, ] ## ±»¶¯´¥·¢µÄ¼¼ÄÜЧ¹û»òÕßÊͷż¼ÄÜ def isPassiveTriggerSkill(curSkill): return curSkill.GetSkillType() in [ChConfig.Def_SkillType_Passive, ChConfig.Def_SkillType_PassiveBuff, ChConfig.Def_SkillType_PassivePlsBuff, #±»¶¯´¥·¢ÔöÒæÀàbuff 16 ChConfig.Def_SkillType_PassiveDepBuff, #±»¶¯´¥·¢¼õÒæÀàbuff 17 ChConfig.Def_SkillType_PassiveActionBuff, #±»¶¯´¥·¢µÄ¿ØÖÆÀàbuff 18 ChConfig.Def_SkillType_PassiveLstPlsBuff, #±»¶¯´¥·¢³ÖÐøÔöÒæÀàbuff 21 ChConfig.Def_SkillType_PassiveLstDepBuff, #±»¶¯´¥·¢³ÖÐø¼õÒæÀàbuff 22 ChConfig.Def_SkillType_PassiveLstPlsBuffAtk, ] def isPassiveAttr(curSkill): return (curSkill.GetSkillType() == ChConfig.Def_SkillType_AttrSkill) def isPassiveBuffSkill(curSkill): return (curSkill.GetSkillType() == ChConfig.Def_SkillType_PassiveBuff) # ÓÃÓÚ¼ì²éÊÇ·ñÔÚÊͷű»¶¯¼¼ÄÜÂß¼­ÖУ¬±ÜÃâÑ­»·µ÷Óñ»¶¯¼¼ÄÜ def GetUsingPassiveSkill(attacker): return attacker.GetDictByKey("UsePassive") def SetUsingPassiveSkill(attacker, value): return attacker.SetDict("UsePassive", value) def CheckPlayerAtkInterval(curPlayer, skillTypeID, tick): ''' ÑéÖ¤ÊÇ·ñ»ù±¾¹¥»÷¼ä¸ô ''' return False #=========================================================================== # SetAttackTick ¸Ä³ÉÈë¿ÚÉèÖÃÑéÖ¤¿Í»§¶ËµÄ¼ä¸ô´Ë´¦ÑéÖ¤ÎÞЧ # if tick - curPlayer.GetPlayerAttackTick() < 50: # GameWorld.DebugLog("ѹ°üÌ«Ãܼ¯50ºÁÃ룬 ±£µ×¹¥»÷¼ä¸ôÖÐ %s" % (skillTypeID)) # return True # # return False #=========================================================================== ## ¼ì²é,ÊÇ·ñÊǵ±Ç°Ö°Òµ¼¼ÄÜ£¬°´Î»ÑéÖ¤ # @param µ±Ç°Íæ¼Ò # @param µ±Ç°¼¼ÄÜ # @return None # @remarks º¯ÊýÏêϸ˵Ã÷. def CheckSkillJob(curPlayer, curSkill): skillUseType = curSkill.GetUseType() if skillUseType == 0: #ÎÞÏÞÖÆ return True #Ö°ÒµÏÞÖÆ curPlayerJob ´Ó0¿ªÊ¼ return True if (skillUseType & pow(2, curPlayer.GetJob())) else False ## ÊÇ·ñÊÇ»ù´¡ÊôÐÔЧ¹û # @param effect Ч¹û # @return ²¼¶ûÖµ # @remarks ÊÇ·ñÊÇ»ù´¡ÊôÐÔЧ¹û def IsBaseEffect(effect): return (effect.GetEffectID() in ChConfig.Def_BaseEffectList) #--------------------------------------------------------------------- ## »ñµÃÖÎÁÆ»ù´¡Öµ£¨Ä¿Ç°ÓÃÓÚ³ÖÐøÐÔ¼¼ÄܵļÆË㣩 # @param attacker ¹¥»÷Õß # @param useSkill ʹÓõļ¼ÄÜ # @return »ù´¡ÖÎÁÆÖµ # @remarks º¯ÊýÏêϸ˵Ã÷. def GetCureBaseValue(attacker, useSkill): return GetAttackerHurtValueByAtkType(attacker, AttackCommon.GetBattleType(attacker, useSkill)) ## »ñµÃ»ù´¡É˺¦Öµ£¨Ä¿Ç°ÓÃÓÚ³ÖÐøÐÔ¼¼ÄܵļÆË㣩 # @param attacker ¹¥»÷Õß # @param useSkill ʹÓõļ¼ÄÜ # @return »ù´¡É˺¦Öµ # @remarks »ñµÃ»ù´¡É˺¦Öµ def GetHurtBaseValue(attacker, useSkill): return GetAttackerHurtValueByAtkType(attacker, AttackCommon.GetBattleType(attacker, useSkill)) #--------------------------------------------------------------------- ## ͨ¹ý¹¥»÷ÀàÐÍ»ñµÃ¹¥»÷·½É˺¦Öµ # @param attacker ¹¥»÷Õß # @param atkType ¹¥»÷ÀàÐÍ£¨ÎïÀí¹¥»÷¡¢Ä¦·¨¹¥»÷£© # @return ¹¥»÷·½É˺¦Öµ # @remarks ͨ¹ý¹¥»÷ÀàÐÍ»ñµÃ¹¥»÷·½É˺¦Öµ def GetAttackerHurtValueByAtkType(attacker, atkType): return (attacker.GetMinAtk() + random.random() * (attacker.GetMaxAtk() - attacker.GetMinAtk())) #=========================================================================== # if atkType == IPY_GameWorld.ghtPhy: # #(×îС¹¥»÷ + rand()*( ×î´ó¹¥»÷É˺¦-×îС¹¥»÷É˺¦ ) # return (attacker.GetMinAtk() + random.random() * (attacker.GetMaxAtk() - attacker.GetMinAtk())) # # #(×îС½£ÆøÉ˺¦ + rand()*( ×î´ó½£ÆøÉ˺¦-×îС½£ÆøÉ˺¦ ) # return (attacker.GetMAtkMin() + random.random() * (attacker.GetMAtkMax() - attacker.GetMAtkMin())) #=========================================================================== #--------------------------------------------------------------------- ## »ñµÃij¼¼ÄܹÜÀíÆ÷ÊÇ·ñÓÐÌØ¶¨¼¼ÄÜ # @param buffManage ijbuff¹ÜÀíÆ÷ # @param givenSkillTypeList ÌØ¶¨¼¼ÄÜÀàÐÍÁбí # @return ÊÇ·ñÓÐÌØ¶¨¼¼ÄÜ # @remarks º¯ÊýÏêϸ˵Ã÷. def IsHasGivenBuff(buffManage, givenSkillTypeList): buffCount = buffManage.GetBuffCount() for i in range(buffCount): buffObj = buffManage.GetBuff(i) curSkillType = buffObj.GetSkill().GetSkillType() if curSkillType in givenSkillTypeList: return True return False #--------------------------------------------------------------------- ##»ñµÃÇøÓò¼¼ÄÜÉ˺¦¶ÔÏóÊýÁ¿ # @param curSkill ¼¼ÄÜʵÀý # @return ·µ»ØÖµ, É˺¦ÊýÁ¿ # @remarks »ñµÃÇøÓò¼¼ÄÜÉ˺¦¶ÔÏóÊýÁ¿ def GetSkillArea_Atk_Count(attacker, curSkill): if attacker.GetGameObjType() == IPY_GameWorld.gotPlayer and attacker.GetAttackMode() == IPY_GameWorld.amContest: # µ¥Ò»Ä¿±êËø¶¨Ä£Ê½ return 1 #ĬÈϹ¥»÷×î´óÊý hurtCount = 50 curEffect = GetSkillEffectByEffectID(curSkill, ChConfig.Def_Skill_Effect_AreaAttackkCount) if curEffect != None: #ÕÒµ½ÁË hurtCount = min(curEffect.GetEffectValue(0), hurtCount) hurtCount += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(attacker, None, curSkill, ChConfig.TriggerType_AttackCnt) #GameWorld.GodLog( 'SkillName = %s, hurtCount = %s'%( curSkill.GetSkillName(), hurtCount ) ) return hurtCount ##ͨ¹ýЧ¹ûIDÕÒ³öÖ¸¶¨¼¼ÄܵÄЧ¹û # @param curSkill ¼¼ÄÜʵÀý # @param effectID ¼¼ÄÜЧ¹ûID # @return ·µ»ØÐ§¹û # @remarks ͨ¹ýЧ¹ûIDÕÒ³öÖ¸¶¨¼¼ÄܵÄЧ¹û def GetSkillEffectByEffectID(curSkill, effectID): for i in range(0, curSkill.GetEffectCount()): curEffect = curSkill.GetEffect(i) curEffectID = curEffect.GetEffectID() if not curEffectID: #²ß»®ÓпÉÄÜÖÐ;ɾ³ý£¬²»ÓÃreturn continue #²»ÊÇÐèÒªµÄЧ¹û if curEffectID != effectID: continue #ÕÒµ½ÁË return curEffect return ## ͨ¹ý¼¼ÄÜÀàÐÍID»ñµÃµ±Ç°Íæ¼Ò¶ÔÓ¦µÄbuff¶ÔÏó # @param curPlayer µ±Ç°Íæ¼Òobj # @param skillID Òª²éÕҵļ¼ÄÜÀàÐÍID # @return Íæ¼Òbuff¶ÔÏó # @remarks ͨ¹ý¼¼ÄÜÀàÐÍID»ñµÃµ±Ç°Íæ¼Ò¶ÔÓ¦µÄbuff¶ÔÏó def GetPlayerBuffBySkillTypeID(curPlayer, skillTypeID): curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillTypeID) if curSkill == None: GameWorld.ErrLog("GetPlayerBuffBySkillTypeID = %s DBNoFind" % (skillTypeID)) return buffTuple = GetBuffManagerByBuffType(curPlayer, GetBuffType(curSkill)) if buffTuple == (): GameWorld.ErrLog("GetPlayerBuffBySkillTypeID = %s IsNoBuff" % (skillTypeID)) return buffManager = buffTuple[0] return buffManager.FindBuff(skillTypeID) ##´Óij¸ö¼¼ÄÜÕÒµ½Ö¸¶¨µÄ¼¼ÄÜЧ¹ûIDÖÐAÖµ¶ÔÓ¦IDµÄÒÑѧ¼¼ÄÜ # @param tagObj # @param curSkill # @param effectID # @return ²éÕҵļ¼ÄÜ # @remarks ĿǰÓÃÓÚÎÞµÐÕ¶ºÍ½£Èз籩Ïà¹ØµÄ¿ÉѧµÄ±»¶¯¼¼ÄÜ def GetSkillFromOtherSkillByEffectID(tagObj, curSkill, effectID): curSkillEff = GetSkillEffectByEffectID(curSkill, effectID) if curSkillEff == None: #GameWorld.ErrLog("ûÓб»¶¯¼¼ÄÜЧ¹ûÏî%s ID=%s, Lv=%s"%(effectID, # curSkill.GetSkillID(), curSkill.GetSkillLV())) return None return tagObj.GetSkillManager().FindSkillBySkillTypeID(curSkillEff.GetEffectValue(0)) ##»ñµÃÖÎÁÆÖµ # @param userObj Ê©·¨Õß # @param tagObj ÊÜЧ¹ûÕß # @param curSkill ¼¼ÄÜ # @param cureType ÖÎÁÆÀàÐÍ£¨Ó°Ï칫ʽ£©×Ô¶¨Ò壺1.É˺¦ 2.×î´óѪÁ¿ # @return ÖÎÁÆÖµ # @remarks »ñµÃÖÎÁÆÖµ def GetCureHP(userObj, tagObj, curSkill, cureType=ChConfig.Def_Cure_Attack, largeNum=False): curePercent = 1.0 #ÖÎÁƼӳÉÖµ cureBaseValue = 0 #ÖÎÁÆ»ù´¡Öµ #passiveSkill = GetSkillFromOtherSkillByEffectID(userObj, curSkill, ChConfig.Def_Skill_Effect_PassiveSkillID) #¸Ã±»¶¯¼¼ÄÜÒÑѧ, Ôò´¦Àí±»¶¯Ó°ÏìµÄЧ¹û #=========================================================================== # if passiveSkill != None and isPassiveSkill(passiveSkill): # cureEffect = GetSkillEffectByEffectID(passiveSkill, ChConfig.Def_Skill_Effect_CureUpper) # # #¼ÆËãÖÎÁƼӳÉ,°´¼¸ÂÊ´¥·¢ # if GameWorld.CanHappen(passiveSkill.GetHappenRate(), ChConfig.Def_MaxRateValue) \ # and cureEffect != None: # curePercent += cureEffect.GetEffectValue(0) / float(ChConfig.Def_MaxRateValue) #=========================================================================== #ÌØÊâ¼¼Äܵĸ½¼ÓÖµ addExValue = 0 #»ñµÃ»ù´¡ÖÎÁÆÖµ if cureType == ChConfig.Def_Cure_Attack: cureBaseValue = GetCureBaseValue(userObj, curSkill) elif cureType == ChConfig.Def_Cure_MaxHP: cureBaseValue = GameObj.GetMaxHP(userObj) elif cureType == ChConfig.Def_Cure_PNE: cureBaseValue = userObj.GetPNE() addPer = curSkill.GetEffect(0).GetEffectValue(2)/float(ChConfig.Def_MaxRateValue) addExValue = GetCureBaseValue(userObj, curSkill)*addPer elif cureType == ChConfig.Def_Cure_PHY: cureBaseValue = GameObj.GetMaxHP(userObj) elif cureType == ChConfig.Def_Cure_HurtValue: cureBaseValue = GameObj.GetLastHurtValue(userObj) elif cureType == ChConfig.Def_Cure_TagMaxHP: cureBaseValue = 0 if not tagObj else GameObj.GetMaxHP(tagObj) #Õâ±ßдËÀÁËЧ¹û1£¬»ù±¾ÒѾ­¶¨ÐÍ #»ñµÃ¼¼ÄܵļÆËã²ÎÊýÖµ if cureType == ChConfig.Def_Cure_PHY: # ¸ù¾ÝÃô½Ý,Á¦Á¿²îÖµ¼°Ð§¹ûϵÊý¼ÆËã»Ö¸´±ÈÀý skillPer = max(0, userObj.GetPHY() - userObj.GetSTR()) / float(curSkill.GetEffect(0).GetEffectValue(0)) GameWorld.DebugLog("Ó¢Ó¸´ËÕ: Ãô=%s,Á¦=%s,skillPer=%s" % (userObj.GetPHY(), userObj.GetSTR(), skillPer)) else: skillPer = curSkill.GetEffect(0).GetEffectValue(0) / float(ChConfig.Def_MaxRateValue) #¼¼Äܸ½¼Ó skillValue = curSkill.GetEffect(0).GetEffectValue(1) skillPer += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(userObj, None, curSkill, ChConfig.TriggerType_AddHP)/float(ChConfig.Def_MaxRateValue) #¹«Ê½¼ÆËãÖÎÁÆÖµ cureHP = int((cureBaseValue * skillPer + skillValue + addExValue) * curePercent) if not largeNum: cureHP = min(cureHP, ChConfig.Def_UpperLimit_DWord) #GameWorld.DebugLog("»ñÈ¡ÖÎÁÆÖµ(%s)£ºcureType=%s,cureBaseValue=%s,skillPer=%s,skillValue=%s" # % (cureHP, cureType, cureBaseValue, skillPer, skillValue)) return cureHP ##»ñµÃ»ØÄ§Öµ # @param userObj Ê©·¨Õß # @param tagObj ÊÜЧ¹ûÕß # @param curSkill ¼¼ÄÜ # @param restoreType »Ö¸´ÀàÐÍ£¨Ó°Ï칫ʽ£© # @return »Ö¸´Öµ def GetRestoreMP(userObj, tagObj, curSkill, restoreType=ChConfig.Def_Restore_MaxMP): cureBaseValue = 0 #»ù´¡Öµ if restoreType == ChConfig.Def_Restore_MaxMP: cureBaseValue = userObj.GetMaxMP() elif restoreType == ChConfig.Def_Restore_PHY: cureBaseValue = userObj.GetMaxMP() #Õâ±ßдËÀÁËЧ¹û1£¬»ù±¾ÒѾ­¶¨ÐÍ #»ñµÃ¼¼ÄܵļÆËã²ÎÊýÖµ if restoreType == ChConfig.Def_Restore_PHY: # ¸ù¾ÝÃô½Ý¡¢ÖÇÁ¦²îÖµ¼°Ð§¹ûϵÊý¼ÆËã»Ö¸´±ÈÀý skillPer = max(0, userObj.GetPHY() - userObj.GetPNE()) / float(curSkill.GetEffect(0).GetEffectValue(0)) GameWorld.DebugLog("ħȪӿ¶¯: Ãô=%s,ÖÇ=%s,skillPer=%s" % (userObj.GetPHY(), userObj.GetPNE(), skillPer)) else: skillPer = curSkill.GetEffect(0).GetEffectValue(0) / float(ChConfig.Def_MaxRateValue) #¼¼Äܸ½¼Ó skillValue = curSkill.GetEffect(0).GetEffectValue(1) #¹«Ê½¼ÆËã restoreMP = int(cureBaseValue * skillPer + skillValue) #GameWorld.DebugLog("GetRestoreMP restoreType=%s,restoreMP=%s" % (restoreType, restoreMP)) return restoreMP ## ¸üм¼ÄÜÁ¬»÷Êý # @param attacker # @param skill ʹÓõļ¼ÄÜ # @return def UpdateSkillCombo(attacker, skill, tick): return #=========================================================================== # if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer: # return # # SkillComboDict = ReadChConfig.GetEvalChConfig("SkillCombo") # jobType = ChConfig.JOB_TYPE_DICT[attacker.GetJob()] # # if jobType not in SkillComboDict: # return # # jobSkillComboDict = SkillComboDict[jobType] # # curSkillTypeID = skill.GetSkillTypeID() # # isCombo = False # lastComboTick = attacker.GetDictByKey(ChConfig.Def_PlayerKey_LastSkillComboTick) # comboCnt = attacker.GetDictByKey(ChConfig.Def_PlayerKey_SkillComboCnt) # buffProcessState = attacker.GetDictByKey(ChConfig.Def_PlayerKey_ComboBuffProcessState) # # ³ÖÐøÐÔÉ˺¦buffÒÑ´¦Àí¹ý²»ÔÙ´¦Àí # if curSkillTypeID in ChConfig.Ded_ComboBuffProcessSkillIDList and buffProcessState: # #GameWorld.DebugLog("³ÖÐøÐÔÉ˺¦buffÒÑ´¦Àí¹ý²»ÔÙ´¦Àí£º%s" % curSkillTypeID) # return # # for comboNum, comboInfo in jobSkillComboDict.items(): # # skillList = comboInfo[0] # stateSkillReq = comboInfo[1] # comboInterval = comboInfo[2] # addHurtPerFormat = comboInfo[3] # modulusPlusHappenRate = comboInfo[4] # É˺¦ÏµÊý¼Ó³É¸ÅÂÊÍò·ÖÂÊ # modulusPlusFormat = comboInfo[5] # É˺¦ÏµÊý¹«Ê½ # # if curSkillTypeID not in skillList: # continue # # # Èç¹ûÓÐ×Ë̬ҪÇó # if stateSkillReq != 0: # buffState = attacker.GetBuffState() # if buffState.FindBuff(stateSkillReq) == None: # #GameWorld.DebugLog("·Ç¶ÔÓ¦Ö°Òµ×Ë̬(%s)£¬ÎÞ·¨Á¬»÷£¡" % stateSkillReq) # continue # # curComboCnt = skillList.index(curSkillTypeID) + 1 # µ±Ç°¼¼ÄÜËùÔÚÁ¬»÷Êý # # # Ôڹ涨ʱ¼äÄÚÍê³ÉÁ¬»÷ # #GameWorld.DebugLog("skillList=%s, curSkillTypeID=%s,comboCnt=%s,curComboCnt=%s,tick=%s,lastComboTick=%s,(%s),comboInterval=%s" # # % (skillList, curSkillTypeID, comboCnt, curComboCnt, tick, lastComboTick, tick - lastComboTick, comboInterval)) # if comboCnt > 0 and (comboCnt + 1) == curComboCnt and (tick - lastComboTick) <= comboInterval: # isCombo = True # #GameWorld.DebugLog(" Á¬»÷³É¹¦!") # # # µÚÒ»»÷ # elif curComboCnt == 1: # GameWorld.DebugLog(" ¼¼ÄܵÚÒ»»÷!") # comboCnt = 0 # isCombo = True # # if isCombo: # STR = attacker.GetSTR() # PHY = attacker.GetPHY() # modulus = 1 # É˺¦ÏµÊý # if GameWorld.CanHappen(modulusPlusHappenRate): # modulus = eval(modulusPlusFormat) # addHurtPer = eval(addHurtPerFormat) # attacker.SetDict(ChConfig.Def_PlayerKey_LastSkillComboTick, tick) # attacker.SetDict(ChConfig.Def_PlayerKey_SkillComboCnt, curComboCnt) # attacker.SetDict(ChConfig.Def_PlayerKey_ComboSkillTypeID, curSkillTypeID) # attacker.SetDict(ChConfig.Def_PlayerKey_ComboAddHurtPer, addHurtPer) # if curSkillTypeID in ChConfig.Ded_ComboBuffProcessSkillIDList: # attacker.SetDict(ChConfig.Def_PlayerKey_ComboBuffProcessState, 1) # #GameWorld.DebugLog(" ³ÖÐøÐÔÉ˺¦buffÁ¬»÷£¡%s" % curSkillTypeID) # # # # ֪ͨ¿Í»§¶ËÁ¬»÷Êý # skillComboPack = ChPyNetSendPack.tagMCSkillCombo() # skillComboPack.Clear() # skillComboPack.ComboNum = comboNum # skillComboPack.ComboCnt = curComboCnt # NetPackCommon.SendFakePack(attacker, skillComboPack) # GameWorld.DebugLog("¼¼ÄÜÁ¬»÷: num=%s,curCnt=%s,comboCnt=%s,Á¦=%s,Ãô=%s,modulus=%s,addHurtPer=%s" # % (comboNum, curComboCnt, comboCnt, STR, PHY, modulus, addHurtPer)) # break # # # ûÓÐÁ¬»÷³É¹¦, ÖØÖÃÁ¬»÷ÐÅÏ¢ # if not isCombo and comboCnt != 0: # attacker.SetDict(ChConfig.Def_PlayerKey_LastSkillComboTick, 0) # attacker.SetDict(ChConfig.Def_PlayerKey_SkillComboCnt, 0) # attacker.SetDict(ChConfig.Def_PlayerKey_ComboSkillTypeID, 0) # attacker.SetDict(ChConfig.Def_PlayerKey_ComboAddHurtPer, 0) # attacker.SetDict(ChConfig.Def_PlayerKey_ComboBuffProcessState, 0) # GameWorld.DebugLog("Á¬»÷ʧ°Ü£¡curSkillTypeID=%s" % curSkillTypeID) # # return #=========================================================================== def GetSkillAddPerByID(curPlayer, skillTypeID): ## »ñÈ¡¼¼ÄÜÉ˺¦°Ù·Ö±ÈÌáÉýÖµ # @param skillTypeID: ¼¼ÄÜTypeID SkillAddPerAttrIDDict = IpyGameDataPY.GetConfigEx("SkillAddPerAttrIDDict") if not SkillAddPerAttrIDDict: SkillAddPerAttrIDDict = {} skillPlusAttrIDDict = IpyGameDataPY.GetFuncEvalCfg("SkillPlusAttrID", 2, {}) for attrIDStr, skillTypeIDList in skillPlusAttrIDDict.items(): attrID = int(attrIDStr) if attrID not in ShareDefine.SkillAddPerAttrIDList: continue for cfgSkillTypeID in skillTypeIDList: SkillAddPerAttrIDDict[cfgSkillTypeID] = attrID IpyGameDataPY.SetConfigEx("SkillAddPerAttrIDDict", SkillAddPerAttrIDDict) if skillTypeID not in SkillAddPerAttrIDDict: return 0 curAttrID = SkillAddPerAttrIDDict[skillTypeID] attrInfo = ChConfig.ItemEffect_AttrDict.get(curAttrID, []) if attrInfo == []: return 0 effIndex = attrInfo[0][0] return EffGetSet.GetValueByEffIndex(curPlayer, effIndex) def GetSkillReducePerByID(curPlayer, skillTypeID): ## »ñÈ¡¼¼ÄÜÉ˺¦°Ù·Ö±È¼õÉËÖµ # @param skillTypeID: ¼¼ÄÜTypeID SkillReducePerAttrIDDict = IpyGameDataPY.GetConfigEx("SkillReducePerAttrIDDict") if not SkillReducePerAttrIDDict: SkillReducePerAttrIDDict = {} skillPlusAttrIDDict = IpyGameDataPY.GetFuncEvalCfg("SkillPlusAttrID", 2, {}) for attrIDStr, skillTypeIDList in skillPlusAttrIDDict.items(): attrID = int(attrIDStr) if attrID not in ShareDefine.SkillReducePerAttrIDList: continue for cfgSkillTypeID in skillTypeIDList: SkillReducePerAttrIDDict[cfgSkillTypeID] = attrID IpyGameDataPY.SetConfigEx("SkillReducePerAttrIDDict", SkillReducePerAttrIDDict) if skillTypeID not in SkillReducePerAttrIDDict: return 0 curAttrID = SkillReducePerAttrIDDict[skillTypeID] attrInfo = ChConfig.ItemEffect_AttrDict.get(curAttrID, []) if attrInfo == []: return 0 effIndex = attrInfo[0][0] return EffGetSet.GetValueByEffIndex(curPlayer, effIndex)