#!/usr/bin/python # -*- coding: GBK -*- #------------------------------------------------------------------------------- # #------------------------------------------------------------------------------- # ##@package Skill.GameBuffs.BuffProcess_830 # # @todo:Ѫ°ü³ÖÐø¶¨Ê±»ØÑª´¥·¢µÄbuffÂß¼­ÊµÏÖ # @author hxp # @date 2014-07-03 # @version 1.5 # # @change: "2015-03-04 20:00" hxp ±»¶¯¼¼ÄÜÔö¼Ó²¹ÑªÐ§¹û # @change: "2016-11-03 20:30" xdh ËÀÍö²»»ØÑª # @change: "2016-11-16 20:00" hxp Ôö¼Ó½ûÁÆ×´Ì¬ÏÂÏÞÖÆ # @change: "2016-11-24 16:30" hxp Ôö¼Ó²»¿É»ØÑªµÄµØÍ¼É趨 # @change: "2017-02-25 17:00" xdh ÉúÃüÖµµÍÓÚÒ»¶¨±ÈÀýʱ²Å»áʹÓÃÉúÃü¾«»ª # # ÏêϸÃèÊö: Ѫ°ü³ÖÐø¶¨Ê±»ØÑª´¥·¢µÄbuffÂß¼­ÊµÏÖ # #--------------------------------------------------------------------- #"""Version = 2017-02-25 17:00""" #--------------------------------------------------------------------- #µ¼Èë import PlayerControl import PassiveBuffEffMng import IPY_GameWorld import SkillCommon import GameWorld import ChConfig import GameObj import BuffSkill #--------------------------------------------------------------------- #È«¾Ö±äÁ¿ #--------------------------------------------------------------------- #--------------------------------------------------------------------- #Âß¼­ÊµÏÖ ## ³ÖÐøÐÔBuff´¦Àí # @param defender ³ÐÊÜÕß # @param curBuff µ±Ç°Buff # @param curEffect BuffЧ¹û # @param tick µ±Ç°Ê±¼ä # @return None # @remarks ³ÖÐøÐÔBuff´¦Àí, ºÈÒ©Ë®µÄ»Ö¸´Âß¼­Ê±¼äTICKÀýÍâ def ProcessBuff(defender, curBuff, curEffect, processBuffTick, tick): #---¼ì²éBuff¿ÉÐÐÐÔ--- curObjType = defender.GetGameObjType() #Íæ¼Ò if curObjType != IPY_GameWorld.gotPlayer: GameWorld.ErrLog("BuffProcess_830, ÀàÐÍ´íÎó, curObjType = %s" % curObjType) return if defender.GetMapID() in ChConfig.CanNotRecoverMapIDList: #GameWorld.DebugLog("¸ÃµØÍ¼ÎÞ·¨Ê¹ÓÃѪ°ü»Ö¸´!") return if GameObj.GetPyPlayerState(defender, ChConfig.Def_PlayerState_LimitAddHP): #GameWorld.DebugLog("µ±Ç°½ûÁÆ×´Ì¬Ï£¬ÎÞ·¨»ØÑª!") return curValue = curBuff.GetValue() # µ±Ç°ÈÝÁ¿ maxRecoverHPPer = curEffect.GetEffectValue(0) # ×î´ó»ØÑª°Ù·Ö±È maxRecoverHP = curEffect.GetEffectValue(1) # ×î´ó»ØÑª¹Ì¶¨Öµ curHP = GameObj.GetHP(defender) maxHP = GameObj.GetMaxHP(defender) if curHP <= 0 or defender.GetPlayerAction() == IPY_GameWorld.paDie: #ËÀÍö²»»ØÑª return #ÉúÃüÖµµÍÓÚ¸ÃÉèÖÃʱ²Å»áʹÓÃÉúÃü¾«»ª HPPackagePercent = defender.NomalDictGetProperty(ChConfig.Def_PDict_AutoFightSetting%("HPPackagePercent", 0), 0) maxCanRecoverHP = max(0, int(maxHP * HPPackagePercent / 100)) if curHP >= maxCanRecoverHP: return needRecoverHP = maxCanRecoverHP - curHP # »ØÂúËùÐèÁ¿ #GameWorld.DebugLog("Ѫ°ü×Ô¶¯»ØÑª£¬µ±Ç°Ñª°üÁ¿=%s" % curValue) #GameWorld.DebugLog(" »ØÂúËùÐèÁ¿=%s" % (needRecoverHP)) # °Ù·Ö±È×î´ó¿É»ØÁ¿ maxRecoverHPByPer = max(0, int(maxHP * maxRecoverHPPer / float(ChConfig.Def_MaxRateValue))) #GameWorld.DebugLog(" °Ù·Ö±È%s,×î´ó¿É»ØÁ¿=%s,×î´ó¹Ì¶¨Á¿=%s" % (maxRecoverHPPer, maxRecoverHPByPer, maxRecoverHP)) # ʵ¼Ê»ØÑªÁ¿ recoverHP = min(needRecoverHP, (maxRecoverHP + maxRecoverHPByPer)) recoverHP = min(recoverHP, curValue) #---Ö´Ðлظ´Âß¼­--- curSkill = curBuff.GetSkill() skillTypeID = curSkill.GetSkillTypeID() SkillCommon.SkillAddHP(defender, skillTypeID, recoverHP) updValue = max(0, curValue - recoverHP) #GameWorld.DebugLog(" ʵ¼Ê»ØÑªÁ¿=%s, Ѫ°üÊ£Óà=%s" % (recoverHP, updValue)) __UpdateBuffValue(defender, curBuff, curSkill, updValue, tick) return ## ¸üÐÂbuffÈÝÁ¿Öµ # @param curPlayer Íæ¼Ò # @param curBuff µ±Ç°Buff # @param skillTypeID # @param updValue ¸üÐÂÖµ # @param tick µ±Ç°Ê±¼ä # @return None def __UpdateBuffValue(curPlayer, curBuff, curSkill, updValue, tick): buffType = SkillCommon.GetBuffType(curSkill) buffTuple = SkillCommon.GetBuffManagerByBuffType(curPlayer, buffType) #ͨ¹ýÀàÐÍ»ñȡĿ±êµÄbuff¹ÜÀíÆ÷Ϊ¿Õ£¬ÔòÌø³ö if buffTuple == (): return buffStateManager = buffTuple[0] # ÈÝÁ¿Îª¿Õ£¬É¾³ýbuff if updValue <= 0: BuffSkill.DelBuffBySkillID(curPlayer, curSkill.GetSkillID(), tick) GameWorld.DebugLog(" Ѫ°üÓÃÍ꣬ɾ³ýѪ°übuff...%s" % curSkill.GetSkillID()) return skillTypeID = curSkill.GetSkillTypeID() buffCount = buffStateManager.GetBuffCount() for index in range(0, buffCount): curBuff = buffStateManager.GetBuff(index) buffSkill = curBuff.GetSkill() if buffSkill.GetSkillTypeID() != skillTypeID: continue #GameWorld.DebugLog(" ¸üÐÂѪ°üÁ¿=%s" % updValue) curBuff.SetValue(updValue) # ֪ͨbuffˢРbuffStateManager.Sync_RefreshBuff(index, curBuff.GetRemainTime()) break return