| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #  | 
| ##@package  | 
| #  | 
| # @todo: Ôö¼ÓËùÓÐ×øÆïµÄij¸öÊôÐÔЧ¹û°Ù·Ö±È  | 
| #  | 
| # @author: Alee  | 
| # @date 2019-4-3 ÏÂÎç05:28:34  | 
| # @version 1.0  | 
| #  | 
| # @note:   | 
| #  | 
| #---------------------------------------------------------------------  | 
| #µ¼Èë  | 
| import ChConfig  | 
| import PlayerControl  | 
| import ShareDefine  | 
| import IpyGameDataPY  | 
| import GameWorld  | 
| #---------------------------------------------------------------------  | 
|   | 
| ## buffÏßÐÔÔö¼ÓÊôÐÔ  | 
| #  @param defender Buff³ÐÊÜÕß  | 
| #  @param curEffect ¼¼ÄÜЧ¹û  | 
| #  @param calcDict ¼¼ÄÜЧ¹ûÀÛ¼Ó×Ü±í  | 
| #  @return None  | 
| def OnCalcBuffEx(defender, curEffect, calcDict, curBuff):  | 
|     attrType = curEffect.GetEffectValue(0)  | 
|     value = GetHorseAttrByQuality(defender, attrType)  | 
|     value = int(value*curEffect.GetEffectValue(1)*1.0/ChConfig.Def_MaxRateValue)  | 
|       | 
|     #[ÊôÐÔË÷Òý, ÊÇ·ñ»ù´¡ÊôÐÔ£¬(·Ç)ÏßÐÔ]  | 
|     attrInfo = ChConfig.ItemEffect_AttrDict.get(attrType, [])  | 
|     if attrInfo == []:  | 
|         return  | 
|       | 
|     for i in attrInfo[0]:  | 
|         GameWorld.AddDictValue(calcDict, {i:value})  | 
|       | 
|     return  | 
|   | 
|   | 
| ## ·µ»ØbuffÀàÐÍ£¬ÏßÐÔÓë·ñ  | 
| #  @param   | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.    | 
| def GetCalcType():  | 
|     return ChConfig.TYPE_Linear  | 
|   | 
| def GetHorseAttrByQuality(curPlayer, attrType):  | 
|     value = 0  | 
|     ipyDataMgr = IpyGameDataPY.IPY_Data()  | 
|     for i in xrange(ipyDataMgr.GetHorseCount()):  | 
|         ipyData = ipyDataMgr.GetHorseByIndex(i)  | 
|         horseID = ipyData.GetHorseID()  | 
|         lv = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_LV % horseID, 0, ChConfig.Def_PDictType_Horse)  | 
|         if not lv:  | 
|             continue  | 
|       | 
|         horseUpData = IpyGameDataPY.GetIpyGameData("HorseUp", horseID, lv)  | 
|         if not horseUpData:  | 
|             continue  | 
|           | 
|         attrTypeList = horseUpData.GetAttrType()  | 
|         attrValueList = horseUpData.GetAttrValue()  | 
|         if attrType not in attrTypeList:  | 
|             continue  | 
|           | 
|         value += attrValueList[attrTypeList.index(attrType)]  | 
|   | 
|     return value  | 
|   |