| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package SkillModule_7  | 
| #  | 
| # @todo: Íæ¼ÒºÍNPC¹«ÓàÕÙ»½ÊÞ¼¼ÄÜÄ£°å  | 
| # @author Alee  | 
| # @date 2010-12-22 09:30  | 
| # @version 1.3  | 
| #  | 
| # ÏêϸÃèÊö: Íæ¼ÒºÍNPC¹«ÓàÕÙ»½ÊÞ¼¼ÄÜÄ£°å  | 
| #  | 
| # @change: "2011-02-25 13:30" Alee ÕÙ»½²ÎÊýÐÞ¸Ä  | 
| # @change: "2011-06-24 15:10" Alee Ìí¼ÓÕÙ»½²»Í¬ÕÙ»½Ê޵ŦÄÜ  | 
| # @change: "2011-07-15 14:00" Alee ÐÞ¸ÄÕÙ»½º¯Êý  | 
| #---------------------------------------------------------------------  | 
| """Version = 2011-07-15 14:00"""  | 
| #------------------------------------------------------------------------------  | 
| #µ¼Èë  | 
| import SkillCommon  | 
| import GameWorld  | 
| import ChConfig  | 
| import BaseAttack  | 
| import IPY_GameWorld  | 
|   | 
| #Â߼ʵÏÖ  | 
| ##Íæ¼ÒºÍNPC¹«ÓàÕÙ»½ÊÞ¼¼ÄÜÄ£°å  | 
| # @param attacker ¹¥»÷ÕßʵÀý  | 
| # @param defender ·ÀÊØÕßʵÀý  | 
| # @param curSkill ¼¼ÄÜʵÀý  | 
| # @param tagRoundPosX ÇøÓò×ø±êX  | 
| # @param tagRoundPosY ÇøÓò×ø±êY  | 
| # @param isEnhanceSkill ÊÇ·ñΪ¸½¼Ó¼¼ÄÜ  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµÎªÕæ, Êͷųɹ¦  | 
| # @remarks Íæ¼ÒºÍNPC¹«ÓàÕÙ»½ÊÞ¼¼ÄÜÄ£°å  | 
| def UseSkill(attacker, defender, curSkill, tagRoundPosX, tagRoundPosY, isEnhanceSkill, tick):  | 
|     summonResult = False  | 
|     #·ÖÎªÍæ¼ÒÕÙ»½ºÍNPCÕÙ»½  | 
|     if attacker.GetGameObjType() == IPY_GameWorld.gotNPC:  | 
|         summonResult = NPCUseSkill_SummonNPC(attacker, defender, curSkill, tick)  | 
|     else:  | 
|         summonResult = PlayerUseSkill_SummonNPC(attacker, defender, curSkill, tagRoundPosX, tagRoundPosY, tick)  | 
|       | 
|     #ÕÙ»½²»³É¹¦  | 
|     if not summonResult:  | 
|         return summonResult  | 
|       | 
|     #´¦Àí¼¼ÄÜ´¥·¢ºÍ¹¥»÷³É¹¦Âß¼  | 
|     return BaseAttack.DoSkillEx_AttackSucess(attacker, defender, curSkill, tick, isEnhanceSkill)  | 
|   | 
| ##Íæ¼ÒÕÙ»½ÊÞ  | 
| # @param attacker ¹¥»÷ÕßʵÀý  | 
| # @param defender ·ÀÊØÕßʵÀý  | 
| # @param curSkill ¼¼ÄÜʵÀý  | 
| # @param tagRoundPosX ÇøÓò×ø±êX  | 
| # @param tagRoundPosY ÇøÓò×ø±êY  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµÎªÕæ, Êͷųɹ¦  | 
| # @remarks Íæ¼ÒÕÙ»½ÊÞ  | 
| def PlayerUseSkill_SummonNPC(attacker, defender, curSkill, tagRoundPosX, tagRoundPosY, tick):  | 
|     curEffect = curSkill.GetEffect(0)  | 
|     if curEffect == None:  | 
|         GameWorld.Log("ÕÙ»½¼¼ÄÜÎÞЧ¹û,skillID = %s"%curSkill.GetSkillID(), attacker.GetPlayerID())  | 
|         return False  | 
|       | 
|     curSummonID = curEffect.GetEffectValue(0)  | 
|     if curSummonID == 0:  | 
|         GameWorld.Log("¼¼ÄÜ %sÌî±í´íÎó,ÕÙ»½IDΪ0"%curSkill.GetSkillID(), attacker.GetPlayerID())  | 
|         return False  | 
|       | 
|     #¼ì²éÕÙ»½´æÔڵĹæÔò  | 
|     if not SkillCommon.SummonNPCOccurRule(attacker, curSummonID, tick):  | 
|         return False  | 
|       | 
|     #ÑéÖ¤ÊÇ·ñÖ¸¶¨·Å¼¼ÄÜ  | 
|     isAppointBornPos = True  | 
|     if tagRoundPosX == -1 or tagRoundPosY == -1:  | 
|         isAppointBornPos = False  | 
|       | 
|     SkillCommon.PlayerSummonNPC(attacker, curSkill, curSummonID, ChConfig.Def_SummonAppearDist,  | 
|                                  tick, isAppointBornPos, tagRoundPosX, tagRoundPosY)  | 
|       | 
|     return True  | 
|   | 
| ##NPCÕÙ»½ÊÞ  | 
| # @param attacker ¹¥»÷ÕßʵÀý  | 
| # @param defender ·ÀÊØÕßʵÀý  | 
| # @param curSkill ¼¼ÄÜʵÀý  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµÎªÕæ, Êͷųɹ¦  | 
| # @remarks NPCÕÙ»½ÊÞ  | 
| def NPCUseSkill_SummonNPC(attacker, defender, curSkill, tick):  | 
|     curSummonID = curSkill.GetEffect(0).GetEffectValue(0)  | 
|     curSummonCount = curSkill.GetEffect(0).GetEffectValue(1)  | 
|       | 
|     if curSummonID <= 0 or curSummonCount <= 0:  | 
|         GameWorld.ErrLog("NPCʹÓü¼ÄÜ %s£¬ÕÙ»½ID»òÕßÊýÁ¿ÓÐÎó"%curSkill.GetSkillID())  | 
|         return False  | 
|       | 
|     maxAngryCount = attacker.GetNPCAngry().GetAngryCount()  | 
|       | 
|     #ÕÙ»½  | 
|     SkillCommon.DoLogic_NPC_UseSkill_SummonNPCAll(attacker, curSkill, curSummonID, curSummonCount,   | 
|                                                   maxAngryCount, tick, addAngry = True)  | 
|       | 
|     return True  | 
|   |