M6.8: Hybrid trait pickers (Phase B)

Per theriapolis-rpg-clades.md "Building a Hybrid": hybrids now pick
two clade traits from the dominant parent + one from the other (2/1
split keyed off DominantParent), and one species trait + one species
detriment from each parent. All clade detriments still inherit fully
from both parents. Universal hybrid detriments unchanged.

CharacterDraft gains six new fields (sire/dam clade-trait arrays,
sire/dam species trait/detriment ids) and a CladeTraitLimit(lineage)
helper. Step 0/1 validators enforce the picks; Aside renders only the
chosen subset for hybrids.

Cascading clears: clade swap clears that lineage's bonus + clade
traits + (if species also invalidated) species pick; species swap
clears that lineage's species trait/detriment; dominant flip trims
overflow from the end (non-destructive when possible); hybrid-off
clears all six new fields.

Toggle buttons in both steps wire MouseEntered/Exited into
PopoverLayer so the player can read each trait's description on
hover (detriment buttons get the red-tinted "DETRIMENT" popover).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Christopher Wiebe
2026-05-04 20:12:56 -07:00
parent e3f0296e6f
commit 8bf9eba2a7
5 changed files with 432 additions and 15 deletions
+26
View File
@@ -47,6 +47,26 @@ public partial class CharacterDraft : Resource
/// <summary>Ability key picked from dam's clade mods.</summary>
[Export] public string DamChosenAbility { get; set; } = "";
// Phase B trait pickers, per theriapolis-rpg-clades.md "Building a Hybrid":
// Clade traits: 2 from dominant parent + 1 from non-dominant (player's
// split). Detriments are inherited fully from both clades
// — no pick.
// Species trait: 1 per parent.
// Species detriment: 1 per parent.
/// <summary>Clade trait IDs picked from sire's clade. Length depends on
/// dominant: 2 if sire is dominant, 1 if dam is.</summary>
[Export] public Godot.Collections.Array<string> SireChosenCladeTraits { get; set; } = new();
[Export] public Godot.Collections.Array<string> DamChosenCladeTraits { get; set; } = new();
[Export] public string SireChosenSpeciesTrait { get; set; } = "";
[Export] public string DamChosenSpeciesTrait { get; set; } = "";
[Export] public string SireChosenSpeciesDetriment { get; set; } = "";
[Export] public string DamChosenSpeciesDetriment { get; set; } = "";
/// <summary>Number of clade traits the named lineage is allowed to pick:
/// 2 if it's the dominant parent, 1 otherwise.</summary>
public int CladeTraitLimit(string lineage) =>
lineage == DominantParent ? 2 : 1;
/// <summary>
/// Resolves the "active" clade for downstream steps (Class / Subclass
/// / Background). Purebred uses <see cref="CladeId"/>; hybrids use
@@ -123,6 +143,12 @@ public partial class CharacterDraft : Resource
case "dominant_parent": DominantParent = (string)patch[key]; break;
case "sire_chosen_ability": SireChosenAbility = (string)patch[key]; break;
case "dam_chosen_ability": DamChosenAbility = (string)patch[key]; break;
case "sire_chosen_clade_traits": SireChosenCladeTraits = (Godot.Collections.Array<string>)patch[key]; break;
case "dam_chosen_clade_traits": DamChosenCladeTraits = (Godot.Collections.Array<string>)patch[key]; break;
case "sire_chosen_species_trait": SireChosenSpeciesTrait = (string)patch[key]; break;
case "dam_chosen_species_trait": DamChosenSpeciesTrait = (string)patch[key]; break;
case "sire_chosen_species_detriment":SireChosenSpeciesDetriment = (string)patch[key]; break;
case "dam_chosen_species_detriment": DamChosenSpeciesDetriment = (string)patch[key]; break;
default:
GD.PushWarning($"[CharacterDraft] unknown patch key: {k}");
break;