继续搞点新机制

This commit is contained in:
SoulliesOfficial
2025-10-25 07:49:39 -04:00
parent 76157e3cb1
commit bb9aea5f43
118 changed files with 1521 additions and 6760 deletions

View File

@@ -0,0 +1,54 @@
using Continentis.MainGame;
using Continentis.MainGame.Character;
using UnityEngine;
namespace Continentis.Mods.Basic.Buffs
{
public class Protecting : CharacterCombatBuffBase
{
public CharacterBase target;
public Protected protectedBuff;
public Protecting(CharacterBase target, int actionCount, Protected protectedBuff = null)
{
Initialize(BuffType.Neutral, BuffDispelLevel.DeathOnly, 100);
this.target = target;
this.protectedBuff = protectedBuff;
if (this.protectedBuff == null)
{
Debug.LogError("Protecting buff requires a Protected buff on the target.");
}
this.contentSubmodule = new ContentSubmodule(this)
.AddParameterGetter("Count", () => combatRoundTimeSubmodule.remainingCount.ToString())
.AddParameterGetter("Target", () => target.data.displayName);//TODO: 以后增加角色的ContentSubmodule
this.iconSubmodule = new IconSubmodule(this).SetTextFunctions("Count");
this.combatRoundTimeSubmodule = new CountSubmodule(this, actionCount);
this.eventSubmodule = new EventSubmodule(this);
}
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
{
this.protectedBuff ??= target.combatBuffSubmodule.GetBuff<Protected>(attachedCharacter.elementID.ToString());
this.protectedBuff.protectingBuff = this;
MainGameManager.Instance.basePrefabs.GenerateInfoText(contentSubmodule.displayName, attachedCharacter.characterView);
if (FindExistingSameBuff(out existingBuff))
{
return true; //独立处理直接返回true
}
return true;
}
public override void OnBuffRemove()
{
base.OnBuffRemove();
protectedBuff?.OnBuffRemove();
}
}
}