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
72
73
74
75
76
77
78
79
#!/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)