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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/bin/python
# -*- coding: GBK -*-
#---------------------------------------------------------------------
#
#---------------------------------------------------------------------
##@package CalcNoLineEffect
# ¼ÆËã·ÇÏßÐÔBuff
#
# @author eggxp
# @date 2010-4-22
# @version 1.5
#
# @change: "2013-05-17 15:35" Alee ¸ü¸Ä¼ÆË㷽ʽ
# @change: "2013-09-06 20:00" hxp ÐÞ¸ÄÕ½¶·Á¦¼ÆËãÂß¼­
# @change: "2013-10-15 11:40" hxp ÐÞ¸Ä×Öµä»ñȡֵÅжÏ
# @change: "2013-11-13 21:00" Alee Òƶ¯ËٶȶÀÁ¢´¦Àí
# @change: "2015-07-29 17:30" hxp É˺¦¼õÃâ¸ÄΪÏßÐÔ
#---------------------------------------------------------------------
#"""Version = 2015-07-29 17:30"""
#---------------------------------------------------------------------
import ChConfig
import EffGetSet
import GameWorld
import FBCommon
#---------------------------------------------------------------------
 
def AddPlayerMapAttrNolineEffect(curPlayer, effectDict):
    ## ¸ù¾ÝÍæ¼Òµ±Ç°ÊôÐÔ¸øÍæ¼ÒÌí¼Ó·ÇÏßÐÔЧ¹û¼Ó³É - Ä³Ð©µØÍ¼²ÅÉúЧµÄ
    mapID = FBCommon.GetRecordMapID(curPlayer.GetMapID())
    mapAttrNolineInfo = ChConfig.MapAttrInfoDict_Noline.get(mapID, {})
    for attrIndex, effAttrIndexList in mapAttrNolineInfo.items():
        curValue = EffGetSet.GetValueByEffIndex(curPlayer, attrIndex)
        if not curValue:
            #GameWorld.DebugLog("    Ã»ÓиÃÀàÊôÐÔ: attrIndex=%s" % attrIndex)
            continue
        for effAttrIndex in effAttrIndexList:
            effectDict[effAttrIndex] = effectDict.get(effAttrIndex, 0) + curValue
    return
 
## ¸øÍæ¼ÒÌí¼Ó·ÇÏßÐÔBuffЧ¹û 
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param effectDict Ð§¹ûÁбí
#  @return None
def ChangePlayerAttrInNoLineEffectList(curPlayer, effectDict, isBuffAttr=False):
    for key, value in effectDict.items():
        if value == 0:
            continue
        
        # ¹¦Äܽ»²æÏßÐÔÌáÉýµÄ²»ÔÚÕâÀï´¦Àí£¬ÕâÀïÖ»´¦ÀíÍæ¼Òµ±Ç°ÊôÐԵķÇÏßÐÔÌáÉý
        if key in ChConfig.FuncNoLinearAttrDict:
            continue
        
        curValue = EffGetSet.GetValueByEffIndex(curPlayer, key)
        if curValue == None :
            GameWorld.Log("µ÷ÓÃplayer·ÇÏßÐÔÊôÐÔÌõ¼þʧ°Ü,index = %s" % (key) , curPlayer.GetPlayerID())
            continue
 
        # buff¶ÔÒÆ¶¯ËٶȵÄÓ°Ïì²»ÔÚÕâÀï¼ÆËã, µ¥¶ÀÌá³öÀ´¶ÀÁ¢¼ÆËã
        if isBuffAttr and key == ChConfig.TYPE_Calc_AttrSpeed:
            continue
        
#        if key == ChConfig.TYPE_Calc_AttrSpeed:
#            # Òƶ¯ËÙ¶ÈÔÝû×öÕ½¶·Á¦Í³¼Æ£¬Èç¹ûÐèÒª£¬¿É²ÎÕÕÉ˺¦ÎüÊÕÖ±½Ó¼ÓÉÏÊýÖµ£¬²»×öÌØÊâ´¦Àí
#            # ËÙ¶ÈÌØÊâ´¦Àí, ¶ÀÁ¢´¦Àí ²»Ë¢ÊôÐÔ
#            #EffGetSet.SetValueByEffIndex(curPlayer, key, curValue * ChConfig.Def_MaxRateValue / max(100, ChConfig.Def_MaxRateValue + value))
#            continue        
##        elif key == ChConfig.TYPE_Calc_AttrDamReduce:
##            if mfpObjAttrDict:
##                for mfpObj, attrDict in mfpObjAttrDict.items():
##                    #if not attrDict.has_key(key): # Èç¹û¸ÃÄ£¿éûÓÐÔö¼Ó¸ÃÊôÐÔ£¬ÔòÌø¹ý
##                    if key not in attrDict: # Èç¹û¸ÃÄ£¿éûÓÐÔö¼Ó¸ÃÊôÐÔ£¬ÔòÌø¹ý
##                        continue
##                    curMValue = attrDict[key]
##                    # ¸ø¶ÔӦģ¿éÀÛ¼ÓÉÏ·ÇÏßÐÔÔö¼ÓµÄÕ½¶·ÊôÐÔÖµ£¬¼ÆËãÕ½¶·Á¦Ê±¿ÉÖ±½ÓÓþßÌåÊýÖµ£¬²»×öË¥¼õ´¦Àí
##                    mfpObj.AddCalcMFPAttr(key, curMValue)
##                    
##            tmpValue = curValue + value - curValue * value / ChConfig.Def_MaxRateValue
##            # Ë¥¼õËã·¨
##            EffGetSet.SetValueByEffIndex(curPlayer, key, tmpValue)
#        else:
        EffGetSet.SetValueByEffIndex(curPlayer, key, curValue * (ChConfig.Def_MaxRateValue + value) / ChConfig.Def_MaxRateValue)
    
    return
 
 
## ¸øNPCÌí¼Ó·ÇÏßÐÔBuffЧ¹û
#  @param curNPC µ±Ç°NPC
#  @param effectDict Ð§¹ûÁбí
#  @return None
def ChangeNPCAttrInNoLineEffectList(curNPC, effectDict):
    for key, value in effectDict.items():
        if value == 0:
            continue
        
        curValue = EffGetSet.GetValueByEffIndex(curNPC, key)
        if curValue == None :
            GameWorld.Log("µ÷ÓÃNPC·ÇÏßÐÔÊôÐÔÌõ¼þʧ°Ü,index = %s" % (key))
            continue
        
        EffGetSet.SetValueByEffIndex(curNPC, key, curValue * (ChConfig.Def_MaxRateValue + value) / ChConfig.Def_MaxRateValue)
    
    return