2025-12-13 23:28:23 -05:00
|
|
|
using System.Collections.Generic;
|
2025-10-03 00:02:43 -04:00
|
|
|
using System.Linq;
|
|
|
|
|
using Continentis.MainGame.Card;
|
|
|
|
|
using Continentis.MainGame.Character;
|
2025-11-10 12:57:04 -05:00
|
|
|
using SLSFramework.General;
|
2025-10-03 00:02:43 -04:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace Continentis.MainGame.Card
|
|
|
|
|
{
|
2025-10-24 09:11:22 -04:00
|
|
|
public partial class CardCombatBuffBase : CardBuffBase
|
2025-10-03 00:02:43 -04:00
|
|
|
{
|
|
|
|
|
public CardLogicBase sourceCard;
|
|
|
|
|
|
|
|
|
|
public CountSubmodule combatActionTimeSubmodule;
|
|
|
|
|
public CountSubmodule combatRoundTimeSubmodule;
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-24 09:11:22 -04:00
|
|
|
public partial class CardCombatBuffBase
|
2025-10-03 00:02:43 -04:00
|
|
|
{
|
2025-11-15 12:17:34 -05:00
|
|
|
public sealed override bool OnBuffApply(out BuffBase<CardInstance> existingBuff)
|
2025-10-03 00:02:43 -04:00
|
|
|
{
|
|
|
|
|
throw new System.NotImplementedException("请使用类型约束更强的OnBuffApply方法");
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-24 09:11:22 -04:00
|
|
|
public virtual bool OnBuffApply(out CardCombatBuffBase existingBuff)
|
2025-10-03 00:02:43 -04:00
|
|
|
{
|
|
|
|
|
throw new System.NotImplementedException(); //需要在子类中实现
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnAfterFirstApply()
|
|
|
|
|
{
|
2025-11-01 06:13:58 -04:00
|
|
|
|
|
|
|
|
}
|
2025-10-03 00:02:43 -04:00
|
|
|
|
|
|
|
|
public override void OnBuffRemove()
|
|
|
|
|
{
|
2025-11-10 12:57:04 -05:00
|
|
|
//attachedCard.combatBuffSubmodule.buffList.For(buff => buff.eventSubmodule.onOtherBuffRemoved.Invoke(this));
|
2025-10-03 00:02:43 -04:00
|
|
|
attributeSubmodule?.RefreshAllModifiedAttributes();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void OnUsage()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void OnRoundStart()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void OnRoundEnd()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void OnActionStart()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void OnActionEnd()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-24 09:11:22 -04:00
|
|
|
public partial class CardCombatBuffBase
|
2025-10-03 00:02:43 -04:00
|
|
|
{
|
2025-11-01 06:13:58 -04:00
|
|
|
protected bool FindExistingSameBuff<T>(out T existingBuff) where T : CardBuffBase
|
2025-10-03 00:02:43 -04:00
|
|
|
{
|
2025-12-13 23:28:23 -05:00
|
|
|
bool result = FindExistingSameBuffs(out List<T> existingBuffs, attachedCard.combatBuffSubmodule.buffList);
|
|
|
|
|
existingBuff = result ? existingBuffs[0] : null;
|
|
|
|
|
return result;
|
2025-10-03 00:02:43 -04:00
|
|
|
}
|
|
|
|
|
|
2025-11-15 12:17:34 -05:00
|
|
|
public override void Apply(CardInstance attachedCard, CharacterBase sourceCharacter = null)
|
2025-10-03 00:02:43 -04:00
|
|
|
{
|
|
|
|
|
this.Apply(attachedCard, sourceCharacter, null);
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-15 12:17:34 -05:00
|
|
|
public void Apply(CardInstance attachedCard, CharacterBase sourceCharacter = null, CardLogicBase sourceCard = null)
|
2025-10-03 00:02:43 -04:00
|
|
|
{
|
|
|
|
|
this.attachedCard = attachedCard;
|
|
|
|
|
this.sourceCharacter = sourceCharacter;
|
|
|
|
|
this.sourceCard = sourceCard;
|
|
|
|
|
|
2025-10-24 09:11:22 -04:00
|
|
|
if (OnBuffApply(out CardCombatBuffBase existingBuff))
|
2025-10-03 00:02:43 -04:00
|
|
|
{
|
|
|
|
|
this.attachedCard.combatBuffSubmodule.buffList.Add(this);
|
|
|
|
|
OnAfterFirstApply();
|
|
|
|
|
}
|
2025-11-01 06:13:58 -04:00
|
|
|
|
|
|
|
|
attributeSubmodule?.RefreshAllModifiedAttributes();
|
2025-11-08 09:50:55 -05:00
|
|
|
attachedCard.contentSubmodule.dirtyMark = true;
|
|
|
|
|
|
2025-11-01 06:13:58 -04:00
|
|
|
Debug.Log(base.attachedCard.contentSubmodule.interpretedFunctionText);
|
2025-10-03 00:02:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Remove()
|
|
|
|
|
{
|
|
|
|
|
OnBuffRemove();
|
2025-11-10 12:57:04 -05:00
|
|
|
attachedCard.combatBuffSubmodule.buffList.Remove(this);
|
|
|
|
|
//attachedCard.combatBuffSubmodule.buffList.Exclude(this).For(buff => buff.eventSubmodule?.onOtherBuffRemoved.Invoke(this));
|
2025-10-03 00:02:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void UntriggerRemove()
|
|
|
|
|
{
|
|
|
|
|
this.attachedCard.combatBuffSubmodule.buffList.Remove(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|