#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
#---------------------------------------------------------------------  
 | 
#  
 | 
#---------------------------------------------------------------------  
 | 
##@package Player_Attack_NormalNPC  
 | 
# Íæ¼Ò¹¥»÷ÆÕͨNPC  
 | 
#  
 | 
# @author eggxp  
 | 
# @date 2010-4-20  
 | 
# @version 1.8  
 | 
#  
 | 
# @change: "2010-09-06 17:30" panwei GetBattleTypeº¯ÊýÐÞ¸Ä, ÐÂÔö²ÎÊý:¹¥»÷·½  
 | 
# @change: "2010-11-17 19:00" adaws ¼ÓÈëNPCÕóÈÝÅж¨  
 | 
# @change: "2011-07-15 18:00" zhangd Ìí¼ÓNPC±»Íæ¼Ò´òËÀºó´¥·¢Âß¼  
 | 
# @change: "2012-02-10 20:20" Alee Ìí¼Ó¼¼Äܱط¢Éú״̬  
 | 
# @change: "2013-11-08 18:00" hxp Ôö¼ÓNPC±»¹¥»÷Âß¼Èë¿Ú  
 | 
# @change: "2015-03-05 21:30" hxp ÉËѪÀàÐͼì²é´¥·¢±»¶¯¼¼ÄÜ  
 | 
# @change: "2015-04-11 15:30" hxp Ôö¼Ó×îÖÕÉ˺¦Âß¼  
 | 
# @change: "2016-09-28 21:00" hxp ²»ËÀbossÂß¼Ö§³Ö  
 | 
#------------------------------------------------------------------------------   
 | 
#"""Version = 2016-09-28 21:00"""  
 | 
#---------------------------------------------------------------------  
 | 
import NPCCommon  
 | 
import ChConfig  
 | 
import AttackCommon  
 | 
import GameWorld  
 | 
import FBLogic  
 | 
import ChEquip  
 | 
import IPY_GameWorld  
 | 
import SkillCommon  
 | 
import SkillShell  
 | 
import ChNPC  
 | 
import GameObj  
 | 
#---------------------------------------------------------------------  
 | 
  
 | 
#---------------------------------------------------------------------  
 | 
  
 | 
## ÊÇ·ñ¿ÉÒÔ¹¥»÷   
 | 
#  @param curNormalNPC ¹¥»÷·½:Íæ¼Ò  
 | 
#  @param curTagPlayer ·ÀÊØ·½:ÆÕͨNPC  
 | 
#  @param skill ¼¼ÄÜ(ÎÞ->None)  
 | 
#  @param tick µ±Ç°Ê±¼ä  
 | 
#  @return True or False  
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷.  
 | 
def GetCanAttack(curPlayer, curTagNormalNPC, skill, tick):  
 | 
    #ͨÓÃÅÐ¶Ï  
 | 
    if not AttackCommon.CheckPlayerCanAttackTag(curPlayer, curTagNormalNPC):  
 | 
        return False  
 | 
      
 | 
    if not AttackCommon.CheckPlayerAttackDist(curPlayer, curTagNormalNPC, skill):  
 | 
        return False  
 | 
      
 | 
    return True  
 | 
  
 | 
## »ñµÃ¹ØÏµ  
 | 
#  @param curNormalNPC ¹¥»÷·½:Íæ¼Ò  
 | 
#  @param curTagPlayer ·ÀÊØ·½:ÆÕͨNPC  
 | 
#  @param skill ¼¼ÄÜ(ÎÞ->None)  
 | 
#  @param tick µ±Ç°Ê±¼ä  
 | 
#  @return È磺ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None  
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷.  
 | 
def GetTagRelation(curPlayer, 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 curNormalNPC ¹¥»÷·½:Íæ¼Ò  
 | 
#  @param curTagPlayer ·ÀÊØ·½:ÆÕͨNPC  
 | 
#  @param skill ¼¼ÄÜ(ÎÞ->None)  
 | 
#  @param skillValue ¼¼ÄÜÔöÇ¿  
 | 
#  @param skillPercent ¼¼ÄÜÔöÇ¿°Ù·Ö±È  
 | 
#  @param skillHurtList ¼¼ÄÜÉËѪÁбí(C++½Ó¿Ú)  
 | 
#  @param tick µ±Ç°Ê±¼ä  
 | 
#  @return hurtType £º HurtType É˺¦½á¹¹ÌåÀà   
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷.  
 | 
def DoAttack(curPlayer, curTagNormalNPC, skill, skillValue, skillPercent, skillHurtList, tick):  
 | 
  
 | 
    curTagNPCHPBeforeAtk = GameObj.GetHP(curTagNormalNPC)  
 | 
    hurtType = AttackCommon.GetHurtHP(curPlayer, curTagNormalNPC, skill, skillValue, skillPercent, tick)  
 | 
      
 | 
    #ÉËѪÁ¿  
 | 
    hurtHP = hurtType.HurtHP  
 | 
    #¸øÕâ¸öÆÕͨС¹ÖÔö¼Ó³ðºÞ  
 | 
    npcControl = NPCCommon.NPCControl(curTagNormalNPC)  
 | 
    npcControl.AddObjDetelToAngryList_ByAttack(curPlayer, hurtHP, skill)  
 | 
      
 | 
    #Ìí¼ÓÉËѪÁÐ±í  
 | 
    AttackCommon.NPCAddObjInHurtList(curPlayer, curTagNormalNPC, curTagNPCHPBeforeAtk, hurtHP)  
 | 
    #¸øÕâ¸öÍæ¼ÒµÄËùÓÐÕÙ»½ÊÞÔö¼Ó³ðºÞ  
 | 
    AttackCommon.SummonAddAngryByOwner(curTagNormalNPC, curPlayer, hurtHP)  
 | 
    #Ìí¼Ó¼¼ÄÜÉ˺¦Í¨ÖªÁбí,(ÓÃÓÚ¹¥»÷½áÊø,ͳһ֪ͨ¿Í»§¶Ë)  
 | 
    AttackCommon.AddHurt(curTagNormalNPC, skillHurtList, hurtType.HurtType, hurtHP)  
 | 
  
 | 
    return hurtType  
 | 
  
 | 
## ´¦Àí¹¥»÷ºóµÄ½á¹û  
 | 
#  @param curNormalNPC ¹¥»÷·½:Íæ¼Ò  
 | 
#  @param curTagPlayer ·ÀÊØ·½:ÆÕͨNPC  
 | 
#  @param skill ¼¼ÄÜ(ÎÞ->None)  
 | 
#  @param tick µ±Ç°Ê±¼ä  
 | 
#  @return True  
 | 
#  @remarks º¯ÊýÏêϸ˵Ã÷.  
 | 
def AttackResult(curPlayer, curTagNormalNPC, skill, tick):  
 | 
    if ChNPC.OnUndeathBossAttacked(curTagNormalNPC):  
 | 
        return  
 | 
      
 | 
    if GameObj.GetHP(curTagNormalNPC) <= 0:  
 | 
        if not ChNPC.OnCheckCanDie(curPlayer, curTagNormalNPC, skill, tick):  
 | 
            return  
 | 
        #Ö´Ðл÷ɱNPCÂß¼  
 | 
        FBLogic.DoFB_Player_KillNPC(curPlayer , curTagNormalNPC , tick)  
 | 
        NPCCommon.OnPlayerAttackNPCDie(curTagNormalNPC, curPlayer, skill)  
 | 
        #NPCËÀÍö  
 | 
        curTagNormalNPCControl = NPCCommon.NPCControl(curTagNormalNPC)  
 | 
        curTagNormalNPCControl.SetKilled()  
 | 
    else:  
 | 
        ChNPC.OnNPCAttacked(curPlayer, curTagNormalNPC, skill, tick)  
 | 
          
 | 
          
 | 
    return True  
 | 
  
 | 
  
 | 
  
 | 
  
 |