| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
|   | 
| ##@package BuffProcess_1089  | 
| # °´±»¹¥»÷ÕßµÄ×î´óѪÁ¿°Ù·Ö±È¼õѪ  | 
| #  | 
| # @author Alee  | 
| # @date 2011-03-18 16:45  | 
| # @version 1.2  | 
| #  | 
| # ÐÞ¸Äʱ¼ä ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ  | 
| #  | 
|   | 
| #µ¼Èë  | 
| import SkillCommon  | 
| import GameWorld  | 
| import ChConfig  | 
| import GameObj  | 
| import IPY_GameWorld  | 
| import PassiveBuffEffMng  | 
| #---------------------------------------------------------------------  | 
| #È«¾Ö±äÁ¿  | 
| #---------------------------------------------------------------------  | 
|   | 
| #---------------------------------------------------------------------  | 
| #Â߼ʵÏÖ  | 
| ## ³ÖÐøÐÔBuff´¦Àí °´×î´óѪÁ¿°Ù·Ö±È¼õѪ  | 
| #  @param defender ³ÐÊÜÕß  | 
| #  @param curBuff µ±Ç°Buff  | 
| #  @param curEffect BuffЧ¹û  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def ProcessBuff(defender, curBuff, curEffect, processBuffTick, tick):  | 
|   | 
|     #µ¥´ÎÉ˺¦  | 
|     singleDecHP = SkillCommon.GetProcessBuffChangeHp_Time(curBuff, processBuffTick, tick)  | 
|       | 
|     #buffÓµÓÐÕß  | 
|     buffOwner = SkillCommon.GetBuffOwner(curBuff)  | 
|       | 
|     curBuffSkillID = curBuff.GetSkill().GetSkillTypeID()  | 
|       | 
|     SkillCommon.SkillLostHP(defender, curBuffSkillID, buffOwner, singleDecHP, tick, hurtType=ChConfig.Def_HurtType_Bleed)  | 
|     if curEffect.GetEffectValue(2) and buffOwner:  | 
|         SkillCommon.SkillAddHP(buffOwner, curBuffSkillID, singleDecHP)  | 
|   | 
|     OnPassiveSkillByHurtCount(defender, curBuff, curEffect, buffOwner)  | 
|     return  | 
|   | 
|   | 
| def OnPassiveSkillByHurtCount(defender, curBuff, curEffect, buffOwner):  | 
|     try:  | 
|         if not buffOwner:  | 
|             return  | 
|         if buffOwner.GetGameObjType() != IPY_GameWorld.gotPlayer:  | 
|             return  | 
|         if not defender or not defender.GetID() or GameObj.GetHP(defender) <= 0:  | 
|             return  | 
|         # Ö´ÐдÎÊý¡£ µ±¼³Áé¶ÔÄ¿±êÔì³É3´ÎÉ˺¦Ê±£¬¿É½µµÍÄ¿±ê20%µÄ·ÀÓù  | 
|         curBuff.SetValue1(curBuff.GetValue1() + 1)  | 
|         tick = GameWorld.GetGameWorld().GetTick()  | 
|           | 
|         defender.SetDict(ChConfig.Def_PlayerKey_BuffHurtCnt, curBuff.GetValue1())  | 
|         PassiveBuffEffMng.OnPassiveSkillTrigger(buffOwner, defender, curBuff.GetSkill(), ChConfig.TriggerType_BuffHurtCnt, tick)  | 
|         defender.SetDict(ChConfig.Def_PlayerKey_BuffHurtCnt, 0)  | 
|     except:  | 
|         GameWorld.ErrLog("OnPassiveSkillByHurtCount error!!!")  | 
|     return  | 
|   | 
|   | 
| ## ³ÖÐøÐÔBuffÏûʧ  | 
| #  @param defender ³ÐÊÜÕß  | 
| #  @param curSkill µ±Ç°¼¼ÄÜ  | 
| #  @param curBuff µ±Ç°Buff  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OnBuffDisappear(defender, curSkill, curBuff, curEffect, tick):  | 
|     buffValue = curBuff.GetValue()  | 
|       | 
|     #ÎÞÊ£Óà  | 
|     if buffValue <= 0:  | 
|         return  | 
|       | 
|     #ÒѾËÀÍö²»´¥·¢  | 
|     if GameObj.GetHP(defender) <= 0:  | 
|         return  | 
|       | 
|     buffOwner = SkillCommon.GetBuffOwner(curBuff)  | 
|       | 
|     SkillCommon.SkillLostHP(defender, curSkill.GetSkillTypeID(), buffOwner, buffValue, tick, hurtType=ChConfig.Def_HurtType_Bleed)  | 
|       | 
|     # Ö´ÐдÎÊý  | 
|     OnPassiveSkillByHurtCount(defender, curBuff, curEffect, buffOwner)  | 
|     return  | 
|   | 
|   | 
| ##³ÖÐøÉ˺¦Buff, ¸ù¾Ý¹¥»÷ÕßѪÁ¿¼ÆËã  | 
| # @param attacker ¹¥»÷ÕßʵÀý  | 
| # @param curSkill ¼¼ÄÜʵÀý  | 
| # @param curEffect µ±Ç°¼¼ÄÜЧ¹û1  | 
| # @return ×ÜÖµ  | 
| def CalcBuffValue(attacker, defender, curSkill, changeBuffValueDict):  | 
|     curEffect = curSkill.GetEffect(0)  | 
|     skillPer = curEffect.GetEffectValue(0)  | 
|     skillPer /= float(ChConfig.Def_MaxRateValue)  | 
|     #¼¼Äܸ½¼Ó  | 
|     skillEnhance = curEffect.GetEffectValue(1)  | 
|       | 
|     return [int(GameObj.GetMaxHP(defender) * skillPer + skillEnhance)]  | 
|   |