| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #  | 
| # @todo: ¸ø³èÎïÔö¼ÓÒÑ»ñµÃµÄijƷÖʵijèÎïÃÇ×ܹ¥»÷°Ù·Ö±ÈÖµ£¬Ö±½Ó¸ø³èÎï¼ÓµÄ ²¢·Ç¼Óµ½ÈËÎïÊôÐÔÖеĠ³èÎï¹¥»÷Á¦  | 
| #  | 
| # @author: Alee  | 
| # @date 2018-1-20 ÏÂÎç02:50:26  | 
| # @version 1.0  | 
| #  | 
| # @note:   | 
| #  | 
| #---------------------------------------------------------------------  | 
| #µ¼Èë  | 
| import ChConfig  | 
| import PlayerControl  | 
| import GameFuncComm  | 
| import ShareDefine  | 
| import IpyGameDataPY  | 
| import PetControl  | 
| #---------------------------------------------------------------------  | 
|   | 
| ## buffÏßÐÔÔö¼ÓÊôÐÔ  | 
| #  @param defender Buff³ÐÊÜÕß  | 
| #  @param curEffect ¼¼ÄÜЧ¹û  | 
| #  @param calcDict ¼¼ÄÜЧ¹ûÀÛ¼Ó×Ü±í  | 
| #  @return None  | 
| def OnCalcBuffEx(defender, curEffect, calcDict, curBuff):  | 
|     minAtk, maxAtk = GetPetAtkValueByQuality(defender, curEffect.GetEffectValue(0))  | 
|       | 
|     calcDict[ChConfig.TYPE_Calc_AttrATKMin] = calcDict.get(ChConfig.TYPE_Calc_AttrATKMin, 0) + \  | 
|             int(minAtk*curEffect.GetEffectValue(1)*1.0/ChConfig.Def_MaxRateValue)  | 
|           | 
|     calcDict[ChConfig.TYPE_Calc_AttrATKMax] = calcDict.get(ChConfig.TYPE_Calc_AttrATKMax, 0) + \  | 
|             int(maxAtk*curEffect.GetEffectValue(1)*1.0/ChConfig.Def_MaxRateValue)  | 
|     return  | 
|   | 
|   | 
| ## ·µ»ØbuffÀàÐÍ£¬ÏßÐÔÓë·ñ  | 
| #  @param   | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.    | 
| def GetCalcType():  | 
|     return ChConfig.TYPE_Linear  | 
|   | 
| ## »ñÈ¡ÁéÊÞ³öսʱµÄ¹¥»÷Á¦  | 
| def GetPetAtkValueByQuality(curPet, quality):  | 
|     curPlayer = PetControl.GetPetOwner(curPet)  | 
|     if not curPlayer:  | 
|         return 0, 0  | 
|     if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Pet):  | 
|         #GameWorld.DebugLog(' ³èÎ﹦ÄÜ먦Æô')  | 
|         return 0, 0  | 
|       | 
|     classAddAtk = 0  | 
|     petPackIndex = ShareDefine.rptPet  | 
|     petPack = curPlayer.GetItemManager().GetPack(petPackIndex)  | 
|     for i in range(petPack.GetCount()):  | 
|         packItem = petPack.GetAt(i)  | 
|         if packItem.IsEmpty():  | 
|             continue  | 
|         if quality != packItem.GetUserAttr(ShareDefine.Def_IudetPet_QualityLV):  | 
|             # Ö¸¶¨Æ·ÖÊ  | 
|             continue  | 
|         petItemNPCID = packItem.GetUserAttr(ShareDefine.Def_IudetPet_NPCID)  | 
|         classlv = packItem.GetUserAttr(ShareDefine.Def_IudetPet_ClassLV)  | 
|           | 
|         classIpyData = IpyGameDataPY.GetIpyGameData("PetClassCost", petItemNPCID, classlv + 1)  | 
|         classAddAtk += (classIpyData.GetAtkAdd() if classIpyData else 0)  | 
|     totalMinAtk = classAddAtk  | 
|     totalMaxAtk = classAddAtk  | 
|     return totalMinAtk, totalMaxAtk  |