Action Upgrade System (#22277)

* Adds uses before delay so actions can be used multiple times before cooldown

* adds methods to get remaining charges, to set uses before delay, and to set use delay

* adds method to change action name

* moves set usedelay

* action upgrade ECS

* adds method to reset remaining uses

* adds upgrade events

* refactors action upgrade event and adds logic to parse it

* fix serialization issue

* adds level up draft method

* adds action commands and a command to upgrade an action

* more warning lines to help

* Gets action to upgrade properly

* Removes unneeded fields from the action upgrade component and now properly raises the level of the new action

* Cleans up dead code and comments

* Fixes punctuation in actions-commands and adds a TryUpgradeAction method.

* removes TODO comment

* robust fix

* removes RT

* readds RT

* update RT to 190

* removes change name method

* removes remaining uses & related fields and adds that functionality to charges

* Adds Charges to action tooltips that require it
This commit is contained in:
keronshb
2023-12-15 04:41:44 -05:00
committed by GitHub
parent 39cda517a5
commit 2d692f47da
14 changed files with 438 additions and 5 deletions

View File

@@ -171,7 +171,7 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
// Is the action currently valid?
if (!action.Enabled
|| action.Charges is 0
|| action is { Charges: 0, RenewCharges: false }
|| action.Cooldown.HasValue && action.Cooldown.Value.End > _timing.CurTime)
{
// The user is targeting with this action, but it is not valid. Maybe mark this click as

View File

@@ -191,6 +191,12 @@ public sealed class ActionButton : Control, IEntityControl
var name = FormattedMessage.FromMarkupPermissive(Loc.GetString(metadata.EntityName));
var decr = FormattedMessage.FromMarkupPermissive(Loc.GetString(metadata.EntityDescription));
if (_action is { Charges: not null })
{
var charges = FormattedMessage.FromMarkupPermissive(Loc.GetString($"Charges: {_action.Charges.Value.ToString()}/{_action.MaxCharges.ToString()}"));
return new ActionAlertTooltip(name, decr, charges: charges);
}
return new ActionAlertTooltip(name, decr);
}

View File

@@ -5,5 +5,6 @@
<BoxContainer Orientation="Vertical" RectClipContent="True">
<RichTextLabel MaxWidth="350" StyleClasses="StyleClassTooltipActionTitle"/>
<RichTextLabel MaxWidth="350" StyleClasses="StyleClassTooltipActionDescription"/>
<RichTextLabel MaxWidth="350" StyleClasses="StyleClassTooltipActionCharges"/>
</BoxContainer>
</controls:ActionTooltip>