#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
#  
 | 
#  
 | 
##@package SkillModule_24.py  
 | 
#  
 | 
# @todo:ÊÍ·ÅÁú¾í·ç  
 | 
#  
 | 
# @author jiang  
 | 
# @date 2012-07-13  
 | 
# @version 1.1  
 | 
# @note:  
 | 
#  
 | 
# @change: "2012-07-19 17:30" jiang DoLogic_NPC_UseSkill_SummonNPC²ÎÊýÐÞ¸Ä  
 | 
#------------------------------------------------------------------------------   
 | 
"""Version = 2012-07-19 17:30"""  
 | 
#------------------------------------------------------------------------------   
 | 
# µ¼Èë  
 | 
import GameWorld  
 | 
import IPY_GameWorld  
 | 
import SkillCommon  
 | 
import math  
 | 
import BaseAttack  
 | 
import ChConfig  
 | 
#------------------------------------------------------------------------------   
 | 
  
 | 
## Áú¾í·ç  
 | 
# @param attacker ¹¥»÷ÕßʵÀý  
 | 
# @param defender ·ÀÊØÕßʵÀý  
 | 
# @param curSkill ¼¼ÄÜʵÀý  
 | 
# @param tagRoundPosX ÇøÓò×ø±êX  
 | 
# @param tagRoundPosY ÇøÓò×ø±êY  
 | 
# @param isEnhanceSkill ÊÇ·ñΪ¸½¼Ó¼¼ÄÜ  
 | 
# @param tick Ê±¼ä´Á  
 | 
# @return ·µ»ØÖµÎªÕæ, Êͷųɹ¦  
 | 
def UseSkill(attacker, defender, curSkill, tagRoundPosX, tagRoundPosY, isEnhanceSkill, tick):  
 | 
    curSummonID = curSkill.GetEffect(0).GetEffectValue(0)  # ÕÙ»½ÊÞID  
 | 
    if curSummonID == 0:  
 | 
        return  
 | 
      
 | 
    curSummon = GameWorld.GetGameData().FindNPCDataByID(curSummonID)  
 | 
    if not curSummon:  
 | 
        GameWorld.ErrLog("skillId = %s Error ÕÒ²»µ½idΪ%sµÄnpc"(curSkill.GetSkillID(), curSummonID))  
 | 
        return  
 | 
      
 | 
    maxAngryCount = attacker.GetNPCAngry().GetAngryCount()  
 | 
      
 | 
    attackerPosX = attacker.GetPosX()  
 | 
    attackerPosY = attacker.GetPosY()  
 | 
      
 | 
    #ÕÙ»½  
 | 
    wayCount = curSkill.GetEffect(0).GetEffectValue(1)  # N·½Ïò  
 | 
    for index in range(0, wayCount):  
 | 
        angle = index * 360/wayCount  
 | 
        posX = int(attackerPosX + GameWorld.MyRound(math.cos(3.14*(angle/180.0))))  
 | 
        posY = int(attackerPosY + GameWorld.MyRound(math.sin(3.14*(angle/180.0))))  
 | 
        if not GameWorld.GetMap().IsValidPos(posX, posY):  
 | 
            #×ø±êµã³¬³öµØÍ¼±ß½ç  
 | 
            continue  
 | 
          
 | 
        summonNpc = SkillCommon.DoLogic_NPC_UseSkill_SummonNPC(attacker, curSkill, curSummonID, wayCount,  
 | 
                                     maxAngryCount, tick, False, rebornPosX = posX, rebornPosY = posY)  
 | 
        if not summonNpc:  
 | 
            continue  
 | 
          
 | 
        runDist = curSkill.GetAtkRadius()  
 | 
        tagPosX = int(attackerPosX + GameWorld.MyRound(math.cos(3.14*(angle/180.0)) * runDist))  
 | 
        tagPosY = int(attackerPosY + GameWorld.MyRound(math.sin(3.14*(angle/180.0)) * runDist))  
 | 
        if not GameWorld.GetMap().IsValidPos(tagPosX, tagPosY):  
 | 
            #×ø±êµã³¬³öµØÍ¼±ß½ç  
 | 
            continue  
 | 
      
 | 
        #¼Ç¼¸ÃNPCÖÕµã×ø±ê  
 | 
        summonNpc.SetDict(ChConfig.Def_NPC_Dict_CycloneTagPosX, tagPosX)  
 | 
        summonNpc.SetDict(ChConfig.Def_NPC_Dict_CycloneTagPosY, tagPosY)  
 | 
      
 | 
    #´¦Àí¼¼ÄÜ´¥·¢ºÍ¹¥»÷³É¹¦Âß¼  
 | 
    return BaseAttack.DoSkillEx_AttackSucess(attacker, defender, curSkill, tick, isEnhanceSkill)  
 | 
  
 |