Files
Cielonos/Assets/Scripts/MainGame/Characters/Base/Subcontrollers/Reaction/ReactionSubcontroller.cs
SoulliesOfficial 8ad26129b2 Feel滚
2026-04-29 06:16:07 -04:00

91 lines
3.4 KiB
C#

using System.Collections.Generic;
using SLSUtilities.General;
using UnityEngine;
namespace Cielonos.MainGame.Characters
{
public partial class ReactionSubcontroller : SubcontrollerBase<CharacterBase>
{
public Dictionary<BreakthroughType, bool> originalBreakthroughResistances;
public Dictionary<BreakthroughType, CompoundBool> breakthroughResistances;
public DodgeSubmodule dodgeSm;
public BlockSubmodule blockSm;
public ReflectionSubmodule reflectionSm;
public override void Initialize()
{
base.Initialize();
originalBreakthroughResistances = new Dictionary<BreakthroughType, bool>()
{
{ BreakthroughType.None, true },
{ BreakthroughType.Weak, true },
{ BreakthroughType.Medium, false },
{ BreakthroughType.Heavy, false },
{ BreakthroughType.Disruption, false },
{ BreakthroughType.Forced, false },
{ BreakthroughType.Unstoppable, false },
};
breakthroughResistances = new Dictionary<BreakthroughType, CompoundBool>()
{
{ BreakthroughType.None, new CompoundBool(true) },
{ BreakthroughType.Weak, new CompoundBool(true) },
{ BreakthroughType.Medium, new CompoundBool(false) },
{ BreakthroughType.Heavy, new CompoundBool(false) },
{ BreakthroughType.Disruption, new CompoundBool(false) },
{ BreakthroughType.Forced, new CompoundBool(false) },
{ BreakthroughType.Unstoppable, new CompoundBool(false) },
};
dodgeSm = new DodgeSubmodule(this);
blockSm = new BlockSubmodule(this);
reflectionSm = new ReflectionSubmodule(this);
}
public void Update()
{
if (owner.statusSm.isDead)
{
return;
}
dodgeSm.Update();
blockSm.Update();
reflectionSm.Update();
}
}
public partial class ReactionSubcontroller
{
public void InitializeResistances(EnemyRank enemyRank)
{
if (enemyRank == EnemyRank.Nexus || enemyRank == EnemyRank.Core)
{
originalBreakthroughResistances[BreakthroughType.Medium] = true;
originalBreakthroughResistances[BreakthroughType.Heavy] = true;
originalBreakthroughResistances[BreakthroughType.Disruption] = true;
breakthroughResistances[BreakthroughType.Medium] = new CompoundBool(true);
breakthroughResistances[BreakthroughType.Heavy] = new CompoundBool(true);
breakthroughResistances[BreakthroughType.Disruption] = new CompoundBool(true);
}
}
public void ModifyResistances(bool isResistant, int priority, params BreakthroughType[] types)
{
foreach (BreakthroughType type in types)
{
breakthroughResistances[type].Modify(isResistant, priority);
}
}
public void ModifyResistances(bool isResistant, int priority, List<BreakthroughType> types)
{
foreach (BreakthroughType type in types)
{
breakthroughResistances[type].Modify(isResistant, priority);
}
}
}
}