#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package Skill.PassiveTrigger.PassiveEff_5004
|
#
|
# @todo:¸ÅÂÊËæ»úÒÆ³ýËæ»úÄ¿±êÉíÉÏijÖÖbuff
|
# @author hxp
|
# @date 2025-09-23
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: ¸ÅÂÊËæ»úÒÆ³ýËæ»úÄ¿±êÉíÉÏijÖÖbuff
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2025-09-23 18:30"""
|
#-------------------------------------------------------------------------------
|
|
import ChConfig
|
import BattleObj
|
import GameWorld
|
import TurnBuff
|
import random
|
|
def DoSkillEffectLogic(turnFight, batObj, tagObj, effSkill, curEffect, connSkill, connBuff, **kwargs):
|
# buff¼¼ÄÜÀàÐÍ ÒÆ³ý¸öÊý£¬0Ϊȫ²¿ µÐÓÑ£¬1-µÐ·½£»2-ÓÑ·½ Ëæ»úÄ¿±ê¸öÊý ¸ÅÂÊ
|
skillType = curEffect.GetEffectValue(0) # buff¼¼ÄÜÀàÐÍ
|
delBuffCnt = curEffect.GetEffectValue(1) # ÒÆ³ý¸öÊý£¬0Ϊȫ²¿
|
isFriend = curEffect.GetEffectValue(2) # µÐÓÑ£¬0-µÐ·½£»1-ÓÑ·½
|
delObjCnt = curEffect.GetEffectValue(3) # Ëæ»úÄ¿±ê¸öÊý
|
rate = curEffect.GetEffectValue(4) # ¸ÅÂÊ
|
if not GameWorld.CanHappen(rate):
|
return
|
|
faction = batObj.GetFaction()
|
lineupNum = batObj.GetLineupNum()
|
if isFriend:
|
tagFaction = faction
|
else:
|
tagFaction = ChConfig.Def_FactionB if faction == ChConfig.Def_FactionA else ChConfig.Def_FactionA
|
|
batFaction = turnFight.getBatFaction(tagFaction)
|
batLineup = batFaction.getBatlineup(lineupNum)
|
|
objBuffList = []
|
batObjMgr = BattleObj.GetBatObjMgr()
|
for objID in batLineup.posObjIDDict.values():
|
tagObj = batObjMgr.getBatObj(objID)
|
if not tagObj:
|
continue
|
|
buffList = []
|
buffMgr = tagObj.GetBuffManager()
|
for index in range(buffMgr.GetBuffCount()):
|
buff = buffMgr.GetBuffByIndex(index)
|
skillData = buff.GetSkillData()
|
if skillData.GetSkillType() != skillType:
|
continue
|
buffList.append(buff)
|
|
if buffList:
|
objBuffList.append([tagObj, buffList])
|
|
GameWorld.DebugLog("¸ÅÂÊËæ»úÒÆ³ýËæ»úÄ¿±êÉíÉÏijÖÖbuff: skillType=%s,objLen=%s" % (skillType, len(objBuffList)))
|
if not objBuffList:
|
return
|
|
if delObjCnt < len(objBuffList):
|
random.shuffle(objBuffList) # Ëæ»úÄ¿±ê
|
objBuffList = objBuffList[:delObjCnt]
|
|
for tagObj, buffList in objBuffList:
|
GameWorld.DebugLog("Ä¿±êÉíÉÏijÖÖÀàÐÍbuff¸öÊý: tagID=%s,buffLen=%s" % (tagObj.GetID(), len(buffList)))
|
if not buffList:
|
continue
|
|
if delBuffCnt > len(buffList):
|
random.shuffle(buffList) # Ëæ»úbuff
|
buffList = buffList[:delBuffCnt]
|
|
for buff in buffList:
|
GameWorld.DebugLog(" Ëæ»úÒÆ³ýbuff: tagID=%s,buffID=%s" % (tagObj.GetID(), buff.GetBuffID()))
|
TurnBuff.DoBuffDel(turnFight, tagObj, buff)
|
|
return True
|