From a86e904527470b18f94ed8771635e0517532b2d2 Mon Sep 17 00:00:00 2001 From: David Gay Date: Mon, 16 Oct 2023 16:51:39 -0400 Subject: Add NPC personality and disposition to persona generation --- src/data/random_tables/npc.yaml | 131 ++++++++++++++++++++++++++++++++++++++++ src/main.rs | 6 +- src/rules/npcs.rs | 14 +++-- 3 files changed, 142 insertions(+), 9 deletions(-) diff --git a/src/data/random_tables/npc.yaml b/src/data/random_tables/npc.yaml index daf94e3..5c8b7fe 100644 --- a/src/data/random_tables/npc.yaml +++ b/src/data/random_tables/npc.yaml @@ -138,3 +138,134 @@ npc_general_tendencies: - roll: 24 steps: - text: "loquacious" + +npc_personality: + formula: d8 + rows: + - roll: 1-5 + steps: + - table: npc_average_personality + - roll: 6-7 + steps: + - table: npc_extroverted_personality + - roll: 8 + steps: + - table: npc_introverted_personality + +npc_average_personality: + formula: d8 + rows: + - roll: 1 + steps: + - text: "modest" + - roll: 2 + steps: + - text: "egoist/arrogant" + - roll: 3 + steps: + - text: "friendly" + - roll: 4 + steps: + - text: "aloof" + - roll: 5 + steps: + - text: "hostile" + - roll: 6 + steps: + - text: "well-spoken" + - roll: 7 + steps: + - text: "diplomatic" + - roll: 8 + steps: + - text: "abrasive" + +npc_extroverted_personality: + formula: d8 + rows: + - roll: 1 + steps: + - text: "forceful" + - roll: 2 + steps: + - text: "overbearing" + - roll: 3 + steps: + - text: "friendly" + - roll: 4 + steps: + - text: "blustering" + - roll: 5 + steps: + - text: "antagonistic" + - roll: 6 + steps: + - text: "rude" + - roll: 7 + steps: + - text: "rash" + - roll: 8 + steps: + - text: "diplomatic" + +npc_introverted_personality: + formula: d8 + rows: + - roll: 1 + steps: + - text: "retiring" + - roll: 2 + steps: + - text: "taciturn" + - roll: 3 + steps: + - text: "friendly" + - roll: 4 + steps: + - text: "aloof" + - roll: 5 + steps: + - text: "hostile" + - roll: 6 + steps: + - text: "rude" + - roll: 7 + steps: + - text: "courteous" + - roll: 8 + steps: + - text: "solitary/secretive" + +npc_disposition: + formula: d10 + rows: + - roll: 1 + steps: + - text: "cheerful" + - roll: 2 + steps: + - text: "morose" + - roll: 3 + steps: + - text: "compassionate/sensitive" + - roll: 4 + steps: + - text: "unfeeling/insensitive" + - roll: 5 + steps: + - text: "humble" + - roll: 6 + steps: + - text: "proud/haughty" + - roll: 7 + steps: + - text: "even tempered" + - roll: 8 + steps: + - text: "hot tempered" + - roll: 9 + steps: + - text: "easy going" + - roll: 10 + steps: + - text: "harsh" diff --git a/src/main.rs b/src/main.rs index 95f92b7..4b2d91e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,7 +43,7 @@ fn main() { ); npc.roll_henchman_ability_scores(); - npc.randomize_personality(); + npc.randomize_persona(); let ability_scores = npc.ability_scores.unwrap(); @@ -71,7 +71,7 @@ fn main() { .unwrap(), ability_scores.get_score(AbilityScore::Dexterity).unwrap(), ability_scores.get_score(AbilityScore::Charisma).unwrap(), - npc.personality.unwrap(), + npc.persona.unwrap(), ); } else { println!( @@ -89,7 +89,7 @@ fn main() { .unwrap(), ability_scores.get_score(AbilityScore::Dexterity).unwrap(), ability_scores.get_score(AbilityScore::Charisma).unwrap(), - npc.personality.unwrap(), + npc.persona.unwrap(), ); }; } diff --git a/src/rules/npcs.rs b/src/rules/npcs.rs index 696ba0a..7c84d11 100644 --- a/src/rules/npcs.rs +++ b/src/rules/npcs.rs @@ -12,7 +12,7 @@ pub struct Npc { pub race: Option<&'static Race>, pub class: Option<&'static Class>, pub ability_scores: Option, - pub personality: Option, + pub persona: Option, } impl Npc { @@ -21,14 +21,14 @@ impl Npc { race: Option<&'static Race>, class: Option<&'static Class>, ability_scores: Option, - personality: Option, + persona: Option, ) -> Self { Npc { alignment, race, class, ability_scores, - personality, + persona, } } @@ -100,15 +100,17 @@ impl Npc { // TODO: Verify legality of class based on ability scores. } - pub fn randomize_personality(&mut self) { + pub fn randomize_persona(&mut self) { let appearance = RANDOM_TABLES .roll_table("npc_general_appearance") .to_string(); let tendencies = RANDOM_TABLES .roll_table("npc_general_tendencies") .to_string(); - let components = vec![appearance, tendencies]; - self.personality = Some(components.join(", ")); + let personality = RANDOM_TABLES.roll_table("npc_personality").to_string(); + let disposition = RANDOM_TABLES.roll_table("npc_disposition").to_string(); + let components = vec![appearance, tendencies, personality, disposition]; + self.persona = Some(components.join(", ")); } // TODO: Probably break this out later like this. -- cgit v1.2.3