Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
06bc3fd
Test: basic implementation of boomer bile gun
Fris0uman Mar 9, 2024
329eb56
Use breathability to measure protection against liquid ammo
Fris0uman May 19, 2024
4886277
wip on_hit_effect
Fris0uman Jun 25, 2024
9064302
Apllying effects on Bp is handled in the effect definition, no need f…
Fris0uman Dec 29, 2024
231f22a
Let clothing_wetness_mult be 0 when checking for permeability
Fris0uman Dec 29, 2024
83d0ab1
Only pass the Bp hit to apply_effects_nodamage
Fris0uman Dec 29, 2024
6b874f6
make bile field glowing
GuardianDll Jan 27, 2025
6973371
replace boomer attacks with gun, tweak gun and rounds
GuardianDll Jan 27, 2025
f3ecd06
remove BOOMER and BOOMER_GLOW hardcoded special attacks
GuardianDll Jan 27, 2025
f865f44
on_hit_effects Doc update
Fris0uman Jun 21, 2025
e0962ed
remove reference to inexistant bounce effect
Fris0uman Jun 21, 2025
eb20ee4
add missing include
Fris0uman Jun 21, 2025
041c62f
update gun ammo and boomer to current json style
Fris0uman Jun 21, 2025
0f13586
fix boomer puking sounds
Fris0uman Jun 21, 2025
ca2b745
give ammo to huge boomer and glutton
Fris0uman Jun 21, 2025
00babec
fixes from review
Fris0uman Jun 22, 2025
ca22b01
blinding bile
Fris0uman Jun 22, 2025
c24e197
only advanced boomer makes glowing bile
Fris0uman Jun 22, 2025
04996be
Add test for ammo effect application
Fris0uman Jun 22, 2025
82ee82f
clean up loading code
Fris0uman Jul 10, 2025
68c4dc2
Merge branch 'master' into glubglub_gun
Fris0uman Jul 10, 2025
cff8889
add sections to test
Fris0uman Jul 10, 2025
bb3c989
add boomer_head to gun dps data
Fris0uman Jul 17, 2025
423dc38
tidy up
Fris0uman Jul 17, 2025
5178cf1
fix crash
Fris0uman Jul 17, 2025
0ff6f59
fix ammo effect that should be a flag
Fris0uman Jul 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions data/json/ammo_effects.json
Original file line number Diff line number Diff line change
Expand Up @@ -461,5 +461,10 @@
"type": "ammo_effect",
"//": "runs EoC that cause you to mutate",
"eoc": [ "EOC_random_mutate" ]
},
{
"id": "LIQUID",
"type": "ammo_effect",
"//": "This is basically a flag for liquid ammo, it is set automatically when the material of the ammo is liquid"
}
]
3 changes: 1 addition & 2 deletions data/json/effects.json
Original file line number Diff line number Diff line change
Expand Up @@ -2274,14 +2274,13 @@
"desc": [ "Your vision is obscured by a disgusting splatter of bile." ],
"apply_message": "You're covered in bile!",
"rating": "bad",
"base_mods": { "per_mod": [ -3 ] },
"max_duration": "30 s",
"limb_score_mods": [
{ "limb_score": "vision", "modifier": 0.1 },
{ "limb_score": "night_vis", "modifier": 0.0 },
{ "limb_score": "reaction", "modifier": 0.2 }
],
"flags": [ "EFFECT_LIMB_SCORE_MOD" ],
"flags": [ "EFFECT_LIMB_SCORE_MOD_LOCAL" ],
"show_in_info": true
},
{
Expand Down
6 changes: 5 additions & 1 deletion data/json/field_type.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
"id": "fd_bile",
"type": "field_type",
"legacy_enum_id": 2,
"intensity_levels": [ { "name": "bile splatter", "color": "pink" }, { "name": "bile stain" }, { "name": "puddle of bile" } ],
"intensity_levels": [
{ "name": "bile splatter", "color": "pink" },
{ "name": "bile stain", "light_emitted": 1 },
{ "name": "puddle of bile", "light_emitted": 3 }
],
"description_affix": "covered_in",
"underwater_age_speedup": "25 minutes",
"decay_amount_factor": 2,
Expand Down
74 changes: 74 additions & 0 deletions data/json/monster_special_attacks/monster_ammo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
[
{
"type": "ammunition_type",
"id": "bile",
"name": "boomer bile",
"default": "boomer_bile"
},
{
"id": "boomer_bile",
"type": "ITEM",
"subtypes": [ "AMMO" ],
"name": { "str": "boomer bile", "//~": "NO_I18N" },
"description": { "str": "Boomer bile, if you see this it's a bug.", "//~": "NO_I18N" },
"weight": "3 g",
"volume": "250 ml",
"material": [ "water" ],
"symbol": "=",
"color": "pink",
"phase": "liquid",
"ammo_type": "bile",
"range": 4,
"count": 1,
"effects": [ "NEVER_MISFIRES", "BILE_JET", "BILE_GLOW", "BILE_STINK", "BILE_BLIND" ]
},
{
"id": "boomer_bile_adv",
"type": "ITEM",
"subtypes": [ "AMMO" ],
"name": { "str": "advanced boomer bile", "//~": "NO_I18N" },
"description": { "str": "Boomer bile, if you see this it's a bug.", "//~": "NO_I18N" },
"weight": "3 g",
"volume": "250 ml",
"material": [ "water" ],
"symbol": "=",
"color": "pink",
"phase": "liquid",
"ammo_type": "bile",
"range": 4,
"count": 1,
"effects": [ "NEVER_MISFIRES", "BILE_JET", "BILE_GLOW", "BILE_BOMB", "BILE_STINK", "BILE_IRRITATE", "BILE_BLIND" ]
},
{
"id": "BILE_BOMB",
"type": "ammo_effect",
"//": "Leaves a pool of bile on detonation",
"aoe": { "field_type": "fd_bile", "intensity_min": 3, "intensity_max": 3 }
},
{
"id": "BILE_JET",
"type": "ammo_effect",
"//": "Creates a trail of bile",
"trail": { "field_type": "fd_bile", "intensity_min": 1, "intensity_max": 2, "chance": 75 }
},
{
"id": "BILE_GLOW",
"type": "ammo_effect",
"on_hit_effects": [ { "effect": "glowing", "duration": "5 m", "intensity": 1 } ]
},
{
"id": "BILE_STINK",
"type": "ammo_effect",
"on_hit_effects": [ { "effect": "bile_stink", "duration": "5 m", "intensity": 1, "need_touch_skin": true } ]
},
{
"id": "BILE_IRRITATE",
"type": "ammo_effect",
"on_hit_effects": [ { "effect": "bile_irritant", "duration": "5 m", "intensity": 1, "need_touch_skin": true } ]
},
{
"id": "BILE_BLIND",
"type": "ammo_effect",
"on_hit_effects": [ { "effect": "boomered", "duration": "30 s", "intensity": 1, "need_touch_skin": true } ]
}
]
19 changes: 19 additions & 0 deletions data/json/monster_special_attacks/monster_gun.json
Original file line number Diff line number Diff line change
Expand Up @@ -351,5 +351,24 @@
"range": 100,
"dispersion": 1000,
"ranged_damage": { "damage_type": "stab", "amount": 30 }
},
{
"id": "boomer_head",
"copy-from": "fake_item",
"type": "ITEM",
"subtypes": [ "GUN" ],
"reload_noise": "slosh.",
"name": { "str": "boomer head", "//~": "NO_I18N" },
"description": { "str": "The head of a boomer, if you see this item it's a bug.", "//~": "NO_I18N" },
"material": [ "flesh" ],
"flags": [ "NEVER_JAMS", "NON_FOULING" ],
"ammo_effects": [ "NEVER_MISFIRES", "NO_PENETRATE_OBSTACLES", "LIQUID" ],
"ammo": [ "bile" ],
"skill": "rifle",
"dispersion": 300,
"durability": 10,
"range": 10,
"pocket_data": [ { "pocket_type": "MAGAZINE", "ammo_restriction": { "bile": 1000 }, "watertight": true } ],
"melee_damage": { "bash": 9 }
}
]
62 changes: 57 additions & 5 deletions data/json/monsters/zed_explosive.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,27 @@
"upgrades": { "half_life": 168, "into_group": "GROUP_ZOMBIE_BOOMER_UPGRADE" },
"fungalize_into": "mon_boomer_dusted",
"armor": { "electric": 2 },
"extend": { "flags": [ "BILE_BLOOD" ], "weakpoint_sets": [ "wps_humanoid_head_small" ], "special_attacks": [ [ "BOOMER", 20 ] ] }
"starting_ammo": { "boomer_bile": 999 },
"extend": {
"flags": [ "BILE_BLOOD" ],
"weakpoint_sets": [ "wps_humanoid_head_small" ],
"special_attacks": [
{
"type": "gun",
"move_cost": 150,
"cooldown": 5,
"id": "boomer_bile",
"gun_type": "boomer_head",
"ammo_type": "boomer_bile",
"fake_skills": [ [ "gun", 3 ], [ "rifle", 3 ] ],
"fake_dex": 10,
"targeting_sound": "gurgling.",
"description": "The %s spews bile!",
"no_ammo_sound": "dry heaving.",
"ranges": [ [ 0, 2, "DEFAULT" ] ]
}
]
}
},
{
"id": "mon_boomer_huge",
Expand All @@ -42,8 +62,26 @@
"corpse_type": "NO_CORPSE"
},
"armor": { "bash": 5, "cut": 5, "bullet": 4, "electric": 3 },
"delete": { "special_attacks": [ "BOOMER" ] },
"extend": { "special_attacks": [ [ "BOOMER_GLOW", 20 ] ] }
"delete": { "special_attacks": [ "boomer_bile" ] },
"starting_ammo": { "boomer_bile_adv": 999 },
"extend": {
"special_attacks": [
{
"type": "gun",
"move_cost": 150,
"cooldown": 20,
"id": "boomer_bile_adv",
"gun_type": "boomer_head",
"ammo_type": "boomer_bile_adv",
"fake_skills": [ [ "gun", 3 ], [ "rifle", 3 ] ],
"fake_dex": 10,
"targeting_sound": "gurgling.",
"description": "The %s spews bile!",
"no_ammo_sound": "dry heaving.",
"ranges": [ [ 0, 2, "DEFAULT" ] ]
}
]
}
},
{
"id": "mon_zombie_gasbag",
Expand All @@ -59,7 +97,7 @@
"death_function": { "message": "The %s explodes!", "effect": { "id": "death_gas", "hit_self": true }, "corpse_type": "NO_CORPSE" },
"fungalize_into": "mon_gasbag_dusted",
"armor": { "electric": 1 },
"delete": { "flags": [ "BILE_BLOOD", "BASHES", "GROUP_BASH" ], "special_attacks": [ "BOOMER" ] }
"delete": { "flags": [ "BILE_BLOOD", "BASHES", "GROUP_BASH" ] }
},
{
"id": "mon_zombie_relax_gasbag",
Expand Down Expand Up @@ -105,10 +143,24 @@
"vision_night": 5,
"emit_fields": [ { "emit_id": "emit_sludge_puddle", "delay": "1 s" } ],
"grab_strength": 30,
"starting_ammo": { "boomer_bile_adv": 999 },
"special_attacks": [
{ "id": "grab" },
{ "id": "scratch_humanoid" },
[ "BOOMER", 21 ],
{
"type": "gun",
"move_cost": 150,
"cooldown": 7,
"id": "boomer_bile_adv",
"gun_type": "boomer_head",
"ammo_type": "boomer_bile_adv",
"fake_skills": [ [ "gun", 3 ], [ "rifle", 3 ] ],
"fake_dex": 10,
"targeting_sound": "gurgling.",
"description": "The %s spews bile!",
"no_ammo_sound": "dry heaving.",
"ranges": [ [ 0, 2, "DEFAULT" ] ]
},
{
"id": "bite_humanoid",
"cooldown": 3,
Expand Down
16 changes: 15 additions & 1 deletion data/mods/TropiCataclysm/monsters/zed_plant.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,21 @@
"melee_damage": [ { "damage_type": "cut", "amount": 0 } ],
"vision_night": 3,
"harvest": "exempt",
"special_attacks": [ [ "BOOMER", 20 ], [ "scratch", 20 ] ],
"special_attacks": [
{
"type": "gun",
"move_cost": 150,
"cooldown": 5,
"id": "boomer_bile",
"gun_type": "boomer_head",
"ammo_type": "boomer_bile",
"fake_skills": [ [ "gun", 3 ], [ "rifle", 3 ] ],
"fake_dex": 10,
"no_ammo_sound": "Boomer tries to vomit more, but only droplets are thrown.",
"ranges": [ [ 0, 2, "DEFAULT" ] ]
},
[ "scratch", 20 ]
],
"death_drops": "mon_zombie_thorny_death_drops",
"death_function": { "effect": { "id": "death_boomer", "hit_self": true }, "message": "The %s explodes!", "corpse_type": "NO_CORPSE" },
"upgrades": { "half_life": 56, "into_group": "GROUP_MOSSY_BOOMER_UPGRADE" },
Expand Down
8 changes: 8 additions & 0 deletions doc/JSON/ITEM.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ ammo_effects define what effect the projectile, that you shoot, would have. List
"drop": "null" // Which item to drop at landing point
}
},
"on_hit_effects": [ // This effects will be applied if body part is hit
{
"effect": "bile_stink",// id of an effect, mandatory
"duration": "5 m", // duration, mandatory
"intensity": 1, // intensity, mandatory
"need_touch_skin": true// if true, and projectile is liquid, the target need to be soaked through for effect to be applied
}
],
"do_flashbang": false, // Creates a one tile radius EMP explosion at the hit location; default false
"do_emp_blast": false, // Creates a hardcoded flashbang explosion; default false
"foamcrete_build": false, // Creates foamcrete fields and walls on the hit location, used in aftershock; default false
Expand Down
2 changes: 0 additions & 2 deletions doc/JSON/MONSTER_SPECIAL_ATTACKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ These special attacks are mostly hardcoded in C++ and are generally not configur
- ```BIO_OP_IMPALE``` Stabbing attack, deals heavy damage and has a chance to cause bleeding.
- ```BIO_OP_TAKEDOWN``` Takedown attack, bashes either the target's head or torso and inflicts `downed`.
- ```BLOW_WHISTLE``` Blow a whistle creating a sound of volume 40 from the position of the monster.
- ```BOOMER_GLOW``` Spits glowing bile.
- ```BOOMER``` Spits bile.
- ```BRANDISH``` Brandishes a knife at the player.
- ```BROWSE``` The monster will eat harvestable foods from BROWSABLE trees and plants when they're in season.
- ```BREATHE``` Spawns a `breather`. Note: `breather hub` only!
Expand Down
11 changes: 11 additions & 0 deletions src/ammo_effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ void ammo_effect::load( const JsonObject &jo, std::string_view )
optional( joa, was_loaded, "intensity_max", trail_intensity_max, 0 );
optional( joa, was_loaded, "chance", trail_chance, 100 );
}
if( jo.has_member( "on_hit_effects" ) ) {
JsonArray json_arr = jo.get_array( "on_hit_effects" );
for( JsonObject joe : json_arr ) {
on_hit_effect new_effect;
optional( joe, was_loaded, "need_touch_skin", new_effect.need_touch_skin, false );
mandatory( joe, was_loaded, "duration", new_effect.duration );
mandatory( joe, was_loaded, "effect", new_effect.effect );
mandatory( joe, was_loaded, "intensity", new_effect.intensity );
on_hit_effects.push_back( new_effect );
}
}
optional( jo, was_loaded, "explosion", aoe_explosion_data );
optional( jo, was_loaded, "do_flashbang", do_flashbang, false );
optional( jo, was_loaded, "do_emp_blast", do_emp_blast, false );
Expand Down
10 changes: 10 additions & 0 deletions src/ammo_effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <utility>
#include <vector>

#include "calendar.h"
#include "explosion.h"
#include "field_type.h"
#include "magic.h"
Expand All @@ -19,6 +20,13 @@ template <typename T> class generic_factory;

generic_factory<ammo_effect> &get_all_ammo_effects();

struct on_hit_effect {
bool need_touch_skin;
efftype_id effect;
time_duration duration;
int intensity;
};

struct ammo_effect {
public:
void load( const JsonObject &jo, std::string_view src );
Expand Down Expand Up @@ -55,6 +63,8 @@ struct ammo_effect {
int trail_intensity_max = 0;
int trail_chance = 100;

std::vector<on_hit_effect> on_hit_effects;

// Used by generic_factory
ammo_effect_str_id id;
std::vector<std::pair<ammo_effect_str_id, mod_id>> src;
Expand Down
12 changes: 8 additions & 4 deletions src/character_attire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2589,7 +2589,7 @@ int outfit::clatter_sound() const
return std::round( max_volume );
}

float outfit::clothing_wetness_mult( const bodypart_id &bp ) const
float outfit::clothing_wetness_mult( const bodypart_id &bp, bool permeability_check ) const
{
float clothing_mult = 1.0;
for( const item &i : worn ) {
Expand All @@ -2604,9 +2604,13 @@ float outfit::clothing_wetness_mult( const bodypart_id &bp ) const
}
}

// always some evaporation even if completely covered
// doesn't handle things that would be "air tight"
clothing_mult = std::max( clothing_mult, .1f );
// Skip this part if we're checking for permeability
// and not dealing with sweat
if( !permeability_check ) {
// always some evaporation even if completely covered
// doesn't handle things that would be "air tight"
clothing_mult = std::max( clothing_mult, .1f );
}
return clothing_mult;
}

Expand Down
2 changes: 1 addition & 1 deletion src/character_attire.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class outfit
int worn_guns() const;
int clatter_sound() const;
bool adjust_worn( npc &guy );
float clothing_wetness_mult( const bodypart_id &bp ) const;
float clothing_wetness_mult( const bodypart_id &bp, bool permeability_check = false ) const;
void damage_mitigate( const bodypart_id &bp, damage_unit &dam ) const;
float damage_resist( const damage_type_id &dt, const bodypart_id &bp, bool to_self = false ) const;
// sums the coverage of items that do not have the listed flags
Expand Down
Loading
Loading