1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package Skill.PassiveTrigger.PassiveEff_5022
#
# @todo:¶îÍâÔö¼Ó/¼õÉÙbuffЧ¹ûID/ÊôÐÔIDÖµ
# @author hxp
# @date 2025-10-30
# @version 1.0
#
# ÏêϸÃèÊö: ¶îÍâÔö¼Ó/¼õÉÙbuffЧ¹ûID/ÊôÐÔIDÖµ
#
#-------------------------------------------------------------------------------
#"""Version = 2025-10-30 16:00"""
#-------------------------------------------------------------------------------
 
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
            onlyAlive = calcRule[2] if len(calcRule) > 2 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 onlyAlive and not batObj.IsAlive():
                    continue
                countryCnt += 1
            calcLayer = countryCnt
            GameWorld.DebugLogEx("°´ÓÑ·½Ä³¸ö¹ú¼ÒÎ佫Êý¼ÆËã¶îÍâbuffÊôÐÔ: ruleType=%s,country=%s,countryCnt=%s,onlyAlive=%s", ruleType, country, countryCnt, onlyAlive)
        # 101 - ½ö¶ÔÖ¸¶¨ÐÔ±ðÓÐЧ  ²ÎÊý1£ºÐÔ±ð
        elif ruleType == 101:
            onlySex = calcRule[1] if len(calcRule) > 1 else 0
            if tagObj.GetSex() != onlySex:
                GameWorld.DebugLogEx("5022¶îÍâbuff¶Ô¸ÃÐÔ±ðÎÞЧ: ruleType=%s,onlySex=%s,tagSex=%s,tagID=%s", ruleType, onlySex, tagObj.GetSex(), tagObj.GetID())
                return
            
    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