ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_Attr.py
@@ -15,23 +15,41 @@
#"""Version = 2025-09-16 14:30"""
#-------------------------------------------------------------------------------
import GameWorld
def GetHappenValue(attacker, defender, curEffect, effSkill, effBuff, **skillkwargs):
    
    checkInStateList = curEffect.GetEffectValue(2)
    if checkInStateList:
        if not defender.CheckInState(checkInStateList):
            return
    onlyOwner = curEffect.GetEffectValue(3) # 是否仅对buff施法者有效,默认0-否,1-是
    if onlyOwner:
        if not effBuff:
            return
        if effBuff.GetOwnerID() != defender.GetID():
            return
    attrID = curEffect.GetEffectID()
    attrValue = curEffect.GetEffectValue(0)
    calcType = curEffect.GetEffectValue(1)
    if calcType == 2: # 减少,其他默认增加
        attrValue = -attrValue
    # 10-根据对方buff层级增加
    if calcType == 10:
        buffStateList = curEffect.GetEffectValue(2)
        maxValue = curEffect.GetEffectValue(3) # 累计最高增加值
        layerTotal = 0
        buffMgr = defender.GetBuffManager()
        for buffState in buffStateList:
            for buff in buffMgr.FindBuffListByState(buffState):
                layerTotal += max(1, buff.GetLayer())
        attrValue *= layerTotal
        if maxValue and attrValue > maxValue:
            attrValue = maxValue
        GameWorld.DebugLog("按对方buff层级增加属性: attrID=%s,attrValue=%s,buffStateList=%s,layerTotal=%s,maxValue=%s"
                           % (attrID, attrValue, buffStateList, layerTotal, maxValue))
    else:
        checkInStateList = curEffect.GetEffectValue(2)
        if checkInStateList:
            if not defender.CheckInState(checkInStateList):
                return
        onlyOwner = curEffect.GetEffectValue(3) # 是否仅对buff施法者有效,默认0-否,1-是
        if onlyOwner:
            if not effBuff:
                return
            if effBuff.GetOwnerID() != defender.GetID():
                return
        if calcType == 2: # 减少,其他默认增加
            attrValue = -attrValue
    return attrValue