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
#!/usr/bin/python
# -*- coding: GBK -*-
#---------------------------------------------------------------------
#
#---------------------------------------------------------------------
##@package NormalNPC_Attack_NormalNPC.py
# ÆÕͨNPC¹¥»÷ÆÕͨNPC
#
# @author adaws
# @date 2010-11-17 19:00
# @version 1.3
#
# @change: "2010-11-18 13:50" chenxuewei NpcɱËÀNPCʱ֪ͨ¸±±¾
# @change: "2012-02-10 20:20" Alee Ìí¼Ó¼¼Äܱط¢Éú״̬
# @change: "2016-09-28 21:00" hxp ²»ËÀbossÂß¼­Ö§³Ö
#------------------------------------------------------------------------------ 
#"""Version = 2016-09-28 21:00"""
#---------------------------------------------------------------------
import NPCCommon
import AttackCommon
import ChConfig
import FBLogic
import SkillShell
import ChNPC
import GameObj
import GameWorld
#---------------------------------------------------------------------
Def_FB_NPCAI_SideList = []
#---------------------------------------------------------------------
 
## ÊÇ·ñ¿ÉÒÔ¹¥»÷ 
#  @param attacker ¹¥»÷·½:ÆÕͨNPC
#  @param curTagPlayer ·ÀÊØ·½:ÕÙ»½ÊÞ
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param tick µ±Ç°Ê±¼ä
#  @return True or False
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def GetCanAttack(attacker, defender, skill, tick):
    return AttackCommon.CheckNPCCanAttackTag(attacker, defender, skill)
 
 
## »ñµÃ¹ØÏµ
#  @param attacker ¹¥»÷·½:ÆÕͨNPC
#  @param defender ·ÀÊØ·½:ÆÕͨNPC
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param tick µ±Ç°Ê±¼ä
#  @return È磺ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def GetTagRelation(attacker, defender, skill, tick):
    # ÓÅÏȼ¶¸ßÓÚÆäËû
    atkLimit = ChNPC.GetNPCAttackTagLimit(attacker, defender)
    if atkLimit:
        return ChConfig.Type_Relation_Friend, ChConfig.Def_PASysMessage_None
    
    attackerCampType = NPCCommon.GetFaction(attacker)
    defenderCampType = NPCCommon.GetFaction(defender)
    
    #²»Í¬ÕóÓªÊǵÐÈË
    if attackerCampType != defenderCampType:
        return ChConfig.Type_Relation_Enemy, ChConfig.Def_PASysMessage_None
    
    return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
    
 
## ¹¥»÷
#  @param attacker ¹¥»÷·½:ÆÕͨNPC
#  @param curTagPlayer ·ÀÊØ·½:ÆÕͨNPC
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param skillValue ¼¼ÄÜÔöÇ¿
#  @param skillPercent ¼¼ÄÜÔöÇ¿°Ù·Ö±È
#  @param skillHurtList ¼¼ÄÜÉËѪÁбí(C++½Ó¿Ú)
#  @param tick µ±Ç°Ê±¼ä
#  @return hurtType £º HurtType É˺¦½á¹¹ÌåÀà 
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def DoAttack(attacker, defender, skill, skillValue, skillPercent, skillHurtList, tick):
    #¼ÆËã·´µ¯,Ìí¼ÓÉËѪ 
    hurtType = AttackCommon.GetHurtHP(attacker, defender, skill, skillValue, skillPercent, tick)
    hurtHP = hurtType.HurtHP
    FBLogic.DoFB_NPC_HurtNPC(attacker, defender, hurtHP)
    
    npcControl = NPCCommon.NPCControl(defender)
    npcControl.AddObjDetelToAngryList_ByAttack(attacker, hurtHP, skill)
    
    #Ìí¼Ó¼¼ÄÜÉ˺¦Í¨ÖªÁбí,(ÓÃÓÚ¹¥»÷½áÊø,ͳһ֪ͨ¿Í»§¶Ë)
    AttackCommon.AddHurt(defender, skillHurtList, hurtType.HurtType, hurtHP)
    #ChNPC.OnUndeathBossHurt(defender, hurtHP)
    return hurtType
 
## ´¦Àí¹¥»÷ºóµÄ½á¹û
#  @param attacker ¹¥»÷·½:ÆÕͨNPC
#  @param curTagPlayer ·ÀÊØ·½:ÆÕͨNPC
#  @param skill ¼¼ÄÜ(ÎÞ->None)
#  @param tick µ±Ç°Ê±¼ä
#  @return True
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def AttackResult(attacker, defender, skill, tick):
    
    if ChNPC.OnUndeathBossAttacked(defender):
        return
    
    #ÆÕͨNPC
    if GameObj.GetHP(defender) <= 0:
        
        #¸±±¾
        FBLogic.DoFB_Npc_KillNPC(attacker, defender, tick)
            
        npcControl = NPCCommon.NPCControl(defender)
        npcControl.SetKilled()
    
    return True