Skip to content

Commit

Permalink
JSONify dermatiks and make the pregnancy and birth actually suck (#75284
Browse files Browse the repository at this point in the history
)

* I have no idea what I'm doing

* will it work? damn well hope so!

* ew

* update the docs while you're at it

* clang tidy guide my hand

* effects and EoCs oh my

Co-Authored-By: Anton Simakov <[email protected]>

* maybe now?

* Update monster_attacks.json

* EOC bonanza

* clang tidy my beloved

* typos

* maybe maybe maybe?

* maaaaaaaaybe?

* maaaaaaaaaaaybe?

* file organizing apparently

* applying some review stuff

* clangy

* are we going somewhere?

* syntax for nerds

* JSONize formication

EOCs all done by Guardian

Co-Authored-By: Anton Simakov <[email protected]>

* EOC ID naming scheme

* Update data/json/monster_special_attacks/monster_attacks.json

Co-authored-by: Uwuewsky <[email protected]>

* we live in a bracket hell

* what the fuck is this syntax

* Allow piercing armor to provide preggers protection

* Add sad face from giving birth to giant insect parasites

* Make itchiness hardcoded once again, 'cause that's a lotta work

* Add dermatik larva size counter and corresponding effects for it

* Add EOCs for larva itching and birth

* Rename dermatik_pregnancy to dermatik_visible

* Remove the debug messages

* Change formication chance and duration from the values used for debug purposes

* Make the itchy witchy message bad

* Nerd the thirst drain

* Buffed the hunger drain and added increased metabolism

* Change morale message

* Remove morale effect

* Remove morale type

* Whoopsie doopsie, removed the activation

* Adjust suck range so that all bleeding is heavy bleeding, and lose some redcells during "birth"

* Prevent regen of blood and redcells while carrying dermatik

* It's lintin' time

* It's lintin' time 2

* It's astylin' time

* It's lintin' time 3

* JSON styling

* Remove dermatik attack code again

* Remove deadly blood drain

---------

Co-authored-by: Karol1223 <[email protected]>
Co-authored-by: Anton Simakov <[email protected]>
Co-authored-by: Karol1223 <[email protected]>
Co-authored-by: Uwuewsky <[email protected]>
  • Loading branch information
5 people authored Aug 29, 2024
1 parent b14f56d commit bb6a9a0
Show file tree
Hide file tree
Showing 10 changed files with 153 additions and 151 deletions.
38 changes: 37 additions & 1 deletion data/json/effects.json
Original file line number Diff line number Diff line change
Expand Up @@ -2972,7 +2972,42 @@
"type": "effect_type",
"id": "dermatik",
"immune_bp_flags": [ "BIONIC_LIMB" ],
"blood_analysis_description": "Insect Parasite"
"blood_analysis_description": "Insect Parasite",
"vitamins": [
{ "vitamin": "dermatik_larva_size", "rate": [ [ 1, 1 ] ], "tick": [ "1 m" ] },
{ "vitamin": "vitC", "rate": [ [ -1, -1 ] ], "tick": [ "5 m" ] },
{ "vitamin": "iron", "rate": [ [ -1, -1 ] ], "tick": [ "5 m" ] },
{ "vitamin": "calcium", "rate": [ [ -1, -1 ] ], "tick": [ "5 m" ] },
{ "vitamin": "mutant_toxin", "rate": [ [ 1, 1 ] ], "tick": [ "5 m" ] }
],
"base_mods": {
"hunger_min": [ 1 ],
"hunger_tick": [ 20 ],
"thirst_min": [ 1 ],
"thirst_tick": [ 300 ],
"sleepiness_min": [ 1 ],
"sleepiness_tick": [ 300 ],
"h_mod_min": [ 1 ],
"h_mod_tick": [ 300 ],
"healing_rate": [ 0.05 ]
},
"enchantments": [ { "values": [ { "value": "METABOLISM", "multiply": 3.0 } ] } ],
"immune_flags": [ "ACIDBLOOD", "PARAIMMUNE" ]
},
{
"type": "effect_type",
"id": "dermatik_visible",
"name": [ "Wriggling Skin", "Crawling Lump", "Distended Flesh" ],
"desc": [
"You can feel something wriggling beneath the skin…",
"There's a small lump under your skin, it shifts and writhes with a life of its own…",
"An area of your flesh bulges unnaturally, stretched by the presence of something inside. It feels like it's desperately trying to push its way out…"
],
"rating": "bad",
"max_intensity": 3,
"show_in_info": true,
"base_mods": { "vomit_chance": [ 25200 ], "pain_amount": [ 3 ] },
"scaling_mods": { "vomit_chance": [ -7200 ], "pain_amount": [ 6 ] }
},
{
"type": "effect_type",
Expand All @@ -2983,6 +3018,7 @@
"rating": "bad",
"resist_effects": [ "took_flumed", "took_antihistamine" ],
"main_parts_only": true,
"show_in_info": true,
"immune_bp_flags": [ "BIONIC_LIMB" ],
"max_intensity": 3,
"base_mods": { "str_mod": [ -0.34 ], "int_mod": [ -1 ] },
Expand Down
77 changes: 77 additions & 0 deletions data/json/effects_on_condition/effects_eocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,82 @@
"target_part": "eyes"
}
]
},
{
"type": "effect_on_condition",
"id": "EOC_dermatik_visible_INIT",
"eoc_type": "EVENT",
"required_event": "character_gains_effect",
"condition": { "compare_string": [ "dermatik", { "context_val": "effect" } ] },
"effect": [ { "set_string_var": { "context_val": "bodypart" }, "target_var": { "global_val": "IMPREGNATED_BODYPART" } } ]
},
{
"type": "effect_on_condition",
"id": "EOC_DERMATIK_BIRTH_INIT",
"recurrence": [ "3 minutes", "10 minutes" ],
"condition": { "and": [ { "math": [ "u_vitamin('dermatik_larva_size')", ">=", "1440" ] }, { "x_in_y_chance": { "x": 1, "y": 3 } } ] },
"effect": { "u_lose_effect": "dermatik" }
},
{
"type": "effect_on_condition",
"id": "EOC_DERMATIK_BIRTH",
"eoc_type": "EVENT",
"required_event": "character_loses_effect",
"condition": { "compare_string": [ "dermatik", { "context_val": "effect" } ] },
"effect": [
{
"if": { "math": [ "u_vitamin('dermatik_larva_size')", ">=", "1440" ] },
"then": [
{ "if": { "u_has_effect": "sleep" }, "then": { "u_lose_effect": "sleep" } },
{ "math": [ "NUM_LARVA", "=", "u_val('size')" ] },
{
"u_message": "<global_val:NUM_LARVA> dermatik larvae bursts out of the bulge of flesh on your <global_val:IMPREGNATED_BODYPART>!",
"type": "bad"
},
{
"u_spawn_monster": "mon_dermatik_larva",
"real_count": { "global_val": "NUM_LARVA" },
"min_radius": 1,
"max_radius": 4
},
{ "u_set_field": "fd_blood", "radius": 1, "intensity": 3 },
{ "turn_cost": "6 seconds" },
{ "math": [ "HOW_MUCH_WILL_THIS_SUCK", "=", "rng(21, 30)" ] },
{ "math": [ "u_vitamin('blood')", "-=", "HOW_MUCH_WILL_THIS_SUCK * 100" ] },
{ "math": [ "u_vitamin('redcells')", "-=", "HOW_MUCH_WILL_THIS_SUCK * 100" ] },
{
"u_add_effect": "bleed",
"target_part": { "global_val": "IMPREGNATED_BODYPART" },
"duration": { "math": [ "HOW_MUCH_WILL_THIS_SUCK * 60" ] }
},
{ "math": [ "u_pain()", "+=", "HOW_MUCH_WILL_THIS_SUCK * 2" ] },
{ "math": [ "u_hp(IMPREGNATED_BODYPART)", "-=", "HOW_MUCH_WILL_THIS_SUCK * 2" ] }
],
"else": { "math": [ "u_vitamin('mutant_toxin')", "+=", "u_vitamin('dermatik_larva_size') / 3" ] }
},
{ "u_lose_effect": "dermatik_visible" },
{ "math": [ "u_vitamin('dermatik_larva_size')", "=", "0" ] }
]
},
{
"type": "effect_on_condition",
"id": "EOC_DERMATIK_FORMICATION",
"condition": {
"and": [
{ "u_has_effect": "dermatik" },
{ "not": { "u_has_effect": "formication" } },
{ "not": { "u_has_effect": "took_antihistamine" } },
{ "x_in_y_chance": { "x": 1, "y": { "math": [ "max(360, 2000 - u_vitamin('dermatik_larva_size'))" ] } } }
]
},
"effect": [
{ "u_message": "The growth in your <global_val:IMPREGNATED_BODYPART> itches!", "type": "bad" },
{
"u_add_effect": "formication",
"duration": 360,
"target_part": { "global_val": "IMPREGNATED_BODYPART" },
"intensity": { "math": [ "u_effect_intensity('dermatik_visible', 'bodypart': IMPREGNATED_BODYPART)" ] }
}
]
}
]
23 changes: 23 additions & 0 deletions data/json/monster_special_attacks/monster_attacks.json
Original file line number Diff line number Diff line change
Expand Up @@ -684,5 +684,28 @@
"no_dmg_msg_npc": "%1$s tries to impale <npcname>, but fails to penetrate their armor.",
"dodgeable": true,
"blockable": true
},
{
"type": "monster_attack",
"attack_type": "melee",
"id": "dermatik_impale",
"condition": {
"and": [
{ "and": [ { "u_has_flag": "GRAB_FILTER" } ] },
{
"not": { "or": [ { "u_has_flag": "ACIDBLOOD" }, { "u_has_flag": "PARAIMMUNE" }, { "u_has_effect": "dermatik" } ] }
}
]
},
"damage_max_instance": [ { "damage_type": "stab", "amount": 4, "armor_multiplier": 0.33 } ],
"effects": [ { "id": "dermatik", "duration": 86400, "affect_hit_bp": true } ],
"cooldown": 25,
"move_cost": 300,
"hit_dmg_u": "The %1$s sinks its ovipositor into your %2$s!",
"hit_dmg_npc": "The %1$s sinks its ovipositor into <npcname>'s %2$s!",
"miss_msg_u": "The %s tries to land on you, but you dodge!",
"miss_msg_npc": "The %1$s tries to land on <npcname>, but they dodge!",
"no_dmg_msg_u": "The %1$s lands on your %2$s, but can't penetrate your armor!",
"no_dmg_msg_npc": "The %1$s lands on <npcname>'s %2$s, but can't penetrate their armor!"
}
]
4 changes: 2 additions & 2 deletions data/json/monsters/insect_spider.json
Original file line number Diff line number Diff line change
Expand Up @@ -2325,12 +2325,12 @@
"delete": { "weakpoints": [ { "id": "stinger" } ] },
"harvest": "arachnid_flying",
"dissect": "dissect_insect_sample_single",
"special_attacks": [ [ "DERMATIK", 25 ] ],
"special_attacks": [ { "id": "dermatik_impale" }, { "id": "grab" } ],
"vision_day": 13,
"anger_triggers": [ "FRIEND_ATTACKED", "PLAYER_WEAK" ],
"fear_triggers": [ "HURT", "FIRE" ],
"zombify_into": "mon_meat_cocoon_tiny",
"flags": [ "SEES", "HEARS", "SMELLS", "FLIES", "PATH_AVOID_FIRE", "CANPLAY" ],
"flags": [ "SEES", "HEARS", "SMELLS", "FLIES", "PATH_AVOID_FIRE", "CANPLAY", "GRABS" ],
"armor": { "bash": 2, "cut": 5 }
},
{
Expand Down
12 changes: 12 additions & 0 deletions data/json/vitamin.json
Original file line number Diff line number Diff line change
Expand Up @@ -610,5 +610,17 @@
"min": 0,
"max": 1,
"rate": "1 h"
},
{
"id": "dermatik_larva_size",
"type": "vitamin",
"vit_type": "counter",
"name": { "str": "Dermatik Larva Size" },
"excess": "dermatik_visible",
"min": 0,
"max": 1440,
"rate": "48 h",
"flags": [ "NO_DISPLAY" ],
"disease_excess": [ [ 60, 399 ], [ 400, 1079 ], [ 1080, 1440 ] ]
}
]
1 change: 0 additions & 1 deletion doc/MONSTER_SPECIAL_ATTACKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ These special attacks are mostly hardcoded in C++ and are generally not configur
- ```COPBOT``` Cop-bot warns then tazes the player.
- ```DANCE``` Monster dances.
- ```DARKMAN``` Can cause darkness and wraiths to spawn.
- ```DERMATIK``` Attempts to lay dermatik eggs in the player.
- ```DISAPPEAR``` Hallucination (or other unusual monster) disappears.
- ```DOGTHING``` The dog _thing_ spawns into a tentacle dog.
- ```EAT_CARRION``` The monster will nibble on organic corpses, including zombies and plants, damaging them and filling its stomach if it has the EATS flag.
Expand Down
97 changes: 1 addition & 96 deletions src/monattack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ static const efftype_id effect_countdown( "countdown" );
static const efftype_id effect_darkness( "darkness" );
static const efftype_id effect_dazed( "dazed" );
static const efftype_id effect_deaf( "deaf" );
static const efftype_id effect_dermatik( "dermatik" );
static const efftype_id effect_downed( "downed" );
static const efftype_id effect_dragging( "dragging" );
static const efftype_id effect_eyebot_assisted( "eyebot_assisted" );
Expand Down Expand Up @@ -188,7 +187,6 @@ static const mtype_id mon_breather( "mon_breather" );
static const mtype_id mon_breather_hub( "mon_breather_hub" );
static const mtype_id mon_creeper_hub( "mon_creeper_hub" );
static const mtype_id mon_creeper_vine( "mon_creeper_vine" );
static const mtype_id mon_dermatik( "mon_dermatik" );
static const mtype_id mon_fungal_hedgerow( "mon_fungal_hedgerow" );
static const mtype_id mon_fungal_tendril( "mon_fungal_tendril" );
static const mtype_id mon_fungal_wall( "mon_fungal_wall" );
Expand All @@ -211,7 +209,6 @@ static const mtype_id mon_zombie_jackson( "mon_zombie_jackson" );
static const mtype_id mon_zombie_skeltal_minion( "mon_zombie_skeltal_minion" );

static const skill_id skill_melee( "melee" );
static const skill_id skill_unarmed( "unarmed" );

static const species_id species_LEECH_PLANT( "LEECH_PLANT" );
static const species_id species_SLIME( "SLIME" );
Expand All @@ -225,15 +222,12 @@ static const ter_str_id ter_t_tree( "t_tree" );
static const ter_str_id ter_t_tree_young( "t_tree_young" );
static const ter_str_id ter_t_underbrush( "t_underbrush" );

static const trait_id trait_ACIDBLOOD( "ACIDBLOOD" );
static const trait_id trait_MARLOSS( "MARLOSS" );
static const trait_id trait_MARLOSS_BLUE( "MARLOSS_BLUE" );
static const trait_id trait_PARAIMMUNE( "PARAIMMUNE" );
static const trait_id trait_PROF_FED( "PROF_FED" );
static const trait_id trait_PROF_PD_DET( "PROF_PD_DET" );
static const trait_id trait_PROF_POLICE( "PROF_POLICE" );
static const trait_id trait_PROF_SWAT( "PROF_SWAT" );
static const trait_id trait_TAIL_CATTLE( "TAIL_CATTLE" );
static const trait_id trait_THRESH_MARLOSS( "THRESH_MARLOSS" );
static const trait_id trait_THRESH_MYCUS( "THRESH_MYCUS" );

Expand Down Expand Up @@ -2042,95 +2036,6 @@ bool mattack::fungus_fortify( monster *z )
return true;
}

bool mattack::dermatik( monster *z )
{
if( !z->can_act() ) {
return false;
}

Creature *target = z->attack_target();
if( target == nullptr ||
!z->is_adjacent( target, true ) ||
!z->sees( *target ) ) {
return false;
}

Character *foe = dynamic_cast< Character * >( target );
if( foe == nullptr ) {
return true; // No implanting monsters for now
}

// Can we dodge the attack? Uses player dodge function % chance (melee.cpp)
if( target->dodge_check( z ) ) {
if( target->is_avatar() ) {
add_msg( _( "The %s tries to land on you, but you dodge." ), z->name() );
}
z->stumble();
target->on_dodge( z, z->type->melee_skill );
return true;
}

// Can we swat the bug away?
int dodge_roll = z->dodge_roll();
///\EFFECT_MELEE increases chance to deflect dermatik attack

///\EFFECT_UNARMED increases chance to deflect dermatik attack
int swat_skill = ( foe->get_skill_level( skill_melee ) + foe->get_skill_level(
skill_unarmed ) * 2 ) / 3;
int player_swat = dice( swat_skill, 10 );
if( foe->has_trait( trait_TAIL_CATTLE ) ) {
target->add_msg_if_player( _( "You swat at the %s with your tail!" ), z->name() );
///\EFFECT_DEX increases chance of deflecting dermatik attack with TAIL_CATTLE

///\EFFECT_UNARMED increases chance of deflecting dermatik attack with TAIL_CATTLE
player_swat += ( ( foe->dex_cur + foe->get_skill_level( skill_unarmed ) ) / 2 );
}
Character &player_character = get_player_character();
if( player_swat > dodge_roll ) {
target->add_msg_if_player( _( "The %s lands on you, but you swat it off." ), z->name() );
if( z->get_hp() >= z->get_hp_max() / 2 ) {
z->apply_damage( &player_character, bodypart_id( "torso" ), 1 );
z->check_dead_state();
}
if( player_swat > dodge_roll * 1.5 ) {
z->stumble();
}
return true;
}

// Can the bug penetrate our armor? Or is the limb a bionic one?
const bodypart_id targeted = target->get_random_body_part();
if( !targeted->has_flag( json_flag_BIONIC_LIMB ) &&
4 < player_character.get_armor_type( damage_cut, targeted ) / 3 ) {
//~ 1$s monster name(dermatik), 2$s bodypart name in accusative.
target->add_msg_if_player( _( "The %1$s lands on your %2$s, but can't penetrate your armor." ),
z->name(), body_part_name_accusative( targeted ) );
z->mod_moves( -to_moves<int>( 1_seconds ) * 1.5 ); // Attempted laying takes a while
return true;
}

// Success!
z->mod_moves( -to_moves<int>( 5_seconds ) ); // Successful laying takes a long time
//~ 1$s monster name(dermatik), 2$s bodypart name in accusative.
target->add_msg_if_player( m_bad, _( "The %1$s sinks its ovipositor into your %2$s!" ),
z->name(),
body_part_name_accusative( targeted ) );
if( !foe->has_trait( trait_PARAIMMUNE ) && !foe->has_trait( trait_ACIDBLOOD ) ) {
foe->add_effect( effect_dermatik, 1_turns, targeted, true );
get_event_bus().send<event_type::dermatik_eggs_injected>( foe->getID() );
}

return true;
}

bool mattack::dermatik_growth( monster *z )
{
add_msg_if_player_sees( *z, m_warning, _( "The %s dermatik larva grows into an adult!" ),
z->name() );
z->poly( mon_dermatik );
return false;
}

bool mattack::fungal_trail( monster *z )
{
fungal_effects fe;
Expand Down Expand Up @@ -4765,4 +4670,4 @@ bool mattack::speaker( monster *z )
sounds::sound( z->pos(), 60, sounds::sound_t::order,
SNIPPET.random_from_category( "speaker_warning" ).value_or( translation() ) );
return true;
}
}
2 changes: 0 additions & 2 deletions src/monattack.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ bool fungus_bristle( monster *z ); // Fungal hedgerow rake & inject
bool fungus_growth( monster *z ); // Sporeling -> fungal creature
bool fungus_sprout( monster *z ); // Grow fungal walls
bool fungus_fortify( monster *z ); // Grow fungal hedgerows
bool dermatik( monster *z );
bool dermatik_growth( monster *z );
bool fungal_trail( monster *z );
bool plant( monster *z );
bool disappear( monster *z );
Expand Down
2 changes: 0 additions & 2 deletions src/monstergenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,6 @@ void MonsterGenerator::init_attack()
add_hardcoded_attack( "FUNGUS_GROWTH", mattack::fungus_growth );
add_hardcoded_attack( "FUNGUS_SPROUT", mattack::fungus_sprout );
add_hardcoded_attack( "FUNGUS_FORTIFY", mattack::fungus_fortify );
add_hardcoded_attack( "DERMATIK", mattack::dermatik );
add_hardcoded_attack( "DERMATIK_GROWTH", mattack::dermatik_growth );
add_hardcoded_attack( "FUNGAL_TRAIL", mattack::fungal_trail );
add_hardcoded_attack( "PLANT", mattack::plant );
add_hardcoded_attack( "DISAPPEAR", mattack::disappear );
Expand Down
Loading

0 comments on commit bb6a9a0

Please sign in to comment.