#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
#  
 | 
#  
 | 
##@package SkillModule_25.py  
 | 
#  
 | 
# @todo:NPC NPCרÓàÕÙ»½ÊÞ¼¼ÄÜÄ£°å  
 | 
#  
 | 
# @author jiang  
 | 
# @date 2012-07-13  
 | 
# @version 1.2  
 | 
# @note:  
 | 
#  
 | 
# @change: "2012-07-19 17:30" jiang DoLogic_NPC_UseSkill_SummonNPC²ÎÊýÐÞ¸Ä  
 | 
# @change: "2014-09-22 15:30" hxp Ôö¼Ó¿ÉÖ¸¶¨ÕÙ»½ÊÞ³öÏÖλÖÃΪÕÙ»½Õß½ÅÏ  
 | 
#------------------------------------------------------------------------------   
 | 
"""Version = 2014-09-22 15:30"""  
 | 
#------------------------------------------------------------------------------   
 | 
# µ¼Èë  
 | 
import GameWorld  
 | 
import SkillCommon  
 | 
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)  
 | 
    curSummonCount = curSkill.GetEffect(0).GetEffectValue(1)  # µ¥´ÎÕÙ»½ÊýÁ¿  
 | 
    summonCountAll = curSkill.GetEffect(0).GetEffectValue(2)  # ×ÜÕÙ»½ÊýÁ¿  
 | 
      
 | 
    if curSummonID <= 0 or curSummonCount <= 0:  
 | 
        GameWorld.ErrLog("NPCʹÓü¼ÄÜ %s£¬ÕÙ»½ID»òÕßÊýÁ¿ÓÐÎó"%curSkill.GetSkillID())  
 | 
        return False  
 | 
      
 | 
    maxAngryCount = attacker.GetNPCAngry().GetAngryCount()  
 | 
      
 | 
    # Ô¤¾¯ÕÙ»½  
 | 
    if attacker.GetDictByKey(ChConfig.Def_NPC_Dict_SkillWarnSkillID) == curSkill.GetSkillID():  
 | 
        posCnt = attacker.GetDictByKey(ChConfig.Def_NPC_Dict_SkillWarnPosCnt)  
 | 
        for i in xrange(posCnt):  
 | 
            rebornPosX = attacker.GetDictByKey(ChConfig.Def_NPC_Dict_SkillWarnPosX % i)  
 | 
            rebornPosY = attacker.GetDictByKey(ChConfig.Def_NPC_Dict_SkillWarnPosY % i)  
 | 
            SkillCommon.DoLogic_NPC_UseSkill_SummonNPC(attacker, curSkill, curSummonID, summonCountAll, maxAngryCount,   
 | 
                                                       tick, True, curSkill.GetAtkRadius(), rebornPosX, rebornPosY)  
 | 
    else:  
 | 
        #ÕÙ»½ÊÞλÖÃÔÚ·ÀÊØÕß½ÅÏ  
 | 
        if defender and attacker != defender:  
 | 
            tagRoundPosX = defender.GetPosX()  
 | 
            tagRoundPosY = defender.GetPosY()  
 | 
              
 | 
        isUnderAttacker = curSkill.GetEffect(1).GetEffectValue(0) # ÊÇ·ñÕÙ»½ÔÚÕÙ»½Õß½ÅÏ  
 | 
        if isUnderAttacker:  
 | 
            tagRoundPosX = attacker.GetPosX()  
 | 
            tagRoundPosY = attacker.GetPosY()  
 | 
              
 | 
        #ÕÙ»½  
 | 
        for i in range(0, curSummonCount):  
 | 
            SkillCommon.DoLogic_NPC_UseSkill_SummonNPC(attacker, curSkill, curSummonID, summonCountAll,  
 | 
                                         maxAngryCount, tick, True, curSkill.GetAtkRadius(), tagRoundPosX, tagRoundPosY)  
 | 
              
 | 
    return BaseAttack.DoSkillEx_AttackSucess(attacker, defender, curSkill, tick, isEnhanceSkill)  
 | 
  
 |