hxp
2022-02-21 0c27822ef5e6c67782ed143a4ff03ecfbdfda1fb
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
#!/usr/bin/python
# -*- coding: GBK -*-
#---------------------------------------------------------------------
#
#---------------------------------------------------------------------
##@package Pet_Attack_NormalNPC
# ³èÎï¹¥»÷ÆÕͨNPC
#
# @author chenxuewei
# @date 2010-06-26
# @version 1.7
#
# @change: "2010-07-01 17:20" chenxuewei ÐÞ¸´bug£º³èÎï¹¥»÷NPCµÄ³ðºÞÖµÖ»¼ÓÔÚ³èÎïÉíÉÏ£¬²»Ìí¼ÓÔÚÆäÖ÷ÈËÉíÉÏ¡£
# @change: "2010-09-06 17:30" panwei GetBattleTypeº¯ÊýÐÞ¸Ä, ÐÂÔö²ÎÊý:¹¥»÷·½
# @change: "2010-09-13 14:51" panwei ³èÎï¹¥»÷Ò²¸øÍæ¼ÒÌí¼ÓÒ»·Ý³ðºÞ
# @change: "2010-11-17 19:00" adaws ¼ÓÈëNPCÕóÈÝÅж¨
# @change: "2012-02-10 20:20" Alee Ìí¼Ó¼¼Äܱط¢Éú״̬
# @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 AttackCommon
import SkillCommon
import ChConfig
import FBLogic
import PetControl
import SkillShell
import ChNPC
import GameObj
#---------------------------------------------------------------------
 
#---------------------------------------------------------------------
 
## ÊÇ·ñ¿ÉÒÔ¹¥»÷ 
#  @param curPet ¹¥»÷·½:³èÎï
#  @param curTagNormalNPC ·ÀÊØ·½:ÆÕͨNPC
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param tick µ±Ç°Ê±¼ä
#  @return True or False
#  @remarks ÊÇ·ñ¿ÉÒÔ¹¥»÷ 
def GetCanAttack(curPet, curTagNormalNPC, skill, tick):
    
    if not AttackCommon.CheckNPCCanAttackTag(curPet, curTagNormalNPC, skill):
        return False
     
    return True
 
 
## »ñµÃ¹ØÏµ
#  @param curPet ¹¥»÷·½:³èÎï
#  @param curTagNormalNPC ·ÀÊØ·½:ÆÕͨNPC
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param tick µ±Ç°Ê±¼ä
#  @return È磺ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
#  @remarks »ñµÃ¹ØÏµ
def GetTagRelation(curPet, curTagNormalNPC, skill, tick):
    defenderCampType = NPCCommon.GetFaction(curTagNormalNPC)
    #²»¹¥»÷ÕýÒåµÄÐèҪȥ±£»¤µÄ ÕâÀïÓÐÅ®ÉñºÍÊØÎÀ
    if defenderCampType == ChConfig.CampType_Justice:
        return ChConfig.Type_Relation_Friend, ChConfig.Def_PASysMessage_None
    
    return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
 
 
## ¹¥»÷
#  @param curPet ¹¥»÷·½:³èÎï
#  @param curTagPlayer ·ÀÊØ·½:ÆÕͨNPC
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param skillValue ¼¼ÄÜÔöÇ¿
#  @param skillPercent ¼¼ÄÜÔöÇ¿°Ù·Ö±È
#  @param skillHurtList ¼¼ÄÜÉËѪÁбí(C++½Ó¿Ú)
#  @param tick µ±Ç°Ê±¼ä
#  @return hurtType £º HurtType É˺¦½á¹¹ÌåÀà 
#  @remarks ¹¥»÷
def DoAttack(curPet, curTagNPC, skill, skillValue, skillPercent, skillHurtList, tick):
    curTagNPCHPBeforeAtk = GameObj.GetHP(curTagNPC)
    hurtType = AttackCommon.GetHurtHP(curPet, curTagNPC, skill, skillValue, skillPercent, tick)
    hurtHP = hurtType.HurtHP
 
    npcControl = NPCCommon.NPCControl(curTagNPC)
    curPetOwner = PetControl.GetPetOwner(curPet)  # ³èÎïÖ÷ÈË
    
    #ÎÞ·¨²éÕÒÖ÷ÈË,Ìí¼Ó×Ô¼º
    if curPetOwner:
        AttackCommon.NPCAddObjInHurtList(curPetOwner, curTagNPC, curTagNPCHPBeforeAtk, hurtHP)
        npcControl.AddObjDetelToAngryList_ByAttack(curPetOwner, hurtHP, skill)
    
    #Ìí¼Ó¼¼ÄÜÉ˺¦Í¨ÖªÁбí,(ÓÃÓÚ¹¥»÷½áÊø,ͳһ֪ͨ¿Í»§¶Ë)
    AttackCommon.AddHurt(curTagNPC, skillHurtList, hurtType.HurtType, hurtHP)
    #ChNPC.OnUndeathBossHurt(curTagNPC, hurtHP)
    return hurtType
 
 
## ´¦Àí¹¥»÷ºóµÄ½á¹û
#  @param curPet ¹¥»÷·½:³èÎï
#  @param curTagPlayer ·ÀÊØ·½:ÆÕͨNPC
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param tick µ±Ç°Ê±¼ä
#  @return True
#  @remarks ´¦Àí¹¥»÷ºóµÄ½á¹û
def AttackResult(curPet, curTagNPC, skill, tick):
    
    if ChNPC.OnUndeathBossAttacked(curTagNPC):
        return
    
    #NPCËÀÍö
    if GameObj.GetHP(curTagNPC) <= 0:
        #Ö´Ðл÷ɱNPCÂß¼­
        curPlayer = PetControl.GetPetOwner(curPet)  # ³èÎïÖ÷ÈË
        
        if not ChNPC.OnCheckCanDie(curPlayer, curTagNPC, skill, tick):
            return
        
        if curPlayer != None:
            NPCCommon.OnPlayerAttackNPCDie(curTagNPC, curPlayer, skill)
            FBLogic.DoFB_Player_KillNPC(curPlayer, curTagNPC, tick)
            
        curTagNormalNPCControl = NPCCommon.NPCControl(curTagNPC)
        curTagNormalNPCControl.SetKilled()
    else:
        ChNPC.OnNPCAttacked(curPet, curTagNPC, skill, tick)
        
    
    return True