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
@@ -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;