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
#!/usr/bin/python
# -*- coding: GBK -*-
#
# @todo: ÓнǶȵÄȺÌåbuff
#
# @author: Alee
# @date 2018-1-23 ÉÏÎç09:59:44
# @version 1.0
#
# @note: 
#
#-------------------------------------------------------------------------------------------------------------
#µ¼Èë
import BaseAttack
import GameWorld
import ChConfig
#------------------------------------------------------------------------------ 
 
def UseBuff(attacker, defender, curSkill, tick, tagRoundPosX, tagRoundPosY):
    
    #---¹¥»÷±éÀúÆðµãÓÅÏȼ¶ 1.ÕÒÖ¸¶¨µã 2.·ÀÊØÕߣ¨°üÀ¨×Ô¼º£©---
    if tagRoundPosX == -1 or tagRoundPosY == -1:
        #ÆðµãÊǹ¥»÷·½£¬»¹ÊÇÊܺ¦·½£¬»¹ÊÇµãµØ
        tagRoundPosX = defender.GetPosX()
        tagRoundPosY = defender.GetPosY()
 
    attackRad = curSkill.GetAtkRadius()
    
    attackMatrix = ChConfig.Def_Angle_MatrixDict.get(attackRad)
    if attackMatrix == None:
        GameWorld.ErrLog("ÀàÐÍ´íÎó(%s), ÓнǶȵĹ¥»÷¾ØÕó"%attackRad)
        return False
    
    srcPosX, srcPosY = attacker.GetPosX(), attacker.GetPosY()
    skillMatrix = GameWorld.MatrixCircle(attackMatrix, attacker.GetPosX(), attacker.GetPosY(),
                                         tagRoundPosX, tagRoundPosY)
    
    #¼ÆËãÆ«ÒÆ²úÉú¶µã£¬²¹×ãÄ¿±êµã
    desDist = GameWorld.GetDist(srcPosX, srcPosY, tagRoundPosX, tagRoundPosY)
    atkDist = curSkill.GetAtkDist()
    if atkDist != 0 and desDist <= atkDist:
        insertIndex = int(desDist/float(atkDist)*len(skillMatrix))
        if (tagRoundPosX, tagRoundPosY) not in skillMatrix:
            skillMatrix.insert(insertIndex, (tagRoundPosX, tagRoundPosY))
 
    #ʹÓü¼ÄÜ
    return BaseAttack.SkillAddAreaBuff(attacker, defender, curSkill, attacker.GetPosX(), 
                                       attacker.GetPosY(), tick, False, skillMatrix)