Skip to content

Commit

Permalink
JSONize formication
Browse files Browse the repository at this point in the history
EOCs all done by Guardian

Co-Authored-By: Anton Simakov <[email protected]>
  • Loading branch information
Karol1223 and GuardianDll committed May 25, 2024
1 parent 9116ace commit 68f401a
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 18 deletions.
8 changes: 8 additions & 0 deletions data/json/effects.json
Original file line number Diff line number Diff line change
Expand Up @@ -5001,5 +5001,13 @@
"rating": "bad",
"remove_message": "The wriggling under your skin stops.",
"blood_analysis_description": "Unknown parasitic infection"
},
{
"type": "effect_type",
"id": "formication",
"name": [ "PLACEHOLDER" ],
"desc": [ "PLACEHOLDER" ],
"main_parts_only": true,
"rating": "bad"
}
]
46 changes: 45 additions & 1 deletion data/json/effects_on_condition/effects_eocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,49 @@
{ "u_spawn_monster": "mon_dermatik_larva", "real_count": 1, "min_radius": 1, "max_radius": 4 },
{ "u_lose_effect": "dermatik" }
]
}
},
[
{
"type": "effect_on_condition",
"id": "EOC_FORMICATION_INIT",
"eoc_type": "EVENT",
"required_event": "character_gains_effect",
"condition": { "compare_string": [ "formication", { "context_val": "effect" } ] },
"effect": [ { "queue_eocs": "EOC_FORMICATION", "time_in_future": "1 s" } ]
},
{
"type": "effect_on_condition",
"id": "EOC_FORMICATION",
"condition": { "u_has_effect": "formication" },
"effect": [
{
"if": { "or": [ { "u_has_effect": "narcosis" }, { "u_has_effect": "sleep" } ] },
"else": { "run_eocs": [ "EOC_TRY_SCRATCH" ] }
},
{ "queue_eocs": "EOC_FORMICATION", "time_in_future": "1 s" }
]
},
{
"type": "effect_on_condition",
"id": "EOC_TRY_SCRATCH",
"effect": [
{
"if": {
"x_in_y_chance": {
"x": { "math": [ "u_effect_intensity('formication', 'bodypart': _bodypart)" ] },
"y": { "math": [ "600 + 300 * u_val('intelligence')" ] }
}
},
"then": [
{ "u_message": "You start scratching yourself!" },
{ "npc_message": "<npc_name> stars scratching themselves!" },
{ "turn_cost": 1.5 },
{ "math": [ "u_pain()", "++" ] },
{ "math": [ "hp(_bodypart)", "--" ] }
],
"else": { "u_message": "You want to scratch yourself badly, but you force yourself to stop." }
}
]
}
]
]
18 changes: 1 addition & 17 deletions src/player_hardcoded_effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1268,23 +1268,7 @@ void Character::hardcoded_effects( effect &it )
map &here = get_map();
Character &player_character = get_player_character();
creature_tracker &creatures = get_creature_tracker();
if( id == effect_formication ) {
///\EFFECT_INT decreases occurrence of itching from formication effect
if( x_in_y( intense, 600 + 300 * get_int() ) && !has_effect( effect_narcosis ) ) {
if( !is_npc() ) {
//~ %s is bodypart in accusative.
add_msg( m_warning, _( "You start scratching your %s!" ),
body_part_name_accusative( bp ) );
} else {
//~ 1$s is NPC name, 2$s is bodypart in accusative.
add_msg_if_player_sees( pos(), _( "%1$s starts scratching their %2$s!" ), get_name(),
body_part_name_accusative( bp ) );
}
mod_moves( -to_moves<int>( 1_seconds ) * 1.5 );
mod_pain( 1 );
apply_damage( nullptr, bp, 1 );
}
} else if( id == effect_evil ) {
if( id == effect_evil ) {
// Major effects, all bad.
mod_str_bonus( -( dur > 500_minutes ? 10.0 : dur / 50_minutes ) );
int dex_mod = -( dur > 600_minutes ? 10.0 : dur / 60_minutes );
Expand Down

0 comments on commit 68f401a

Please sign in to comment.