hch
2018-08-24 27c4fd0e86e3baf5070b422c87baa7e1b7c8a0df
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#!/usr/bin/python
# -*- coding: GBK -*-
#---------------------------------------------------------------------
##@package SkillModule_16
# Èº¹¥¼¼ÄÜ£ºÕÙ»½ ¼Ì³ÐÖ÷ÈË
#
# @author Alee
# @date 2011-03-23 17:30
# @version 1.2
#
#Ä£¿éÏêϸ˵Ã÷£ºÕÙ»½ ¼Ì³ÐÖ÷ÈË ¸ù¾Ý1013¾ö¶¨ÐÐΪ
#---------------------------------------------------------------------
"""Version = 2013-10-31 14:45"""
 
 
#µ¼Èë
import GameWorld
import ChConfig
import GameMap
import NPCCommon
import BaseAttack
import IPY_GameWorld
import ItemControler
import SkillDataBoost
import GameObj
import SkillCommon
 
##¼Ì³ÐÍæ¼ÒÊôÐÔµÄÕÙ»½
# @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):
 
    curSummonID = curSkill.GetEffect(0).GetEffectValue(0)
    
    if curSummonID == 0:
        GameWorld.Log("Ìî±í´íÎó,ÕÙ»½IDΪ0", attacker.GetPlayerID())
        return
    
    #---¹¥»÷±éÀúÆðµãÓÅÏȼ¶ 1.ÕÒÖ¸¶¨µã 2.·ÀÊØÕߣ¨°üÀ¨×Ô¼º£©---
    if tagRoundPosX == -1 or tagRoundPosY == -1:
        #ÆðµãÊǹ¥»÷·½£¬»¹ÊÇÊܺ¦·½£¬»¹ÊÇµãµØ
        tagRoundPosX = defender.GetPosX()
        tagRoundPosY = defender.GetPosY()
    
    
    if attacker.GetGameObjType() == IPY_GameWorld.gotPlayer:
        #ÕÙ»½Áé
        PlayerSummonNPC(attacker, curSkill, curSummonID, tagRoundPosX, tagRoundPosY, tick)
    else:
        DoLogic_NPC_UseSkill_SummonNPC(attacker, curSkill, curSummonID, defender.GetPosX(), defender.GetPosY(), tick)
    
    #GameWorld.Log("¼Ì³ÐÍæ¼ÒÊôÐÔÕÙ»½ËÑÊÞ£¬Ê¹Óóɹ¦")
    return BaseAttack.DoSkillEx_AttackSucess(attacker, defender, curSkill, tick, isEnhanceSkill)
 
## Íæ¼ÒÕÙ»½NPC ¼Ì³ÐÍæ¼ÒÊôÐÔµÄÕÙ»½
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param curSkill ÕÙ»½¼¼ÄÜ
#  @param summonID ÕÙ»½ÊÞID
#  @param summonDist ÕÙ»½ÊÞÊôÐÔÁбí
#  @param tick ÕÙ»½ÊÞÀë×Ô¼ºµÄ¾àÀë
#  @return Noneµ±Ç°Ê±¼ä
#  @remarks º¯ÊýÏêϸ˵Ã÷. ÌØÊâ´¦Àí£¬ÒòΪÊǼÙÕÙ»½²»×ßͨÓÃÂß¼­
def PlayerSummonNPC(curPlayer, curSkill, summonID, tagRoundPosX, tagRoundPosY, tick):
    #½«ÒªÕÙ»½³öµÄNPC
    summonNPC = curPlayer.SummonNewNPC()
    
    #ÉèÖÃÕÙ»½ÊÞ»ù´¡ÐÅÏ¢
    summonNPC.SetNPCTypeID(summonID)
    lvSummonNPC = curPlayer.GetLV()
    summonNPC.SetLV(lvSummonNPC)
    summonNPC.SetCountry(curPlayer.GetCountry())
    summonNPC.GetNPCAngry().Init(ChConfig.Def_SummonNPC_Angry_Count)
 
    #³õʼ»¯
    NPCCommon.InitNPC(summonNPC) 
      
    #Íæ¼ÒÕÙ»½ÊÞÁбíÌí¼ÓÕÙ»½ÊÞ,ÕÙ»½ÊÞÌí¼ÓÖ÷ÈË
    summonNPC.SetOwner(curPlayer)
    
    if summonNPC.GetOrgSpeed():
        summonPos = GameMap.GetEmptyPlaceInArea(curPlayer.GetPosX(), curPlayer.GetPosY(), 3)
        tagRoundPosX = summonPos.GetPosX()
        tagRoundPosY = summonPos.GetPosY()
        
    #½«ÕÙ»½ÊÞÕÙ»½³öÀ´
    summonNPC.Reborn(tagRoundPosX, tagRoundPosY)
    summonNPC.SetBornTime(tick)
    summonNPC.SetLastTime(curSkill.GetLastTime())
    
    atkper = 1
    findEffect = SkillCommon.GetSkillEffectByEffectID(curSkill, ChConfig.Def_Skill_Effect_SummonAttr)
 
    if findEffect:
        atkper = float(findEffect.GetEffectValue(0))/ChConfig.Def_MaxRateValue
        
        if findEffect.GetEffectValue(1) == 0:
            # ¸úËæÈËÎï¹¥»÷
            summonNPC.SetDict(ChConfig.Def_PlayerKey_AttackFollowMaster, 1)
            
    #---ÉèÖûù´¡Öµ---
    summonNPC.SetBaseMinAtk(int(curPlayer.GetMinAtk()*atkper))
    summonNPC.SetBaseMaxAtk(int(curPlayer.GetMaxAtk()*atkper))
    summonNPC.SetBaseHit(curPlayer.GetHit())
    
    #È¡È˵Ĺ¥»÷¼ä¸ô
    summonNPC.SetBaseAtkInterval(curPlayer.GetAtkInterval())
    summonNPC.SetBaseMissRate(curPlayer.GetMiss())
    summonNPC.SetBaseSuperHiteRate(curPlayer.GetSuperHitRate())
    
    summonNPC.SetVisible(True)
    summonNPC.SetCanAttack(False)
    
    #SkillDataBoost.SetSummonNPCSkillBoost(curPlayer, summonNPC, curSkill)
    
    return True
 
def DoLogic_NPC_UseSkill_SummonNPC(curNPC, curSkill, summonNPCID, tagRoundPosX, tagRoundPosY, tick):
    # Ô¤¾¯ÕÙ»½
    if curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_SkillWarnSkillID) == curSkill.GetSkillID():
        tagRoundPosX = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_SkillWarnPosX % 0)
        tagRoundPosY = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_SkillWarnPosY % 0)
    
    
    #ÐÂÔöÕÙ»½ÊÞ ÕÒ²»µ½ÔòÌí¼Ó
    curNPC.AddSummonCount(1, summonNPCID, 3)
 
    for i in range(0, curNPC.GetSummonCount()):
        summonNPC = curNPC.GetSummonNPCAt(i)
        
        if not summonNPC:
            continue
        
        if summonNPC.GetNPCID() != summonNPCID:
            continue
        
        #ÒÑÕÙ»½
        if GameObj.GetHP(summonNPC) > 0:
            continue
        
        return SummonNPCByInstance(curNPC, summonNPC, curSkill, tagRoundPosX, tagRoundPosY, tick)
    
    return
 
 
#  ÕÙ»½ÊÞʵÀý
def SummonNPCByInstance(curNPC, summonNPC, curSkill, tagRoundPosX, tagRoundPosY, tick):
    
    #ÉèÖÃÕÙ»½ÊÞ»ù´¡ÐÅÏ¢
    lvSummonNPC = curNPC.GetLV()
    summonNPC.SetLV(lvSummonNPC)
 
    #³õʼ»¯
    NPCCommon.InitNPC(summonNPC) 
 
    if summonNPC.GetOrgSpeed():
        summonPos = GameMap.GetEmptyPlaceInArea(curNPC.GetPosX(), curNPC.GetPosY(), 3)
        tagRoundPosX = summonPos.GetPosX()
        tagRoundPosY = summonPos.GetPosY()
        
    #½«ÕÙ»½ÊÞÕÙ»½³öÀ´
    summonNPC.Reborn(tagRoundPosX, tagRoundPosY)
    summonNPC.SetBornTime(tick)
    summonNPC.SetLastTime(curSkill.GetLastTime())
    
    atkper = 1
    findEffect = SkillCommon.GetSkillEffectByEffectID(curSkill, ChConfig.Def_Skill_Effect_SummonAttr)
 
    if findEffect:
        atkper = float(findEffect.GetEffectValue(0))/ChConfig.Def_MaxRateValue
 
            
    #---ÉèÖûù´¡Öµ---
    summonNPC.SetBaseMinAtk(int(curNPC.GetMinAtk()*atkper))
    summonNPC.SetBaseMaxAtk(int(curNPC.GetMaxAtk()*atkper))
    summonNPC.SetBaseHit(curNPC.GetHit())
 
    NPCCommon.SetRealmLV(summonNPC, NPCCommon.GetRealmLV(curNPC))   # ¼Ì³Ð¾³½ç
 
    #summonNPC.SetBaseAtkInterval(500)
    summonNPC.SetBaseMissRate(curNPC.GetMiss())
    
    summonNPC.SetVisible(True)
    summonNPC.SetCanAttack(False)