hch
2018-11-16 9c7acc7f02e130a8b742ec21579fdf5e6640d3cc
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
#!/usr/bin/python
# -*- coding: GBK -*-
#---------------------------------------------------------------------
#
#---------------------------------------------------------------------
##@package Pet_Attack_SummonNPC
# @todo: ³èÎï¹¥»÷ÕÙ»½ÊÞ
#
# @author chenxuewei
# @date 2010-06-26
# @version 1.4
#
# @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 SkillCommon
import ChConfig
import IPY_GameWorld
import GameWorld
import PetControl
import SkillShell
import GameObj
#---------------------------------------------------------------------
 
#---------------------------------------------------------------------
 
## ÊÇ·ñ¿ÉÒÔ¹¥»÷ 
#  @param curPet ¹¥»÷·½:³èÎï
#  @param curTagSummon ·ÀÊØ·½:ÕÙ»½ÊÞ
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param tick µ±Ç°Ê±¼ä
#  @return True or False
#  @remarks ÊÇ·ñ¿ÉÒÔ¹¥»÷ 
def GetCanAttack(curPet, curTagSummon, skill, tick):
    return AttackCommon.CheckNPCCanAttackTag(curPet, curTagSummon, skill)
 
## »ñµÃ¹ØÏµ
#  @param curPet ¹¥»÷·½:³èÎï
#  @param curTagSummon ·ÀÊØ·½:ÕÙ»½ÊÞ
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param tick µ±Ç°Ê±¼ä
#  @return È磺ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
#  @remarks »ñµÃ¹ØÏµ
def GetTagRelation(curPet, curTagSummon, skill, tick):
    
    curPlayer = PetControl.GetPetOwner(curPet)  # ³èÎïÖ÷ÈË
    
    if curPlayer == None:
        return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
    
    curTagPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curTagSummon)
    
    if curTagPlayer == None:
        return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
    
    if curPlayer != None and curTagPlayer != 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 curPet ¹¥»÷·½:³èÎï
#  @param curTagSummon ·ÀÊØ·½:ÕÙ»½ÊÞ
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param skillValue ¼¼ÄÜÔöÇ¿
#  @param skillPercent ¼¼ÄÜÔöÇ¿°Ù·Ö±È
#  @param skillHurtList ¼¼ÄÜÉËѪÁбí(C++½Ó¿Ú)
#  @param tick µ±Ç°Ê±¼ä
#  @return hurtType £º HurtType É˺¦½á¹¹ÌåÀà 
#  @remarks ¹¥»÷
def DoAttack(curPet, curTagSummon, skill, skillValue, skillPercent, skillHurtList, tick):
    hurtType = AttackCommon.GetHurtHP(curPet, curTagSummon, skill, skillValue, skillPercent, tick)
    
    hurtHP = hurtType.HurtHP
    #Ìí¼Ó³ðºÞ
    summonControl = NPCCommon.NPCControl(curTagSummon)
    #summonControl.AddObjDetelToAngryList_ByAttack(curPet, hurtHP, skill)
 
    #---¹¥»÷·½ÎªÕÙ»½ÊÞ,¸øÖ÷È˼ӳðºÞ---
    curPetOwner = PetControl.GetPetOwner(curPet)  # ³èÎïÖ÷ÈË
    
    if curPetOwner != None:
        summonControl.AddObjToAngryList(curPetOwner, 1)
        
        curTagPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curTagSummon)
        if curTagPlayer != None:
            AttackCommon.OnPVPDamage(curPetOwner, hurtHP, curTagPlayer, "Pet v Summon")
 
    #Ìí¼Ó¼¼ÄÜÉ˺¦Í¨ÖªÁбí,(ÓÃÓÚ¹¥»÷½áÊø,ͳһ֪ͨ¿Í»§¶Ë)
    AttackCommon.AddHurt(curTagSummon, skillHurtList, hurtType.HurtType, hurtHP)
    return hurtType
 
 
## ´¦Àí¹¥»÷ºóµÄ½á¹û
#  @param curPet ¹¥»÷·½:³èÎï
#  @param curTagSummon ·ÀÊØ·½:ÕÙ»½ÊÞ
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param tick µ±Ç°Ê±¼ä
#  @return True
#  @remarks ´¦Àí¹¥»÷ºóµÄ½á¹û
def AttackResult(curPet, curTagSummon, skill, tick):
    
    #»ñÈ¡·ÀÊØ·½ÕÙ»½ÊÞµÄÖ÷ÈË
    curTagPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curTagSummon)
    #¹¥»÷µÄÊÇÍæ¼ÒµÄÕÙ»½ÊÞ
    if curTagPlayer != None and curTagPlayer.GetHP() > 0:
        #½øÈëÕ½¶·×´Ì¬
        AttackCommon.SetPlayerBattleState(curTagPlayer, tick)
        #»ñÈ¡ÕÙ»½ÊÞµÄÖ÷ÈË
        curPlayer = PetControl.GetPetOwner(curPet)  # ³èÎïÖ÷ÈË
        
        #ÊÇ·ñÔÚÌØÊâµÄ¸±±¾ÖÐ
        if curPlayer != None:
            AttackCommon.OnPlayerHitPlayer(curPlayer, curTagPlayer, tick)
    
    #·ÀÊØ·½ÕÙ»½ÊÞËÀÍö
    if GameObj.GetHP(curTagSummon) <= 0:
        curTagSummonNPCControl = NPCCommon.NPCControl(curTagSummon)
        #ÕÙ»½ÊÞËÀÍö
        curTagSummonNPCControl.SetKilled()
    
    return True