| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #  | 
| #---------------------------------------------------------------------  | 
| ##@package AIType_102  | 
| # ½£Óü¿ñÀ½ÒþÐÎÕÙ»½ÊÞ£¬Íæ¼ÒÎÞ·¨¸ÐÖª£¬Êͷű©·çÑ©  | 
| #  | 
| # @author Alee  | 
| # @date 2010-6-4 ÉÏÎç10:51:04  | 
| # @version 1.3  | 
| #  | 
| # @change: "2010-06-08 18:00" È¥³ýÈßÓàµÄ²»¿ÉÒÆ¶¯´¦ÀíÂß¼  | 
| # @change: "2010-06-08 18:00" Ìí¼Ó¹«Ë¾°æ±¾  | 
| # @change: "2016-01-15 15:00" ÐÞ¸ÄΪ×î´óÉúÃüÖµ¾ö¶¨¹¥»÷´ÎÊý  | 
| #  | 
| #Ä£¿éÏêϸ˵Ã÷.  | 
| #---------------------------------------------------------------------  | 
| #µ¼Èë  | 
| import IPY_GameWorld  | 
| import GameWorld  | 
| import NPCCommon  | 
| import BaseAttack  | 
| import ChConfig  | 
| import AICommon  | 
| import SkillShell  | 
| import GameObj  | 
| import PassiveBuffEffMng  | 
| #---------------------------------------------------------------------  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ³õʼ»¯  | 
| #  @param curNPC µ±Ç°npc  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def DoInit(curNPC):  | 
|     curNPC.GetNPCAngry().Init(ChConfig.Def_BossAngryCount)  | 
|   | 
| ## Ö´ÐÐAI  | 
| #  @param curNPC µ±Ç°npc  | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def ProcessAI(curNPC, tick):  | 
|     #1.¼ì²éÕâ¸öNPCµÄ³ðºÞÁÐ±í£¬ Èç¹û³ðºÞÁбíΪ¿Õ£¬ ²¢ÇÒÒÆ¶¯ÖУ¬ ²»´¦Àí  | 
|     if curNPC.IsAlive() != True:  | 
|         #NPCËÀÍö, ½øÈëËÀÍöµ¹¼ÆÊ±  | 
|         return  | 
|       | 
|     if not hasattr(curNPC, "GetLastTime") or not hasattr(curNPC, "GetBornTime"):  | 
|         return  | 
|     curNPCControl = NPCCommon.NPCControl(curNPC)  | 
|     if GameObj.GetHP(curNPC) <= 0 or (curNPC.GetLastTime() != 0 and tick - curNPC.GetBornTime() >= curNPC.GetLastTime()):  | 
|         #GameWorld.Log("ÕÙ»½ÊÞ³¬¹ý´æ»îʱ¼ä, ÉèÖÃËÀÍö")  | 
|         curNPCControl.SetKilled()  | 
|         return  | 
|       | 
|     #¹¥»÷Âß¼ Êͷż¼ÄÜ  | 
|     __NPCFight(curNPC, tick)  | 
|   | 
| ## npc¹¥»÷Âß¼  | 
| #  @param curNPC µ±Ç°npc   | 
| #  @param tick µ±Ç°Ê±¼ä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def __NPCFight(curNPC, tick):  | 
|     # ÊÓÒ°ÖÐÎÞÆäËû¹Ø×¢¶ÔÏ󣬲»¹¥»÷  | 
|     if curNPC.GetAttentionCount() <= 0:  | 
|         return  | 
|       | 
|       | 
|     if tick - curNPC.GetAttackTick() < curNPC.GetAtkInterval():  | 
|         #¹¥»÷¼ä¸ôûÓе½, ·µ»Ø  | 
|         return  | 
|       | 
|     skillManager = curNPC.GetSkillManager()  | 
|     useSkill = None  | 
|     for i in range(skillManager.GetSkillCount()):  | 
|         curSkill = skillManager.GetSkillByIndex(i)  | 
|           | 
|         if curSkill == None:  | 
|             GameWorld.Log("NPC = %s Êý¾Ý¿â²éÕÒ¼¼ÄÜʧ°Ü"%curNPC.GetName())  | 
|             return  | 
|       | 
|         #¹¥»÷¼ä¸ô  | 
|         if tick - curSkill.GetLastUseTick() < curSkill.GetCoolDownTime():  | 
|             continue  | 
|       | 
|         useSkill = curSkill  | 
|         break  | 
|           | 
|     if not useSkill:  | 
|         return  | 
|       | 
|     if curNPC.GetCurAction() != IPY_GameWorld.laNPCAttack:  | 
|         curNPC.SetCurAction(IPY_GameWorld.laNPCAttack)  | 
|       | 
|     SkillShell.NPCUseSkill(curNPC, useSkill, tick)  | 
|     # Ã¿´Î¹¥»÷ºó£¬×ÔÉíÉúÃüÖµ¼õ1£¬ÓÉ×î´óÉúÃüÖµ¾ö¶¨¹¥»÷´ÎÊý  | 
|     GameObj.SetHP(curNPC, GameObj.GetHP(curNPC) - 1)  | 
|     if GameObj.GetHP(curNPC) <= 0:  | 
|         NPCCommon.NPCControl(curNPC).SetKilled()  | 
|     return  | 
|   | 
|   | 
| ## NPCËÀÍö´¦Àí  | 
| #  @param curNPC ËÀÍöNPC  | 
| #  @param HurtType µôÂäÀàÐÍ  | 
| #  @param HurtID ¶ÔÓ¦ÓµÓÐÕßid  | 
| #  @param modulus µôÂäϵÊý  | 
| #  @return None  | 
| def OnDie(curNPC, HurtType, HurtID):  | 
|     # Òý±¬ÖÖ×Ӡ˪±¬¼¼ÄÜ  | 
|     # ntElf ¶¨ÒåΪÈËÎïʹÓöԵسÖÐøÐÔ¼¼ÄÜ£¬²¢ÇÒÈËÎï¿ÉÒÔÒÆ¶¯£¬ÔòÐèÒªntElf×öÒÀÍÐÎïµÄÇé¿ö  | 
|     # ÄÇôntElfÖ´ÐÐÈËÎïµÄÉ˺¦¼ÆËãºÍ±»¶¯´¥·¢Ð§¹û  | 
|     if curNPC.GetType() != IPY_GameWorld.ntElf:  | 
|         return  | 
|     curSkill = curNPC.GetSkillManager().GetSkillByIndex(0)  | 
|     if not curSkill:  | 
|         return  | 
|       | 
|     attacker = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curNPC)  | 
|     if not attacker:  | 
|         return  | 
|       | 
|     skillID = PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(curNPC, None, curSkill, ChConfig.TriggerType_BeBoomSeed)  | 
|     seedSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)  | 
|     if not seedSkill:  | 
|         return  | 
|       | 
|     SkillShell.UsePassiveTriggerSkill(curNPC, seedSkill, None, GameWorld.GetGameWorld().GetTick())  | 
|     return  |