#!/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
|
|