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:
@@ -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;
|
||||
|
||||
@@ -48,6 +48,14 @@ public static class WizardValidation
|
||||
if (string.IsNullOrEmpty(draft.DamChosenAbility))
|
||||
return "Pick a lineage bonus from the dam clade.";
|
||||
|
||||
// Phase B: 2 clade traits from dominant + 1 from non-dominant.
|
||||
int sireNeed = draft.CladeTraitLimit("sire");
|
||||
int damNeed = draft.CladeTraitLimit("dam");
|
||||
if (draft.SireChosenCladeTraits.Count != sireNeed)
|
||||
return $"Pick {sireNeed} sire clade trait{(sireNeed == 1 ? "" : "s")} ({draft.SireChosenCladeTraits.Count}/{sireNeed}).";
|
||||
if (draft.DamChosenCladeTraits.Count != damNeed)
|
||||
return $"Pick {damNeed} dam clade trait{(damNeed == 1 ? "" : "s")} ({draft.DamChosenCladeTraits.Count}/{damNeed}).";
|
||||
|
||||
return null;
|
||||
}
|
||||
return string.IsNullOrEmpty(draft.CladeId) ? "Pick a clade." : null;
|
||||
@@ -59,6 +67,24 @@ public static class WizardValidation
|
||||
{
|
||||
if (string.IsNullOrEmpty(draft.SireSpeciesId)) return "Pick a sire species.";
|
||||
if (string.IsNullOrEmpty(draft.DamSpeciesId)) return "Pick a dam species.";
|
||||
|
||||
// Phase B: one species trait + one species detriment per lineage.
|
||||
// A species with an empty detriment list still requires explicit
|
||||
// confirmation — UI shows "(none)" affordance.
|
||||
if (string.IsNullOrEmpty(draft.SireChosenSpeciesTrait))
|
||||
return "Pick a sire species trait.";
|
||||
if (string.IsNullOrEmpty(draft.DamChosenSpeciesTrait))
|
||||
return "Pick a dam species trait.";
|
||||
|
||||
var sireSp = CodexContent.SpeciesById(draft.SireSpeciesId);
|
||||
var damSp = CodexContent.SpeciesById(draft.DamSpeciesId);
|
||||
if (sireSp is not null && sireSp.Detriments.Length > 0
|
||||
&& string.IsNullOrEmpty(draft.SireChosenSpeciesDetriment))
|
||||
return "Pick a sire species detriment.";
|
||||
if (damSp is not null && damSp.Detriments.Length > 0
|
||||
&& string.IsNullOrEmpty(draft.DamChosenSpeciesDetriment))
|
||||
return "Pick a dam species detriment.";
|
||||
|
||||
return null;
|
||||
}
|
||||
return string.IsNullOrEmpty(draft.SpeciesId) ? "Pick a species." : null;
|
||||
|
||||
Reference in New Issue
Block a user