using Cthangover.Core.Actions;
namespace Cthangover.Core.Battle
{
///
/// Selects which battle core (combat ruleset) the next battle will use.
/// The "core" variable maps to a entry by
/// string ID. Must be called before a battle starts, as
/// reads the active core at initialization time.
///
public class BattleSetCoreAction : IScenarioAction
{
///
/// Registered as "battle.set_core" — selects the combat ruleset
/// for the next battle encounter. If "core" is empty or missing, logs a
/// warning and returns without modifying the registry.
///
public string Name => "battle.set_core";
///
/// Reads the "core" variable and sets it as the active battle core
/// via . The core determines
/// combat mechanics (turn order, ability system, etc.) for the
/// next initiated battle.
///
public void Run(IActionContext ctx)
{
var core = ctx.GetParam("core");
if (string.IsNullOrEmpty(core))
{
ctx.Log("EVENT", "BattleSetCoreAction: missing 'core' variable");
return;
}
BattleCoreRegistry.Instance.SetActive(core);
ctx.Log("EVENT", $"BattleSetCoreAction: battle core set to '{core}'");
}
}
}