Skip to content

Commit

Permalink
Replace hardcoded personality modifiers with json
Browse files Browse the repository at this point in the history
  • Loading branch information
RenechCDDA committed Dec 20, 2023
1 parent cf77958 commit 771bbce
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 48 deletions.
23 changes: 22 additions & 1 deletion data/json/npcs/classes.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@
"bonus_dex": { "rng": [ -2, 0 ] },
"bonus_int": { "rng": [ 1, 5 ] },
"bonus_per": { "rng": [ -2, 0 ] },
"bonus_aggression": { "rng": [ -3, -1 ] },
"bonus_bravery": { "rng": [ -2, 0 ] },
"skills": [
{ "skill": "ALL", "level": { "mul": [ { "one_in": 3 }, { "sum": [ { "dice": [ 2, 2 ] }, { "rng": [ -1, -2 ] } ] } ] } },
{ "skill": "electronics", "bonus": { "rng": [ 1, 4 ] } },
Expand All @@ -102,6 +104,7 @@
"bonus_str": { "rng": [ -2, 0 ] },
"bonus_int": { "rng": [ 0, 2 ] },
"bonus_per": { "rng": [ 0, 2 ] },
"bonus_aggression": { "rng": [ -4, 0 ] },
"shopkeeper_item_group": "NC_DOCTOR_misc",
"proficiencies": [
"prof_intro_chemistry",
Expand All @@ -127,7 +130,8 @@
"job_description": "I'm collecting gear and selling it.",
"traits": [ { "group": "BG_survival_story_EVACUEE" }, { "group": "NPC_starting_traits" }, { "group": "Appearance_demographics" } ],
"bonus_int": { "one_in": 4 },
"bonus_per": { "one_in": 4 }
"bonus_per": { "one_in": 4 },
"bonus_collector": { "rng": [ 1, 5 ] }
},
{
"type": "npc_class",
Expand All @@ -138,6 +142,8 @@
"bonus_str": { "rng": [ -1, 0 ] },
"bonus_dex": { "rng": [ 0, 2 ] },
"bonus_per": { "rng": [ 0, 2 ] },
"bonus_bravery": { "rng": [ 0, 3 ] },
"bonus_collector": { "rng": [ -6, -1 ] },
"skills": [
{ "skill": "ALL", "level": { "mul": [ { "one_in": 3 }, { "sum": [ { "dice": [ 2, 2 ] }, { "rng": [ -1, -2 ] } ] } ] } },
{ "skill": "dodge", "bonus": { "rng": [ 2, 4 ] } },
Expand All @@ -155,6 +161,8 @@
"bonus_str": { "rng": [ 0, 1 ] },
"bonus_int": { "rng": [ -2, 0 ] },
"bonus_per": { "rng": [ 0, 2 ] },
"bonus_aggression": { "rng": [ 0, 2 ] },
"bonus_bravery": { "rng": [ 1, 5 ] },
"skills": [
{ "skill": "ALL", "level": { "mul": [ { "one_in": 3 }, { "sum": [ { "dice": [ 2, 2 ] }, { "rng": [ 0, -4 ] } ] } ] } },
{ "skill": "gun", "bonus": { "rng": [ 1, 3 ] } },
Expand Down Expand Up @@ -213,6 +221,9 @@
"bonus_str": { "rng": [ -1, -3 ] },
"bonus_dex": { "rng": [ -1, 0 ] },
"bonus_int": { "rng": [ 2, 5 ] },
"bonus_aggression": { "rng": [ -5, -1 ] },
"bonus_bravery": { "rng": [ -8, -2 ] },
"bonus_collector": { "rng": [ 0, 2 ] },
"proficiencies": [
"prof_intro_chemistry",
"prof_intro_biology",
Expand All @@ -235,6 +246,8 @@
"name": { "str": "Bounty Hunter" },
"job_description": "I'm a killer for hire.",
"traits": [ { "group": "BG_survival_story_POLICE" }, { "group": "NPC_starting_traits" }, { "group": "Appearance_demographics" } ],
"bonus_aggression": { "rng": [ 1, 6 ] },
"bonus_bravery": { "rng": [ 0, 5 ] },
"skills": [
{ "skill": "ALL", "level": { "sum": [ { "dice": [ 3, 2 ] }, { "constant": -3 } ] } },
{ "skill": "gun", "bonus": { "rng": [ 2, 4 ] } },
Expand Down Expand Up @@ -275,6 +288,8 @@
],
"bonus_str": { "rng": [ 2, 4 ] },
"bonus_dex": { "rng": [ 0, 2 ] },
"bonus_aggression": { "rng": [ 1, 6 ] },
"bonus_bravery": { "rng": [ 0, 5 ] },
"skills": [
{ "skill": "ALL", "level": { "sum": [ { "dice": [ 3, 2 ] }, { "constant": -4 } ] } },
{ "skill": "dodge", "bonus": { "rng": [ 1, 3 ] } },
Expand All @@ -291,6 +306,8 @@
"name": { "str": "Scavenger" },
"job_description": "I'm just trying to survive.",
"traits": [ { "group": "BG_survival_story_EVACUEE" }, { "group": "NPC_starting_traits" }, { "group": "Appearance_demographics" } ],
"bonus_aggression": { "rng": [ 1, 3 ] },
"bonus_bravery": { "rng": [ 1, 4 ] },
"skills": [
{ "skill": "ALL", "level": { "sum": [ { "dice": [ 3, 2 ] }, { "constant": -3 } ] } },
{ "skill": "gun", "bonus": { "rng": [ 2, 4 ] } },
Expand Down Expand Up @@ -415,6 +432,8 @@
"bonus_str": { "rng": [ 0, 2 ] },
"bonus_dex": { "one_in": 2 },
"bonus_int": { "rng": [ 0, -2 ] },
"bonus_aggression": { "rng": [ 1, 3 ] },
"bonus_bravery": { "rng": [ 0, 3 ] },
"skills": [
{ "skill": "ALL", "level": { "sum": [ { "dice": [ 3, 2 ] }, { "constant": -3 } ] } },
{ "skill": "dodge", "bonus": { "rng": [ 1, 2 ] } },
Expand All @@ -432,6 +451,7 @@
"traits": [ { "group": "NPC_starting_traits" }, { "group": "Appearance_demographics" } ],
"common": false,
"bonus_per": { "one_in": 4 },
"bonus_collector": { "rng": [ 1, 5 ] },
"shopkeeper_item_group": "NC_BARTENDER_misc",
"skills": [
{
Expand All @@ -450,6 +470,7 @@
"//": "This is a unique NPC who doesn't get randomly selected background traits",
"common": false,
"bonus_per": { "one_in": 4 },
"bonus_collector": { "rng": [ 1, 5 ] },
"shopkeeper_item_group": "NC_JUNK_SHOPKEEP_misc",
"skills": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"common": false,
"bonus_int": { "one_in": 4 },
"bonus_per": { "one_in": 4 },
"bonus_collector": { "rng": [ 1, 5 ] },
"shopkeeper_item_group": "NC_EVAC_SHOPKEEP_misc",
"carry_override": "NC_EVAC_SHOPKEEP_misc",
"skills": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
"bonus_dex": { "rng": [ 2, 2 ] },
"bonus_int": { "rng": [ 1, 1 ] },
"bonus_per": { "rng": [ 2, 2 ] },
"bonus_aggression": { "rng": [ 0, 1 ] },
"bonus_collector": { "rng": [ 0, 2 ] },
"shopkeeper_item_group": "NC_ARSONIST_STOCK",
"carry_override": "NC_ARSONIST_STOCK",
"worn_override": "NC_ARSONIST_worn",
Expand Down
47 changes: 0 additions & 47 deletions src/npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -837,53 +837,6 @@ void npc::randomize( const npc_class_id &type, const npc_template_id &tem_id )
set_skill_level( skill.ident(), level );
}

if( type.is_null() ) { // Untyped; no particular specialization
} else if( type == NC_EVAC_SHOPKEEP || type == NC_BARTENDER || type == NC_JUNK_SHOPKEEP ) {
personality.collector += rng( 1, 5 );

} else if( type == NC_ARSONIST ) {
personality.aggression += rng( 0, 1 );
personality.collector += rng( 0, 2 );

} else if( type == NC_SOLDIER ) {
personality.aggression += rng( 1, 3 );
personality.bravery += rng( 0, 5 );

} else if( type == NC_HACKER ) {
personality.bravery -= rng( 1, 3 );
personality.aggression -= rng( 0, 2 );

} else if( type == NC_DOCTOR ) {
personality.aggression -= rng( 0, 4 );
cash += 10000 * rng( 0, 3 ) * rng( 0, 3 );

} else if( type == NC_TRADER ) {
personality.collector += rng( 1, 5 );
cash += 25000 * rng( 1, 10 );

} else if( type == NC_NINJA ) {
personality.bravery += rng( 0, 3 );
personality.collector -= rng( 1, 6 );
// TODO: give ninja his styles back

} else if( type == NC_COWBOY ) {
personality.aggression += rng( 0, 2 );
personality.bravery += rng( 1, 5 );

} else if( type == NC_SCIENTIST ) {
personality.aggression -= rng( 1, 5 );
personality.bravery -= rng( 2, 8 );
personality.collector += rng( 0, 2 );

} else if( type == NC_BOUNTY_HUNTER || type == NC_THUG ) {
personality.aggression += rng( 1, 6 );
personality.bravery += rng( 0, 5 );

} else if( type == NC_SCAVENGER ) {
personality.aggression += rng( 1, 3 );
personality.bravery += rng( 1, 4 );

}
//A universal barter boost to keep NPCs competitive with players
//The int boost from trade wasn't active... now that it is, most
//players will vastly outclass npcs in trade without a little help.
Expand Down

0 comments on commit 771bbce

Please sign in to comment.