Files
Continentis/Assets/Mods/Basic/Characters/CombatBuffs/General/Protected.cs
2025-10-25 07:49:39 -04:00

49 lines
1.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Continentis.MainGame;
using Continentis.MainGame.Character;
using Continentis.MainGame.Combat;
using SLSFramework.General;
using UnityEngine;
namespace Continentis.Mods.Basic.Buffs
{
public class Protected : CharacterCombatBuffBase
{
public CharacterBase protector;
public Protecting protectingBuff;
public Protected(CharacterBase protector)
{
Initialize(BuffType.Neutral, BuffDispelLevel.DeathOnly, 100);
SetIdentification(protector.elementID.ToString());
this.protector = protector;
this.contentSubmodule = new ContentSubmodule(this)
.AddParameterGetter("Protector", () => protector.data.displayName);//TODO: 以后增加角色的ContentSubmodule
this.iconSubmodule = new IconSubmodule(this).SetTextFunctions();
this.eventSubmodule = new EventSubmodule(this);
this.eventSubmodule.onOpponentDecideAction.Add("Protected",
new EventUnit<CharacterBase, IntendedCard, CharacterBase>((opponent, intendedCard, originalTarget) =>
{
if (opponent is CombatNPC npc)
{
intendedCard.targets.Remove(originalTarget);
intendedCard.targets.Add(protector); //TODO: 后续用设计专门的函数决定目标改变
}
}));
}
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
{
MainGameManager.Instance.basePrefabs.GenerateInfoText(contentSubmodule.displayName, attachedCharacter.characterView);
if (FindExistingSameBuff(out existingBuff))
{
return true; //独立处理直接返回true
}
return true;
}
}
}