2025-10-30 12:07:59 -04:00
|
|
|
|
using System.Collections.Generic;
|
2025-10-25 07:49:39 -04:00
|
|
|
|
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
|
|
|
|
|
|
{
|
2025-10-30 12:07:59 -04:00
|
|
|
|
public List<Protecting> protectingSources;
|
2025-10-25 07:49:39 -04:00
|
|
|
|
|
2025-10-30 12:07:59 -04:00
|
|
|
|
public Protected()
|
2025-10-25 07:49:39 -04:00
|
|
|
|
{
|
|
|
|
|
|
Initialize(BuffType.Neutral, BuffDispelLevel.DeathOnly, 100);
|
|
|
|
|
|
|
2025-10-31 10:02:30 -04:00
|
|
|
|
this.protectingSources = new List<Protecting>();
|
|
|
|
|
|
|
|
|
|
|
|
this.statusSubmodule = new StatusSubmodule(this, StatusType.Protected);
|
|
|
|
|
|
|
2025-10-30 12:07:59 -04:00
|
|
|
|
this.contentSubmodule = new ContentSubmodule(this);//TODO: 以后增加角色的ContentSubmodule
|
2025-10-25 07:49:39 -04:00
|
|
|
|
|
|
|
|
|
|
this.iconSubmodule = new IconSubmodule(this).SetTextFunctions();
|
|
|
|
|
|
|
|
|
|
|
|
this.eventSubmodule = new EventSubmodule(this);
|
2025-10-30 12:07:59 -04:00
|
|
|
|
/*
|
|
|
|
|
|
this.eventSubmodule.onOpponentDecideAction.Add("Protected",
|
2025-10-25 07:49:39 -04:00
|
|
|
|
new EventUnit<CharacterBase, IntendedCard, CharacterBase>((opponent, intendedCard, originalTarget) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
if (opponent is CombatNPC npc)
|
|
|
|
|
|
{
|
|
|
|
|
|
intendedCard.targets.Remove(originalTarget);
|
2025-10-30 12:07:59 -04:00
|
|
|
|
//intendedCard.targets.Add(protector); //TODO: 后续用设计专门的函数决定目标改变
|
2025-10-25 07:49:39 -04:00
|
|
|
|
}
|
|
|
|
|
|
}));
|
2025-10-30 12:07:59 -04:00
|
|
|
|
*/
|
2025-10-25 07:49:39 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
|
|
|
|
|
|
{
|
|
|
|
|
|
MainGameManager.Instance.basePrefabs.GenerateInfoText(contentSubmodule.displayName, attachedCharacter.characterView);
|
2025-10-31 10:02:30 -04:00
|
|
|
|
|
|
|
|
|
|
if (attachedCharacter.combatBuffSubmodule.TryGetBuffs(out List<Protecting> conflictProtectings))
|
|
|
|
|
|
{
|
|
|
|
|
|
//如果目标正在保护其他角色时,被保护,则应当将目标的所有Protecting Buff移除,以防止冲突.
|
|
|
|
|
|
Debug.Log($"Conflicted Protecting buffs found, count: {conflictProtectings.Count}. Removing all.");
|
|
|
|
|
|
conflictProtectings.For(cp => cp.Remove());
|
|
|
|
|
|
}
|
2025-10-25 07:49:39 -04:00
|
|
|
|
|
|
|
|
|
|
if (FindExistingSameBuff(out existingBuff))
|
|
|
|
|
|
{
|
2025-10-30 12:07:59 -04:00
|
|
|
|
return false;
|
2025-10-25 07:49:39 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|