#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
#-------------------------------------------------------------------------------  
 | 
#  
 | 
##@package Skill.GameSkills.SkillModule_34  
 | 
#  
 | 
# @todo:Ë²ÒÆ+É˺¦  
 | 
# @author hxp  
 | 
# @date 2016-3-31  
 | 
# @version 1.0  
 | 
#  
 | 
# ÏêϸÃèÊö: Ë²ÒÆ+É˺¦(Ч¹û°ë¾¶ 0-µ¥¹¥; >0Ⱥ¹¥Ð§¹û°ë¾¶); ¿ÉÔÙ´¥·¢¼¼ÄÜ  
 | 
#  
 | 
#-------------------------------------------------------------------------------  
 | 
#"""Version = 2016-3-31 11:30"""  
 | 
#-------------------------------------------------------------------------------  
 | 
  
 | 
import GameMap  
 | 
import ChConfig  
 | 
import GameWorld  
 | 
import BaseAttack  
 | 
import IPY_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):  
 | 
      
 | 
    if tagRoundPosX == -1 or tagRoundPosY == -1:  
 | 
        if not defender:  
 | 
            return  
 | 
          
 | 
        tagRoundPosX = defender.GetPosX()  
 | 
        tagRoundPosY = defender.GetPosY()  
 | 
          
 | 
          
 | 
    skillEffect = curSkill.GetEffect(0)  
 | 
    skillPer = skillEffect.GetEffectValue(0) / float(ChConfig.Def_MaxRateValue)  
 | 
    skillEnhance = skillEffect.GetEffectValue(1)  
 | 
      
 | 
    curRadius = curSkill.GetAtkRadius() # 0-µ¥¹¥; >0Ⱥ¹¥Ð§¹û°ë¾¶  
 | 
    if curRadius == 0:  
 | 
        result = BaseAttack.Attack(attacker, defender, curSkill, tick, skillPer, skillEnhance, 1, isEnhanceSkill)  
 | 
    else:  
 | 
        result = BaseAttack.AttackerSkillAttackArea(attacker, defender, tagRoundPosX, tagRoundPosY, curSkill, skillPer, skillEnhance, tick, isExSkill=isEnhanceSkill)  
 | 
  
 | 
    #NPC  
 | 
    if attacker.GetGameObjType() == IPY_GameWorld.gotNPC:  
 | 
        posX, posY = GameMap.GetNearbyPosByDis(defender.GetPosX(), defender.GetPosY(), 1)  
 | 
        if posX == 0 and posY == 0:  
 | 
            return  
 | 
        attacker.ResetPos(tagRoundPosX, tagRoundPosY, curSkill.GetSkillID())  
 | 
      
 | 
    #Íæ¼Ò  
 | 
    elif attacker.GetGameObjType() == IPY_GameWorld.gotPlayer:  
 | 
        GameWorld.ResetPlayerPos(attacker, tagRoundPosX, tagRoundPosY, curSkill.GetSkillID())  
 | 
          
 | 
    return result  
 | 
      
 |