M6.13: Sex picker + species variant schema
Adds character Sex (male/female) as a top-level CharacterDraft field
required for every character, and species variants as a layer on top
of the base species record. Two variant axes:
- "sex": auto-resolves from CharacterDraft.Sex for purebreds; for
hybrids, pinned by parent role (sire = male, dam = female)
by definition. No picker needed beyond Step 0.
- "lineage": explicit per-species pick (Ram-Folk's sheep/goat). Has
its own picker on Step 1 (purebred path under the grid;
hybrid path embedded into the per-parent pick column).
Schema (Theriapolis.Core/Data):
- SpeciesDef gains VariantAxis (string) and Variants (array of
SpeciesVariantDef { Id, Name, Traits, Detriments }).
- JSON content not yet populated — that's M6.14.
CharacterDraft adds:
- Sex (required by Step 0 validation)
- SpeciesVariant / SireSpeciesVariant / DamSpeciesVariant
- ResolveVariantId(species, role) that returns the active variant
id for a given context — used by Aside to layer variant traits
onto the base species traits.
Step 0 (StepClade): sex picker row above the hybrid toggle. Two
toggle buttons radio-style.
Step 1 (StepSpecies): purebred path renders a lineage picker below
the grid when the picked species has VariantAxis == "lineage";
hybrid path embeds a lineage picker at the top of each parent's
pick column. Hover popovers summarise each variant's contents.
Validation: Sex is required at Step 0. Lineage variant required at
Step 1 for any picked species (purebred or per-hybrid-parent) with
VariantAxis == "lineage".
Aside: AddVariantContent layers the resolved variant's extra
traits/detriments onto the base species rendering, for both purebred
and hybrid paths.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -269,10 +269,14 @@ public partial class Aside : MarginContainer
|
||||
// (single-pick each, per doc) plus the four universal detriments.
|
||||
if (_draft.IsHybrid)
|
||||
{
|
||||
AddPickedSpeciesPick(flow, CodexContent.SpeciesById(_draft.SireSpeciesId),
|
||||
var sireSp = CodexContent.SpeciesById(_draft.SireSpeciesId);
|
||||
var damSp = CodexContent.SpeciesById(_draft.DamSpeciesId);
|
||||
AddPickedSpeciesPick(flow, sireSp,
|
||||
_draft.SireChosenSpeciesTrait, _draft.SireChosenSpeciesDetriment);
|
||||
AddPickedSpeciesPick(flow, CodexContent.SpeciesById(_draft.DamSpeciesId),
|
||||
AddPickedSpeciesPick(flow, damSp,
|
||||
_draft.DamChosenSpeciesTrait, _draft.DamChosenSpeciesDetriment);
|
||||
AddVariantContent(flow, sireSp, _draft.ResolveVariantId(sireSp, "sire"));
|
||||
AddVariantContent(flow, damSp, _draft.ResolveVariantId(damSp, "dam"));
|
||||
|
||||
// Universal hybrid detriments — every hybrid has all four.
|
||||
foreach (var (name, desc) in UniversalHybridDetriments)
|
||||
@@ -280,7 +284,9 @@ public partial class Aside : MarginContainer
|
||||
}
|
||||
else
|
||||
{
|
||||
AddSpeciesTraits(flow, CodexContent.SpeciesById(_draft.SpeciesId));
|
||||
var sp = CodexContent.SpeciesById(_draft.SpeciesId);
|
||||
AddSpeciesTraits(flow, sp);
|
||||
AddVariantContent(flow, sp, _draft.ResolveVariantId(sp, ""));
|
||||
}
|
||||
|
||||
// Class level-1 features.
|
||||
@@ -362,6 +368,22 @@ public partial class Aside : MarginContainer
|
||||
flow.AddChild(new TraitChip { TraitName = d.Name, Description = d.Description, Detriment = true });
|
||||
}
|
||||
|
||||
/// <summary>Render the resolved variant's extra traits/detriments,
|
||||
/// if any. <paramref name="variantId"/> is the variant key (e.g. "male"
|
||||
/// or "sheep"); empty when no resolution applies.</summary>
|
||||
private static void AddVariantContent(HFlowContainer flow,
|
||||
Theriapolis.Core.Data.SpeciesDef? species,
|
||||
string variantId)
|
||||
{
|
||||
if (species is null || string.IsNullOrEmpty(variantId)) return;
|
||||
var variant = System.Array.Find(species.Variants, v => v.Id == variantId);
|
||||
if (variant is null) return;
|
||||
foreach (var t in variant.Traits)
|
||||
flow.AddChild(new TraitChip { TraitName = t.Name, Description = t.Description });
|
||||
foreach (var d in variant.Detriments)
|
||||
flow.AddChild(new TraitChip { TraitName = d.Name, Description = d.Description, Detriment = true });
|
||||
}
|
||||
|
||||
/// <summary>Hybrid: one chosen species trait + one chosen species detriment.</summary>
|
||||
private static void AddPickedSpeciesPick(HFlowContainer flow, Theriapolis.Core.Data.SpeciesDef? species,
|
||||
string chosenTraitId, string chosenDetrimentId)
|
||||
|
||||
Reference in New Issue
Block a user