#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
#-------------------------------------------------------------------------------  
 | 
#  
 | 
#-------------------------------------------------------------------------------  
 | 
#  
 | 
##@package Skill.PassiveBuffEffMng  
 | 
#  
 | 
# @todo:±»¶¯buffЧ¹û¹ÜÀí  
 | 
# @author hxp  
 | 
# @date 2015-3-6  
 | 
# @version 1.1  
 | 
#  
 | 
# @change: "2016-11-16 15:30" hxp Ôö¼Ó»ñȡ˥ÈõЧ¹ûÐÅÏ¢ÁÐ±í  
 | 
#  
 | 
# ÏêϸÃèÊö: ±»¶¯buffЧ¹û¹ÜÀís  
 | 
#  
 | 
#---------------------------------------------------------------------  
 | 
#"""Version = 2016-11-16 15:30"""  
 | 
#---------------------------------------------------------------------  
 | 
          
 | 
#µ¼Èë  
 | 
import IPY_GameWorld  
 | 
import ReadChConfig  
 | 
import PassiveBuff  
 | 
import GameWorld  
 | 
import ChConfig  
 | 
import IpyGameDataPY  
 | 
import SkillCommon  
 | 
import BuffSkill  
 | 
import SkillShell  
 | 
import PlayerControl  
 | 
import NetPackCommon  
 | 
import ChPyNetSendPack  
 | 
import PlayerVip  
 | 
import AttackCommon  
 | 
import PyGameData  
 | 
import PlayerHorse  
 | 
import BaseAttack  
 | 
import EventShell  
 | 
import NPCCommon  
 | 
import PetControl  
 | 
import QuestCommon  
 | 
  
 | 
GameWorld.ImportAll("Script\\Skill\\", "PassiveBuff")  
 | 
  
 | 
  
 | 
  
 | 
# --------±»¶¯¹¦·¨ÉèÖÃ--------------------------------------------------------------------  
 | 
  
 | 
#===============================================================================  
 | 
# // B4 07 ±»¶¯¼¼ÄÜÉèÖ㨹¦·¨£© # tagCMPassiveSet  
 | 
#   
 | 
# struct    tagCMPassiveSet  
 | 
# {  
 | 
#    tagHead        Head;  
 | 
#    BYTE        Page;    // ·ÖÒ³  
 | 
#    BYTE        Index;    // ÐòºÅ  
 | 
#    DWORD        SkillID;    // ¼¼ÄÜID  
 | 
# };  
 | 
#===============================================================================  
 | 
def OnPassiveSet(index, clientData, tick):  
 | 
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  
 | 
    findSkill = None  
 | 
    if clientData.SkillID != 0:  
 | 
        findSkill = curPlayer.GetSkillManager().FindSkillBySkillID(clientData.SkillID)  
 | 
        if not findSkill:  
 | 
            return  
 | 
          
 | 
        if findSkill.GetFuncType() != ChConfig.Def_SkillFuncType_FbPassiveSkill:  
 | 
            return  
 | 
    
 | 
    holeCnt = IpyGameDataPY.GetFuncCfg('PassSkillEquipLimit', 2)  
 | 
    if clientData.Index >= holeCnt:  
 | 
        # ³¬³ö¿×Êý  
 | 
        return  
 | 
      
 | 
    pageCnt = IpyGameDataPY.GetFuncCfg('PassSkillEquipLimit', 3)  
 | 
    if clientData.Page >= pageCnt:  
 | 
        # ³¬³öÒ³Êý  
 | 
        return  
 | 
      
 | 
    tmpDict = IpyGameDataPY.GetFuncEvalCfg('PassSkillEquipLimit', 1)  
 | 
    # Ê£ÓàVIPʱ¼ä  
 | 
    #haveVipTime = PlayerVip.GetCurVIPTime(curPlayer)  
 | 
    strIndex = str(clientData.Index)   
 | 
    if strIndex in tmpDict:  
 | 
        # ÅжÏÌõ¼þ  
 | 
        for key, value in tmpDict[strIndex].items():  
 | 
            if key == "level" and curPlayer.GetLV() < value:  
 | 
                return  
 | 
            if key == "vipLv":  
 | 
                if curPlayer.GetVIPLv() < value:# or haveVipTime <=0:  
 | 
                    return  
 | 
            if key == "MountLv":  
 | 
                if PlayerHorse.GetHorseSumLV(curPlayer) < value:  
 | 
                    return  
 | 
              
 | 
  
 | 
            # ¶à¼ÓÒ»ÖÖÈÎÎñÅÐ¶Ï  
 | 
            if key == "OpenSkillSlots":  
 | 
                # Ö÷ÏßÈÎÎñÍê³Éʱ»áÉèÖñêÖ¾¿É½øµØÍ¼±êÖ¾  
 | 
                mission_1 = QuestCommon.GetCommonMission(curPlayer)  
 | 
                if not mission_1:  
 | 
                    return  
 | 
  
 | 
                if (pow(2, int(strIndex)) & mission_1.GetProperty("OpenSkillSlots")) == 0:  
 | 
                    return  
 | 
                  
 | 
    PlayerControl.NomalDictSetProperty(curPlayer,   
 | 
                                       ChConfig.Def_PDict_GFPassiveIndex%(clientData.Page, clientData.Index),  
 | 
                                       clientData.SkillID,  
 | 
                                       ChConfig.Def_PDictType_GFPassive)  
 | 
      
 | 
    # Í¨Öª¿Í»§¶ËÉèÖóɹ¦  
 | 
    sendPack = ChPyNetSendPack.tagMCPassiveSetAnswer()  
 | 
    sendPack.Page = clientData.Page  
 | 
    sendPack.Index = clientData.Index  
 | 
    sendPack.SkillID = clientData.SkillID  
 | 
    NetPackCommon.SendFakePack(curPlayer, sendPack)  
 | 
      
 | 
    # Ë¢±»¶¯Ð§¹ûºÍÊôÐÔ  
 | 
    page = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GFPassivePage, 0, ChConfig.Def_PDictType_GFPassive)  
 | 
    if clientData.Page == page:  
 | 
        GetPassiveEffManager().RegistPassiveEffSet(curPlayer)  
 | 
        PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()  
 | 
          
 | 
    EventShell.EventRespons_PassiveSet(curPlayer)  
 | 
    return  
 | 
  
 | 
  
 | 
#===============================================================================  
 | 
# //B4 08 ±»¶¯¼¼ÄÜҳѡÔñ£¨¹¦·¨£© # tagCMPassivePage  
 | 
#   
 | 
# struct    tagCMPassivePage  
 | 
# {  
 | 
#    tagHead        Head;  
 | 
#    BYTE        Page;    // ·ÖÒ³  
 | 
# };  
 | 
#===============================================================================  
 | 
  
 | 
def OnPassivePage(index, clientData, tick):  
 | 
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)  
 | 
    pageCnt = IpyGameDataPY.GetFuncCfg('PassSkillEquipLimit', 3)  
 | 
    if clientData.Page >= pageCnt:  
 | 
        # ³¬³öÒ³Êý  
 | 
        return  
 | 
      
 | 
      
 | 
    PlayerControl.NomalDictSetProperty(curPlayer,   
 | 
                                       ChConfig.Def_PDict_GFPassivePage,  
 | 
                                       clientData.Page,  
 | 
                                       ChConfig.Def_PDictType_GFPassive)  
 | 
      
 | 
    # Í¨Öª¿Í»§¶ËÉèÖóɹ¦  
 | 
    sendPack = ChPyNetSendPack.tagMCPassivePage()  
 | 
    sendPack.Page = clientData.Page  
 | 
    NetPackCommon.SendFakePack(curPlayer, sendPack)  
 | 
      
 | 
    # Ë¢±»¶¯Ð§¹ûºÍÊôÐÔ  
 | 
    GetPassiveEffManager().RegistPassiveEffSet(curPlayer)  
 | 
    PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()  
 | 
    return  
 | 
  
 | 
  
 | 
# ¼ì²éÊÇ·ñµ±Ç°ÕýÔÚʹÓõı»¶¯¼¼ÄÜ  
 | 
def FindUsePassiveSkills(curPlayer):  
 | 
    page = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GFPassivePage, 0, ChConfig.Def_PDictType_GFPassive)  
 | 
    holeCnt = IpyGameDataPY.GetFuncCfg('PassSkillEquipLimit', 2)  
 | 
    skills = []  
 | 
    for i in xrange(holeCnt):  
 | 
        findSkillID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GFPassiveIndex%(page, i), 0,   
 | 
                                                     ChConfig.Def_PDictType_GFPassive)  
 | 
        if findSkillID == 0:  
 | 
            continue  
 | 
        skills.append(findSkillID)  
 | 
          
 | 
    return skills  
 | 
  
 | 
# µÇ¼֪ͨ£¬²¢¹ýÂ˹ýÆÚVIP¿×  
 | 
def OnLoginGFPassive(curPlayer):  
 | 
    # ---֪ͨÿҳÊý¾Ý---  
 | 
    holeCnt = IpyGameDataPY.GetFuncCfg('PassSkillEquipLimit', 2)  
 | 
    pageCnt = IpyGameDataPY.GetFuncCfg('PassSkillEquipLimit', 3)  
 | 
      
 | 
    sendPack = ChPyNetSendPack.tagMCPassiveSet()  
 | 
    sendPack.PageCnt = pageCnt  
 | 
    sendPack.PassiveSkills = []  
 | 
      
 | 
      
 | 
    #tmpDict = IpyGameDataPY.GetFuncEvalCfg('PassSkillEquipLimit', 1)  
 | 
      
 | 
    # Ê£ÓàVIPʱ¼ä  
 | 
    #haveVipTime = PlayerVip.GetCurVIPTime(curPlayer)  
 | 
      
 | 
    for i in xrange(pageCnt):  
 | 
        skills = ChPyNetSendPack.tagMCPassiveSkills()  
 | 
        skills.Count = holeCnt  
 | 
        skills.SkillIDList = []  
 | 
        for j in xrange(holeCnt):  
 | 
  
 | 
            #===================================================================  
 | 
            # # ÅжÏVIP¹ýÆÚµÄÇé¿ö  
 | 
            # for key, value in tmpDict.get(j, {}).items():  
 | 
            #    if key == "vipLv":  
 | 
            #        if curPlayer.GetVIPLv() < value or haveVipTime <=0:  
 | 
            #            PlayerControl.NomalDictSetProperty(curPlayer,   
 | 
            #                                               ChConfig.Def_PDict_GFPassiveIndex%(i, j),   
 | 
            #                                               0,  
 | 
            #                                               ChConfig.Def_PDictType_GFPassive)  
 | 
            #===================================================================  
 | 
          
 | 
            skillID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GFPassiveIndex%(i, j), 0,  
 | 
                                                     ChConfig.Def_PDictType_GFPassive)  
 | 
            skills.SkillIDList.append(skillID)  
 | 
          
 | 
        sendPack.PassiveSkills.append(skills)  
 | 
      
 | 
    NetPackCommon.SendFakePack(curPlayer, sendPack)  
 | 
      
 | 
    # ---֪ͨ¼¤»îÒ³---  
 | 
    page = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GFPassivePage, 0, ChConfig.Def_PDictType_GFPassive)  
 | 
    sendPack = ChPyNetSendPack.tagMCPassivePage()  
 | 
    sendPack.Page = page  
 | 
    NetPackCommon.SendFakePack(curPlayer, sendPack)  
 | 
    return  
 | 
  
 | 
# Çл»µØÍ¼  
 | 
def OnLoadMapGFPassive(curPlayer):  
 | 
    # ±»¶¯¼¼ÄÜ  
 | 
    GetPassiveEffManager().RegistPassiveEff(curPlayer)  
 | 
      
 | 
    #tmpDict = IpyGameDataPY.GetFuncEvalCfg('PassSkillEquipLimit', 1)  
 | 
    #holeCnt = IpyGameDataPY.GetFuncCfg('PassSkillEquipLimit', 2)  
 | 
      
 | 
    # Ê£ÓàVIPʱ¼ä  
 | 
    #haveVipTime = PlayerVip.GetCurVIPTime(curPlayer)  
 | 
      
 | 
    #µ±Ç°Ê¹ÓÃÒ³  
 | 
    #page = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GFPassivePage, 0, ChConfig.Def_PDictType_GFPassive)  
 | 
  
 | 
#===============================================================================  
 | 
#    for j in xrange(holeCnt):  
 | 
#   
 | 
#        # ÅжÏVIP¹ýÆÚµÄÇé¿ö  
 | 
#        for key, value in tmpDict.get(j, {}).items():  
 | 
#            if key != "vipLv":  
 | 
#                continue  
 | 
#            if curPlayer.GetVIPLv() < value or haveVipTime <= 0:  
 | 
#                PlayerControl.NomalDictSetProperty(curPlayer,   
 | 
#                                                   ChConfig.Def_PDict_GFPassiveIndex%(page, j),   
 | 
#                                                   0,  
 | 
#                                                   ChConfig.Def_PDictType_GFPassive)  
 | 
#===============================================================================  
 | 
      
 | 
    # Ä§×å·¨±¦-±»¶¯¼¼ÄÜÒ³  
 | 
    GetPassiveEffManager().RegistPassiveEffSet(curPlayer)  
 | 
      
 | 
    GetPassiveEffManager().RegistPassiveBuff(curPlayer)  
 | 
  
 | 
    # ÖúÕ½ÉñÊÞ¼¼ÄÜ  
 | 
    GetPassiveEffManager().RegistPassiveEffDogz(curPlayer)  
 | 
  
 | 
#-±»¶¯Âß¼´¦Àí--------------------------------------------------------------------------------------------------  
 | 
##À뿪µØÍ¼´¦Àí  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @return   
 | 
def OnPlayerLeaveMap(curPlayer):  
 | 
    GetPassiveEffManager().RemovePassiveEff((curPlayer.GetID(), IPY_GameWorld.gotPlayer))  
 | 
    for i in range(1,3):  
 | 
        #³èÎï  
 | 
        GetPassiveEffManager().RemovePassiveEff((curPlayer.GetID()*10+i, IPY_GameWorld.gotNPC))  
 | 
    return  
 | 
  
 | 
# »ñµÃ¡¾¼¼ÄÜ¡¿±»¶¯Ð§¹û¶ÔÓ¦µÄ ±»¶¯´¥·¢·½Ê½ ÓëGetBuffTriggerTypeByEffectID»¥²¹  
 | 
def GetTriggerTypeByEffectID(effectID):  
 | 
    # ÁÙʱÅäÖà  
 | 
    tdict = {  
 | 
             2102:ChConfig.TriggerType_BeAttackOver,   # ±»¹¥»÷ºó´¥·¢ 20  
 | 
             2104:ChConfig.TriggerType_LockHP, # ËøÑª´¥·¢¼¼ÄÜ 63  
 | 
             2105:ChConfig.TriggerType_BeLuckyHit, # ±»»áÐÄÒ»»÷´¥·¢¼¼ÄÜ 64  
 | 
             2106:ChConfig.TriggerType_BeSuperHit,  # ±»±©»÷´¥·¢¼¼ÄÜ  
 | 
               
 | 
             4000:ChConfig.TriggerType_BuffState,   # ½øÈë4012µÄij¸ö״̬´¥·¢¼¼ÄÜ 2  
 | 
             4001:ChConfig.TriggerType_TagBuffState,   # Ä¿±ê½øÈë4012µÄij¸ö״̬´¥·¢¼¼ÄÜ 2  
 | 
             4002:ChConfig.TriggerType_AddDamagePer,   # Ìá¸ßÔö¼ÓÉ˺¦ÊôÐÔÖµ£¬¼ÆËãʱ 3  
 | 
             4003:ChConfig.TriggerType_AddDamagePer,   # Ìá¸ßÔö¼ÓÉ˺¦ÊôÐÔÖµ£¬¼ÆËãʱ 3  
 | 
             4004:ChConfig.TriggerType_AttackOver,  # ¹¥»÷£¨¶ÔµÐ¼¼ÄÜ£©ºó±»¶¯¼¼Äܱ»´¥·¢ 4  
 | 
             4005:ChConfig.TriggerType_AttackAddSkillPer,  # ËùÓй¥»÷É˺¦(SkillPer)Ôö¼Ó£¬º¬ÆÕ¹¥£¬¼ÆËãʱ 5  
 | 
             4006:ChConfig.TriggerType_SuperHit, # ±©»÷ʱ ´¥·¢¼¼ÄÜ6,  
 | 
             4007:ChConfig.TriggerType_SuperHitValue, # ±©»÷ʱ Ôö¼Ó±©»÷Öµ7,  
 | 
             4008:ChConfig.TriggerType_AttackAddSkillPer,  # ËùÓй¥»÷É˺¦(SkillPer)Ôö¼Ó£¬º¬ÆÕ¹¥£¬¼ÆËãʱ 5  
 | 
             4009:ChConfig.TriggerType_HurtObjAddBuff, # »÷ÖÐÍæ¼Ò£¨Èº¹¥¶à´Î´¥·¢£©8,  
 | 
             4010:ChConfig.TriggerType_ReduceCD, # ¼õÉÙCD9, #CD  
 | 
             4011:ChConfig.TriggerType_SuperHitSkillPer, # ±©»÷ʱ£¬Ôö¼Ó¼¼ÄÜÉ˺¦ 10  
 | 
             4013:ChConfig.TriggerType_AttackAddFinalValue,   #¹¥»÷Ôö¼ÓÊä³öÉ˺¦11  
 | 
             4014:ChConfig.TriggerType_HappenState,   #±Ø¶¨´¥·¢  
 | 
             4015:ChConfig.TriggerType_AttackAddSkillPer,  # ËùÓй¥»÷É˺¦(SkillPer)Ôö¼Ó£¬º¬ÆÕ¹¥£¬¼ÆËãʱ 5  
 | 
             4016:ChConfig.TriggerType_AbsorbShield,  # Ìá¸ß÷è÷ëÓÓÉíµÄ¼õÉÙÉ˺¦Ð§¹ûÌáÉý20% 13  
 | 
             4017:ChConfig.TriggerType_BounceHP,   # ·´µ¯É˺¦¹Ì¶¨Öµ14,  
 | 
             4018:ChConfig.TriggerType_BuffDisappear,   # buffÏûʧºó´¥·¢¼¼ÄÜ15,  
 | 
             4019:ChConfig.TriggerType_BuffTime,   # ÑÓ³¤BUFFʱ¼ä16,  
 | 
             4020:ChConfig.TriggerType_BounceHPPer,   # ·´µ¯É˺¦°Ù·Ö±ÈÖµ17,  
 | 
             4021:ChConfig.TriggerType_AddSingleSkillPer,   # ³ÖÐøÐÔ¹¥»÷µÄµ¥´Î¹¥»÷Öð´ÎÔö¼Ó¼¼ÄÜÉ˺¦18,  
 | 
             4022:ChConfig.TriggerType_SkillOverNoAttack,   # ¼¼ÄÜÊͷźó ÓëTriggerType_AttackOverÏà·´19,  
 | 
             4023:ChConfig.TriggerType_BeAttackOver,   # ±»¹¥»÷ºó´¥·¢ 20  
 | 
             4024:ChConfig.TriggerType_AddIceAtkPer,    # ¹¥»÷¸½¼ÓÕæÊµÉ˺¦°Ù·Ö±È 21  
 | 
             4025:ChConfig.TriggerType_AddIceAtk,    # ¹¥»÷¸½¼ÓÕæÊµÉ˺¦¹Ì¶¨Öµ 22  
 | 
             4026:ChConfig.TriggerType_DebuffOff,    # µÖÏûÒ»´Îdebuff 23  
 | 
             4027:ChConfig.TriggerType_AttackKill,   # Õ¶É± 24  
 | 
             4028:ChConfig.TriggerType_WillDead,   # ½øÈë±ôËÀ״̬ʱ´¥·¢¼¼ÄÜ 25  
 | 
             4029:ChConfig.TriggerType_BuffBoom,   # Öж¾ºó±¬Õ¨ 26  
 | 
             4030:ChConfig.TriggerType_Success_Buff_SkillPer, # Ìá¸ß4501³É¹¦¸ÅÂÊ 27  
 | 
             4031:ChConfig.TriggerType_HurtObjAddBuff,   # ÔÚËãÉ˺¦Ê±Èº¹¥1¶Ô1¼Óbuff£¬¿ÉÓÃÓÚÒ»¸öÉ˺¦¶à´Î´¥·¢ 28  
 | 
             4032:ChConfig.TriggerType_BeBoomSeed,   # ±»¶¯Òý±¬ÊÓÒ°ÄÚ¶ÔÏóµÄbuffÖÖ×Ó 29  
 | 
             4033:ChConfig.TriggerType_AttackOver,  # ¹¥»÷£¨¶ÔµÐ¼¼ÄÜ£©ºó±»¶¯¼¼Äܱ»´¥·¢ 4  
 | 
             4034:ChConfig.TriggerType_AttackAddSkillPer,  # Ôö¼ÓXP¼¼ÄÜ·ÇС¹ÖÉ˺¦  
 | 
             4035:ChConfig.TriggerType_AttackAddSkillPer,  # Ôö¼ÓXP¼¼ÄÜС¹ÖÉ˺¦  
 | 
             4036:ChConfig.TriggerType_AttackCnt,  # Ôö¼Ó¼¼Äܹ¥»÷ÊýÁ¿£¨Ð§¹ûID1200£©  
 | 
             4037:ChConfig.TriggerType_SuperHitOneByOne, # Ö»¶Ô±©»÷Ä¿±ê´¥·¢¼¼ÄÜ  
 | 
             4038:ChConfig.TriggerType_BuffState,   # ½øÈë4012µÄij¸ö״̬´¥·¢¼¼ÄÜ 2  
 | 
             4039:ChConfig.TriggerType_AttackOverPassive,  # ¹¥»÷£¨¶ÔµÐ¼¼ÄÜ£©ºó±»¶¯¼¼Äܱ»´¥·¢ÔÚÆäËû±»¶¯Ð§¹û´¦Àíºóµ÷Ó㬴¥·¢Ë³ÐòÔÒò  
 | 
             4040:ChConfig.TriggerType_BeSuperHit,  # ±»±©»÷´¥·¢¼¼ÄÜ  
 | 
             4041:ChConfig.TriggerType_AddExpRate,  # ¸ÅÂÊÐÔ¼Ó³Éɱ¹Ö¾Ñé  
 | 
             4042:ChConfig.TriggerType_DamageReduce,   # ¼õÉÙÉ˺¦  
 | 
             4043:ChConfig.TriggerType_DamageReducePVP,   # PVP¼õÉÙÉ˺¦  
 | 
             4044:ChConfig.TriggerType_MissPer, # ÉÁ±ÜÌáÉý°Ù·Ö±È  
 | 
             4045:ChConfig.TriggerType_SkillDist,   # Ôö¼Ó¼¼Äܹ¥»÷¾àÀë  
 | 
             4046:ChConfig.TriggerType_ReduceHurtHPPer,  # °Ù·Ö±È¼õÉÙ¹¥»÷¼ÆËãºóÉ˺¦   
 | 
             4047:ChConfig.TriggerType_TimeCalc, # Ò»¶¨Ê±¼äÑ»·Öд¥·¢Êͷż¼ÄÜ  
 | 
             4048:ChConfig.TriggerType_MissSkill,   # ÉÁ±Üºó´¥·¢Êͷż¼ÄÜ  
 | 
             4049:ChConfig.TriggerType_MissSuccessPer, # ÉÁ±Ü³É¹¦ÂÊÌáÉý  
 | 
             4050:ChConfig.TriggerType_OneDamage,   # É˺¦½µµÍµ½1µã  
 | 
             4051:ChConfig.TriggerType_LuckyHit, # »áÐÄÒ»»÷ʱÔö¼Ó»áÐÄÉ˺¦°Ù·Ö±È 50  
 | 
             4052:ChConfig.TriggerType_Buff_SuckBloodPer,   # ¹¥»÷ °Ù·Ö±ÈÎüѪ  
 | 
             4053:ChConfig.TriggerType_AddLayer, # BUFF²ã¼¶Ôö¼Óʱ 52  
 | 
             4054:ChConfig.TriggerType_AttackAddSkillPer,  # ËùÓй¥»÷É˺¦(SkillPer)Ôö¼Ó£¬º¬ÆÕ¹¥£¬¼ÆËãʱ 5  
 | 
             4055:ChConfig.TriggerType_StormAttackReduceCD, # ÀལÈз籩¹¥»÷ºó´¥·¢Ð§¹û  
 | 
             4056:ChConfig.TriggerType_PassiveBuffValue, ## ±»¶¯buffÖµ¼ÆËãÖжþ´Î»ñÈ¡±»¶¯Öµ 54  
 | 
             4057:ChConfig.TriggerType_AttackKillHappen, ## ¶Ô±»¶¯¼¼ÄÜնɱµÄ¸ÅÂÊÔöÇ¿ 55  
 | 
             4058:ChConfig.TriggerType_AddBuffOver, # Ìí¼ÓbuffÖ®ºó´¥·¢¼¼ÄÜ 56  
 | 
             4059:ChConfig.TriggerType_StormAttackOneByOne, # ÀལÈз籩¹¥»÷1¶Ô1´¥·¢¼¼ÄÜ  57  
 | 
             4060:ChConfig.TriggerType_StormAttackOver, # ÀལÈз籩¹¥»÷ºó´¥·¢¼¼ÄÜ  57  
 | 
             4061:ChConfig.TriggerType_AttackOverPassive,  # ¹¥»÷£¨¶ÔµÐ¼¼ÄÜ£©ºó±»¶¯¼¼Äܱ»´¥·¢ÔÚÆäËû±»¶¯Ð§¹û´¦Àíºóµ÷Ó㬴¥·¢Ë³ÐòÔÒò  
 | 
             4062:ChConfig.TriggerType_AttackAddFinalPer, # Ôö¼Ó×îÖÕÉ˺¦°Ù·Ö±È 59  
 | 
             4063:ChConfig.TriggerType_SummonDie,   #×ÔÉíÕÙ»½ÊÞËÀÍö´¥·¢¼¼ÄÜ 60  
 | 
             4064:ChConfig.TriggerType_GiftReduceCD, # Ì츳¼õÉÙCD9, #CD  
 | 
             4065:ChConfig.TriggerType_DamageReducePVP,   # PVP¼õÉÙÉ˺¦  
 | 
             4066:ChConfig.TriggerType_AddDamagePer,   # Ìá¸ßÔö¼ÓÉ˺¦ÊôÐÔÖµ£¬¼ÆËãʱ 3  
 | 
             4067:ChConfig.TriggerType_ProDefValue, # Éñ±ø»¤¶ÜֵϽµÊ± 62  
 | 
             4068:ChConfig.TriggerType_LockHP, # ËøÑª´¥·¢¼¼ÄÜ 63  
 | 
             4069:ChConfig.TriggerType_ZhongjiZhansha, # ÖÕ¼«Õ¶É± 64  
 | 
             }  
 | 
    return tdict.get(effectID, -1)   
 | 
    #===========================================================================  
 | 
    # # ´Ë±íÅäÖàӰÏìÀàÐÍ  
 | 
    # ipyData = IpyGameDataPY.GetIpyGameData('SkillEffect', effectID)  
 | 
    # if not ipyData:  
 | 
    #    return -1  
 | 
    #   
 | 
    # #{(´¥·¢·½Ê½/µã£¬ ¹ØÁª¼¼ÄÜ)£º{buff£º¡¾Ð§¹û¡¿}}  
 | 
    #   
 | 
    # return ipyData.GetTriggerType()  
 | 
    #===========================================================================  
 | 
  
 | 
# »ñµÃ¡¾BUFF¡¿±»¶¯´¥·¢µÄ·½Ê½ ÓëGetTriggerTypeByEffectID»¥²¹  
 | 
def GetBuffTriggerTypeByEffectID(effectID):  
 | 
    tdict = {  
 | 
             4500:ChConfig.TriggerType_AttackOver, # BUFFÀࣺ¹¥»÷´¥·¢Ð¼¼ÄÜ  
 | 
             4501:ChConfig.TriggerType_AttackAddSkillPer, # BUFFÀࣺÌá¸ßÖ÷¶¯¼¼Äܵļ¼ÄÜÉ˺¦  
 | 
             4502:ChConfig.TriggerType_BeAttackOver, # BUFFÀࣺ±»¹¥»÷´¥·¢¼¼ÄÜ  
 | 
             4503:ChConfig.TriggerType_AddDamagePer,  # BUFFÀࣺ ¹¥»÷ʱÌá¸ßÔö¼ÓÉ˺¦  
 | 
             4504:ChConfig.TriggerType_BounceHP,  # BUFFÀࣺ ·´µ¯É˺¦¹Ì¶¨Öµ  
 | 
             4506:ChConfig.TriggerType_BeAttackOver, # BUFFÀࣺ±»¹¥»÷´¥·¢¼¼ÄÜ  Ö»Ë¢ÐÂÊôÐÔ ²»´¥·¢¼¼ÄÜ  
 | 
             4507:ChConfig.TriggerType_Buff_AddSuperHitRate, # BUFFÀà:Ôö¼Ó±©»÷ÂÊ  
 | 
             4508:ChConfig.TriggerType_Buff_AttackSubLayer,  # BUFFÀࣺ¹¥»÷¼õbuff²ã£¬0Ïûʧ  
 | 
             4514:ChConfig.TriggerType_Buff_BeAttackSubLayer,  # BUFFÀࣺ±»¹¥»÷¼õbuff²ã£¬0Ïûʧ  
 | 
             4509:ChConfig.TriggerType_Buff_SuckBloodPer,   # BUFFÀࣺ °Ù·Ö±ÈÎüѪ, ´Ë´¦·ÇÊôÐÔÀà  
 | 
             4510:ChConfig.TriggerType_Buff_MustBeHit,   # BUFFÀࣺ ÎÞÊÓÉÁ±Ü±ØÖÐ  
 | 
             4511:ChConfig.TriggerType_AttackAddFinalValue,   #¹¥»÷Ôö¼ÓÊä³öÉ˺¦11  
 | 
             4512:ChConfig.TriggerType_ReduceHurtHPPer, # °Ù·Ö±È¼õÉÙ¹¥»÷¼ÆËãºóÉ˺¦   
 | 
             4513:ChConfig.TriggerType_AttackAddFinalValue,   #¹¥»÷Ôö¼ÓÊä³öÉ˺¦11  
 | 
             4515:ChConfig.TriggerType_AddIceAtkPer,    # BUFFÀࣺ¹¥»÷¸½¼ÓÕæÊµÉ˺¦°Ù·Ö±È  
 | 
             4516:ChConfig.TriggerType_ChangeHurtToHP,    # BUFFÀࣺbuffÖаÑÊܵ½É˺¦µÄxx%ת»¯ÎªÉúÃüÖµ  
 | 
             4517:ChConfig.TriggerType_DebuffOff,   # BUFFÀࣺ µÖÏûdebuff  
 | 
             4518:ChConfig.TriggerType_ForbidenCure, # BUFFÀࣺ ½ûÖ¹ÖÎÁÆ 53  
 | 
             4519:ChConfig.TriggerType_WillDead,   # BUFFÀࣺ ½øÈë±ôËÀ״̬ 25  
 | 
             4520:ChConfig.TriggerType_AddLayer, # BUFFÀࣺ Ä¿±êBUFF²ã¼¶Ôö¼Óʱ 52  
 | 
             4521:ChConfig.TriggerType_BeLuckyHitSubPer, # ¼õÉÙÊܵ½µÄ»áÐÄÉ˺¦ 65  
 | 
               
 | 
             803:ChConfig.TriggerType_BloodShield,  # Ñª¶Ü  
 | 
             806:ChConfig.TriggerType_BloodShield,  # Ñª¶Ü  
 | 
             807:ChConfig.TriggerType_BloodShield,  # Ñª¶Ü  
 | 
             808:ChConfig.TriggerType_BloodShield,  # Ñª¶Ü  
 | 
             }  
 | 
    return tdict.get(effectID, -1)  
 | 
  
 | 
  
 | 
#--------±»¶¯Ð§¹û---------------------------  
 | 
# ±»¶¯Ð§¹ûµÄÀ´Ô´¿ÉÄÜÊDZ»¶¯¼¼ÄÜ£¬±»¶¯buff£¬»òÕ߯äËûÔöÒæbuff  
 | 
# ¸ù¾Ý´¥·¢µã×éÖ¯²»Í¬µÄ´æ´¢  
 | 
# Êý¾ÝΪ¿ÕÖØÐÂ×éÖ¯  
 | 
class PassiveEff(object):  
 | 
    def __init__(self, gameObj):  
 | 
        self.gameObj = gameObj  
 | 
        #{(´¥·¢Ä£Ê½£¬ ±»Ó°ÏìµÄ¼¼ÄÜID):{BUFFid£º[Ó°ÏìBUFFµÄ¸½´øÐ§¹û]}}  
 | 
        self.AffectBuffDict = {}    # µ±Ç°ÕýÊÜÓ°ÏìµÄЧ¹ûbuff, keyΪ´¥·¢µã  
 | 
        self.AffectSkillDict = {}    # ±»¶¯¼¼ÄÜ {(´¥·¢Ä£Ê½£¬ ±»Ó°ÏìµÄ¼¼ÄÜID):[±»¶¯¼¼ÄÜID£¬Ð§¹û]  
 | 
        self.AffectPassiveSkillSetDict = {}    # ±»¶¯¼¼ÄÜ×°±¸ {(´¥·¢Ä£Ê½£¬ ±»Ó°ÏìµÄ¼¼ÄÜID):[±»¶¯¼¼ÄÜID£¬Ð§¹û]  
 | 
        self.AffectDogzSkillDict = {}   # ÉñÊÞÖúÕ½¼¼ÄÜ  
 | 
      
 | 
    #¼Ç¼»áÓ°ÏìÆäËû¼¼ÄÜ»òÕß±»¶¯´¥·¢Êͷż¼ÄܵÄBUFF  
 | 
    def AddBuffInfoByEffect(self, effect, skillID):  
 | 
        effectID = effect.GetEffectID()  
 | 
          
 | 
        #{(´¥·¢·½Ê½/µã£¬ ¹ØÁª¼¼ÄÜ)£º{BUFFID£º¡¾Ð§¹û¡¿}}  
 | 
        triggerType = GetBuffTriggerTypeByEffectID(effectID)  
 | 
        if triggerType == -1:  
 | 
            return  
 | 
  
 | 
        releaseSkillID = 0  
 | 
        keyTuple = (triggerType, releaseSkillID)  
 | 
        if keyTuple not in self.AffectBuffDict:  
 | 
            self.AffectBuffDict[keyTuple] = {}  
 | 
              
 | 
        if skillID not in self.AffectBuffDict[keyTuple]:  
 | 
            self.AffectBuffDict[keyTuple][skillID] = []  
 | 
        self.AffectBuffDict[keyTuple][skillID].append(effect)  # ´æ´¢ÊÜÓ°ÏìµÄÐÅÏ¢  
 | 
        return  
 | 
          
 | 
  
 | 
          
 | 
    # ÐèÔÚɾ³ýBUFF´¦Àí  
 | 
    def DelBuffInfo(self, skillData):  
 | 
        if not skillData:  
 | 
            return  
 | 
          
 | 
        skillID = skillData.GetSkillID()  
 | 
        releaseSkillID = 0 # ÔÝÇÒÎÞ¹ØÁª¾ßÌå¼¼ÄÜ  
 | 
        for i in range(0, skillData.GetEffectCount()):  
 | 
            curEffect = skillData.GetEffect(i)  
 | 
            effectID = curEffect.GetEffectID()  
 | 
              
 | 
            triggerType = GetBuffTriggerTypeByEffectID(effectID)  
 | 
            if triggerType == -1:  
 | 
                continue  
 | 
              
 | 
            if (triggerType, releaseSkillID) not in self.AffectBuffDict:  
 | 
                continue  
 | 
              
 | 
            if skillID not in self.AffectBuffDict[(triggerType, releaseSkillID)]:  
 | 
                continue  
 | 
              
 | 
            self.AffectBuffDict[(triggerType, releaseSkillID)].pop(skillID)  
 | 
              
 | 
        return  
 | 
      
 | 
      
 | 
      
 | 
    # »ñµÃ±»¶¯´¥·¢µÄ buff  
 | 
    def GetBuffsByTriggerType(self, triggerType, useSkillID=0):  
 | 
        return self.AffectBuffDict.get((triggerType, 0), {})  
 | 
       
 | 
      
 | 
    # ÖØË¢ÉñÊÞÖúÕ½¼¼ÄÜ  
 | 
    def RefreshDogzBattleSkill(self):  
 | 
        self.AffectDogzSkillDict = {}  
 | 
        skills = FindDogzBattleSkills(self.gameObj)  
 | 
          
 | 
        for curSkill in skills:  
 | 
            if not SkillCommon.isPassiveTriggerSkill(curSkill):  
 | 
                continue  
 | 
              
 | 
            skillTypeID = curSkill.GetSkillTypeID()  
 | 
              
 | 
            connSkillID = SkillShell.GetConnectSkillID(curSkill)    # ¹ØÁª¼¼ÄÜID, 0´ú±í²»ÏÞ¼¼ÄÜ  
 | 
            for i in xrange(curSkill.GetEffectCount()):  
 | 
                curEffect = curSkill.GetEffect(i)  
 | 
                effectID = curEffect.GetEffectID()  
 | 
                if effectID == 0:  
 | 
                    continue  
 | 
                  
 | 
                triggerType = GetTriggerTypeByEffectID(effectID)  
 | 
                if triggerType == -1:  
 | 
                    continue  
 | 
                  
 | 
                key = (triggerType,connSkillID)  
 | 
                if key not in self.AffectDogzSkillDict:  
 | 
                    self.AffectDogzSkillDict[key] = []  
 | 
                      
 | 
                self.AffectDogzSkillDict[key].append((skillTypeID, effectID))  
 | 
          
 | 
        return self.AffectDogzSkillDict  
 | 
      
 | 
      
 | 
    # ÖØË¢¿É×°±¸µÄ±»¶¯¼¼ÄÜ  
 | 
    def RefreshPassiveSkillSet(self):  
 | 
        self.AffectPassiveSkillSetDict = {}  
 | 
        skillManager = self.gameObj.GetSkillManager()  
 | 
        skills = FindUsePassiveSkills(self.gameObj)  
 | 
          
 | 
        for skillID in skills:  
 | 
            curSkill = skillManager.FindSkillBySkillID(skillID)  
 | 
            if not curSkill:  
 | 
                continue  
 | 
              
 | 
            skillTypeID = curSkill.GetSkillTypeID()  
 | 
            connSkillID = SkillShell.GetConnectSkillID(curSkill)    # ¹ØÁª¼¼ÄÜID, 0´ú±í²»ÏÞ¼¼ÄÜ  
 | 
            for i in xrange(curSkill.GetEffectCount()):  
 | 
                curEffect = curSkill.GetEffect(i)  
 | 
                effectID = curEffect.GetEffectID()  
 | 
                if effectID == 0:  
 | 
                    continue  
 | 
                  
 | 
                triggerType = GetTriggerTypeByEffectID(effectID)  
 | 
                if triggerType == -1:  
 | 
                    continue  
 | 
                  
 | 
                key = (triggerType,connSkillID)  
 | 
                if key not in self.AffectPassiveSkillSetDict:  
 | 
                    self.AffectPassiveSkillSetDict[key] = []  
 | 
                      
 | 
                self.AffectPassiveSkillSetDict[key].append((skillTypeID, effectID))  
 | 
          
 | 
        return self.AffectPassiveSkillSetDict  
 | 
      
 | 
      
 | 
    # ÖØË¢±»¶¯Ðͼ¼ÄÜ£¨º¬sp£¬Ì츳£¬²»º¬±»¶¯¼¼Äܹ¦ÄÜ£©´æ´¢  
 | 
    def RefreshPassiveSkill(self):  
 | 
        self.AffectSkillDict = {}  
 | 
        skillManager = self.gameObj.GetSkillManager()  
 | 
        for i in range(0 , skillManager.GetSkillCount()):  
 | 
            curSkill = skillManager.GetSkillByIndex(i)  
 | 
            if not curSkill:  
 | 
                continue  
 | 
              
 | 
            if not SkillCommon.isPassiveTriggerSkill(curSkill):  
 | 
                continue  
 | 
              
 | 
            if curSkill.GetFuncType() in [ChConfig.Def_SkillFuncType_FbPassiveSkill,  
 | 
                                          ChConfig.Def_SkillFuncType_Dogz]:  
 | 
                # ±»¶¯¼¼ÄܺÍÉñÊÞÐèÉèÖòÅÓÐЧ  
 | 
                continue  
 | 
              
 | 
            skillTypeID = curSkill.GetSkillTypeID()  
 | 
            connSkillID = SkillShell.GetConnectSkillID(curSkill)    # ¹ØÁª¼¼ÄÜID, 0´ú±í²»ÏÞ¼¼ÄÜ  
 | 
            for i in xrange(curSkill.GetEffectCount()):  
 | 
                curEffect = curSkill.GetEffect(i)  
 | 
                effectID = curEffect.GetEffectID()  
 | 
                if effectID == 0:  
 | 
                    continue  
 | 
                  
 | 
                triggerType = GetTriggerTypeByEffectID(effectID)  
 | 
                if triggerType == -1:  
 | 
                    continue  
 | 
                  
 | 
                key = (triggerType,connSkillID)  
 | 
                if key not in self.AffectSkillDict:  
 | 
                    self.AffectSkillDict[key] = []  
 | 
                  
 | 
                self.AffectSkillDict[key].append((skillTypeID, effectID))  
 | 
          
 | 
        return self.AffectSkillDict  
 | 
      
 | 
    # Ìí¼Ó±»¶¯¼¼ÄÜ  
 | 
    def AddPassiveSkill(self, skillID):  
 | 
        curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)  
 | 
        if not curSkill:  
 | 
            return  
 | 
          
 | 
        if not SkillCommon.isPassiveTriggerSkill(curSkill):  
 | 
            return  
 | 
          
 | 
        skillTypeID = curSkill.GetSkillTypeID()  
 | 
        connSkillID = SkillShell.GetConnectSkillID(curSkill)    # ¹ØÁª¼¼ÄÜID, 0´ú±í²»ÏÞ¼¼ÄÜ  
 | 
        for i in xrange(curSkill.GetEffectCount()):  
 | 
            curEffect = curSkill.GetEffect(i)  
 | 
            effectID = curEffect.GetEffectID()  
 | 
            if effectID == 0:  
 | 
                continue  
 | 
              
 | 
            triggerType = GetTriggerTypeByEffectID(effectID)  
 | 
            if triggerType == -1:  
 | 
                continue  
 | 
              
 | 
            key = (triggerType,connSkillID)  
 | 
            if key not in self.AffectSkillDict:  
 | 
                self.AffectSkillDict[key] = []  
 | 
              
 | 
            if (skillTypeID, effectID) not in self.AffectSkillDict[key]:  
 | 
                self.AffectSkillDict[key].append((skillTypeID, effectID))  
 | 
          
 | 
        return self.AffectSkillDict  
 | 
      
 | 
  
 | 
    def GetPassiveSkillsByTriggerType(self, triggerType, connSkillID=0):  
 | 
        skillList = []  
 | 
        ## bug:2018-03-15  
 | 
        ## skillList=self.AffectSkillDict.get((triggerType, connSkillID), [])ÔÙÓÃextend»áµ¼ÖÂAffectSkillDictÎÞÏÞÔö³¤  
 | 
        skillList.extend(self.AffectSkillDict.get((triggerType, connSkillID), []))  
 | 
        skillList.extend(self.AffectPassiveSkillSetDict.get((triggerType, connSkillID), []))  
 | 
        skillList.extend(self.AffectDogzSkillDict.get((triggerType, connSkillID), []))  
 | 
        if connSkillID != 0 and connSkillID != ChConfig.Def_SkillID_Somersault:  
 | 
            skillList.extend(self.AffectSkillDict.get((triggerType, 0), []))  
 | 
            skillList.extend(self.AffectPassiveSkillSetDict.get((triggerType, 0), []))  
 | 
            skillList.extend(self.AffectDogzSkillDict.get((triggerType, 0), []))  
 | 
        return skillList  
 | 
          
 | 
#ËùÓÐobjµÄ±»¶¯Ð§¹û¹ÜÀí  
 | 
class PassiveEffManager(object):  
 | 
      
 | 
    def __init__(self):  
 | 
        self.passiveEffClassDict = {}  
 | 
          
 | 
    # ÊÇ·ñ³õʼ»¯  
 | 
    def GetPassiveEff(self, gameObj):  
 | 
        key = (gameObj.GetID(), gameObj.GetGameObjType())   
 | 
  
 | 
        return self.passiveEffClassDict.get(key, None)  
 | 
  
 | 
      
 | 
    def InitObjPassiveEff(self, gameObj):  
 | 
        key = (gameObj.GetID(), gameObj.GetGameObjType())   
 | 
        if key not in self.passiveEffClassDict:   
 | 
            self.passiveEffClassDict[key] = PassiveEff(gameObj)  
 | 
        return self.passiveEffClassDict[key]  
 | 
      
 | 
    def AddPassiveEff(self, gameObj, passiveEff):  
 | 
        key = (gameObj.GetID(), gameObj.GetGameObjType())   
 | 
        self.passiveEffClassDict[key] = passiveEff  
 | 
      
 | 
    # ×¢²á±»¶¯¼¼ÄÜ  
 | 
    def RegistPassiveEff(self, gameObj, skillID=0):  
 | 
        passiveEff = self.GetPassiveEff(gameObj)  
 | 
        if not passiveEff or not skillID:  
 | 
              
 | 
            if passiveEff:  
 | 
                # µ±´ÓÓб»¶¯µ½ÍêȫûÓб»¶¯µÄ¹ý³Ì£¬ÐèÒªÔÚ´ËˢР 
 | 
                passiveEff.RefreshPassiveSkill()  
 | 
                return  
 | 
              
 | 
            # Ç¿ÖÆË¢ÐÂËùÓб»¶¯¼¼ÄÜ  
 | 
            passiveEff = PassiveEff(gameObj)  
 | 
            if not passiveEff.RefreshPassiveSkill():  
 | 
                # ´Ë´¦ÊÇΪÁ˲»¸øAddPassiveEffÔö¼Ó¿ÕÀà. ¹Ê²»Ã¿´Îµ÷ÓÃAddPassiveEff  
 | 
                # µ«ÁíÒ»ÖÖ´ÓÓб»¶¯µ½ÍêȫûÓб»¶¯»á±»´Ë¹ýÂË£¬µ¼ÖÂɾ³ý²»ÁË£¬ÔÚÉÏÃæ´¦Àí  
 | 
                return  
 | 
            self.AddPassiveEff(gameObj, passiveEff)  
 | 
        elif skillID:  
 | 
            # µ¥¸öÌí¼Ó±»¶¯¼¼ÄÜ  
 | 
            passiveEff.AddPassiveSkill(skillID)  
 | 
  
 | 
        return  
 | 
      
 | 
    # ÈËÎïÐèͬ²½×¢²á±»¶¯¼¼ÄÜ  
 | 
    def RegistPassiveEffSet(self, gameObj):  
 | 
        passiveEff = self.GetPassiveEff(gameObj)  
 | 
        if not passiveEff:  
 | 
            # Ç¿ÖÆË¢ÐÂËùÓб»¶¯¼¼ÄÜ  
 | 
            passiveEff = PassiveEff(gameObj)  
 | 
            if not passiveEff.RefreshPassiveSkillSet():  
 | 
                return  
 | 
            self.AddPassiveEff(gameObj, passiveEff)  
 | 
        else:  
 | 
            passiveEff.RefreshPassiveSkillSet()  
 | 
        return  
 | 
          
 | 
          
 | 
    # ÈËÎïÐèͬ²½×¢²áÉñÊÞ¼¼ÄÜ  
 | 
    def RegistPassiveEffDogz(self, gameObj):  
 | 
        passiveEff = self.GetPassiveEff(gameObj)  
 | 
        if not passiveEff:  
 | 
            # Ç¿ÖÆË¢ÐÂËùÓб»¶¯¼¼ÄÜ  
 | 
            passiveEff = PassiveEff(gameObj)  
 | 
            if not passiveEff.RefreshDogzBattleSkill():  
 | 
                return  
 | 
            self.AddPassiveEff(gameObj, passiveEff)  
 | 
        else:  
 | 
            passiveEff.RefreshDogzBattleSkill()  
 | 
        return  
 | 
          
 | 
          
 | 
    def RegistPassiveBuff(self, gameObj):  
 | 
        # buff # É¸Ñ¡buffType ·ñÔòNPCûÓд˽ӿڻᱨ´í  
 | 
        for buffType in [IPY_GameWorld.bfBuff, IPY_GameWorld.bfDeBuff, IPY_GameWorld.bfProcessBuff  
 | 
                         , IPY_GameWorld.btPassiveBuf, IPY_GameWorld.bfActionBuff, IPY_GameWorld.bfProcessDeBuff]:  
 | 
              
 | 
            if buffType == IPY_GameWorld.btPassiveBuf and gameObj.GetGameObjType() == IPY_GameWorld.gotNPC:  
 | 
                # NPCÖ»ÓгèÎïÓб»¶¯BUFF  
 | 
                if not PetControl.IsPet(gameObj):  
 | 
                    continue  
 | 
              
 | 
            buffTuple = SkillCommon.GetBuffManagerByBuffType(gameObj, buffType)  
 | 
            #ͨ¹ýÀàÐÍ»ñȡĿ±êµÄbuff¹ÜÀíÆ÷Ϊ¿Õ£¬ÔòÌø³ö  
 | 
            if buffTuple == ():  
 | 
                continue  
 | 
      
 | 
            buffManager = buffTuple[0]  
 | 
              
 | 
            for i in xrange(buffManager.GetBuffCount()):  
 | 
                curBuff = buffManager.GetBuff(i)  
 | 
                buffSkill = curBuff.GetSkill()  
 | 
                if not buffSkill:  
 | 
                    continue  
 | 
                for effectIndex in range(0, buffSkill.GetEffectCount()):  
 | 
                    curEffect = buffSkill.GetEffect(effectIndex)  
 | 
                    effectID = curEffect.GetEffectID()  
 | 
                    if effectID == 0:  
 | 
                        continue  
 | 
                      
 | 
                    triggerType = GetBuffTriggerTypeByEffectID(effectID)  
 | 
                    if triggerType == -1:  
 | 
                        continue  
 | 
                    passiveEff = self.InitObjPassiveEff(gameObj)  
 | 
                    passiveEff.AddBuffInfoByEffect(curEffect, buffSkill.GetSkillID())  
 | 
          
 | 
        return  
 | 
      
 | 
      
 | 
    def RemovePassiveEff(self, key):  
 | 
        if key in self.passiveEffClassDict:  
 | 
            self.passiveEffClassDict.pop(key)  
 | 
        return  
 | 
      
 | 
      
 | 
def GetPassiveEffManager():  
 | 
    if not PyGameData.g_PassiveEffManager:  
 | 
        PyGameData.g_PassiveEffManager = PassiveEffManager()  
 | 
    return PyGameData.g_PassiveEffManager  
 | 
  
 | 
  
 | 
## µ±Ç°Êͷż¼ÄÜ skillData  
 | 
#def CalcBuffTriggerSkill(attacker, skillData, target, tick):  
 | 
#    #===========================================================================  
 | 
#    # passiveEff = GetPassiveEffManager().GetPassiveEff(attacker, False)  
 | 
#    # if not passiveEff:  
 | 
#    #    return  
 | 
#    # #Ó°Ïì¼¼ÄܵÄBUFF  
 | 
#    # buffTriggerSkillDict = passiveEff.GetBuffTriggerSkill(skillData.GetSkillID())  
 | 
#    # if not buffTriggerSkillDict:  
 | 
#    #    return  
 | 
#    #   
 | 
#    # passiveEff.CalcBuffTriggerSkill(attacker, target, skillData, buffTriggerSkillDict, tick)  
 | 
#    #===========================================================================  
 | 
#    OnPassiveSkillTrigger(attacker, target, ChConfig.TriggerType_AttackOver, tick)  
 | 
  
 | 
#===============================================================================  
 | 
# # ÅжÏPK¹ØÏµÊÇ·ñ¿É¹¥»÷ Def_BattleRelationType_CommNoBossÒ²¿É¹¥»÷ Ö»Êǹ¥»÷ÎÞЧ¹û  
 | 
# def CheckBattleRelationType(skillBattleType, battleRelationType):  
 | 
#    if skillBattleType in [ChConfig.Def_BattleRelationType_Comm, ChConfig.Def_BattleRelationType_CommNoBoss]:  
 | 
#        return True  
 | 
#      
 | 
#    #if battleRelationType in [ChConfig.Def_BattleRelationType_Comm, ChConfig.Def_BattleRelationType_CommNoBoss]:  
 | 
#    #    return True  
 | 
#      
 | 
#    if skillBattleType != battleRelationType:  
 | 
#        # PKģʽµÄÅж¨  
 | 
#        return False  
 | 
#    return True  
 | 
#===============================================================================  
 | 
  
 | 
# ²éÕÒ±»¶¯¼¼ÄÜʱµÄ¶ÔÏó  
 | 
def GetPassiveDefender(attacker, defender):  
 | 
    # Ñ°ÕÒ±»»÷Õߣ¬1.Ä¿±êÅųýÊÇ×Ô¼º£¨ºóÃæÂß¼»á¸ü»»£© 2. ²é¿Í»§¶ËÉ˺¦¶ÓÁУ¬3.²é·þÎñ¶ËÉ˺¦¶ÓÁР     
 | 
    if defender and defender != attacker:  
 | 
        return defender  
 | 
  
 | 
    # Ã»ÓÐÄ¿±êµÄÇé¿öÈ¡É˺¦¶ÓÁÐÖеĵÚÒ»¸ö¶ÔÏó  
 | 
    if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:  
 | 
        return  
 | 
      
 | 
    useSkillTagID = attacker.GetUseSkillTagID()  
 | 
    useSkillTagType = attacker.GetUseSkillTagType()  
 | 
    defender = GameWorld.GetObj(useSkillTagID, useSkillTagType)  
 | 
    if defender:  
 | 
        return defender  
 | 
      
 | 
    curHurt = BaseAttack.GetFirstHurtObj()  
 | 
    if not curHurt:  
 | 
        return  
 | 
      
 | 
    return GameWorld.GetObj(curHurt.GetObjID(), curHurt.GetObjType())  
 | 
          
 | 
  
 | 
# ¶àÖÖ±»¶¯¼¼ÄÜÓÅÏÈ´¥·¢ÊÍ·ÅÒ»¸ö£¬Èç±»¶¯ ÑªÁ¿40%´¥·¢Î޵м¼ÄÜ£¬ÑªÁ¿Ò»¶¨ÊÇÍ£ÁôÔÚ40%  
 | 
# ÏÈËøÑª£¬ºó´¥·¢¼¼Äܠͬ DelayUsePassiveTriggerSkill Ê¹Óà  
 | 
def OnPassiveSkillLockHP(attacker, defender, connSkill, triggerType, tick, isEnhanceSkill=False):  
 | 
    attacker = FindRealAttacker(attacker)  
 | 
    if not attacker:  
 | 
        return 0, 0  
 | 
  
 | 
    stopPassiveSkill = False   # ±»¶¯¼¼Äܲ»ÄÜÔÙ´¥·¢±»¶¯¼¼ÄÜ£¬µ«¿ÉÒÔ´¥·¢Ì츳¼¼ÄÜ  
 | 
    if connSkill:  
 | 
        if not connSkill.GetFuncType():  
 | 
            # ·Ç¹¦ÄÜÀ༼ÄÜ£¬±ÜÃâËÀÑ»·  
 | 
            return 0, 0  
 | 
        if SkillCommon.isPassiveSkill(connSkill):  
 | 
            stopPassiveSkill = True  
 | 
          
 | 
    if SkillCommon.GetUsingPassiveSkill(attacker) and triggerType != ChConfig.TriggerType_BuffState:  
 | 
        # ·À·¶±»¶¯¼¼ÄÜ´¥·¢µÄ ·Ç±»¶¯¼¼ÄÜ  
 | 
        stopPassiveSkill = True  
 | 
      
 | 
    passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)  
 | 
    if not passiveEff:  
 | 
        return 0, 0  
 | 
          
 | 
    connSkillID = connSkill.GetSkillTypeID() if connSkill else 0  
 | 
    skills = passiveEff.GetPassiveSkillsByTriggerType(triggerType, connSkillID)  
 | 
    if not skills:  
 | 
        return 0, 0  
 | 
          
 | 
    defender = GetPassiveDefender(attacker, defender)  
 | 
  
 | 
    # µ±Ç°Õ½¶·¹ØÏµ pvp pve  
 | 
    battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)  
 | 
    #GameWorld.DebugLog("OnPriorityPassiveSkillTrigger-----------%s-%s"%(skills, battleRelationType))  
 | 
      
 | 
    lockHPPerMax = 0  ## È¡ÓÐЧµÄ×î¸ßѪÁ¿  
 | 
    lockHPSkillID = 0  
 | 
    for skillTypeID, effectID in skills:  
 | 
        if connSkillID == skillTypeID:  
 | 
            continue  
 | 
        curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)  
 | 
        if not curSkill:  
 | 
            continue  
 | 
  
 | 
        if stopPassiveSkill and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_GiftSkill:  
 | 
            # Ö»ÓÐÌ츳²Å¿ÉÒÔÔٴα»´¥·¢  
 | 
            continue   
 | 
          
 | 
        effect = SkillCommon.GetSkillEffectByEffectID(curSkill, effectID)  
 | 
        if not effect:  
 | 
            continue  
 | 
  
 | 
        if SkillCommon.RefreshSkillRemainTime(curSkill, tick):  
 | 
            continue  
 | 
          
 | 
        skillBattleType = SkillCommon.GetSkillBattleType(curSkill)  
 | 
        if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):  
 | 
            # PKģʽµÄÅж¨  
 | 
            continue  
 | 
          
 | 
        pyName = "PassiveSkill_%s" % effectID  
 | 
        callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "CheckCanHappen"))  
 | 
        if not callFunc:  
 | 
            continue  
 | 
        if not callFunc(attacker, defender, effect, curSkill):  
 | 
            continue  
 | 
          
 | 
        # ×îÖÕÈ¡×î¸ßÖµÀ´¾ö¶¨µ±Ç°ÉúÃüÖµ£¬¿¨ÑªÉ趨  
 | 
        if effect.GetEffectValue(0) > lockHPPerMax:  
 | 
            lockHPPerMax = effect.GetEffectValue(0)  
 | 
            lockHPSkillID = skillTypeID  
 | 
          
 | 
    return lockHPSkillID, lockHPPerMax  
 | 
  
 | 
  
 | 
# ËøÑª¹¦Äܵļ¼ÄÜ º¬ÈËÎïºÍ³èÎï  
 | 
def OnObjsPassiveSkillLockHP(attacker, defender, connSkill, triggerType, tick,):  
 | 
    if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:  
 | 
        return 0  
 | 
      
 | 
    lockHPSkillID, lockHPPerMax = OnPassiveSkillLockHP(attacker, defender, connSkill, triggerType, tick)  
 | 
    rolePet = attacker.GetPetMgr().GetFightPet()  
 | 
    if rolePet:  
 | 
        lockHPSkillIDPet, lockHPPerMaxPet = OnPassiveSkillLockHP(rolePet, defender, connSkill, triggerType, tick)  
 | 
      
 | 
        if lockHPPerMax + lockHPPerMaxPet == 0:  
 | 
            # ÎÞ´¥·¢  
 | 
            return 0  
 | 
          
 | 
        # ´¥·¢³èÎï¼¼ÄܱêÖ¾  
 | 
        if lockHPPerMaxPet > lockHPPerMax:  
 | 
            rolePet.SetDict(ChConfig.Def_PlayerKey_LockHPSkillID, lockHPSkillIDPet)  
 | 
            return lockHPPerMaxPet  
 | 
      
 | 
    if lockHPPerMax == 0:  
 | 
        return 0  
 | 
      
 | 
    # ´¥·¢ÈËÎï¼¼ÄܱêÖ¾  
 | 
    attacker.SetDict(ChConfig.Def_PlayerKey_LockHPSkillID, lockHPSkillID)  
 | 
    return lockHPPerMax  
 | 
  
 | 
  
 | 
# ´ÓÉËѪÑÓºóµ½¼¼ÄܽáÊø´¥·¢±»¶¯¼¼ÄÜ  
 | 
def DelayUsePassiveTriggerSkill(attacker, curSkill, defender, tick):  
 | 
    if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:  
 | 
        return  
 | 
      
 | 
    # ¼ì²éÊdzèÎﻹÊÇÈËÎï¼¼ÄÜ  
 | 
    skillTypeID = attacker.GetDictByKey(ChConfig.Def_PlayerKey_LockHPSkillID)  
 | 
    if not skillTypeID:  
 | 
        rolePet = attacker.GetPetMgr().GetFightPet()  
 | 
        if not rolePet:  
 | 
            return  
 | 
        skillTypeID = rolePet.GetDictByKey(ChConfig.Def_PlayerKey_LockHPSkillID)  
 | 
        if not skillTypeID:  
 | 
            return  
 | 
        attacker = rolePet  
 | 
        GameWorld.DebugLog("DelayUsePassiveTriggerSkill-----pet")  
 | 
      
 | 
    # Ò»¶¨ÒªÇå±êÖ¾  
 | 
    attacker.SetDict(ChConfig.Def_PlayerKey_LockHPSkillID, 0)  
 | 
      
 | 
    curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)  
 | 
    if not curSkill:  
 | 
        return  
 | 
      
 | 
    GameWorld.DebugLog("DelayUsePassiveTriggerSkill-----skillTypeID-%s"%skillTypeID)  
 | 
    # ÉèÖñêÖ¾±ÜÃâ±»¶¯¼¼ÄÜ´¥·¢±»¶¯¼¼ÄÜ, ±»¶¯µ±ÖпÉÄܻᴥ·¢¶àÖÖÀàÐͼ¼ÄÜ£¬¹Ê²»ÓÃisPassiveSkill×öÆÁ±Î  
 | 
    SkillCommon.SetUsingPassiveSkill(attacker, 1)  
 | 
    if not SkillShell.UsePassiveTriggerSkill(attacker, curSkill, defender, tick):  
 | 
        # ²»¹Ü¼¼ÄÜÊÇ·ñÊÇ·ñ³É¹¦¶¼±ØÐë½øÈëCD  
 | 
        SkillCommon.SetSkillRemainTime(curSkill, PlayerControl.GetReduceSkillCDPer(attacker), tick, attacker)  
 | 
          
 | 
    SkillCommon.SetUsingPassiveSkill(attacker, 0)  
 | 
    return  
 | 
  
 | 
  
 | 
# Áé³è²¿·Ö¼¼ÄÜÐèҪͨ¹ýÖ÷ÈË´¥·¢£¬Áé³è×Ô¼º´¥·¢µÄÂß¼ÒÀÈ»×ß OnPassiveSkillTrigger  
 | 
def OnPetPassiveSkillTrigger(attacker, defender, connSkill, triggerType, tick):  
 | 
    if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:  
 | 
        return  
 | 
      
 | 
    rolePet = attacker.GetPetMgr().GetFightPet()  
 | 
    #ÎÞ³öÕ½³èÎï  
 | 
    if rolePet == None:  
 | 
        return  
 | 
  
 | 
    OnPassiveSkillTrigger(rolePet, defender, connSkill, triggerType, tick)  
 | 
  
 | 
  
 | 
# ±»¶¯¼¼ÄÜ´¥·¢ÊÍ·Å  
 | 
def OnPassiveSkillTrigger(attacker, defender, connSkill, triggerType, tick, isEnhanceSkill=False, skillIDSet=None):  
 | 
    attacker = FindRealAttacker(attacker)  
 | 
    if not attacker:  
 | 
        return False  
 | 
  
 | 
    stopPassiveSkill = False   # ±»¶¯¼¼Äܲ»ÄÜÔÙ´¥·¢±»¶¯¼¼ÄÜ£¬µ«¿ÉÒÔ´¥·¢Ì츳¼¼ÄÜ  
 | 
    if connSkill:  
 | 
        if not connSkill.GetFuncType():  
 | 
            # ·Ç¹¦ÄÜÀ༼ÄÜ£¬±ÜÃâËÀÑ»·  
 | 
            return False  
 | 
        if SkillCommon.isPassiveSkill(connSkill):  
 | 
            #GameWorld.DebugLog("±»¶¯¼¼Äܲ»ÄÜÔٴδ¥·¢±»¶¯¼¼ÄÜ")  
 | 
            #return False  
 | 
            stopPassiveSkill = True  
 | 
          
 | 
    if SkillCommon.GetUsingPassiveSkill(attacker) and triggerType != ChConfig.TriggerType_BuffState:  
 | 
        # ·À·¶±»¶¯¼¼ÄÜ´¥·¢µÄ ·Ç±»¶¯¼¼ÄÜ  
 | 
        #GameWorld.DebugLog("±»¶¯¼¼ÄÜÊÍ·ÅÖв»ÄÜÔٴδ¥·¢±»¶¯¼¼ÄÜ---%s"%triggerType)  
 | 
        #return   
 | 
        stopPassiveSkill = True  
 | 
      
 | 
    passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)  
 | 
    if not passiveEff:  
 | 
        return False  
 | 
          
 | 
    connSkillID = connSkill.GetSkillTypeID() if connSkill else 0  
 | 
    skills = passiveEff.GetPassiveSkillsByTriggerType(triggerType, connSkillID)  
 | 
    if not skills:  
 | 
        return False  
 | 
          
 | 
    defender = GetPassiveDefender(attacker, defender)  
 | 
  
 | 
    result = False  
 | 
    # µ±Ç°Õ½¶·¹ØÏµ pvp pve  
 | 
    battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)  
 | 
    #GameWorld.DebugLog("OnPassiveSkillTrigger-----------%s-%s"%(skills, battleRelationType))  
 | 
    for skillTypeID, effectID in skills:  
 | 
        if connSkillID == skillTypeID:  
 | 
            continue  
 | 
        curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)  
 | 
        if not curSkill:  
 | 
            continue  
 | 
  
 | 
        if stopPassiveSkill and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_GiftSkill:  
 | 
            # Ö»ÓÐÌ츳²Å¿ÉÒÔÔٴα»´¥·¢  
 | 
            continue   
 | 
          
 | 
        effect = SkillCommon.GetSkillEffectByEffectID(curSkill, effectID)  
 | 
        if not effect:  
 | 
            continue  
 | 
  
 | 
        if SkillCommon.RefreshSkillRemainTime(curSkill, tick):  
 | 
            continue  
 | 
        result = True   # ´ú±íÓÐЧ´¥·¢£¬µ«²»¹ØÏµ´¥·¢½á¹û  
 | 
          
 | 
        skillBattleType = SkillCommon.GetSkillBattleType(curSkill)  
 | 
        if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):  
 | 
            # PKģʽµÄÅж¨  
 | 
            continue  
 | 
          
 | 
        pyName = "PassiveSkill_%s" % effectID  
 | 
        callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "CheckCanHappen"))  
 | 
        if callFunc and not callFunc(attacker, defender, effect, curSkill):  
 | 
            continue  
 | 
          
 | 
        # ÉèÖñêÖ¾±ÜÃâ±»¶¯¼¼ÄÜ´¥·¢±»¶¯¼¼ÄÜ, ±»¶¯µ±ÖпÉÄܻᴥ·¢¶àÖÖÀàÐͼ¼ÄÜ£¬¹Ê²»ÓÃisPassiveSkill×öÆÁ±Î  
 | 
        SkillCommon.SetUsingPassiveSkill(attacker, 1)  
 | 
        if SkillShell.UsePassiveTriggerSkill(attacker, curSkill, defender, tick, isEnhanceSkill):  
 | 
            if skillIDSet:   
 | 
                curSkill.SetRemainTime(0)  # Ò»´Î¹¥»÷¶à´Îµ÷Ó࣬ÔÚÍâ²ãͳһµ÷ÓÃCD  
 | 
                skillIDSet.add(skillTypeID)  
 | 
        SkillCommon.SetUsingPassiveSkill(attacker, 0)  
 | 
        
 | 
    # ´ú±íÓÐЧ´¥·¢£¬µ«²»¹ØÏµ´¥·¢½á¹û, Íâ²ã¸ù¾ÝÐèÇóʹÓã¬Èç¼õÉÙÑ»·ÅжϠ   
 | 
    return result  
 | 
  
 | 
  
 | 
#ntSummon£º£¨3£©ÆÕͨÕÙ»½ÊÞ£¬¿É¼Ì³ÐÖ÷ÈË»ù´¡ÊôÐÔÈç¹¥»÷   
 | 
#ntElf£º£¨4£©Íæ¼ÒÌæÉí£¬ÍêȫӵÓÐÍæ¼ÒÊôÐԺͱ»¶¯¹¦ÄÜ  
 | 
#ntFairy £º£¨7£©Í¬ntSummon£¬µ«¼¼Äܿɴ¥·¢±»¶¯¹¦ÄÜ  
 | 
  
 | 
# ntElf ¶¨ÒåΪÈËÎïʹÓöԵسÖÐøÐÔ¼¼ÄÜ£¬²¢ÇÒÈËÎï¿ÉÒÔÒÆ¶¯£¬ÔòÐèÒªntElf×öÒÀÍÐÎïµÄÇé¿ö  
 | 
# ÄÇôntElfÖ´ÐÐÈËÎïµÄÉ˺¦¼ÆËãºÍ±»¶¯´¥·¢Ð§¹û  
 | 
# ±»¶¯¼¼ÄÜÖ»´¦ÀíÍæ¼Ò£¬³èÎºÍÁé  
 | 
def FindRealAttacker(attacker):  
 | 
    if attacker.GetGameObjType() != IPY_GameWorld.gotNPC:  
 | 
        # --Íæ¼Ò  
 | 
        return attacker  
 | 
      
 | 
    npcType = attacker.GetType()  
 | 
    if npcType not in [IPY_GameWorld.ntPet, IPY_GameWorld.ntElf, IPY_GameWorld.ntFairy]:  
 | 
        if attacker.GetIsBoss():  
 | 
            return attacker  
 | 
        return  
 | 
      
 | 
    if npcType == IPY_GameWorld.ntPet:  
 | 
        # --³èÎï  
 | 
        return attacker  
 | 
      
 | 
    else:  
 | 
        # ntElf ¶¨ÒåΪÈËÎïʹÓöԵسÖÐøÐÔ¼¼ÄÜ£¬²¢ÇÒÈËÎï¿ÉÒÔÒÆ¶¯£¬ÔòÐèÒªntElf×öÒÀÍÐÎïµÄÇé¿ö  
 | 
        # ÄÇôntElfÖ´ÐÐÈËÎïµÄÉ˺¦¼ÆËãºÍ±»¶¯´¥·¢Ð§¹û  
 | 
        attacker = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, attacker)  
 | 
        return attacker  
 | 
      
 | 
    return  
 | 
          
 | 
# ±»¶¯¼¼ÄܸıäÖµ  connSkill ÎªÖ÷¶¯Êͷż¼ÄÜ  
 | 
def GetPassiveSkillValueByTriggerType(attacker, defender, connSkill, triggerType):  
 | 
    attacker = FindRealAttacker(attacker)  
 | 
    if not attacker:  
 | 
        return 0  
 | 
      
 | 
    stopPassiveSkill = False   # ±»¶¯¼¼Äܲ»ÄÜÔÙ´¥·¢±»¶¯¼¼ÄÜ£¬µ«¿ÉÒÔ´¥·¢Ì츳¼¼ÄÜ  
 | 
    if connSkill and SkillCommon.isPassiveSkill(connSkill):  
 | 
        #GameWorld.DebugLog("±»¶¯¼¼Äܲ»ÄÜÔٴδ¥·¢±»¶¯¼¼ÄÜ")  
 | 
        #return 0  
 | 
        stopPassiveSkill = True  
 | 
          
 | 
    passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)  
 | 
    if not passiveEff:  
 | 
        return 0  
 | 
    connSkillID = connSkill.GetSkillTypeID() if connSkill else 0  
 | 
    skills = passiveEff.GetPassiveSkillsByTriggerType(triggerType, connSkillID)  
 | 
    if not skills:  
 | 
        return 0  
 | 
      
 | 
    # µ±Ç°Õ½¶·¹ØÏµ pvp pve  
 | 
    battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)  
 | 
    tick = GameWorld.GetGameWorld().GetTick()  
 | 
    curValue = 0  
 | 
  
 | 
    for skillTypeID, effectID in skills:  
 | 
        if connSkillID == skillTypeID:  
 | 
            continue  
 | 
        curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)  
 | 
        if not curSkill:  
 | 
            continue  
 | 
        if stopPassiveSkill and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_GiftSkill:  
 | 
            # Ö»ÓÐÌ츳²Å¿ÉÒÔÔٴα»´¥·¢  
 | 
            continue   
 | 
          
 | 
        if curSkill.GetCoolDownTime() and SkillCommon.RefreshSkillRemainTime(curSkill, tick):  
 | 
            #ÓÐÅäÖÃCDµÄ²ÅÅÐ¶Ï  
 | 
            continue  
 | 
          
 | 
        effect = SkillCommon.GetSkillEffectByEffectID(curSkill, effectID)  
 | 
        if not effect:  
 | 
            continue  
 | 
        skillBattleType = SkillCommon.GetSkillBattleType(curSkill)  
 | 
        if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):  
 | 
            continue  
 | 
          
 | 
        pyName = "PassiveSkill_%s" % effectID  
 | 
  
 | 
        callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "CheckCanHappen"))  
 | 
          
 | 
        # Ìõ¼þ²»Âú×ã  
 | 
        if callFunc and not callFunc(attacker, defender, effect, curSkill):  
 | 
            continue  
 | 
          
 | 
        callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "GetValue"))  
 | 
        if callFunc is None:  
 | 
            continue  
 | 
          
 | 
        curValue += callFunc(attacker, defender, effect)  
 | 
        if curSkill.GetCoolDownTime():  
 | 
            SkillCommon.SetSkillRemainTime(curSkill, 0, tick, attacker)  
 | 
          
 | 
    return curValue  
 | 
  
 | 
  
 | 
# È¡³öÊÜÓ°ÏìµÄ±»¶¯¼¼ÄÜ£¬Íⲿ´¦Àí  
 | 
def GetPassiveSkillByTriggerType(attacker, defender, connSkill, triggerType):  
 | 
    attacker = FindRealAttacker(attacker)  
 | 
    if not attacker:  
 | 
        return []  
 | 
    if connSkill and SkillCommon.isPassiveSkill(connSkill):  
 | 
        #GameWorld.DebugLog("±»¶¯¼¼Äܲ»ÄÜÔٴδ¥·¢±»¶¯¼¼ÄÜ")  
 | 
        return []  
 | 
    passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)  
 | 
    if not passiveEff:  
 | 
        return []  
 | 
    connSkillID = connSkill.GetSkillTypeID() if connSkill else 0  
 | 
    skills = passiveEff.GetPassiveSkillsByTriggerType(triggerType, connSkillID)  
 | 
    if not skills:  
 | 
        return []  
 | 
      
 | 
    # µ±Ç°Õ½¶·¹ØÏµ pvp pve  
 | 
    battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)  
 | 
    #tick = GameWorld.GetGameWorld().GetTick()  
 | 
    skillList = []  
 | 
    for skillTypeID, effectID in skills:  
 | 
        if connSkillID == skillTypeID:  
 | 
            continue  
 | 
        curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)  
 | 
        #if SkillCommon.RefreshSkillRemainTime(curSkill, tick):  
 | 
        #    continue  
 | 
        if not curSkill:  
 | 
            continue  
 | 
          
 | 
        effect = SkillCommon.GetSkillEffectByEffectID(curSkill, effectID)  
 | 
        if not effect:  
 | 
            continue  
 | 
        skillBattleType = SkillCommon.GetSkillBattleType(curSkill)  
 | 
        if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):  
 | 
            continue  
 | 
          
 | 
        pyName = "PassiveSkill_%s" % effectID  
 | 
          
 | 
        callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "CheckCanHappen"))  
 | 
          
 | 
        # Ìõ¼þ²»Âú×ã  
 | 
        if callFunc and not callFunc(attacker, defender, effect, curSkill):  
 | 
            continue  
 | 
          
 | 
        skillList.append(curSkill)  
 | 
          
 | 
    return skillList  
 | 
  
 | 
  
 | 
# ±»¶¯¼¼ÄÜ´¥·¢µ«ÎÞÐèÊÍ·Å£¬ÈçµÖÏûdebuff£¬Ö»Ðè×ßCD¼´¿É  
 | 
def OnPassiveSkillHappen(attacker, defender, connSkill, triggerType, tick):  
 | 
    attacker = FindRealAttacker(attacker)  
 | 
    if not attacker:  
 | 
        return  
 | 
    passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)  
 | 
    if not passiveEff:  
 | 
        return  
 | 
    connSkillID = connSkill.GetSkillTypeID() if connSkill else 0  
 | 
    skills = passiveEff.GetPassiveSkillsByTriggerType(triggerType, connSkillID)  
 | 
    if not skills:  
 | 
        return  
 | 
      
 | 
    defender = GetPassiveDefender(attacker, defender)  
 | 
          
 | 
    # µ±Ç°Õ½¶·¹ØÏµ pvp pve  
 | 
    battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)  
 | 
      
 | 
    for skillTypeID, effectID in skills:  
 | 
        if connSkillID == skillTypeID:  
 | 
            continue  
 | 
        curSkill = attacker.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)  
 | 
        if not curSkill:  
 | 
            continue  
 | 
          
 | 
        effect = SkillCommon.GetSkillEffectByEffectID(curSkill, effectID)  
 | 
        if not effect:  
 | 
            continue  
 | 
        if SkillCommon.RefreshSkillRemainTime(curSkill, tick):  
 | 
            continue  
 | 
        skillBattleType = SkillCommon.GetSkillBattleType(curSkill)  
 | 
        if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):  
 | 
            # PKģʽµÄÅж¨  
 | 
            continue  
 | 
              
 | 
        pyName = "PassiveSkill_%s" % effectID  
 | 
        callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "CheckCanHappen"))  
 | 
          
 | 
        if callFunc and not callFunc(attacker, defender, effect, curSkill, connSkill):  
 | 
            continue  
 | 
          
 | 
        SkillCommon.SetSkillRemainTime(curSkill, 0, tick, attacker)  
 | 
        SkillShell.DoLogic_UseEnhanceSkill(attacker, defender, curSkill, tick)  
 | 
          
 | 
        return True  
 | 
          
 | 
    return False  
 | 
  
 | 
  
 | 
# ±»¶¯¼¼ÄÜ´¥·¢µ«ÎÞÐèÊÍ·Å£¬ÈçµÖÏûdebuff£¬Ö»Ðè×ßCD¼´¿É  
 | 
def OnPassiveBuffHappen(attacker, defender, tagSkill, triggerType, tick):  
 | 
    attacker = FindRealAttacker(attacker)  
 | 
    if not attacker:  
 | 
        return False  
 | 
  
 | 
    passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)  
 | 
    if not passiveEff:  
 | 
        return False  
 | 
    buffDict = passiveEff.GetBuffsByTriggerType(triggerType)  
 | 
    if not buffDict:  
 | 
        return False  
 | 
      
 | 
    # µ±Ç°Õ½¶·¹ØÏµ pvp pve  
 | 
    battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)  
 | 
    skillBattleType = SkillCommon.GetSkillBattleType(tagSkill)  
 | 
    if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):  
 | 
        return  
 | 
  
 | 
    tagSkillID = tagSkill.GetSkillID() if tagSkill else 0  
 | 
      
 | 
    for skillID, effectList in buffDict.items():  
 | 
        if tagSkillID == skillID:  
 | 
            continue  
 | 
        for passiveEffect in effectList:  
 | 
            # ±»¶¯´¥·¢µÄ¼¼ÄÜ  
 | 
            pyName = "PassiveBuff_%s"%passiveEffect.GetEffectID()  
 | 
              
 | 
            callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "CheckCanHappen"))  
 | 
            if not callFunc:  
 | 
                continue  
 | 
              
 | 
            if not callFunc(attacker, defender, passiveEffect, tagSkill):  
 | 
                continue  
 | 
              
 | 
            callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "DoLogic"))  
 | 
            if callFunc:  
 | 
                callFunc(attacker, defender, passiveEffect, tagSkill, skillID)  
 | 
  
 | 
            return True  
 | 
          
 | 
    return False  
 | 
#------------------------BuffÀà ±»¶¯´¥·¢, ²¢·ÇÈ«ÊDZ»¶¯¼¼ÄÜ-----------------------------------------------  
 | 
  
 | 
#buffÀà´¥·¢Êͷż¼ÄÜ£¬ÎÞCDÑéÖ¤  
 | 
def OnPassiveBuffTrigger(attacker, defender, useSkill, triggerType, tick):  
 | 
    attacker = FindRealAttacker(attacker)  
 | 
    if not attacker:  
 | 
        return  
 | 
  
 | 
    stopPassiveSkill = False   # ±»¶¯¼¼Äܲ»ÄÜÔÙ´¥·¢±»¶¯¼¼ÄÜ£¬µ«¿ÉÒÔ´¥·¢Ì츳¼¼ÄÜ  
 | 
    if useSkill:  
 | 
        if not useSkill.GetFuncType():  
 | 
            # ·Ç¹¦ÄÜÀ༼ÄÜ£¬±ÜÃâËÀÑ»·  
 | 
            return  
 | 
        if SkillCommon.isPassiveSkill(useSkill):  
 | 
            #GameWorld.DebugLog("±»¶¯¼¼Äܲ»ÄÜÔٴδ¥·¢±»¶¯¼¼ÄÜ")  
 | 
            #return  
 | 
            stopPassiveSkill = True  
 | 
          
 | 
    if SkillCommon.GetUsingPassiveSkill(attacker):  
 | 
        # ·À·¶±»¶¯¼¼ÄÜ´¥·¢µÄ ·Ç±»¶¯¼¼ÄÜ  
 | 
        #GameWorld.DebugLog("±»¶¯¼¼Äܲ»ÄÜÔٴδ¥·¢±»¶¯¼¼ÄÜ---%s"%triggerType)  
 | 
        #return  
 | 
        stopPassiveSkill = True  
 | 
          
 | 
    passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)  
 | 
    if not passiveEff:  
 | 
        return  
 | 
      
 | 
    buffDict = passiveEff.GetBuffsByTriggerType(triggerType)  
 | 
    if not buffDict:  
 | 
        return  
 | 
  
 | 
    defender = GetPassiveDefender(attacker, defender)  
 | 
          
 | 
    # µ±Ç°Õ½¶·¹ØÏµ pvp pve  
 | 
    battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)  
 | 
    useSkillID = useSkill.GetSkillID() if useSkill else 0  
 | 
  
 | 
    for skillID, effectList in buffDict.items():  
 | 
        if skillID == useSkillID:  
 | 
            continue  
 | 
        for passiveEffect in effectList:  
 | 
            # ±»¶¯´¥·¢µÄ¼¼ÄÜ  
 | 
            pyName = "PassiveBuff_%s"%passiveEffect.GetEffectID()  
 | 
            curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)  
 | 
            if not curSkill:  
 | 
                continue  
 | 
            if stopPassiveSkill and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_GiftSkill:  
 | 
                # Ö»ÓÐÌ츳²Å¿ÉÒÔÔٴα»´¥·¢  
 | 
                continue   
 | 
            callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "CheckCanHappen"))  
 | 
            if not callFunc:  
 | 
                continue  
 | 
              
 | 
            if not callFunc(attacker, defender, passiveEffect, skillID, useSkill=useSkill):  
 | 
                continue  
 | 
              
 | 
            callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "GetSkillData"))  
 | 
            if not callFunc:  
 | 
                continue  
 | 
              
 | 
            skillData = callFunc(passiveEffect)  
 | 
            if not skillData:  
 | 
                continue  
 | 
  
 | 
            skillBattleType = SkillCommon.GetSkillBattleType(skillData)  
 | 
            if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):  
 | 
                # PKģʽµÄÅж¨  
 | 
                continue  
 | 
              
 | 
            SkillCommon.SetUsingPassiveSkill(attacker, 1)  
 | 
            if SkillShell.UsePassiveTriggerSkill(attacker, skillData, defender, tick):  
 | 
                AfterUsePassiveSkill(pyName, attacker, defender, passiveEffect, tick)  
 | 
            SkillCommon.SetUsingPassiveSkill(attacker, 0)  
 | 
  
 | 
def AfterUsePassiveSkill(pyName, attacker, defender, passiveEffect, tick):  
 | 
    # ¸½¼Ó´¥·¢ºóÂß¼  
 | 
    callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "AfterUsePassiveSkill"))  
 | 
    if not callFunc:  
 | 
        return  
 | 
    callFunc(attacker, defender, passiveEffect, tick)  
 | 
    return  
 | 
  
 | 
# buff Ó°ÏìµÄ(¹¥»÷)ÐÐΪֵ  
 | 
# ·µ»ØÊýÖµ  
 | 
def GetValueByPassiveBuffTriggerType(attacker, defender, useSkill, triggerType):  
 | 
    attacker = FindRealAttacker(attacker)  
 | 
    if not attacker:  
 | 
        return 0  
 | 
      
 | 
    stopPassiveSkill = False   # ±»¶¯¼¼Äܲ»ÄÜÔÙ´¥·¢±»¶¯¼¼ÄÜ£¬µ«¿ÉÒÔ´¥·¢Ì츳¼¼ÄÜ  
 | 
    if useSkill and SkillCommon.isPassiveSkill(useSkill):  
 | 
        #GameWorld.DebugLog("±»¶¯¼¼Äܲ»ÄÜÔٴδ¥·¢±»¶¯¼¼ÄÜ")  
 | 
        #return 0  
 | 
        stopPassiveSkill = True  
 | 
  
 | 
  
 | 
    passiveEff = GetPassiveEffManager().GetPassiveEff(attacker)  
 | 
    if not passiveEff:  
 | 
        return 0  
 | 
    buffDict = passiveEff.GetBuffsByTriggerType(triggerType)  
 | 
    if not buffDict:  
 | 
        return 0  
 | 
      
 | 
    # µ±Ç°Õ½¶·¹ØÏµ pvp pve  
 | 
    battleRelationType = AttackCommon.GetBattleRelationType(attacker, defender)  
 | 
    skillBattleType = SkillCommon.GetSkillBattleType(useSkill)  
 | 
    if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):  
 | 
        return 0  
 | 
      
 | 
    useSkillID = useSkill.GetSkillID() if useSkill else 0  
 | 
    #tick = GameWorld.GetGameWorld().GetTick()  
 | 
    curValue = 0  
 | 
      
 | 
    for skillID, effectList in buffDict.items():  
 | 
        if skillID == useSkillID:  
 | 
            continue  
 | 
        curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)  
 | 
        if not curSkill:  
 | 
            continue  
 | 
          
 | 
        for passiveEffect in effectList:  
 | 
            if stopPassiveSkill and curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_GiftSkill:  
 | 
                # Ö»ÓÐÌ츳²Å¿ÉÒÔÔٴα»´¥·¢  
 | 
                continue   
 | 
              
 | 
            # ±»¶¯´¥·¢µÄ¼¼ÄÜ  
 | 
            pyName = "PassiveBuff_%s"%passiveEffect.GetEffectID()  
 | 
              
 | 
            callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "CheckCanHappen"))  
 | 
            if not callFunc:  
 | 
                continue  
 | 
              
 | 
            # Ìõ¼þ²»Âú×ã  
 | 
            if not callFunc(attacker, defender, passiveEffect, skillID, useSkill=useSkill):  
 | 
                continue  
 | 
              
 | 
            callFunc = GameWorld.GetExecFunc(PassiveBuff, "%s.%s" % (pyName, "GetValue"))  
 | 
            if callFunc is None:  
 | 
                continue  
 | 
              
 | 
            # Èç±»¶¯¼¼ÄÜ£ºÇ§»ÃÚ¤Ñ×ÕæÊµÉ˺¦´Ó2±ä4±¶  
 | 
            curValue += GetPassiveSkillValueByTriggerType(attacker, defender, curSkill, ChConfig.TriggerType_PassiveBuffValue)  
 | 
            curValue += callFunc(attacker, defender, passiveEffect)  
 | 
              
 | 
    return curValue  
 | 
  
 | 
  
 | 
# ÒòΪҪ¼æÈݵ͵ȼ¶¼¼ÄÜ£¬ËùÒÔ¼¼ÄÜÖ»ÄÜÊÇÔÚÖúÕ½µÄʱºò£¬ÏÈɾ³ýÉñÊÞ¼¼ÄÜÔÙѧϰеÄÖúÕ½ÉñÊÞ¼¼ÄÜ  
 | 
def PlayerDogzSkill(curPlayer):  
 | 
  
 | 
    dogzSkills = [] # ÐèҪѧϰµÄ¼¼ÄÜ  
 | 
    ipyDataMgr = IpyGameDataPY.IPY_Data()  
 | 
    for i in xrange(ipyDataMgr.GetDogzCount()):  
 | 
        ipyData = ipyDataMgr.GetDogzByIndex(i)  
 | 
        if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_DogzFightState, i):  
 | 
            continue  
 | 
          
 | 
        dogzSkills.extend(ipyData.GetHelpBattleSkills())  
 | 
      
 | 
    delDogzSkills = [] # É¾³ý²»ÔÚÖúÕ½ÉñÊÞ¶ÓÁеļ¼ÄÜ  
 | 
    skillManager = curPlayer.GetSkillManager()  
 | 
    for i in xrange(skillManager.GetSkillCount()):  
 | 
        curSkill = skillManager.GetSkillByIndex(i)  
 | 
        if curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_Dogz:  
 | 
            continue  
 | 
        skillID = curSkill.GetSkillID()  
 | 
          
 | 
        delDogzSkills.append(skillID)  
 | 
          
 | 
    GameWorld.DebugLog("PlayerDogzSkill:%s - É¾³ý%s"%(dogzSkills, delDogzSkills))  
 | 
      
 | 
    # É¾³ýÉñÊÞ¼¼ÄÜ  
 | 
    for skillID in delDogzSkills:  
 | 
        skillManager.DeleteSkillBySkillID(skillID, False)  
 | 
      
 | 
    # Ìí¼ÓÖúÕ½¼¼ÄÜ£¬Í¬À༼ÄÜÈ¡×î¸ß  
 | 
    dogzSkills.sort()  
 | 
    for skillID in dogzSkills:  
 | 
        skillData = GameWorld.GetGameData().GetSkillBySkillID(skillID)  
 | 
        if not skillData:  
 | 
            continue  
 | 
        if skillData.GetSkillType() == ChConfig.Def_SkillType_AttrSkillNoLearn:  
 | 
            # Í¬¼¼Äܿɶà¸öµþ¼ÓµÄ¼¼Äܲ»ÄÜѧ£¬ËãÊôÐÔʱֱ½ÓÈ¡±í  
 | 
            continue  
 | 
          
 | 
        skillManager.LearnSkillByID(skillID, False)  
 | 
      
 | 
    # Ë¢±»¶¯Ð§¹û  
 | 
    GetPassiveEffManager().RegistPassiveEffDogz(curPlayer)  
 | 
    return  
 | 
  
 | 
  
 | 
# »ñÈ¡ÖúÕ½ÉñÊ޵ļ¼ÄÜÁÐ±í  
 | 
def FindDogzBattleSkills(gameObj):  
 | 
    skills = []  
 | 
    if gameObj.GetGameObjType() != IPY_GameWorld.gotPlayer:  
 | 
        return skills  
 | 
      
 | 
    skillManager = gameObj.GetSkillManager()  
 | 
    for i in xrange(skillManager.GetSkillCount()):  
 | 
        curSkill = skillManager.GetSkillByIndex(i)  
 | 
        if not curSkill:  
 | 
            continue  
 | 
          
 | 
        if curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_Dogz:  
 | 
            continue  
 | 
        skills.append(curSkill)  
 | 
          
 | 
    return skills  
 |