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