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
#!/usr/bin/python
# -*- coding: GBK -*-
#---------------------------------------------------------------------
#
#---------------------------------------------------------------------
##@package SummonNPC_Attack_SummonNPC
# ÕÙ»½ÊÞ¹¥»÷ÕÙ»½ÊÞ
#
# @author eggxp
# @date 2010-4-20
# @version 1.9
#
# ÐÞ¸Äʱ¼ä ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
# @change: "2010-05-12 18:30" zhengyang Ìí¼Ó×¢ÊÍ
# @change: "2010-05-28 15:50" chenxuewei Ó¦²ß»®ÁõºèÉúÐèÇó£ºÔö¼Ó½£Ê¥ÏîÄ¿µÄPK¹æÔò
# @change: "2010-06-02 10:50" chenxuewei Íæ¼Ò¿ÉÒÔ¹¥»÷Ä¿±êµÄÇé¿öÏ£¬»ñµÃÍæ¼Ò¼äµÄ¹ØÏµÍ³Ò»ÔÚAttackCommon´¦Àí
# @change: "2010-06-07 13:30" Alee ÕÙ»½ÊÞ¹¥»÷¸øÖ÷È˼ӳðºÞ
# @change: "2010-06-07 17:30" Alee µ÷ÓÃÒÑÓеĹÜÀíÆ÷
# @change: "2010-09-06 17:30" panwei GetBattleTypeº¯ÊýÐÞ¸Ä, ÐÂÔö²ÎÊý:¹¥»÷·½
# @change: "2010-09-27 17:55" panwei È¡ÏûGM²»¿É¹¥»÷ÏÞÖÆ
# @change: "2012-02-10 20:20" Alee Ìí¼Ó¼¼Äܱط¢Éú״̬
# @change: "2016-02-26 17:00" hxp Ôö¼ÓPVPÉ˺¦Í³¼Æ
#------------------------------------------------------------------------------ 
"""Version = 2016-02-26 17:00"""
#---------------------------------------------------------------------
import NPCCommon
import AttackCommon
import ChConfig
import IPY_GameWorld
import GameWorld
import PlayerControl
import SkillShell
import GameObj
#---------------------------------------------------------------------
 
#---------------------------------------------------------------------
 
## ÊÇ·ñ¿ÉÒÔ¹¥»÷ 
#  @param curNormalNPC ¹¥»÷·½:ÕÙ»½ÊÞ
#  @param curTagPlayer ·ÀÊØ·½:ÕÙ»½ÊÞ
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param tick µ±Ç°Ê±¼ä
#  @return True or False
#  @remarks ÊÇ·ñ¿ÉÒÔ¹¥»÷ 
def GetCanAttack(curSummonNPC, curTagSummon, skill, tick):
    return AttackCommon.CheckNPCCanAttackTag(curSummonNPC, curTagSummon, skill)
 
## »ñµÃ¹ØÏµ
#  @param curNormalNPC ¹¥»÷·½:ÕÙ»½ÊÞ
#  @param curTagPlayer ·ÀÊØ·½:ÕÙ»½ÊÞ
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param tick µ±Ç°Ê±¼ä
#  @return È磺ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
#  @remarks »ñµÃ¹ØÏµ
def GetTagRelation(curSummonNPC, curTagSummon, skill, tick):
    #±äÁ¿³õʼ»¯
    curSummonOwner_NPC = None
    curTagSummonOwner_NPC = None
    
    #»ñµÃ2¸öÕÙ»½ÊÞµÄÖ÷ÈË
    curPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curSummonNPC) 
    
    if curPlayer == None :
        curSummonOwner_NPC = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotNPC, curSummonNPC)
    
    curTagPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curTagSummon)
    
    if curTagPlayer == None :
        curTagSummonOwner_NPC = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotNPC, curTagSummon)
    
    if curSummonOwner_NPC != None and curTagSummonOwner_NPC != None :
        #NPCµÄÕÙ»½ÊÞ²»»¥Ï๥»÷
        return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
    
    if curPlayer != None and curTagPlayer != None :
        #˽ÓÐľ׮ֻÄÜ×Ô¼º´ò×Ô¼ºµÄ
        if curTagSummon.GetType() in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
            summonPlayerID = curTagSummon.GetDictByKey(ChConfig.Def_NPC_Dict_PriWoodPilePlayerID)
            if curPlayer.GetPlayerID() != summonPlayerID:
                return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
            return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
        
        #Í¬Ò»Íæ¼Ò²»»¥Ï๥»÷
        if GameWorld.IsSameObj(curPlayer, curTagPlayer):
            return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
        
        
        #¼ì²é¹¥»÷ģʽ
        if not AttackCommon.CheckPlayerAttackMode_Player(curPlayer, curTagPlayer):
            return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_AttackMode
        
        #------------------------ÒÔÏÂÂß¼­,¶¼ÊÇÍæ¼Ò¿ÉÒÔ¹¥»÷Ä¿±êµÄÇé¿öÏÂ
        
        return AttackCommon.GetPlayersRelation(curPlayer, curTagPlayer)
    
    #²»Í¬ÀàÐ͵Ä,¿ÉÒÔÖ±½Ó¹¥»÷
    return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
 
 
## ¹¥»÷
#  @param curNormalNPC ¹¥»÷·½:ÕÙ»½ÊÞ
#  @param curTagPlayer ·ÀÊØ·½:ÕÙ»½ÊÞ
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param skillValue ¼¼ÄÜÔöÇ¿
#  @param skillPercent ¼¼ÄÜÔöÇ¿°Ù·Ö±È
#  @param skillHurtList ¼¼ÄÜÉËѪÁбí(C++½Ó¿Ú)
#  @param tick µ±Ç°Ê±¼ä
#  @return hurtType £º HurtType É˺¦½á¹¹ÌåÀà 
#  @remarks ¹¥»÷
def DoAttack(curSummonNPC, curTagSummon, skill, skillValue, skillPercent, skillHurtList, tick):
    hurtType = AttackCommon.GetHurtHP(curSummonNPC, curTagSummon, skill, 
                                      skillValue, skillPercent, tick)
    hurtHP = hurtType.HurtHP
    #Ìí¼Ó³ðºÞ
    summonControl = NPCCommon.NPCControl(curTagSummon)
    summonControl.AddObjDetelToAngryList_ByAttack(curSummonNPC, hurtHP, skill)
    
    #---¹¥»÷·½ÎªÕÙ»½ÊÞ,¸øÖ÷È˼ӳðºÞ---
    summonOwner = NPCCommon.GetSummonOwnerDetel(curSummonNPC)
    
    if summonOwner != None:
        summonControl.AddObjToAngryList(summonOwner, 1)
 
    curPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curSummonNPC)
    curTagPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curTagSummon)
    if curPlayer != None and curTagPlayer != None:
        AttackCommon.OnPVPDamage(curPlayer, hurtHP, curTagPlayer, "Summon v Summon")
        
        
    #Ìí¼Ó¼¼ÄÜÉ˺¦Í¨ÖªÁбí,(ÓÃÓÚ¹¥»÷½áÊø,ͳһ֪ͨ¿Í»§¶Ë)
    AttackCommon.AddHurt(curTagSummon, skillHurtList, hurtType.HurtType, hurtHP)
    return hurtType
 
 
## ´¦Àí¹¥»÷ºóµÄ½á¹û
#  @param curNormalNPC ¹¥»÷·½:ÕÙ»½ÊÞ
#  @param curTagPlayer ·ÀÊØ·½:ÕÙ»½ÊÞ
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param tick µ±Ç°Ê±¼ä
#  @return True
#  @remarks ´¦Àí¹¥»÷ºóµÄ½á¹û
def AttackResult(curSummonNPC, curTagSummon, skill, tick):
    #»ñÈ¡·ÀÊØ·½ÕÙ»½ÊÞµÄÖ÷ÈË
    curTagPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curTagSummon)
    #¹¥»÷µÄÊÇÍæ¼ÒµÄÕÙ»½ÊÞ
    if curTagPlayer != None and GameObj.GetHP(curTagPlayer) > 0:
        #½øÈëÕ½¶·×´Ì¬
        AttackCommon.SetPlayerBattleState(curTagPlayer, tick)
        #»ñÈ¡ÕÙ»½ÊÞµÄÖ÷ÈË
        curPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curSummonNPC)
        
        #ÊÇ·ñÔÚÌØÊâµÄ¸±±¾ÖÐ
        if curPlayer != None:
            AttackCommon.OnPlayerHitPlayer(curPlayer, curTagPlayer, tick)
    
    #·ÀÊØ·½ÕÙ»½ÊÞËÀÍö
    if GameObj.GetHP(curTagSummon) <= 0:
        curTagSummonNPCControl = NPCCommon.NPCControl(curTagSummon)
        #ÕÙ»½ÊÞËÀÍö
        curTagSummonNPCControl.SetKilled()
    
    return True