Skip to content

Commit

Permalink
Adds social/asocial mutations (#71837)
Browse files Browse the repository at this point in the history
* social stuff

* Update mutation_effect_eocs.json

* Update activity_handlers.cpp

* Update activity_handlers.cpp

* Update activity_handlers.cpp

* Update monattack.cpp

* Update math_parser_diag.cpp

* Update math_parser_diag.cpp
  • Loading branch information
worm-girl authored Feb 23, 2024
1 parent ef80b88 commit e144b3a
Show file tree
Hide file tree
Showing 10 changed files with 462 additions and 3 deletions.
42 changes: 42 additions & 0 deletions data/json/effects.json
Original file line number Diff line number Diff line change
Expand Up @@ -4885,6 +4885,48 @@
"flags": [ "FEATHER_FALL" ],
"max_duration": "1 s"
},
{
"type": "effect_type",
"id": "social_satisfied",
"name": [ "Good Company" ],
"desc": [ "It feels good to spend time around others." ],
"max_duration": "6 h",
"max_intensity": 1,
"rating": "good"
},
{
"type": "effect_type",
"id": "social_dissatisfied",
"name": [ "Lonely", "Very Lonely", "All Alone" ],
"desc": [
"You feel a little lonely.",
"You could really use a friend right now.",
"What's the point of surviving if you're all alone?"
],
"max_intensity": 3,
"rating": "bad"
},
{
"type": "effect_type",
"id": "asocial_satisfied",
"name": [ "Alone" ],
"desc": [ "Being on your own makes you feel good." ],
"max_intensity": 1,
"max_duration": "6 h",
"rating": "good"
},
{
"type": "effect_type",
"id": "asocial_dissatisfied",
"name": [ "Irritable", "Annoyed", "Crowded" ],
"desc": [
"Being around others has left you feeling drained.",
"OK, that's enough social time. You'd really rather be alone now.",
"Your nerves are frayed from all this socializing. You need some alone time to recharge."
],
"max_intensity": 3,
"rating": "bad"
},
{
"type": "effect_type",
"id": "quadruped_full",
Expand Down
48 changes: 48 additions & 0 deletions data/json/effects_on_condition/effects_eocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,53 @@
}
],
"false_effect": [ { "u_lose_morale": "morale_bad_protein_bar" } ]
},
{
"type": "effect_on_condition",
"id": "eoc_social_satisfied",
"recurrence": [ "1 minutes", "5 minutes" ],
"condition": { "u_has_effect": "social_satisfied" },
"effect": [ { "u_add_morale": "morale_social", "bonus": 6, "max_bonus": 6, "duration": "1 days", "decay_start": "1 days" } ],
"false_effect": [ { "u_lose_morale": "morale_social" } ]
},
{
"type": "effect_on_condition",
"id": "eoc_social_dissatisfied",
"recurrence": [ "1 minutes", "5 minutes" ],
"condition": { "u_has_effect": "social_dissatisfied" },
"effect": [
{
"u_add_morale": "morale_asocial",
"bonus": { "math": [ "u_effect_intensity('social_dissatisfied') * -7" ] },
"max_bonus": -21,
"duration": "1 days",
"decay_start": "1 days"
}
],
"false_effect": [ { "u_lose_morale": "morale_social_dissatisfied" } ]
},
{
"type": "effect_on_condition",
"id": "eoc_asocial_satisfied",
"recurrence": [ "1 minutes", "5 minutes" ],
"condition": { "u_has_effect": "asocial_satisfied" },
"effect": [ { "u_add_morale": "morale_asocial", "bonus": 10, "max_bonus": 10, "duration": "1 days", "decay_start": "1 days" } ],
"false_effect": [ { "u_lose_morale": "morale_asocial" } ]
},
{
"type": "effect_on_condition",
"id": "eoc_asocial_dissatisfied",
"recurrence": [ "1 minutes", "5 minutes" ],
"condition": { "u_has_effect": "asocial_dissatisfied" },
"effect": [
{
"u_add_morale": "morale_social",
"bonus": { "math": [ "u_effect_intensity('asocial_dissatisfied') * -7" ] },
"max_bonus": -21,
"duration": "1 days",
"decay_start": "1 days"
}
],
"false_effect": [ { "u_lose_morale": "morale_asocial_dissatisfied" } ]
}
]
144 changes: 144 additions & 0 deletions data/json/effects_on_condition/mutation_eocs/mutation_effect_eocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,5 +695,149 @@
{ "u_activate_trait": "WINGS_INSECT_active" },
{ "u_message": "You don't have the stamina to keep buzzing.", "type": "bad" }
]
},
{
"type": "effect_on_condition",
"id": "EOC_social1_bonus",
"recurrence": [ "10 minutes", "30 minutes" ],
"//": "Alcohol and sedatives prevent the bad effects of these EOCs. Antidepressants prevent (but don't remove) both the good and bad effects, keeping you at a baseline state.",
"condition": {
"and": [
{ "u_has_flag": "SOCIAL1" },
{ "not": { "u_has_effect": "took_prozac" } },
{ "math": [ "u_characters_nearby('radius': 30)", ">", "0" ] },
{ "not": { "u_has_effect": "narcosis" } }
]
},
"effect": [
{ "u_lose_effect": "social_dissatisfied" },
{ "u_lose_effect": "social_satisfied" },
{ "u_add_effect": "social_satisfied", "duration": "2 hours" }
]
},
{
"type": "effect_on_condition",
"id": "EOC_social2_bonus",
"recurrence": [ "10 minutes", "30 minutes" ],
"condition": {
"and": [
{ "u_has_flag": "SOCIAL2" },
{ "not": { "u_has_effect": "took_prozac" } },
{ "math": [ "u_characters_nearby('radius': 30, 'attitude': 'allies')", ">", "0" ] },
{ "not": { "u_has_effect": "narcosis" } }
]
},
"effect": [
{ "u_lose_effect": "social_dissatisfied" },
{ "u_lose_effect": "social_satisfied" },
{ "u_add_effect": "social_satisfied", "duration": "6 hours" }
]
},
{
"type": "effect_on_condition",
"id": "EOC_social2_penalty",
"recurrence": [ "30 minutes", "90 minutes" ],
"condition": {
"and": [
{ "u_has_flag": "SOCIAL2" },
{ "math": [ "u_characters_nearby('radius': 30, 'attitude': 'allies')", "==", "0" ] },
{ "not": { "u_has_effect": "took_prozac" } },
{ "not": { "u_has_effect": "valium" } },
{ "not": { "u_has_effect": "took_xanax" } },
{ "not": { "u_has_effect": "drunk" } },
{ "not": { "u_has_effect": "narcosis" } }
]
},
"effect": [
{ "u_lose_effect": "social_satisfied" },
{
"u_add_effect": "social_dissatisfied",
"duration": "PERMANENT",
"intensity": { "math": [ "u_effect_intensity('social_dissatisfied') + 1" ] }
},
{ "u_message": "You could use some friendly company.", "type": "bad" }
]
},
{
"type": "effect_on_condition",
"id": "EOC_asocial1_bonus",
"recurrence": [ "10 minutes", "30 minutes" ],
"condition": {
"and": [
{ "u_has_flag": "ASOCIAL1" },
{ "not": { "u_has_effect": "took_prozac" } },
{ "math": [ "u_characters_nearby('radius': 30)", "==", "0" ] },
{ "not": { "u_has_effect": "narcosis" } }
]
},
"effect": [
{ "u_lose_effect": "asocial_dissatisfied" },
{ "u_lose_effect": "asocial_satisfied" },
{ "u_add_effect": "asocial_satisfied", "duration": "2 hours" }
]
},
{
"type": "effect_on_condition",
"id": "EOC_asocial2_bonus",
"recurrence": [ "10 minutes", "30 minutes" ],
"condition": {
"and": [
{ "u_has_flag": "ASOCIAL2" },
{ "math": [ "u_characters_nearby('radius': 30)", "==", "0" ] },
{ "not": { "u_has_effect": "took_prozac" } },
{ "not": { "u_has_effect": "narcosis" } }
]
},
"effect": [ { "u_lose_effect": "asocial_dissatisfied" }, { "u_add_effect": "asocial_satisfied", "duration": "6 hours" } ]
},
{
"type": "effect_on_condition",
"id": "EOC_asocial2_penalty",
"recurrence": [ "30 minutes", "90 minutes" ],
"condition": {
"and": [
{ "u_has_flag": "ASOCIAL2" },
{ "not": { "u_has_effect": "took_prozac" } },
{ "not": { "u_has_effect": "valium" } },
{ "not": { "u_has_effect": "took_xanax" } },
{ "not": { "u_has_effect": "drunk" } },
{ "math": [ "u_characters_nearby('radius': 30)", ">", "0" ] },
{ "not": { "u_has_effect": "narcosis" } }
]
},
"effect": [
{ "u_lose_effect": "asocial_satisfied" },
{
"u_add_effect": "asocial_dissatisfied",
"duration": "PERMANENT",
"intensity": { "math": [ "u_effect_intensity('asocial_dissatisfied') + 1" ] }
},
{ "u_message": "You'd really rather be by yourself.", "type": "bad" }
]
},
{
"type": "effect_on_condition",
"id": "EOC_social_reset_sleep",
"recurrence": [ "30 minutes", "45 minutes" ],
"condition": {
"and": [
{ "or": [ { "u_has_effect": "narcosis" }, { "u_has_effect": "sleep" } ] },
{ "or": [ { "u_has_effect": "social_dissatisfied" }, { "u_has_effect": "social_dissatisfied" } ] }
]
},
"effect": [ { "u_lose_effect": "asocial_dissatisfied" }, { "u_lose_effect": "social_dissatisfied" } ]
},
{
"type": "effect_on_condition",
"id": "EOC_social_reset_drugs",
"recurrence": [ "1 seconds", "1 seconds" ],
"//": "Sedatives are effective at acutely treating social anxiety/autophobia. Enjoy your benzo addiction, survivors.",
"condition": {
"and": [
{ "or": [ { "u_has_effect": "valium" }, { "u_has_effect": "took_xanax" } ] },
{ "or": [ { "u_has_effect": "social_dissatisfied" }, { "u_has_effect": "social_dissatisfied" } ] }
]
},
"effect": [ { "u_lose_effect": "asocial_dissatisfied" }, { "u_lose_effect": "social_dissatisfied" } ]
}
]
10 changes: 10 additions & 0 deletions data/json/morale_types.json
Original file line number Diff line number Diff line change
Expand Up @@ -428,5 +428,15 @@
"id": "morale_afs_drugs",
"type": "morale_type",
"text": "Chemical enhancement moodswing"
},
{
"id": "morale_social",
"type": "morale_type",
"text": "Spent time around allies"
},
{
"id": "morale_asocial",
"type": "morale_type",
"text": "Spent time alone"
}
]
4 changes: 4 additions & 0 deletions data/json/mutations/mutation_type.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,9 @@
{
"type": "mutation_type",
"id": "BODY_ARMOR_MOD"
},
{
"type": "mutation_type",
"id": "SOCIAL"
}
]
56 changes: 54 additions & 2 deletions data/json/mutations/mutations.json
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
"player_display": false,
"dummy": true,
"category": [ "HUMAN" ],
"types": [ "ANIMAL_EMPATHY", "ATTITUDE", "HUMAN_EMPATHY", "MASOCHISM", "MEMORY", "SLEEPINESS", "WANDERLUST" ],
"types": [ "ANIMAL_EMPATHY", "SOCIAL", "ATTITUDE", "HUMAN_EMPATHY", "MASOCHISM", "MEMORY", "SLEEPINESS", "WANDERLUST" ],
"cancels": [
"ADDICTIVE",
"ADRENALINE",
Expand Down Expand Up @@ -9655,14 +9655,66 @@
"category": [ "ALPHA" ],
"starting_trait": true
},
{
"type": "mutation",
"id": "SOCIAL1",
"name": { "str": "Extrovert" },
"points": 1,
"types": [ "SOCIAL" ],
"cancels": [ "ASOCIAL1", "ASOCIAL2" ],
"changes_to": [ "SOCIAL2" ],
"description": "You don't mind being alone, but you get a slight mood boost from being around friends.",
"starting_trait": true,
"flags": [ "SOCIAL1" ],
"category": [ "CATTLE", "ELFA", "LUPINE", "MOUSE", "RAT", "CHIROPTERAN", "BIRD", "FISH" ]
},
{
"type": "mutation",
"id": "SOCIAL2",
"name": { "str": "Sociable" },
"points": 1,
"types": [ "SOCIAL" ],
"cancels": [ "ASOCIAL1", "ASOCIAL2" ],
"description": "You are a social creature. Spending time with friends will improve your mood, but if you're alone too long, you'll start to feel unhappy.",
"starting_trait": true,
"mixed_effect": true,
"flags": [ "SOCIAL2" ],
"category": [ "CATTLE", "LUPINE", "MOUSE", "RAT", "CHIROPTERAN", "ELFA" ]
},
{
"type": "mutation",
"id": "ASOCIAL1",
"name": { "str": "Introvert" },
"points": 1,
"types": [ "SOCIAL" ],
"cancels": [ "SOCIAL1", "SOCIAL2" ],
"changes_to": [ "ASOCIAL2" ],
"description": "You can tolerate others, but you prefer to be alone. Spending time by yourself will boost your mood slightly.",
"starting_trait": true,
"flags": [ "ASOCIAL1" ],
"category": [ "SPIDER", "URSINE", "FELINE", "LIZARD", "BEAST", "CHIMERA" ]
},
{
"type": "mutation",
"id": "ASOCIAL2",
"name": { "str": "Loner" },
"points": 1,
"types": [ "SOCIAL" ],
"cancels": [ "SOCIAL1", "SOCIAL2" ],
"description": "You'd really rather be by yourself. Being alone will improve your mood, but spending too much time around other people can grate on your nerves.",
"starting_trait": true,
"mixed_effect": true,
"flags": [ "ASOCIAL2" ],
"category": [ "SPIDER", "URSINE", "LIZARD", "BEAST" ]
},
{
"type": "mutation",
"id": "ALPHA_COMPLEX",
"name": { "str": "Superiority Complex" },
"points": 0,
"description": "You can't stand to prostrate yourself before your lessers and hate it when they don't immediately do what you say. Persuasion is much more difficult, but you're better at lying and intimidating.",
"purifiable": false,
"types": [ "HUMAN_EMPATHY" ],
"types": [ "SOCIAL" ],
"social_modifiers": { "lie": 10, "persuade": -25, "intimidate": 10 },
"category": [ "ALPHA" ],
"prereqs": [ "INT_ALPHA", "PER_ALPHA" ],
Expand Down
2 changes: 2 additions & 0 deletions doc/NPCs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,7 @@ _some functions support array arguments or kwargs, denoted with square brackets
| attack_speed() ||| u, n | Return the characters current adjusted attack speed with their current weapon.<br/><br/>Example:<br/>`"condition": { "math": [ "u_attack_speed()", ">=", "10"] }`|
| addiction_intensity(`s`/`v`) ||| u, n | Return the characters current intensity of the given addiction.<br/>Argument is addiction type ID.<br/><br/>Example:<br/>`"condition": { "math": [ "u_addiction_intensity('caffeine')", ">=", "1"] }`|
| addiction_turns(`s`/`v`) ||| u, n | Return the characters current duration left (in turns) for the given addiction.<br/>Argument is addiction type ID. <br/><br/>Example:<br/>`"condition": { "math": [ "u_addiction_turns('caffeine')", ">=", "3600"] }`|
| characters_nearby() ||| u, n, global | Return the number of nearby characters (that is, the avatar and/or NPCs who are not hallucinations). <br/><br/>Optional kwargs:<br/>`radius`: `d`/`v` - limit to radius (rl_dist)<br/>`location`: `v` - center search on this location<br/>`attitude`: `s`/`v` - attitude filter. Must be one of `hostile`, `allies`, `not_allies`, `any`. Assumes `any` if not specified<br/><br/>The `location` kwarg is mandatory in the global scope.<br/>`allow_hallucinations`: `d`/`v` - False by default. If set to any non-zero number, all hallucinated NPCs in range will be counted as well.<br/><br/>Examples:<br/>`"condition": { "math": [ "u_characters_nearby('radius': u_search_radius * 3, 'attitude': 'not_allies' )", ">", "0" ] }`<br/><br/>`"condition": { "math": [ "characters_nearby( 'radius': u_search_radius * 3, 'location': u_search_loc)", ">", "5" ] }`|
| charge_count(`s`/`v`) ||| u, n | Return the charges of a given item in the character's inventory.<br/>Argument is item ID.<br/><br/>Example:<br/>`"condition": { "math": [ "u_charge_count('light_plus_battery_cell')", ">=", "100"] }`|
| coverage(`s`/`v`) ||| u, n | Return the characters total coverage of a body part.<br/>Argument is bodypart ID. <br/>For items, returns typical coverage of the item. <br/><br/>Example:<br/>`"condition": { "math": [ "u_coverage('torso')", ">", "0"] }`|
| distance(`s`/`v`,`s`/`v`) ||| g | Return distance between two targets.<br/>Arguments are location variables or special strings (`u`, `npc`). `u` means your location. `npc` means NPC's location.<br/><br/>Example:<br/>`"condition": { "math": [ "distance('u', loc)", "<=", "50"] }`|
Expand Down Expand Up @@ -1358,6 +1359,7 @@ _some functions support array arguments or kwargs, denoted with square brackets
| val(`s`) || varies | u, n | Return or set a Character or item value. Argument is a [Character/item aspect](#list-of-character-and-item-aspects).<br/><br/>These are all in one function for legacy reasons and are generally poorly tested. If you need one of them, consider porting it to a native math function.<br/><br/>Example:<br/>`{ "math": [ "u_val('strength')", "=", "2" ] }`|
| vitamin(`s`/`v`) ||| u, n | Return or set the characters vitamin level.<br/>Argument is vitamin ID.<br/><br/>Example:<br/>`{ "math": [ "u_vitamin('mutagen')", "=", "0" ] }`|
| warmth(`s`/`v`) ||| u, n | Return the characters warmth on a body part.<br/>Argument is bodypart ID.<br/><br/>Example:<br/> The value displayed in-game is calculated as follows.<br/> `"{ "math": [ "u_warmth_in_game", "=", "(u_warmth('torso') / 100) * 2 - 100"] }`|
| vision_range() ||| u, n | Return the character's visual range, adjusted by their mutations, effects, and other issues.<br/><br/>Example:<br/> `"{ "math": [ "u_vision_range", "<", "30"] }`|
| weather(`s`) ||| N/A<br/>(global) | Return or set a weather aspect<br/><br/>Aspect must be one of:<br/>`temperature` (in Kelvin),<br/>`humidity` (as percentage),<br/>`pressure` (in millibar),<br/>`windpower` (in mph).<br/>`precipitation` (in mm / h) either 0.5 (very_light ), 1.5 (light), or 3 (heavy). Read only.<br/><br/>Temperature conversion functions are available: `celsius()`, `fahrenheit()`, `from_celsius()`, and `from_fahrenheit()`.<br/><br/>Examples:<br/>`{ "math": [ "weather('temperature')", "<", "from_fahrenheit( 33 )" ] }`<br/>`{ "math": [ "fahrenheit( weather('temperature') )", "==", "21" ] }`|
| damage_level() ||| u, n | Return the damage level of the talker, which must be an item.<br/><br/>Example:<br/>`"condition": { "math": [ "n_damage_level()", "<", "1" ] }`|

Expand Down
Loading

0 comments on commit e144b3a

Please sign in to comment.