Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 18 additions & 0 deletions data/json/field_type.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@
"display_field": true,
"looks_like": "fd_acid"
},
{
"id": "fd_bile_adv",
"type": "field_type",
"intensity_levels": [
{ "name": "thick bile splatter", "color": "pink" },
{ "name": "thick bile stain", "light_emitted": 1 },
{ "name": "puddle of thick bile", "light_emitted": 3 }
],
"description_affix": "covered_in",
"underwater_age_speedup": "25 minutes",
"decay_amount_factor": 2,
"is_splattering": true,
"half_life": "1 days",
"phase": "liquid",
"accelerated_decay": true,
"display_field": true,
"looks_like": "fd_bile"
},
{
"id": "fd_darkness",
"type": "field_type",
Expand Down
4 changes: 2 additions & 2 deletions data/json/items/ammo.json
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@
"category": "spare_parts",
"material": [ "stone" ],
"ammo_type": "rock",
"flags": [ "TRADER_AVOID", "NPC_THROWN" ],
"flags": [ "TRADER_AVOID", "NPC_THROWN", "ALLOWS_BODY_BLOCK" ],
"weight": "657 g",
"volume": "250 ml",
"damage": { "damage_type": "bash", "amount": 7 },
Expand All @@ -572,7 +572,7 @@
"loudness": 0,
"to_hit": { "grip": "solid", "length": "hand", "surface": "any", "balance": "neutral" },
"recovery_chance": 99,
"effects": [ "NEVER_MISFIRES", "NON_FOULING", "ALLOWS_BODY_BLOCK" ],
"effects": [ "NEVER_MISFIRES", "NON_FOULING" ],
"qualities": [ [ "HAMMER", 1 ] ],
"melee_damage": { "bash": 7 },
"thrown_damage": { "damage_type": "bash", "amount": 7 }
Expand Down
86 changes: 86 additions & 0 deletions data/json/monster_special_attacks/monster_ammo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[
{
"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_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_ADV", "BILE_GLOW", "BILE_BOMB_ADV", "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_JET_ADV",
"type": "ammo_effect",
"//": "Creates a trail of advanced bile",
"trail": { "field_type": "fd_bile_adv", "intensity_min": 1, "intensity_max": 2, "chance": 75 }
},
{
"id": "BILE_BOMB_ADV",
"type": "ammo_effect",
"//": "Leaves a pool of advanced bile on detonation",
"aoe": { "field_type": "fd_bile_adv", "intensity_min": 3, "intensity_max": 3 }
},
{
"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 },
"extend": { "special_attacks": [ [ "BOOMER_GLOW", 20 ] ] },
"delete": { "special_attacks": [ "BOOMER" ] }
"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", "GRABS", "PUSH_MON" ], "special_attacks": [ "BOOMER" ] }
"delete": { "flags": [ "BILE_BLOOD", "BASHES", "GROUP_BASH", "GRABS", "PUSH_MON" ], "special_attacks": [ "boomer_bile" ] }
},
{
"id": "mon_zombie_relax_gasbag",
Expand Down Expand Up @@ -107,10 +145,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
3 changes: 2 additions & 1 deletion data/mods/TEST_DATA/expected_dps_data/guns_dps.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"glock_34": 5.09,
"glock_48": 5.09,
"glock_44": 5.09,
"bone_dart": 6.29
"bone_dart": 6.29,
"boomer_head": 7.69
}
}
]
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 @@ -94,8 +94,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
9 changes: 9 additions & 0 deletions src/ammo_effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ int_id<ammo_effect>::int_id( const ammo_effect_str_id &id ) : _id( id.id() )
{
}

void on_hit_effect::deserialize( const JsonObject &jo )
{
optional( jo, false, "need_touch_skin", need_touch_skin, false );
mandatory( jo, false, "duration", duration );
mandatory( jo, false, "effect", effect );
mandatory( jo, false, "intensity", intensity );
}

void ammo_effect::load( const JsonObject &jo, std::string_view )
{
optional( jo, was_loaded, "trigger_chance", trigger_chance, 1 );
Expand All @@ -82,6 +90,7 @@ 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 );
}
optional( jo, was_loaded, "on_hit_effects", on_hit_effects );
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
12 changes: 12 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,15 @@ 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;

void deserialize( const JsonObject &jo );
};

struct ammo_effect {
public:
void load( const JsonObject &jo, std::string_view src );
Expand Down Expand Up @@ -55,6 +65,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
Loading
Loading