#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
#-------------------------------------------------------------------------------  
 | 
#  
 | 
#-------------------------------------------------------------------------------  
 | 
#  
 | 
##@package SkillModule_12  
 | 
#  
 | 
# @todo: Ö¸¶¨Ä¿±êÓнǶȵÄȺÌ巶Χ¹¥»÷Ä£°å  
 | 
# @author Alee  
 | 
# @date 2010-12-31 17:43  
 | 
# @version 1.3  
 | 
#  
 | 
# ÏêϸÃèÊö: Ö¸¶¨Ä¿±êÓнǶȵÄȺÌ巶Χ¹¥»÷Ä£°å  
 | 
# @change: "2011-1-11 17:30" Alee ²ÎÊý´íÎó,×ø±êÆðµãºÍË¥¼õ  
 | 
# @change: "2011-04-27 15:50" Alee ×Öµäȡֵ·À·¶  
 | 
# @change: "2013-08-15 19:00" Alee ²¹×ãÄ¿±êÒÅ©µã  
 | 
#  
 | 
#------------------------------------------------------------------------------   
 | 
"""Version = 2013-08-15 19:00"""  
 | 
#------------------------------------------------------------------------------  
 | 
#µ¼Èë  
 | 
import ChConfig  
 | 
import BaseAttack  
 | 
import GameWorld  
 | 
#---------------------------------------------------------------------  
 | 
##Ö¸¶¨Ä¿±êÓнǶȵÄȺÌ巶Χ¹¥»÷Ä£°å  
 | 
# @param attacker ¹¥»÷ÕßʵÀý  
 | 
# @param defender ·ÀÊØÕßʵÀý  
 | 
# @param curSkill ¼¼ÄÜʵÀý  
 | 
# @param tagRoundPosX ÇøÓò×ø±êX  
 | 
# @param tagRoundPosY ÇøÓò×ø±êY  
 | 
# @param isEnhanceSkill ÊÇ·ñΪ¸½¼Ó¼¼ÄÜ  
 | 
# @param tick Ê±¼ä´Á  
 | 
# @return ·µ»ØÖµÎªÕæ, Êͷųɹ¦  
 | 
# @remarks Ö¸¶¨Ä¿±êÓнǶȵÄȺÌ巶Χ¹¥»÷Ä£°å  
 | 
def UseSkill(attacker, defender, curSkill, tagRoundPosX, tagRoundPosY, isEnhanceSkill, tick):  
 | 
    skillEffect = curSkill.GetEffect(0)  
 | 
    skillPer = skillEffect.GetEffectValue(0) / float(ChConfig.Def_MaxRateValue)  
 | 
    skillEnhance = skillEffect.GetEffectValue(1)  
 | 
      
 | 
    #---¹¥»÷±éÀúÆðµãÓÅÏȼ¶ 1.ÕÒÖ¸¶¨µã 2.·ÀÊØÕߣ¨°üÀ¨×Ô¼º£©---  
 | 
    if tagRoundPosX == -1 or tagRoundPosY == -1:  
 | 
        if not defender:  
 | 
            GameWorld.ErrLog("SkillModule_12 not defender!")  
 | 
            return  
 | 
        #ÆðµãÊǹ¥»÷·½£¬»¹ÊÇÊܺ¦·½£¬»¹ÊÇµãµØ  
 | 
        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.AttackerSkillAttackArea(attacker, defender, attacker.GetPosX(), attacker.GetPosY(),  
 | 
                                              curSkill, skillPer, skillEnhance, tick, [],  
 | 
                                              isEnhanceSkill, skillMatrix)  
 | 
  
 |