using System; namespace IdleSpectator; /// Phrase fragments keyed by the already-resolved voice. No ActorAsset lookup. public static class ActivityActionLexicon { public static string[] GetBag( ProseVoice voice, string verb, bool hasTarget, ActivityTerrain terrain = ActivityTerrain.Unknown) { voice ??= ProseVoice.Unknown(); string v = string.IsNullOrEmpty(verb) ? "move" : verb; if (voice.AssetKind == ActivityAssetKind.Vehicle) { return VehicleBag(v); } string[] authored = ActivitySpeciesVoiceCatalog.GetBag(voice.BaseSpeciesId, v, terrain); if (authored != null && authored.Length > 0) { return authored; } // Safe fallback for unknown future assets that are not yet in the authored catalog. if (voice.Modifier != ActivityModifier.None) { string[] modifier = ModifierBag(voice, v, hasTarget); if (modifier != null) return modifier; } string[] body = BodyBag(voice.BaseBodyTag, v, hasTarget, terrain); return body ?? GenericBag(v, hasTarget); } private static string[] ModifierBag(ProseVoice voice, string verb, bool hasTarget) { switch (voice.Modifier) { case ActivityModifier.Undead: return UndeadBag(voice.BaseBodyTag, verb, hasTarget); case ActivityModifier.Elemental: return verb switch { "move" => new[] { "surges ahead in a trail of flame{place_at}", "flows forward in a rolling blaze{place_at}" }, "wait" => new[] { "flickers in place{place_at}", "burns steadily while waiting{place_at}" }, "play" => new[] { "flickers into quick spirals and sudden bursts{place_at}", "loops in bright arcs of flame{place_at}" }, "eat" => new[] { "feeds the inner flame{place_at}", "draws fuel into the flames{place_at}" }, "sleep" => new[] { "dims into a banked rest{place_at}", "settles into a low, steady glow{place_at}" }, "hunt" => Targeted(hasTarget, "surges after {target}{place_at}", "hunts {target} in a trail of heat{place_at}", "searches for prey in flickering sweeps{place_at}", "hunts as flames flicker and rise{place_at}"), "fight" => Targeted(hasTarget, "crashes into {target} in a burst of flame{place_at}", "flares against {target}{place_at}", "fights in a storm of sparks{place_at}", "clashes amid sparks and flame{place_at}"), "laugh" => new[] { "crackles with bright laughter{place_at}", "flares in a laughing burst{place_at}" }, _ => GenericBag(verb, hasTarget) }; case ActivityModifier.Mush: return verb switch { "move" => new[] { "shuffles ahead in soft, uneven steps{place_at}", "creeps forward as spores drift{place_at}" }, "wait" => new[] { "rests while spores drift around it{place_at}", "waits while faint spores drift{place_at}" }, "play" => new[] { "bobs and puffs spores in short bursts{place_at}", "wobbles about, shedding little clouds of spores{place_at}" }, "eat" => new[] { "feeds slowly on decaying matter{place_at}", "draws a slow meal from decay{place_at}" }, "sleep" => new[] { "settles into a soft, quiet rest{place_at}", "folds down among drifting spores{place_at}" }, _ => GenericBag(verb, hasTarget) }; case ActivityModifier.Tumor: return verb switch { "move" => new[] { "pulses forward as its mass shifts{place_at}", "lurches ahead in uneven surges{place_at}" }, "wait" => new[] { "throbs in unsettling stillness{place_at}", "quivers without moving on{place_at}" }, "play" => new[] { "writhes and recoils in restless loops{place_at}", "pulses in an oddly buoyant rhythm{place_at}" }, "eat" => new[] { "feeds with consuming hunger{place_at}", "absorbs food into the growing mass{place_at}" }, "fight" => Targeted(hasTarget, "lashes into {target} with terrible force{place_at}", "surges against {target}{place_at}", "fights in a thrashing fury{place_at}", "clashes in a violent rush{place_at}"), _ => GenericBag(verb, hasTarget) }; case ActivityModifier.Alien: return verb switch { "move" => new[] { "glides ahead without a sound{place_at}", "tracks a precise, unfamiliar course{place_at}" }, "wait" => new[] { "observes in unreadable stillness{place_at}", "stands motionless and watches{place_at}" }, "play" => new[] { "repeats curious patterns of motion{place_at}", "darts, pauses, and changes direction without warning{place_at}" }, "hunt" => Targeted(hasTarget, "tracks {target} without a sound{place_at}", "closes on {target} in eerie silence{place_at}", "scans for prey{place_at}", "hunts by unfamiliar instinct{place_at}"), "fight" => Targeted(hasTarget, "strikes at {target} with uncanny precision{place_at}", "clashes with {target} in sudden bursts{place_at}", "fights with unreadable intent{place_at}", "attacks in a precise rush{place_at}"), _ => GenericBag(verb, hasTarget) }; case ActivityModifier.Construct: return verb switch { "move" => new[] { "moves in measured, jointed steps{place_at}", "shifts forward with deliberate precision{place_at}" }, "wait" => new[] { "idles in rigid watchfulness{place_at}", "stays motionless, mechanisms quiet{place_at}" }, "play" => new[] { "repeats a sequence of precise motions{place_at}", "spins and resets with mechanical exactness{place_at}" }, "eat" => new[] { "takes in fuel with mechanical care{place_at}", "replenishes what keeps it moving{place_at}" }, "sleep" => new[] { "powers down into quiet rest{place_at}", "settles into a dormant stillness{place_at}" }, _ => GenericBag(verb, hasTarget) }; default: return null; } } private static string[] UndeadBag(ActivityBodyTag body, string verb, bool hasTarget) { if (verb == "move") { return body switch { ActivityBodyTag.Canine => new[] { "pads ahead with a stiff, uneven gait{place_at}", "sniffs ahead and shambles on{place_at}" }, ActivityBodyTag.Feline => new[] { "slinks ahead in eerie silence{place_at}", "pads forward with stiff precision{place_at}" }, ActivityBodyTag.Insect => new[] { "skitters ahead on stiff little legs{place_at}", "crawls forward in twitching bursts{place_at}" }, ActivityBodyTag.Plant => new[] { "creeps ahead in withered motion{place_at}", "drags dead growth behind it{place_at}" }, ActivityBodyTag.Dragon => new[] { "lumbers ahead with the weight of a fallen giant{place_at}", "advances like ruin given motion{place_at}" }, ActivityBodyTag.Bird => new[] { "flutters ahead on lifeless wings{place_at}", "hops forward in ragged, uneven motions{place_at}" }, _ => new[] { "shambles forward in uneven steps{place_at}", "drifts along in restless undeath{place_at}" } }; } return verb switch { "wait" => new[] { "waits in hollow stillness{place_at}", "stands in restless silence{place_at}" }, "play" => new[] { "lurches in clumsy circles{place_at}", "repeats jerking motions with eerie persistence{place_at}" }, "eat" => new[] { "feeds with deathless hunger{place_at}", "tears into a meal with endless hunger{place_at}" }, "sleep" => new[] { "slumps into a hollow rest{place_at}", "goes still in restless undeath{place_at}" }, "hunt" => Targeted(hasTarget, "shambles after {target}{place_at}", "hunts {target} with hollow hunger{place_at}", "hunts with deathless hunger{place_at}", "searches for prey without rest{place_at}"), "fight" => Targeted(hasTarget, "lunges at {target} without fear{place_at}", "clashes with {target} in relentless fury{place_at}", "fights without fear or hesitation{place_at}", "presses on without giving ground{place_at}"), "laugh" => new[] { "groans in a broken laugh{place_at}", "makes a hollow sound of laughter{place_at}" }, "social" => Targeted(hasTarget, "lingers near {target} in uneasy silence{place_at}", "stands beside {target} without a word{place_at}", "seeks company in deathly quiet{place_at}", "lingers among the living{place_at}"), _ => GenericBag(verb, hasTarget) }; } private static string[] BodyBag( ActivityBodyTag body, string verb, bool hasTarget, ActivityTerrain terrain) { if (verb == "move") { return body switch { ActivityBodyTag.Humanoid => new[] { "walks along, taking in the surroundings{place_at}", "wanders ahead at an easy pace{place_at}" }, ActivityBodyTag.Canine => new[] { "trots along without hurry{place_at}", "roams ahead, following a scent{place_at}" }, ActivityBodyTag.Feline => new[] { "pads softly along{place_at}", "slinks ahead at an easy pace{place_at}" }, ActivityBodyTag.Bird => new[] { "flutters steadily onward{place_at}", "hops and flaps along nearby{place_at}" }, ActivityBodyTag.Insect => new[] { "scuttles along without hurry{place_at}", "skitters quickly forward{place_at}" }, ActivityBodyTag.Arachnid => new[] { "skitters onward on many legs{place_at}", "creeps ahead with careful steps{place_at}" }, ActivityBodyTag.Amphibian => new[] { "hops from patch to patch{place_at}", "bounces along in springy steps{place_at}" }, ActivityBodyTag.Aquatic => AquaticTerrainBag( terrain, "glides through the water{place_at}", "swims onward with easy strokes{place_at}", "moves forward in a smooth, winding motion{place_at}", "twists steadily onward{place_at}"), ActivityBodyTag.Reptile => new[] { "slides along without hurry{place_at}", "creeps forward in a low crawl{place_at}" }, ActivityBodyTag.Livestock => new[] { "ambles along without hurry{place_at}", "wanders in slow, heavy steps{place_at}" }, ActivityBodyTag.Plant => new[] { "creeps along as stems and leaves sway{place_at}", "eases forward in slow, leafy steps{place_at}" }, ActivityBodyTag.Fungi => new[] { "drifts along in soft, uneven steps{place_at}", "spreads forward as spores trail behind{place_at}" }, ActivityBodyTag.Protist => new[] { "oozes onward without hurry{place_at}", "pulses along in slow ripples{place_at}" }, ActivityBodyTag.Machina => new[] { "moves ahead in measured steps{place_at}", "tracks a precise course{place_at}" }, ActivityBodyTag.Mythic => new[] { "drifts forward without a sound{place_at}", "moves with an uncanny grace{place_at}" }, ActivityBodyTag.Gregalia => new[] { "lopes onward with an uneven gait{place_at}", "wanders in twitchy, restless steps{place_at}" }, ActivityBodyTag.Primate => new[] { "lopes onward with nimble curiosity{place_at}", "moves ahead in quick clever steps{place_at}" }, ActivityBodyTag.Rodent => new[] { "scurries onward without hurry{place_at}", "pads ahead in quick little steps{place_at}" }, ActivityBodyTag.Ursid => new[] { "lumbers onward with steady weight{place_at}", "pads ahead in heavy unhurried steps{place_at}" }, ActivityBodyTag.Seal => new[] { "slides forward on its belly{place_at}", "bounds ahead with a sleek, rolling motion{place_at}" }, ActivityBodyTag.Procyonid => new[] { "pads onward, nosing around{place_at}", "scampers ahead in nimble steps{place_at}" }, ActivityBodyTag.Hyaenid => new[] { "lopes onward with rough confidence{place_at}", "trots ahead in rangy strides{place_at}" }, ActivityBodyTag.Armadillo => new[] { "trundles onward with its body held low{place_at}", "scurries ahead in armored little steps{place_at}" }, ActivityBodyTag.Crawler => new[] { "writhes steadily forward{place_at}", "crawls ahead without hurry{place_at}" }, ActivityBodyTag.Cold => new[] { "moves onward in a breath of cold{place_at}", "drifts ahead with wintry calm{place_at}" }, ActivityBodyTag.Crystal => new[] { "glides onward with crystalline precision{place_at}", "moves in stiff, glittering steps{place_at}" }, ActivityBodyTag.Crab => new[] { "scuttles sideways{place_at}", "sidesteps onward behind a hard shell{place_at}" }, _ => GenericBag(verb, hasTarget) }; } if (verb == "play") { return body switch { ActivityBodyTag.Canine => new[] { "tumbles, bounds, and wheels around{place_at}", "bounds, feints, and wrestles about{place_at}" }, ActivityBodyTag.Feline => new[] { "bats, twists, and springs aside{place_at}", "pounces and leaps without warning{place_at}" }, ActivityBodyTag.Bird => new[] { "flutters in looping arcs{place_at}", "hops and flaps about{place_at}" }, ActivityBodyTag.Insect => new[] { "scuttles in quick zigzags{place_at}", "darts about in short bursts{place_at}" }, ActivityBodyTag.Arachnid => new[] { "skitters in quick loops{place_at}", "darts about on many legs{place_at}" }, ActivityBodyTag.Amphibian => new[] { "hops about in lively bursts{place_at}", "bounces back and forth{place_at}" }, ActivityBodyTag.Aquatic => AquaticTerrainBag( terrain, "splashes and darts through the water{place_at}", "weaves quick circles through the water{place_at}", "twists and darts about{place_at}", "wriggles in quick loops{place_at}"), ActivityBodyTag.Crab => new[] { "scuttles in quick sideways loops{place_at}", "sidesteps and spins about{place_at}" }, ActivityBodyTag.Reptile => new[] { "slides, coils, and doubles back{place_at}", "winds about in slow loops{place_at}" }, ActivityBodyTag.Livestock => new[] { "stomps and bounds clumsily{place_at}", "frolics in heavy, eager bursts{place_at}" }, ActivityBodyTag.Plant => new[] { "sways and twists in slow arcs{place_at}", "twists and rustles energetically{place_at}" }, ActivityBodyTag.Primate => new[] { "clambers, swings, and doubles back{place_at}", "scrambles about with nimble mischief{place_at}" }, ActivityBodyTag.Rodent => new[] { "scampers in tight circles{place_at}", "darts about in quick zigzags{place_at}" }, ActivityBodyTag.Ursid => new[] { "rolls over and lumbers upright again{place_at}", "lumbers about with clumsy cheer{place_at}" }, ActivityBodyTag.Crawler => new[] { "loops around and doubles back{place_at}", "writhes about in restless circles{place_at}" }, _ => new[] { "paces, turns, and doubles back{place_at}", "moves in quick, restless bursts{place_at}" } }; } if (verb == "wait") { return body switch { ActivityBodyTag.Insect => new[] { "holds still with its antennae raised{place_at}", "waits while its antennae twitch{place_at}" }, ActivityBodyTag.Amphibian => new[] { "crouches low and waits{place_at}", "sits still, ready to spring{place_at}" }, ActivityBodyTag.Feline => new[] { "settles into a watchful crouch{place_at}", "waits without looking away{place_at}" }, ActivityBodyTag.Canine => new[] { "waits with alert ears{place_at}", "holds a restless pause{place_at}" }, ActivityBodyTag.Aquatic => AquaticTerrainBag( terrain, "hovers in the water and waits{place_at}", "drifts almost motionless in the water{place_at}", "rests almost motionless{place_at}", "waits with only a faint twitch{place_at}"), ActivityBodyTag.Bird => new[] { "perches and waits{place_at}", "holds a light watchful pause{place_at}" }, ActivityBodyTag.Plant => new[] { "holds a rooted pause{place_at}", "stands still with leaves barely stirring{place_at}" }, ActivityBodyTag.Machina => new[] { "idles in a watchful hold{place_at}", "stays still and scans the surroundings{place_at}" }, _ => new[] { "waits in watchful quiet{place_at}", "stands quietly and watches{place_at}" } }; } if (verb == "hunt") { return body switch { ActivityBodyTag.Canine => Targeted(hasTarget, "hunts {target} by scent{place_at}", "follows {target}'s trail{place_at}", "follows the scent of prey{place_at}", "hunts by scent{place_at}"), ActivityBodyTag.Feline => Targeted(hasTarget, "hunts {target} in silence{place_at}", "stalks {target} without a sound{place_at}", "hunts without making a sound{place_at}", "stalks prey in silence{place_at}"), ActivityBodyTag.Bird => Targeted(hasTarget, "tracks {target} with sharp eyes{place_at}", "circles after {target}{place_at}", "searches keenly for prey{place_at}", "circles after prey{place_at}"), ActivityBodyTag.Insect => Targeted(hasTarget, "scuttles after {target}{place_at}", "darts toward {target}{place_at}", "searches for prey in quick bursts{place_at}", "scuttles after prey{place_at}"), ActivityBodyTag.Reptile => Targeted(hasTarget, "slides after {target}{place_at}", "creeps closer to {target}{place_at}", "waits low for prey to approach{place_at}", "stalks prey in a low crawl{place_at}"), _ => Targeted(hasTarget, "pursues {target}{place_at}", "closes in on {target}{place_at}", "searches for prey{place_at}", "moves quietly on the hunt{place_at}") }; } return verb switch { "fight" => Targeted(hasTarget, "fights {target} in a fierce clash{place_at}", "trades blows with {target}{place_at}", "fights with fierce resolve{place_at}", "clashes without giving ground{place_at}"), "eat" => body switch { ActivityBodyTag.Canine => new[] { "gulps down a meal{place_at}", "tears into a meal{place_at}" }, ActivityBodyTag.Feline => new[] { "eats in small, careful bites{place_at}", "takes its time over a meal{place_at}" }, ActivityBodyTag.Insect => new[] { "nibbles rapidly at a meal{place_at}", "eats in quick little bites{place_at}" }, ActivityBodyTag.Plant => new[] { "draws nourishment slowly{place_at}", "feeds without moving from the spot{place_at}" }, ActivityBodyTag.Livestock => new[] { "grazes with steady appetite{place_at}", "settles in to feed{place_at}" }, _ => new[] { "sits down to eat{place_at}", "finishes a meal{place_at}" } }, "sleep" => body switch { ActivityBodyTag.Canine => new[] { "curls into sleep{place_at}", "settles into deep rest{place_at}" }, ActivityBodyTag.Feline => new[] { "curls into a neat sleep{place_at}", "settles into quiet rest{place_at}" }, ActivityBodyTag.Bird => new[] { "tucks into sleep{place_at}", "roosts into rest{place_at}" }, ActivityBodyTag.Aquatic => AquaticTerrainBag( terrain, "drifts into rest in the water{place_at}", "settles almost motionless in the water{place_at}", "goes still to rest{place_at}", "settles into a quiet sleep{place_at}"), ActivityBodyTag.Plant => new[] { "settles into leafy rest{place_at}", "goes completely still{place_at}" }, _ => new[] { "settles into deep sleep{place_at}", "rests after the day's demands{place_at}" } }, "social" => Targeted(hasTarget, "spends time with {target}{place_at}", "talks and lingers with {target}{place_at}", "looks for company{place_at}", "lingers near others{place_at}"), "laugh" => new[] { "laughs aloud and lets the mood carry{place_at}", "breaks into open laughter{place_at}" }, "sing" => body == ActivityBodyTag.Bird ? new[] { "sings out on light wings{place_at}", "fills the air with bright song{place_at}" } : new[] { "sings out for whoever will hear{place_at}", "raises a clear song{place_at}" }, _ => GenericBag(verb, hasTarget) }; } private static string[] VehicleBag(string verb) { return verb switch { "move" => new[] { "cuts steadily across the water{place_at}", "sails onward with the current{place_at}" }, "wait" => new[] { "rides quietly at rest on the water{place_at}", "holds position on the gentle swell{place_at}" }, "fish" => new[] { "works the water for fish{place_at}", "casts for a catch from the deck{place_at}" }, "trade" => new[] { "carries trade across the water{place_at}", "makes a measured trading run{place_at}" }, "haul" => new[] { "takes cargo aboard{place_at}", "settles the load for passage{place_at}" }, _ => new[] { "continues working on the water{place_at}", "keeps steadily to its course{place_at}" } }; } private static string[] GenericBag(string verb, bool hasTarget) { return verb switch { "farm" => new[] { "tends the fields with patient care{place_at}{job_as}", "works the soil from row to row{place_at}{job_as}" }, "haul" => new[] { "unloads {carrying} after a long haul{place_at}{job_as}", "delivers {carrying} into storage{place_at}" }, "pollinate" => new[] { "works carefully among the blossoms{place_at}", "moves steadily from flower to flower{place_at}" }, "fish" => new[] { "works the water for fish{place_at}{job_as}", "waits patiently for a bite{place_at}" }, "heal" => Targeted(hasTarget, "tends carefully to {target}{place_at}", "works to heal {target}{place_at}", "tends wounds with careful hands{place_at}", "works patiently to recover{place_at}"), "fire" => new[] { "fights the blaze with urgent care{place_at}", "battles fire before it spreads{place_at}" }, "flee" => new[] { "bolts away from danger{place_at}", "retreats before danger closes in{place_at}" }, "work" => new[] { "works steadily at the task{place_at}{job_as}", "labors through the task at hand{place_at}{job_as}" }, "trade" => new[] { "trades and bargains{place_at}{job_as}", "haggles through a careful deal{place_at}" }, "settle" => new[] { "handles civic business{place_at}{job_as}", "sees to matters around the settlement{place_at}" }, "warrior" => Targeted(hasTarget, "holds formation against {target}{place_at}", "drills for war near {target}{place_at}", "stands ready for battle{place_at}", "keeps formation ready{place_at}"), "read" => new[] { "reads with quiet attention{place_at}", "studies the page{place_at}{job_as}" }, "lover" => Targeted(hasTarget, "draws close to {target}{place_at}", "shares a tender moment with {target}{place_at}", "follows the pull of kinship{place_at}", "seeks companionship{place_at}"), "gather_life" => new[] { "gathers with kin{place_at}", "moves among the group{place_at}" }, "move" => new[] { "wanders without hurry{place_at}", "roams nearby, looking around{place_at}" }, "wait" => new[] { "waits in watchful quiet{place_at}", "stands still and watches{place_at}" }, "play" => new[] { "paces, turns, and doubles back{place_at}", "moves in quick, restless bursts{place_at}" }, "eat" => new[] { "sits down to eat{place_at}", "finishes a meal{place_at}" }, "sleep" => new[] { "settles into deep sleep{place_at}", "rests after the day's demands{place_at}" }, "hunt" => Targeted(hasTarget, "pursues {target}{place_at}", "closes in on {target}{place_at}", "searches for prey{place_at}", "moves quietly on the hunt{place_at}"), "fight" => Targeted(hasTarget, "fights {target} in a fierce clash{place_at}", "trades blows with {target}{place_at}", "fights with fierce resolve{place_at}", "clashes without giving ground{place_at}"), "social" => Targeted(hasTarget, "spends time with {target}{place_at}", "talks and lingers with {target}{place_at}", "looks for company{place_at}", "lingers near others{place_at}"), _ => hasTarget ? new[] { "attends to " + verb.Replace('_', ' ') + " with {target}{place_at}", "works on " + verb.Replace('_', ' ') + " near {target}{place_at}" } : new[] { "attends to " + verb.Replace('_', ' ') + "{place_at}", "works through " + verb.Replace('_', ' ') + "{place_at}" } }; } private static string[] Targeted( bool hasTarget, string withTargetA, string withTargetB, string noTargetA, string noTargetB) { return hasTarget ? new[] { withTargetA, withTargetB } : new[] { noTargetA, noTargetB }; } private static string[] AquaticTerrainBag( ActivityTerrain terrain, string liquidA, string liquidB, string nonLiquidA, string nonLiquidB) { return terrain == ActivityTerrain.Liquid ? new[] { liquidA, liquidB } : new[] { nonLiquidA, nonLiquidB }; } }