#!/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)  
 | 
  
 |