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 Skill.GameSkills.SkillModule_34
#
# @todo:Ë²ÒÆ+É˺¦
# @author hxp
# @date 2016-3-31
# @version 1.0
#
# ÏêϸÃèÊö: Ë²ÒÆ+É˺¦(Ч¹û°ë¾¶ 0-µ¥¹¥; >0Ⱥ¹¥Ð§¹û°ë¾¶); ¿ÉÔÙ´¥·¢¼¼ÄÜ
#
#-------------------------------------------------------------------------------
#"""Version = 2016-3-31 11:30"""
#-------------------------------------------------------------------------------
 
import GameMap
import ChConfig
import GameWorld
import BaseAttack
import IPY_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):
    
    if tagRoundPosX == -1 or tagRoundPosY == -1:
        if not defender:
            return
        
        tagRoundPosX = defender.GetPosX()
        tagRoundPosY = defender.GetPosY()
        
        
    skillEffect = curSkill.GetEffect(0)
    skillPer = skillEffect.GetEffectValue(0) / float(ChConfig.Def_MaxRateValue)
    skillEnhance = skillEffect.GetEffectValue(1)
    
    curRadius = curSkill.GetAtkRadius() # 0-µ¥¹¥; >0Ⱥ¹¥Ð§¹û°ë¾¶
    if curRadius == 0:
        result = BaseAttack.Attack(attacker, defender, curSkill, tick, skillPer, skillEnhance, 1, isEnhanceSkill)
    else:
        result = BaseAttack.AttackerSkillAttackArea(attacker, defender, tagRoundPosX, tagRoundPosY, curSkill, skillPer, skillEnhance, tick, isExSkill=isEnhanceSkill)
 
    #NPC
    if attacker.GetGameObjType() == IPY_GameWorld.gotNPC:
        posX, posY = GameMap.GetNearbyPosByDis(defender.GetPosX(), defender.GetPosY(), 1)
        if posX == 0 and posY == 0:
            return
        attacker.ResetPos(tagRoundPosX, tagRoundPosY, curSkill.GetSkillID())
    
    #Íæ¼Ò
    elif attacker.GetGameObjType() == IPY_GameWorld.gotPlayer:
        GameWorld.ResetPlayerPos(attacker, tagRoundPosX, tagRoundPosY, curSkill.GetSkillID())
        
    return result