| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #---------------------------------------------------------------------  | 
| #  | 
| #---------------------------------------------------------------------  | 
| ##@package SummonNPC_Attack_SummonNPC  | 
| # ÕÙ»½ÊÞ¹¥»÷ÕÙ»½ÊÞ  | 
| #  | 
| # @author eggxp  | 
| # @date 2010-4-20  | 
| # @version 1.9  | 
| #  | 
| # ÐÞ¸Äʱ¼ä ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ  | 
| # @change: "2010-05-12 18:30" zhengyang Ìí¼Ó×¢ÊÍ  | 
| # @change: "2010-05-28 15:50" chenxuewei Ó¦²ß»®ÁõºèÉúÐèÇó£ºÔö¼Ó½£Ê¥ÏîÄ¿µÄPK¹æÔò  | 
| # @change: "2010-06-02 10:50" chenxuewei Íæ¼Ò¿ÉÒÔ¹¥»÷Ä¿±êµÄÇé¿öÏ£¬»ñµÃÍæ¼Ò¼äµÄ¹ØÏµÍ³Ò»ÔÚAttackCommon´¦Àí  | 
| # @change: "2010-06-07 13:30" Alee ÕÙ»½ÊÞ¹¥»÷¸øÖ÷È˼ӳðºÞ  | 
| # @change: "2010-06-07 17:30" Alee µ÷ÓÃÒÑÓеĹÜÀíÆ÷  | 
| # @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 ChConfig  | 
| import IPY_GameWorld  | 
| import GameWorld  | 
| import PlayerControl  | 
| import SkillShell  | 
| import TurnAttack  | 
| import GameObj  | 
| #---------------------------------------------------------------------  | 
|   | 
| #---------------------------------------------------------------------  | 
|   | 
| ## ÊÇ·ñ¿ÉÒÔ¹¥»÷   | 
| #  @param curNormalNPC ¹¥»÷·½:ÕÙ»½ÊÞ  | 
| #  @param curTagPlayer ·ÀÊØ·½:ÕÙ»½ÊÞ  | 
| #  @param skill ¼¼ÄÜ(ÎÞ->None)  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return True or False  | 
| #  @remarks ÊÇ·ñ¿ÉÒÔ¹¥»÷   | 
| def GetCanAttack(curSummonNPC, curTagSummon, skill, tick):  | 
|     return AttackCommon.CheckNPCCanAttackTag(curSummonNPC, curTagSummon, skill)  | 
|   | 
| ## »ñµÃ¹ØÏµ  | 
| #  @param curNormalNPC ¹¥»÷·½:ÕÙ»½ÊÞ  | 
| #  @param curTagPlayer ·ÀÊØ·½:ÕÙ»½ÊÞ  | 
| #  @param skill ¼¼ÄÜ(ÎÞ->None)  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return È磺ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None  | 
| #  @remarks »ñµÃ¹ØÏµ  | 
| def GetTagRelation(curSummonNPC, curTagSummon, skill, tick):  | 
|     #±äÁ¿³õʼ»¯  | 
|     curSummonOwner_NPC = None  | 
|     curTagSummonOwner_NPC = None  | 
|       | 
|     #»ñµÃ2¸öÕÙ»½ÊÞµÄÖ÷ÈË  | 
|     curPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curSummonNPC)   | 
|       | 
|     if curPlayer == None :  | 
|         curSummonOwner_NPC = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotNPC, curSummonNPC)  | 
|       | 
|     curTagPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curTagSummon)  | 
|       | 
|     if curTagPlayer == None :  | 
|         curTagSummonOwner_NPC = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotNPC, curTagSummon)  | 
|       | 
|     if curSummonOwner_NPC != None and curTagSummonOwner_NPC != None :  | 
|         #NPCµÄÕÙ»½ÊÞ²»»¥Ï๥»÷  | 
|         return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None  | 
|       | 
|     if curPlayer != None and curTagPlayer != None :  | 
|         #˽ÓÐľ׮ֻÄÜ×Ô¼º´ò×Ô¼ºµÄ  | 
|         if curTagSummon.GetType() in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:  | 
|             summonPlayerID = curTagSummon.GetDictByKey(ChConfig.Def_NPC_Dict_PriWoodPilePlayerID)  | 
|             if curPlayer.GetPlayerID() != summonPlayerID:  | 
|                 return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None  | 
|             return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_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 curNormalNPC ¹¥»÷·½:ÕÙ»½ÊÞ  | 
| #  @param curTagPlayer ·ÀÊØ·½:ÕÙ»½ÊÞ  | 
| #  @param skill ¼¼ÄÜ(ÎÞ->None)  | 
| #  @param skillValue ¼¼ÄÜÔöÇ¿  | 
| #  @param skillPercent ¼¼ÄÜÔöÇ¿°Ù·Ö±È  | 
| #  @param skillHurtList ¼¼ÄÜÉËѪÁбí(C++½Ó¿Ú)  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return hurtType £º HurtType É˺¦½á¹¹ÌåÀà   | 
| #  @remarks ¹¥»÷  | 
| def DoAttack(curSummonNPC, curTagSummon, skill, skillValue, skillPercent, skillHurtList, tick):  | 
|     hurtType = AttackCommon.GetHurtHP(curSummonNPC, curTagSummon, skill,   | 
|                                       skillValue, skillPercent, tick)  | 
|     hurtHP = hurtType.HurtHP  | 
|     #Ìí¼Ó³ðºÞ  | 
|     summonControl = NPCCommon.NPCControl(curTagSummon)  | 
|     summonControl.AddObjDetelToAngryList_ByAttack(curSummonNPC, hurtHP, skill)  | 
|       | 
|     #---¹¥»÷·½ÎªÕÙ»½ÊÞ,¸øÖ÷È˼ӳðºÞ---  | 
|     summonOwner = NPCCommon.GetSummonOwnerDetel(curSummonNPC)  | 
|       | 
|     if summonOwner != None:  | 
|         summonControl.AddObjToAngryList(summonOwner, 1)  | 
|   | 
|     curPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curSummonNPC)  | 
|     curTagPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curTagSummon)  | 
|     if curPlayer != None and curTagPlayer != None:  | 
|         AttackCommon.OnPVPDamage(curPlayer, hurtHP, curTagPlayer, "Summon v Summon")  | 
|           | 
|           | 
|     #Ìí¼Ó¼¼ÄÜÉ˺¦Í¨ÖªÁбí,(ÓÃÓÚ¹¥»÷½áÊø,ͳһ֪ͨ¿Í»§¶Ë)  | 
|     AttackCommon.AddHurt(curTagSummon, skillHurtList, hurtType.HurtType, hurtHP)  | 
|     return hurtType  | 
|   | 
|   | 
| ## ´¦Àí¹¥»÷ºóµÄ½á¹û  | 
| #  @param curNormalNPC ¹¥»÷·½:ÕÙ»½ÊÞ  | 
| #  @param curTagPlayer ·ÀÊØ·½:ÕÙ»½ÊÞ  | 
| #  @param skill ¼¼ÄÜ(ÎÞ->None)  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return True  | 
| #  @remarks ´¦Àí¹¥»÷ºóµÄ½á¹û  | 
| def AttackResult(curSummonNPC, curTagSummon, skill, tick):  | 
|     #»ñÈ¡·ÀÊØ·½ÕÙ»½ÊÞµÄÖ÷ÈË  | 
|     curTagPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curTagSummon)  | 
|     #¹¥»÷µÄÊÇÍæ¼ÒµÄÕÙ»½ÊÞ  | 
|     if curTagPlayer != None and GameObj.GetHP(curTagPlayer) > 0:  | 
|         #½øÈëÕ½¶·×´Ì¬  | 
|         AttackCommon.SetPlayerBattleState(curTagPlayer, tick)  | 
|         #»ñÈ¡ÕÙ»½ÊÞµÄÖ÷ÈË  | 
|         curPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curSummonNPC)  | 
|           | 
|         #ÊÇ·ñÔÚÌØÊâµÄ¸±±¾ÖÐ  | 
|         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  |