| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #---------------------------------------------------------------------  | 
| #  | 
| #---------------------------------------------------------------------  | 
| ##@package Pet_Attack_SummonNPC  | 
| # @todo: ³èÎï¹¥»÷ÕÙ»½ÊÞ  | 
| #  | 
| # @author chenxuewei  | 
| # @date 2010-06-26  | 
| # @version 1.4  | 
| #  | 
| # @change: "2010-09-06 17:30" panwei GetBattleTypeº¯ÊýÐÞ¸Ä, ÐÂÔö²ÎÊý:¹¥»÷·½  | 
| # @change: "2010-09-27 17:55" panwei È¡ÏûGM²»¿É¹¥»÷ÏÞÖÆ  | 
| # @change: "2012-02-10 20:20" Alee Ìí¼Ó¼¼Äܱط¢Éú״̬  | 
| # @change: "2016-02-26 17:00" hxp Ôö¼ÓPVPÉ˺¦Í³¼Æ  | 
| #------------------------------------------------------------------------------   | 
| #"""Version = 2016-02-26 17:00"""  | 
| #---------------------------------------------------------------------  | 
| import NPCCommon  | 
| import AttackCommon  | 
| import SkillCommon  | 
| import ChConfig  | 
| import IPY_GameWorld  | 
| import GameWorld  | 
| import PetControl  | 
| import SkillShell  | 
| import GameObj  | 
| import TurnAttack  | 
| #---------------------------------------------------------------------  | 
|   | 
| #---------------------------------------------------------------------  | 
|   | 
| ## ÊÇ·ñ¿ÉÒÔ¹¥»÷   | 
| #  @param curPet ¹¥»÷·½:³èÎï  | 
| #  @param curTagSummon ·ÀÊØ·½:ÕÙ»½ÊÞ  | 
| #  @param skill ¼¼ÄÜ(ÎÞ->None)  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return True or False  | 
| #  @remarks ÊÇ·ñ¿ÉÒÔ¹¥»÷   | 
| def GetCanAttack(curPet, curTagSummon, skill, tick):  | 
|     return AttackCommon.CheckNPCCanAttackTag(curPet, curTagSummon, skill)  | 
|   | 
| ## »ñµÃ¹ØÏµ  | 
| #  @param curPet ¹¥»÷·½:³èÎï  | 
| #  @param curTagSummon ·ÀÊØ·½:ÕÙ»½ÊÞ  | 
| #  @param skill ¼¼ÄÜ(ÎÞ->None)  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return È磺ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None  | 
| #  @remarks »ñµÃ¹ØÏµ  | 
| def GetTagRelation(curPet, curTagSummon, skill, tick):  | 
|       | 
|     curPlayer = PetControl.GetPetOwner(curPet)  # ³èÎïÖ÷ÈË  | 
|       | 
|     if curPlayer == None:  | 
|         return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None  | 
|       | 
|     curTagPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curTagSummon)  | 
|       | 
|     if curTagPlayer == None:  | 
|         return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None  | 
|       | 
|     if curPlayer != None and curTagPlayer != None:  | 
|         #Í¬Ò»Íæ¼Ò²»»¥Ï๥»÷  | 
|         if GameWorld.IsSameObj(curPlayer, curTagPlayer):  | 
|             return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None  | 
|           | 
|         #¼ì²é¹¥»÷ģʽ  | 
|         if not AttackCommon.CheckPlayerAttackMode_Player(curPlayer, curTagPlayer):  | 
|             return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_AttackMode  | 
|           | 
|         #------------------------ÒÔÏÂÂß¼,¶¼ÊÇÍæ¼Ò¿ÉÒÔ¹¥»÷Ä¿±êµÄÇé¿öÏ  | 
|           | 
|         return AttackCommon.GetPlayersRelation(curPlayer, curTagPlayer)  | 
|       | 
|     #²»Í¬ÀàÐ͵Ä,¿ÉÒÔÖ±½Ó¹¥»÷  | 
|     return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None  | 
|   | 
|   | 
| ## ¹¥»÷  | 
| #  @param curPet ¹¥»÷·½:³èÎï  | 
| #  @param curTagSummon ·ÀÊØ·½:ÕÙ»½ÊÞ  | 
| #  @param skill ¼¼ÄÜ(ÎÞ->None)  | 
| #  @param skillValue ¼¼ÄÜÔöÇ¿  | 
| #  @param skillPercent ¼¼ÄÜÔöÇ¿°Ù·Ö±È  | 
| #  @param skillHurtList ¼¼ÄÜÉËѪÁбí(C++½Ó¿Ú)  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return hurtType £º HurtType É˺¦½á¹¹ÌåÀà   | 
| #  @remarks ¹¥»÷  | 
| def DoAttack(curPet, curTagSummon, skill, skillValue, skillPercent, skillHurtList, tick):  | 
|     hurtType = AttackCommon.GetHurtHP(curPet, curTagSummon, skill, skillValue, skillPercent, tick)  | 
|       | 
|     hurtHP = hurtType.HurtHP  | 
|     #Ìí¼Ó³ðºÞ  | 
|     summonControl = NPCCommon.NPCControl(curTagSummon)  | 
|     #summonControl.AddObjDetelToAngryList_ByAttack(curPet, hurtHP, skill)  | 
|   | 
|     #---¹¥»÷·½ÎªÕÙ»½ÊÞ,¸øÖ÷È˼ӳðºÞ---  | 
|     curPetOwner = PetControl.GetPetOwner(curPet)  # ³èÎïÖ÷ÈË  | 
|       | 
|     if curPetOwner != None:  | 
|         summonControl.AddObjToAngryList(curPetOwner, 1)  | 
|           | 
|         curTagPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curTagSummon)  | 
|         if curTagPlayer != None:  | 
|             AttackCommon.OnPVPDamage(curPetOwner, hurtHP, curTagPlayer, "Pet v Summon")  | 
|   | 
|     #Ìí¼Ó¼¼ÄÜÉ˺¦Í¨ÖªÁбí,(ÓÃÓÚ¹¥»÷½áÊø,ͳһ֪ͨ¿Í»§¶Ë)  | 
|     AttackCommon.AddHurt(curTagSummon, skillHurtList, hurtType.HurtType, hurtHP)  | 
|     return hurtType  | 
|   | 
|   | 
| ## ´¦Àí¹¥»÷ºóµÄ½á¹û  | 
| #  @param curPet ¹¥»÷·½:³èÎï  | 
| #  @param curTagSummon ·ÀÊØ·½:ÕÙ»½ÊÞ  | 
| #  @param skill ¼¼ÄÜ(ÎÞ->None)  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return True  | 
| #  @remarks ´¦Àí¹¥»÷ºóµÄ½á¹û  | 
| def AttackResult(curPet, curTagSummon, skill, tick):  | 
|       | 
|     #»ñÈ¡·ÀÊØ·½ÕÙ»½ÊÞµÄÖ÷ÈË  | 
|     curTagPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curTagSummon)  | 
|     #¹¥»÷µÄÊÇÍæ¼ÒµÄÕÙ»½ÊÞ  | 
|     if curTagPlayer != None and GameObj.GetHP(curTagPlayer) > 0:  | 
|         #½øÈëÕ½¶·×´Ì¬  | 
|         AttackCommon.SetPlayerBattleState(curTagPlayer, tick)  | 
|         #»ñÈ¡ÕÙ»½ÊÞµÄÖ÷ÈË  | 
|         curPlayer = PetControl.GetPetOwner(curPet)  # ³èÎïÖ÷ÈË  | 
|           | 
|         #ÊÇ·ñÔÚÌØÊâµÄ¸±±¾ÖÐ  | 
|         if curPlayer != None:  | 
|             AttackCommon.OnPlayerHitPlayer(curPlayer, curTagPlayer, tick)  | 
|       | 
|     #·ÀÊØ·½ÕÙ»½ÊÞËÀÍö  | 
|     if GameObj.GetHP(curTagSummon) <= 0:  | 
|         if TurnAttack.SetKilled(curTagSummon):  | 
|             return  | 
|         curTagSummonNPCControl = NPCCommon.NPCControl(curTagSummon)  | 
|         #ÕÙ»½ÊÞËÀÍö  | 
|         curTagSummonNPCControl.SetKilled()  | 
|       | 
|     return True  |