1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/python
# -*- coding: GBK -*-
#
# @todo: Ôö¼Óij¸ö·¨±¦µÄÊôÐÔ°Ù·Ö±È
#
# @author: Alee
# @date 2018-1-20 ÏÂÎç02:50:26
# @version 1.0
#
# @note: 
#
#---------------------------------------------------------------------
#µ¼Èë
import ChConfig
import PlayerControl
import PlayerMagicWeapon
import GameWorld
import IpyGameDataPY
#---------------------------------------------------------------------
 
## buffÏßÐÔÔö¼ÓÊôÐÔ
#  @param defender Buff³ÐÊÜÕß
#  @param curEffect ¼¼ÄÜЧ¹û
#  @param calcDict ¼¼ÄÜЧ¹ûÀÛ¼Ó×ܱí
#  @return None
def OnCalcBuffEx(defender, curEffect, calcDict, curBuff):
    attrType = curEffect.GetEffectValue(1)
    value = GetMagicWeaponAttrByType(defender, curEffect.GetEffectValue(0), attrType)
    value = int(value*curEffect.GetEffectValue(2)*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 GetMagicWeaponAttrByType(curPlayer, magicWeaponID, attrType):
    if PlayerMagicWeapon.GetIsActiveMagicWeapon(curPlayer, magicWeaponID):
        return 0
    # ±íÊôÐÔΪÀÛ¼Ó
    curMWLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MagicWeaponLV % magicWeaponID)
    value = 0
    for lv in xrange(curMWLV+1):
        upIpyData = IpyGameDataPY.GetIpyGameDataNotLog('TreasureUp', magicWeaponID, lv)
        if upIpyData:
            value += upIpyData.GetAddAttr().get(attrType, 0)
    return value