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
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
#
##@package SkillModule_12
#
# @todo: Ö¸¶¨Ä¿±êÓнǶȵÄȺÌ巶Χ¹¥»÷Ä£°å
# @author Alee
# @date 2010-12-31 17:43
# @version 1.3
#
# ÏêϸÃèÊö: Ö¸¶¨Ä¿±êÓнǶȵÄȺÌ巶Χ¹¥»÷Ä£°å
# @change: "2011-1-11 17:30" Alee ²ÎÊý´íÎó,×ø±êÆðµãºÍË¥¼õ
# @change: "2011-04-27 15:50" Alee ×Öµäȡֵ·À·¶
# @change: "2013-08-15 19:00" Alee ²¹×ãÄ¿±êÒÅ©µã
#
#------------------------------------------------------------------------------ 
"""Version = 2013-08-15 19:00"""
#------------------------------------------------------------------------------
#µ¼Èë
import ChConfig
import BaseAttack
import 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):
    skillEffect = curSkill.GetEffect(0)
    skillPer = skillEffect.GetEffectValue(0)
    skillEnhance = skillEffect.GetEffectValue(1)
    
    #---¹¥»÷±éÀúÆðµãÓÅÏȼ¶ 1.ÕÒÖ¸¶¨µã 2.·ÀÊØÕߣ¨°üÀ¨×Ô¼º£©---
    if tagRoundPosX == -1 or tagRoundPosY == -1:
        if not defender:
            GameWorld.ErrLog("SkillModule_12 not defender!")
            return
        #ÆðµãÊǹ¥»÷·½£¬»¹ÊÇÊܺ¦·½£¬»¹ÊÇµãµØ
        tagRoundPosX = defender.GetPosX()
        tagRoundPosY = defender.GetPosY()
 
    attackRad = curSkill.GetAtkRadius()
    
    attackMatrix = ChConfig.Def_Angle_MatrixDict.get(attackRad)
    if attackMatrix == None:
        GameWorld.ErrLog("ÀàÐÍ´íÎó(%s), ÓнǶȵĹ¥»÷¾ØÕó"%attackRad)
        return False
    
    srcPosX, srcPosY = attacker.GetPosX(), attacker.GetPosY()
    skillMatrix = GameWorld.MatrixCircle(attackMatrix, attacker.GetPosX(), attacker.GetPosY(),
                                         tagRoundPosX, tagRoundPosY)
    
    #¼ÆËãÆ«ÒÆ²úÉú¶µã£¬²¹×ãÄ¿±êµã
    desDist = GameWorld.GetDist(srcPosX, srcPosY, tagRoundPosX, tagRoundPosY)
    atkDist = curSkill.GetAtkDist()
    if atkDist != 0 and desDist <= atkDist:
        insertIndex = int(desDist/float(atkDist)*len(skillMatrix))
        if (tagRoundPosX, tagRoundPosY) not in skillMatrix:
            skillMatrix.insert(insertIndex, (tagRoundPosX, tagRoundPosY))
    
    #ʹÓü¼ÄÜ
    return BaseAttack.AttackerSkillAttackArea(attacker, defender, attacker.GetPosX(), attacker.GetPosY(),
                                              curSkill, skillPer, skillEnhance, tick, [],
                                              isEnhanceSkill, skillMatrix)