hch
2018-09-20 a8d160566fcad719e98b6ac1ad6354fb6ddb1dc5
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
#!/usr/bin/python
# -*- coding: GBK -*-
#---------------------------------------------------------------------
#
#---------------------------------------------------------------------
##@package SummonNPC_Attack_NormalNPC
# @todo: ÕÙ»½ÊÞ¹¥»÷ÆÕͨNPC
#
# @author: panwei
# @date 2010-09-06
# @version 2.1
#
# @change: "2010-09-06 17:30" panwei GetBattleTypeº¯ÊýÐÞ¸Ä, ÐÂÔö²ÎÊý:¹¥»÷·½
# @change: "2010-11-18 11:00" adaws NPCÕóÈÝÅж¨´íÐÞ¸Ä
# @change: "2010-11-18 13:50" chenxuewei NpcɱËÀNPCʱ֪ͨ¸±±¾
# @change: "2011-04-15 14:00" chenxuewei ÐÞ¸´bug9922:ÊØ»¤Çô³µ,·¶Î§¼¼ÄÜ(Íæ¼ÒÕÙ»ØÒþÐÎNPC·ÅȺ¹¥¼¼ÄÜ)¿É¹¥»÷¼º·½Çô³µ¡¢ÊØÎÀ
# @change: "2011-05-11 13:45" Alee ÕÙ»½ÊÞÊÇÏÝÚåÔò°Ñ³ðºÞ¸øÖ÷ÈË
# @change: "2011-05-12 14:00" Alee ÏÝÚå¸ÄΪÁé³ðºÞÈ«×ªÒÆ¸øÖ÷ÈË
# @change: "2011-05-12 17:00" chenxuewei AttackResultÕÙ»½ÊÞÓÐûÖ÷È˶¼Ö»ÒªÍ¨Öª¸±±¾Ò»´Î¼´¿É£¬±ÜÃâÖØ¸´Í¨Öª
# @change: "2012-02-10 20:20" Alee Ìí¼Ó¼¼Äܱط¢Éú״̬
# @change: "2013-01-03 17:00" wdb È¥³ýnpc¹¥»÷Ôì³ÉµÄÉËѪ¼Ç¼
# @change: "2013-11-08 18:00" hxp Ôö¼ÓNPC±»¹¥»÷Âß¼­Èë¿Ú
# @change: "2016-09-28 21:00" hxp ²»ËÀbossÂß¼­Ö§³Ö
#------------------------------------------------------------------------------ 
#"""Version = 2016-09-28 21:00"""
#---------------------------------------------------------------------
import NPCCommon
import IPY_GameWorld
import AttackCommon
import ChConfig
import GameWorld
import FBLogic
import SkillShell
import ChNPC
import GameObj
#---------------------------------------------------------------------
 
#---------------------------------------------------------------------
## ÊÇ·ñ¿ÉÒÔ¹¥»÷ 
#  @param curNormalNPC ¹¥»÷·½:ÕÙ»½ÊÞ
#  @param curTagPlayer ·ÀÊØ·½:ÆÕͨNPC
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param tick µ±Ç°Ê±¼ä
#  @return ²¼¶ûÖµ
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def GetCanAttack(curSummonNPC, curTagNormalNPC, skill, tick):
    
    return AttackCommon.CheckNPCCanAttackTag(curSummonNPC, curTagNormalNPC, skill)
 
#---------------------------------------------------------------------
## »ñµÃ¹ØÏµ
#  @param curNormalNPC ¹¥»÷·½:ÕÙ»½ÊÞ
#  @param curTagPlayer ·ÀÊØ·½:ÆÕͨNPC
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param tick µ±Ç°Ê±¼ä
#  @return ¹ØÏµÁбí È磺[ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None]
#  @remarks »ñµÃ¹ØÏµÁбí
def GetTagRelation(curSummonNPC, curTagNormalNPC, skill, tick):
    
    #·ÀÊØ·½ÕóÓª
    defenderCampType = NPCCommon.GetFaction(curTagNormalNPC)
    
    #Íæ¼ÒµÄÕÙ»½ÊÞ²ÅÄܹ¥»÷ÆÕͨNPC
    npcOwner_Player = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curSummonNPC)
 
    if npcOwner_Player != None:
        
        #²»¹¥»÷ÕýÒåµÄÐèҪȥ±£»¤µÄ ÕâÀïÓÐÅ®ÉñºÍÊØÎÀ
        if defenderCampType == ChConfig.CampType_Justice:
            return ChConfig.Type_Relation_Friend, ChConfig.Def_PASysMessage_None
        
        return ChConfig.Type_Relation_Enemy, ChConfig.Def_PASysMessage_None
    
    #¹¥»÷·½ÕóÓª
    attackerCampType = curSummonNPC.GetDictByKey(ChConfig.Def_NpcDictKey_CampType)
    if attackerCampType != defenderCampType:
        return ChConfig.Type_Relation_Enemy, ChConfig.Def_PASysMessage_None
    return ChConfig.Type_Relation_Friend, ChConfig.Def_PASysMessage_None
#---------------------------------------------------------------------
## ¹¥»÷
#  @param curNormalNPC ¹¥»÷·½:ÕÙ»½ÊÞ
#  @param curTagPlayer ·ÀÊØ·½:ÆÕͨNPC
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param skillValue ¼¼ÄÜÔöÇ¿
#  @param skillPercent ¼¼ÄÜÔöÇ¿°Ù·Ö±È
#  @param skillHurtList ¼¼ÄÜÉËѪÁбí(C++½Ó¿Ú)
#  @param tick µ±Ç°Ê±¼ä
#  @return hurtType £º HurtType É˺¦½á¹¹ÌåÀà 
#  @remarks ¹¥»÷Âß¼­
def DoAttack(curSummonNPC, curTagNPC, skill, skillValue, skillPercent, skillHurtList, tick):
    curTagNPCHPBeforeAtk = GameObj.GetHP(curTagNPC)
    hurtType = AttackCommon.GetHurtHP(curSummonNPC, curTagNPC, skill,
                                      skillValue, skillPercent, tick)
    hurtHP = hurtType.HurtHP
    #---±»¹¥»÷µÄNPCÌí¼Ó³ðºÞ---
    curTagNPCControl = NPCCommon.NPCControl(curTagNPC)
    curTagNPCControl.AddObjDetelToAngryList_ByAttack(curSummonNPC, hurtHP, skill)
    
    #---±»¹¥»÷µÄNPCÌí¼ÓÉËѪ---
    
    #¹¥»÷·½ÎªÕÙ»½ÊÞ,Ìí¼Óµ½Ö÷ÈËÉËѪÖÐ
    summonOwner = NPCCommon.GetSummonOwnerDetel(curSummonNPC)
 
    #2013-1-3,È¥³ýnpc¹¥»÷Ôì³ÉµÄÉËѪ¼Ç¼
    if summonOwner != None:
 
        # ÕÙ»½ÊÞÖ÷ÈËÎªÍæ¼Ò£¬ÉËѪ
        if summonOwner.GetGameObjType() == IPY_GameWorld.gotPlayer:
            AttackCommon.NPCAddObjInHurtList(summonOwner, curTagNPC, curTagNPCHPBeforeAtk, hurtHP)
        
        addAngry = hurtHP
        if skill != None:
            addAngry += skill.GetSkillAngry()
        
        #Ò²Ìí¼ÓÒ»·ÝÖ÷È˵ijðºÞ(±©·çÑ©ÕâÀàµÄ²»¿É¹¥»÷ÕÙ»½¼¼ÄÜ, ÒªNPC¹¥»÷Ö÷ÈË)
        curTagNPCControl.AddObjToAngryList(summonOwner, addAngry)
    
    #---¹¹½¨ÉËѪÁбí---
    
    #Ìí¼Ó¼¼ÄÜÉ˺¦Í¨ÖªÁбí,(ÓÃÓÚ¹¥»÷½áÊø,ͳһ֪ͨ¿Í»§¶Ë)
    AttackCommon.AddHurt(curTagNPC, skillHurtList, hurtType.HurtType, hurtHP)
    #ChNPC.OnUndeathBossHurt(curTagNPC, hurtHP)
    return hurtType
#---------------------------------------------------------------------
## ´¦Àí¹¥»÷ºóµÄ½á¹û
#  @param curNormalNPC ¹¥»÷·½:ÕÙ»½ÊÞ
#  @param curTagPlayer ·ÀÊØ·½:ÆÕͨNPC
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param tick µ±Ç°Ê±¼ä
#  @return ÎÞÒâÒå
#  @remarks ´¦Àí¹¥»÷ºóµÄ½á¹û
def AttackResult(curSummonNPC, curTagNPC, skill, tick):
    
    if ChNPC.OnUndeathBossAttacked(curTagNPC):
        return
    
    #---NPC»¹»î×Å---
    if GameObj.GetHP(curTagNPC) > 0:
        ChNPC.OnNPCAttacked(curSummonNPC, curTagNPC, skill, tick)
        return
 
    #---NPC±»»÷ɱ---
    #Íæ¼Ò»÷ɱNPC¸±±¾´¥·¢Æ÷
    curPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curSummonNPC)
    
    #2011-05-12 chenxuewei ÓÐûÖ÷È˶¼Ö»ÒªÍ¨ÖªÒ»´Î¼´¿É£¬±ÜÃâÖØ¸´Í¨Öª
    if curPlayer != None:
        FBLogic.DoFB_Player_KillNPC(curPlayer, curTagNPC, tick)
        NPCCommon.OnPlayerAttackNPCDie(curTagNPC, curPlayer, skill)
    else:
        #¸±±¾
        FBLogic.DoFB_Npc_KillNPC(curSummonNPC, curTagNPC, tick)
        
    #µ÷ÓÃͳһ»÷ɱÂß¼­
    curTagNPCControl = NPCCommon.NPCControl(curTagNPC)
    curTagNPCControl.SetKilled()
    return
#---------------------------------------------------------------------