ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/PassiveTrigger/PassiveEff_5022.py
@@ -16,14 +16,43 @@
#-------------------------------------------------------------------------------
import GameWorld
import BattleObj
def DoSkillEffectLogic(turnFight, batObj, tagObj, effSkill, curEffect, connSkill, connBuff, **kwargs):
    effEx1 = curEffect.GetEffectValue(0) # 支持多个属性
    effEx2 = curEffect.GetEffectValue(1) # 支持多个属性
    calcRule = curEffect.GetEffectValue(2) # 附加计算规则,没配置默认增加固定值
    calcLayer = 1 # 没配置的默认1层,相当于固定值
    if calcRule:
        ruleType = calcRule[0]
        # 100 - 按友方某个国家武将数  参数1:国家
        if ruleType == 100:
            country = calcRule[1] if len(calcRule) > 1 else 0
            batLineup = batObj.GetBatLineup()
            countryCnt = 0
            batObjMgr = BattleObj.GetBatObjMgr()
            for objID in batLineup.posObjIDDict.values():
                batObj = batObjMgr.getBatObj(objID)
                if not batObj:
                    continue
                if batObj.GetCountry() != country:
                    continue
                #if batObj.IsAlive(): # 死亡也算
                #    continue
                countryCnt += 1
            calcLayer = countryCnt
            GameWorld.DebugLogEx("按友方某个国家武将数计算额外buff属性: ruleType=%s,country=%s,countryCnt=%s", ruleType, country, countryCnt)
    if calcLayer <= 0:
        return
    for effEX in [effEx1, effEx2]:
        if not isinstance(effEX, list) or len(effEX) != 3:
            continue
        attrID, attrValue, calcType = effEX
        if calcLayer > 1:
            attrValue = int(attrValue * calcLayer)
        GameWorld.DebugLogEx("额外buff效果ID/属性ID值: attrID=%s,attrValue=%s,calcType=%s", attrID, attrValue, calcType)
        connBuff.AddEffectValueEx(attrID, attrValue, calcType)
    return True