#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
#  
 | 
# @todo: ÑªÁ¿»¤¶Ü£¨¹¥»÷£©    806    »¤¶ÜÖµ¹¥»÷Á¦µÄ°Ù·Ö±È  
 | 
#  
 | 
# @author: Alee  
 | 
# @date 2018-1-30 ÏÂÎç05:11:45  
 | 
# @version 1.0  
 | 
#  
 | 
# @note:   
 | 
#  
 | 
#---------------------------------------------------------------------  
 | 
  
 | 
import ChConfig  
 | 
import GameWorld  
 | 
import SkillCommon  
 | 
  
 | 
def CheckCanHappen(attacker, defender, passiveEffect, skillID, **skillkwargs):  
 | 
  
 | 
    curSkill = GameWorld.GetGameData().GetSkillBySkillID(skillID)  
 | 
    if not curSkill:  
 | 
        return False  
 | 
      
 | 
    buffType = SkillCommon.GetBuffType(curSkill)  
 | 
    buffTuple = SkillCommon.GetBuffManagerByBuffType(attacker, buffType)  
 | 
    #ͨ¹ýÀàÐÍ»ñȡĿ±êµÄbuff¹ÜÀíÆ÷Ϊ¿Õ£¬ÔòÌø³ö  
 | 
    if buffTuple == ():  
 | 
        return False  
 | 
      
 | 
    buffManager = buffTuple[0]  
 | 
    buff = buffManager.FindBuff(skillID)  
 | 
    if not buff:  
 | 
        return False  
 | 
      
 | 
    buffValue = buff.GetValue()  
 | 
    if buffValue == 0:  
 | 
        return False  
 | 
      
 | 
    hurtValue = attacker.GetDictByKey(ChConfig.Def_PlayerKey_BloodShiledHurt)  
 | 
    if hurtValue == 0:  
 | 
        return False  
 | 
      
 | 
    buff.SetValue(max(buffValue - hurtValue, 0))  
 | 
    attacker.SetDict(ChConfig.Def_PlayerKey_BloodShiledHurt, max(hurtValue - buffValue, 0))  
 | 
      
 | 
    if buff.GetValue() == 0:  
 | 
        buff.SetRemainTime(0)  
 | 
    return True  
 | 
  
 | 
  
 | 
def GetValue(attacker, defender, passiveEffect):  
 | 
    return 1  
 | 
  
 |