Files
Cielonos/Assets/Scripts/MainGame/Characters/Base/Subcontrollers/Reaction/ReactionSubcontroller.cs
SoulliesOfficial 649b7a5ddc 更新
2026-05-23 08:27:50 -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<Breakthrough.Type, bool> originalBreakthroughResistances;
public Dictionary<Breakthrough.Type, CompoundBool> breakthroughResistances;
public DodgeSubmodule dodgeSm;
public BlockSubmodule blockSm;
public ReflectionSubmodule reflectionSm;
public override void Initialize()
{
base.Initialize();
originalBreakthroughResistances = new Dictionary<Breakthrough.Type, bool>()
{
{ Breakthrough.Type.None, true },
{ Breakthrough.Type.Weak, true },
{ Breakthrough.Type.Medium, false },
{ Breakthrough.Type.Heavy, false },
{ Breakthrough.Type.Disruption, false },
{ Breakthrough.Type.Forced, false },
{ Breakthrough.Type.Unstoppable, false },
};
breakthroughResistances = new Dictionary<Breakthrough.Type, CompoundBool>()
{
{ Breakthrough.Type.None, new CompoundBool(true) },
{ Breakthrough.Type.Weak, new CompoundBool(true) },
{ Breakthrough.Type.Medium, new CompoundBool(false) },
{ Breakthrough.Type.Heavy, new CompoundBool(false) },
{ Breakthrough.Type.Disruption, new CompoundBool(false) },
{ Breakthrough.Type.Forced, new CompoundBool(false) },
{ Breakthrough.Type.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[Breakthrough.Type.Medium] = true;
originalBreakthroughResistances[Breakthrough.Type.Heavy] = true;
originalBreakthroughResistances[Breakthrough.Type.Disruption] = true;
breakthroughResistances[Breakthrough.Type.Medium] = new CompoundBool(true);
breakthroughResistances[Breakthrough.Type.Heavy] = new CompoundBool(true);
breakthroughResistances[Breakthrough.Type.Disruption] = new CompoundBool(true);
}
}
public void ModifyResistances(bool isResistant, int priority, params Breakthrough.Type[] types)
{
foreach (Breakthrough.Type type in types)
{
breakthroughResistances[type].Modify(isResistant, priority);
}
}
public void ModifyResistances(bool isResistant, int priority, List<Breakthrough.Type> types)
{
foreach (Breakthrough.Type type in types)
{
breakthroughResistances[type].Modify(isResistant, priority);
}
}
}
}