From daec67f350f20f3a2bc0e4051c8a15389bbe5be4 Mon Sep 17 00:00:00 2001 From: iisaev Date: Wed, 21 Oct 2026 13:22:18 +0200 Subject: [PATCH] Scenario action party.add Lets a game without C# give the player a character from a scenario. --- src/Actions/PartyAddAction.cs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/Actions/PartyAddAction.cs diff --git a/src/Actions/PartyAddAction.cs b/src/Actions/PartyAddAction.cs new file mode 100644 index 0000000..873d600 --- /dev/null +++ b/src/Actions/PartyAddAction.cs @@ -0,0 +1,29 @@ +using Cthangover.Core.Actions; + +namespace Cthangover.Mods.Characters +{ + /// + /// action party.add id=hero — puts a character template into the + /// player's party and battle set. Lets a game without C# give the player + /// their starting party from its first scenario (a new game resets the + /// party and replays that scenario). A character already in the roster keeps + /// their level and health and only returns to the battle set. + /// + public class PartyAddAction : IScenarioAction + { + /// DSL name. + public string Name => "party.add"; + + /// Reads id and adds the character. + public void Run(IActionContext ctx) + { + var id = ctx.GetParam("id"); + if (string.IsNullOrWhiteSpace(id)) + { + ctx.LogWarning("EVENT", "party.add: missing 'id'"); + return; + } + ctx.Character.AddToParty(id.Trim()); + } + } +}