Commit pending working-tree changes (local edits, line endings)

This commit is contained in:
cthangover committed 2026-10-21 12:32:01 +02:00
1 parent 4fa8137071
commit a7d03cd41a
6 files changed
+272 -272

No files matched your search

+21 -21
View File
@@ -1,21 +1,21 @@
namespace Cthangover.Mods.Skills
{
/// <summary>
/// Represents the rarity tier of a skill card, determining its drop probability,
/// visual frame treatment, and relative power budget. Higher tiers correspond to
/// more potent effects and rarer acquisition chances.
/// </summary>
public enum RareType
{
/// <summary>Standard skill with the highest drop rate and baseline power.</summary>
Common,
/// <summary>Slightly improved stats and a lower drop rate than <c>Common</c>.</summary>
Uncommon,
/// <summary>Notably stronger, appearing infrequently in loot pools.</summary>
Rare,
/// <summary>Powerful skill with significant gameplay impact; very low drop chance.</summary>
Epic,
/// <summary>The highest tier — game-changing abilities with extremely rare availability.</summary>
Legendary
}
}
namespace Cthangover.Mods.Skills
{
/// <summary>
/// Represents the rarity tier of a skill card, determining its drop probability,
/// visual frame treatment, and relative power budget. Higher tiers correspond to
/// more potent effects and rarer acquisition chances.
/// </summary>
public enum RareType
{
/// <summary>Standard skill with the highest drop rate and baseline power.</summary>
Common,
/// <summary>Slightly improved stats and a lower drop rate than <c>Common</c>.</summary>
Uncommon,
/// <summary>Notably stronger, appearing infrequently in loot pools.</summary>
Rare,
/// <summary>Powerful skill with significant gameplay impact; very low drop chance.</summary>
Epic,
/// <summary>The highest tier — game-changing abilities with extremely rare availability.</summary>
Legendary
}
}
+112 -112
View File
@@ -1,112 +1,112 @@
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using Cthangover.Core.Factories;
using Cthangover.Core.Utils;
using Godot;
namespace Cthangover.Mods.Skills
{
/// <summary>
/// Immutable data model for a single skill definition, populated by
/// <see cref="SkillFactory"/> from JSON assets. Each instance carries the
/// metadata required to render a skill card in the UI (<see cref="Sprite"/>,
/// <see cref="Name"/>, <see cref="Description"/>) and to resolve its gameplay
/// behaviour through <see cref="SkillType"/> and <see cref="RareType"/>.
/// Instances are shared across the runtime and should not be mutated after
/// construction.
/// </summary>
[Serializable]
[EntityKind("skill")]
public class SkillInfo : IIdentifiable
{
/// <summary>
/// The unique string key of this skill, used as the primary lookup in
/// <see cref="SkillFactory"/> and as the identity token in
/// <see cref="SkillData.Skills"/>.
/// </summary>
[JsonPropertyName("Id")]
public string ID { get; set; }
/// <summary>
/// The display name shown on the skill card. This value is passed through
/// <see cref="TranslationServer.Translate"/> before rendering, allowing
/// localisation via Godot's translation system.
/// </summary>
public string Name { get; set; }
/// <summary>
/// A longer textual description explaining what the skill does in gameplay
/// terms. Displayed in tooltip and detail views alongside the card artwork.
/// </summary>
public string Description { get; set; }
/// <summary>
/// The relative path to the skill's artwork texture, resolved inside the
/// mod-group "characters/skills" by <see cref="TextureUtils.LoadFromModGroup"/>
/// when the <see cref="Sprite"/> property is first accessed.
/// </summary>
public string Image { get; set; }
/// <summary>
/// Optional ID of the action card this skill gifts to the player when
/// acquired (e.g. an active skill that hands over a battle card).
/// Resolved against <see cref="Cthangover.Core.Factories.Impls.ActionCharacterFactory"/>
/// when the skills panel renders the detail view, and pushed into
/// <see cref="Cthangover.Core.Settings.ActionPoolData.ActionIds"/> by
/// <see cref="SkillService"/> so the card becomes assignable to a
/// character. Empty for skills that only act as passive gates and
/// never produce a card.
/// </summary>
public string GrantsAction { get; set; }
/// <summary>
/// Numeric bonuses this skill grants while owned. They are the card's
/// actual payload: the skills panel shows the first effect on the grid
/// card, lists all of them in the study plate, and sums every owned
/// skill's effects into the global "collection effect" plate via
/// <see cref="SkillEffectAggregator"/>. Empty for skills that only gate
/// content (e.g. unlock an action) without touching stats.
/// </summary>
[JsonPropertyName("Effects")]
public List<SkillEffectInfo> Effects { get; set; }
/// <summary>
/// The gameplay classification of this skill (<c>Active</c>, <c>Passive</c>,
/// or <c>ForCharacter</c>), serialised as a string in JSON and converted
/// via <see cref="JsonStringEnumConverter"/>.
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
[JsonPropertyName("Type")]
public SkillType SkillType { get; set; }
/// <summary>
/// The rarity tier of this skill, serialised as a string in JSON and
/// converted via <see cref="JsonStringEnumConverter"/>. Drives the colour
/// of the card frame, study plate and rarity badge through
/// <see cref="SkillPalette"/>.
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
[JsonPropertyName("Rare")]
public RareType RareType { get; set; }
private Texture2D cacheSprite;
/// <summary>
/// Lazily loads and caches the <see cref="Texture2D"/> for this skill's
/// card artwork. On first access the texture is resolved from the mod-group
/// "characters/skills" using the <see cref="Image"/> path; subsequent
/// accesses return the cached reference.
/// </summary>
public Texture2D Sprite
{
get
{
if (cacheSprite == null)
cacheSprite = TextureUtils.LoadFromModGroup("characters/skills", Image);
return cacheSprite;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using Cthangover.Core.Factories;
using Cthangover.Core.Utils;
using Godot;
namespace Cthangover.Mods.Skills
{
/// <summary>
/// Immutable data model for a single skill definition, populated by
/// <see cref="SkillFactory"/> from JSON assets. Each instance carries the
/// metadata required to render a skill card in the UI (<see cref="Sprite"/>,
/// <see cref="Name"/>, <see cref="Description"/>) and to resolve its gameplay
/// behaviour through <see cref="SkillType"/> and <see cref="RareType"/>.
/// Instances are shared across the runtime and should not be mutated after
/// construction.
/// </summary>
[Serializable]
[EntityKind("skill")]
public class SkillInfo : IIdentifiable
{
/// <summary>
/// The unique string key of this skill, used as the primary lookup in
/// <see cref="SkillFactory"/> and as the identity token in
/// <see cref="SkillData.Skills"/>.
/// </summary>
[JsonPropertyName("Id")]
public string ID { get; set; }
/// <summary>
/// The display name shown on the skill card. This value is passed through
/// <see cref="TranslationServer.Translate"/> before rendering, allowing
/// localisation via Godot's translation system.
/// </summary>
public string Name { get; set; }
/// <summary>
/// A longer textual description explaining what the skill does in gameplay
/// terms. Displayed in tooltip and detail views alongside the card artwork.
/// </summary>
public string Description { get; set; }
/// <summary>
/// The relative path to the skill's artwork texture, resolved inside the
/// mod-group "characters/skills" by <see cref="TextureUtils.LoadFromModGroup"/>
/// when the <see cref="Sprite"/> property is first accessed.
/// </summary>
public string Image { get; set; }
/// <summary>
/// Optional ID of the action card this skill gifts to the player when
/// acquired (e.g. an active skill that hands over a battle card).
/// Resolved against <see cref="Cthangover.Core.Factories.Impls.ActionCharacterFactory"/>
/// when the skills panel renders the detail view, and pushed into
/// <see cref="Cthangover.Core.Settings.ActionPoolData.ActionIds"/> by
/// <see cref="SkillService"/> so the card becomes assignable to a
/// character. Empty for skills that only act as passive gates and
/// never produce a card.
/// </summary>
public string GrantsAction { get; set; }
/// <summary>
/// Numeric bonuses this skill grants while owned. They are the card's
/// actual payload: the skills panel shows the first effect on the grid
/// card, lists all of them in the study plate, and sums every owned
/// skill's effects into the global "collection effect" plate via
/// <see cref="SkillEffectAggregator"/>. Empty for skills that only gate
/// content (e.g. unlock an action) without touching stats.
/// </summary>
[JsonPropertyName("Effects")]
public List<SkillEffectInfo> Effects { get; set; }
/// <summary>
/// The gameplay classification of this skill (<c>Active</c>, <c>Passive</c>,
/// or <c>ForCharacter</c>), serialised as a string in JSON and converted
/// via <see cref="JsonStringEnumConverter"/>.
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
[JsonPropertyName("Type")]
public SkillType SkillType { get; set; }
/// <summary>
/// The rarity tier of this skill, serialised as a string in JSON and
/// converted via <see cref="JsonStringEnumConverter"/>. Drives the colour
/// of the card frame, study plate and rarity badge through
/// <see cref="SkillPalette"/>.
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
[JsonPropertyName("Rare")]
public RareType RareType { get; set; }
private Texture2D cacheSprite;
/// <summary>
/// Lazily loads and caches the <see cref="Texture2D"/> for this skill's
/// card artwork. On first access the texture is resolved from the mod-group
/// "characters/skills" using the <see cref="Image"/> path; subsequent
/// accesses return the cached reference.
/// </summary>
public Texture2D Sprite
{
get
{
if (cacheSprite == null)
cacheSprite = TextureUtils.LoadFromModGroup("characters/skills", Image);
return cacheSprite;
}
}
}
}
+38 -38
View File
@@ -1,38 +1,38 @@
namespace Cthangover.Mods.Skills
{
/// <summary>
/// Enumerates every skill available in the game by its canonical identifier.
/// Each member corresponds to a JSON-definition entry loaded by
/// <see cref="SkillFactory"/> and used to construct <see cref="SkillInfo"/> instances.
/// The underlying <c>int</c> values are not manually assigned; the enum serves
/// purely as a compile-time-safe skill reference.
/// </summary>
public enum SkillName : int
{
/// <summary>
/// A domination-type skill that allows the player to command enslaved units,
/// overriding enemy AI and redirecting attacks under the player's control.
/// </summary>
SLAVE_MASTER
}
/// <summary>
/// Provides conversion helpers for <see cref="SkillName"/> values, used when
/// bridging the enum-based API with string-based lookups in
/// <see cref="SkillData"/> and factory registries.
/// </summary>
public static class SkillNameExtensions
{
/// <summary>
/// Converts a <see cref="SkillName"/> enum value to its lowercase string
/// identifier, matching the format expected by <see cref="SkillData.Skills"/>
/// and serialization layers.
/// </summary>
/// <param name="skill">The skill enum value to convert.</param>
/// <returns>The lowercase name of the enum constant (e.g. "slave_master").</returns>
public static string ID(this SkillName skill)
{
return skill.ToString().ToLower();
}
}
}
namespace Cthangover.Mods.Skills
{
/// <summary>
/// Enumerates every skill available in the game by its canonical identifier.
/// Each member corresponds to a JSON-definition entry loaded by
/// <see cref="SkillFactory"/> and used to construct <see cref="SkillInfo"/> instances.
/// The underlying <c>int</c> values are not manually assigned; the enum serves
/// purely as a compile-time-safe skill reference.
/// </summary>
public enum SkillName : int
{
/// <summary>
/// A domination-type skill that allows the player to command enslaved units,
/// overriding enemy AI and redirecting attacks under the player's control.
/// </summary>
SLAVE_MASTER
}
/// <summary>
/// Provides conversion helpers for <see cref="SkillName"/> values, used when
/// bridging the enum-based API with string-based lookups in
/// <see cref="SkillData"/> and factory registries.
/// </summary>
public static class SkillNameExtensions
{
/// <summary>
/// Converts a <see cref="SkillName"/> enum value to its lowercase string
/// identifier, matching the format expected by <see cref="SkillData.Skills"/>
/// and serialization layers.
/// </summary>
/// <param name="skill">The skill enum value to convert.</param>
/// <returns>The lowercase name of the enum constant (e.g. "slave_master").</returns>
public static string ID(this SkillName skill)
{
return skill.ToString().ToLower();
}
}
}
+26 -26
View File
@@ -1,26 +1,26 @@
namespace Cthangover.Mods.Skills
{
/// <summary>
/// Classifies how a skill behaves during gameplay. This distinction drives
/// which battle-phase the skill can be used in and how its effects are resolved
/// by the combat engine.
/// </summary>
public enum SkillType
{
/// <summary>
/// Must be intentionally triggered during the player's turn, consuming an action
/// resource and targeting a specific ally or enemy.
/// </summary>
Active,
/// <summary>
/// Remains in effect continuously once acquired, providing a persistent buff
/// or aura without requiring any player input.
/// </summary>
Passive,
/// <summary>
/// Applies directly to the owning character as a stat modifier or intrinsic trait,
/// rather than being a card the player selects each turn.
/// </summary>
ForCharacter,
}
}
namespace Cthangover.Mods.Skills
{
/// <summary>
/// Classifies how a skill behaves during gameplay. This distinction drives
/// which battle-phase the skill can be used in and how its effects are resolved
/// by the combat engine.
/// </summary>
public enum SkillType
{
/// <summary>
/// Must be intentionally triggered during the player's turn, consuming an action
/// resource and targeting a specific ally or enemy.
/// </summary>
Active,
/// <summary>
/// Remains in effect continuously once acquired, providing a persistent buff
/// or aura without requiring any player input.
/// </summary>
Passive,
/// <summary>
/// Applies directly to the owning character as a stat modifier or intrinsic trait,
/// rather than being a card the player selects each turn.
/// </summary>
ForCharacter,
}
}
+38 -38
View File
@@ -1,38 +1,38 @@
using System.Collections.Generic;
using System.Linq;
using Cthangover.Core.Factories.Impls;
using Cthangover.Core.Settings;
using Cthangover.Mods.Interface.Base.Lists.Impls;
namespace Cthangover.Mods.Skills
{
/// <summary>
/// UI widget that displays all skills currently owned by the player in a
/// column-based card grid. Extends
/// <see cref="ColumnCellListWidget{TItem, TModel}"/> to reuse the generic
/// list-rendering pipeline. When the widget is populated it reads the set
/// of owned skill IDs from <see cref="SkillData.Skills"/> in the current
/// <see cref="GameData"/> runtime, resolves each ID to a
/// <see cref="SkillInfo"/> via <see cref="SkillFactory.Instance"/>, and
/// hands the resulting models to the list for rendering as
/// <see cref="SkillCardBehaviour"/> items.
/// </summary>
public partial class SkillWidget : ColumnCellListWidget<SkillCardBehaviour, SkillInfo>
{
/// <summary>
/// Produces the collection of <see cref="SkillInfo"/> models that the
/// list widget will render. Each ownedskill ID from
/// <see cref="GameData.Instance.Runtime.SkillData"/> is resolved through
/// <see cref="SkillFactory.Instance.Get"/> and collected into a
/// <see cref="List{T}"/>.
/// </summary>
/// <returns>
/// A snapshot of all currently owned skills, each as a fully-populated
/// <see cref="SkillInfo"/> instance.
/// </returns>
public override ICollection<SkillInfo> CreateModels()
{
return GameData.Instance.Runtime.SkillData.Skills.Select(x => SkillFactory.Instance.Get(x)).ToList();
}
}
}
using System.Collections.Generic;
using System.Linq;
using Cthangover.Core.Factories.Impls;
using Cthangover.Core.Settings;
using Cthangover.Mods.Interface.Base.Lists.Impls;
namespace Cthangover.Mods.Skills
{
/// <summary>
/// UI widget that displays all skills currently owned by the player in a
/// column-based card grid. Extends
/// <see cref="ColumnCellListWidget{TItem, TModel}"/> to reuse the generic
/// list-rendering pipeline. When the widget is populated it reads the set
/// of owned skill IDs from <see cref="SkillData.Skills"/> in the current
/// <see cref="GameData"/> runtime, resolves each ID to a
/// <see cref="SkillInfo"/> via <see cref="SkillFactory.Instance"/>, and
/// hands the resulting models to the list for rendering as
/// <see cref="SkillCardBehaviour"/> items.
/// </summary>
public partial class SkillWidget : ColumnCellListWidget<SkillCardBehaviour, SkillInfo>
{
/// <summary>
/// Produces the collection of <see cref="SkillInfo"/> models that the
/// list widget will render. Each ownedskill ID from
/// <see cref="GameData.Instance.Runtime.SkillData"/> is resolved through
/// <see cref="SkillFactory.Instance.Get"/> and collected into a
/// <see cref="List{T}"/>.
/// </summary>
/// <returns>
/// A snapshot of all currently owned skills, each as a fully-populated
/// <see cref="SkillInfo"/> instance.
/// </returns>
public override ICollection<SkillInfo> CreateModels()
{
return GameData.Instance.Runtime.SkillData.Skills.Select(x => SkillFactory.Instance.Get(x)).ToList();
}
}
}