1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/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)