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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
#
##@package SkillModule_7
#
# @todo: Íæ¼ÒºÍNPC¹«ÓàÕÙ»½ÊÞ¼¼ÄÜÄ£°å
# @author Alee
# @date 2010-12-22 09:30
# @version 1.3
#
# ÏêϸÃèÊö: Íæ¼ÒºÍNPC¹«ÓàÕÙ»½ÊÞ¼¼ÄÜÄ£°å
#
# @change: "2011-02-25 13:30" Alee ÕÙ»½²ÎÊýÐÞ¸Ä
# @change: "2011-06-24 15:10" Alee Ìí¼ÓÕÙ»½²»Í¬ÕÙ»½Ê޵ŦÄÜ
# @change: "2011-07-15 14:00" Alee ÐÞ¸ÄÕÙ»½º¯Êý
#---------------------------------------------------------------------
"""Version = 2011-07-15 14:00"""
#------------------------------------------------------------------------------
#µ¼Èë
import SkillCommon
import GameWorld
import ChConfig
import BaseAttack
import IPY_GameWorld
 
#Âß¼­ÊµÏÖ
##Íæ¼ÒºÍNPC¹«ÓàÕÙ»½ÊÞ¼¼ÄÜÄ£°å
# @param attacker ¹¥»÷ÕßʵÀý
# @param defender ·ÀÊØÕßʵÀý
# @param curSkill ¼¼ÄÜʵÀý
# @param tagRoundPosX ÇøÓò×ø±êX
# @param tagRoundPosY ÇøÓò×ø±êY
# @param isEnhanceSkill ÊÇ·ñΪ¸½¼Ó¼¼ÄÜ
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎªÕæ, Êͷųɹ¦
# @remarks Íæ¼ÒºÍNPC¹«ÓàÕÙ»½ÊÞ¼¼ÄÜÄ£°å
def UseSkill(attacker, defender, curSkill, tagRoundPosX, tagRoundPosY, isEnhanceSkill, tick):
    summonResult = False
    #·ÖÎªÍæ¼ÒÕÙ»½ºÍNPCÕÙ»½
    if attacker.GetGameObjType() == IPY_GameWorld.gotNPC:
        summonResult = NPCUseSkill_SummonNPC(attacker, defender, curSkill, tick)
    else:
        summonResult = PlayerUseSkill_SummonNPC(attacker, defender, curSkill, tagRoundPosX, tagRoundPosY, tick)
    
    #ÕÙ»½²»³É¹¦
    if not summonResult:
        return summonResult
    
    #´¦Àí¼¼ÄÜ´¥·¢ºÍ¹¥»÷³É¹¦Âß¼­
    return BaseAttack.DoSkillEx_AttackSucess(attacker, defender, curSkill, tick, isEnhanceSkill)
 
##Íæ¼ÒÕÙ»½ÊÞ
# @param attacker ¹¥»÷ÕßʵÀý
# @param defender ·ÀÊØÕßʵÀý
# @param curSkill ¼¼ÄÜʵÀý
# @param tagRoundPosX ÇøÓò×ø±êX
# @param tagRoundPosY ÇøÓò×ø±êY
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎªÕæ, Êͷųɹ¦
# @remarks Íæ¼ÒÕÙ»½ÊÞ
def PlayerUseSkill_SummonNPC(attacker, defender, curSkill, tagRoundPosX, tagRoundPosY, tick):
    curEffect = curSkill.GetEffect(0)
    if curEffect == None:
        GameWorld.Log("ÕÙ»½¼¼ÄÜÎÞЧ¹û,skillID = %s"%curSkill.GetSkillID(), attacker.GetPlayerID())
        return False
    
    curSummonID = curEffect.GetEffectValue(0)
    if curSummonID == 0:
        GameWorld.Log("¼¼ÄÜ %sÌî±í´íÎó,ÕÙ»½IDΪ0"%curSkill.GetSkillID(), attacker.GetPlayerID())
        return False
    
    #¼ì²éÕÙ»½´æÔڵĹæÔò
    if not SkillCommon.SummonNPCOccurRule(attacker, curSummonID, tick):
        return False
    
    #ÑéÖ¤ÊÇ·ñÖ¸¶¨·Å¼¼ÄÜ
    isAppointBornPos = True
    if tagRoundPosX == -1 or tagRoundPosY == -1:
        isAppointBornPos = False
    
    SkillCommon.PlayerSummonNPC(attacker, curSkill, curSummonID, ChConfig.Def_SummonAppearDist,
                                 tick, isAppointBornPos, tagRoundPosX, tagRoundPosY)
    
    return True
 
##NPCÕÙ»½ÊÞ
# @param attacker ¹¥»÷ÕßʵÀý
# @param defender ·ÀÊØÕßʵÀý
# @param curSkill ¼¼ÄÜʵÀý
# @param tick Ê±¼ä´Á
# @return ·µ»ØÖµÎªÕæ, Êͷųɹ¦
# @remarks NPCÕÙ»½ÊÞ
def NPCUseSkill_SummonNPC(attacker, defender, curSkill, tick):
    curSummonID = curSkill.GetEffect(0).GetEffectValue(0)
    curSummonCount = curSkill.GetEffect(0).GetEffectValue(1)
    
    if curSummonID <= 0 or curSummonCount <= 0:
        GameWorld.ErrLog("NPCʹÓü¼ÄÜ %s£¬ÕÙ»½ID»òÕßÊýÁ¿ÓÐÎó"%curSkill.GetSkillID())
        return False
    
    maxAngryCount = attacker.GetNPCAngry().GetAngryCount()
    
    #ÕÙ»½
    SkillCommon.DoLogic_NPC_UseSkill_SummonNPCAll(attacker, curSkill, curSummonID, curSummonCount, 
                                                  maxAngryCount, tick, addAngry = True)
    
    return True