Skip to content

Commit

Permalink
make ammo_effect_WIDE actually work (#78935)
Browse files Browse the repository at this point in the history
* make ammo_effect_WIDE to actually work

* typo
  • Loading branch information
osuphobia authored Jan 4, 2025
1 parent 58db8be commit 774f85b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion data/json/monsters/monster_flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
{
"id": "HARDTOSHOOT",
"type": "monster_flag",
"//": "It's one size smaller for ranged attacks, no less then creature_size::tiny"
"//": "It's one size smaller for ranged attacks, no less than creature_size::tiny"
},
{
"id": "GRABS",
Expand Down
16 changes: 13 additions & 3 deletions src/ballistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ static const ammo_effect_str_id ammo_effect_STREAM( "STREAM" );
static const ammo_effect_str_id ammo_effect_STREAM_BIG( "STREAM_BIG" );
static const ammo_effect_str_id ammo_effect_STREAM_TINY( "STREAM_TINY" );
static const ammo_effect_str_id ammo_effect_TANGLE( "TANGLE" );
static const ammo_effect_str_id ammo_effect_WIDE( "WIDE" );

static const efftype_id effect_bounced( "bounced" );

Expand Down Expand Up @@ -231,9 +232,18 @@ dealt_projectile_attack projectile_attack( const projectile &proj_arg,
creature_tracker &creatures = get_creature_tracker();
Creature *target_critter = creatures.creature_at( target_arg );
map &here = get_map();
double target_size = target_critter != nullptr ?
target_critter->ranged_target_size() :
here.ranged_target_size( target_arg );
double target_size;
if( target_critter != nullptr ) {
const monster *mon = target_critter->as_monster();
if( mon && proj_arg.proj_effects.count( ammo_effect_WIDE ) ) {
// ammo with ammo_effect_WIDE ignores mon_flag_HARDTOSHOOT
target_size = occupied_tile_fraction( mon->get_size() );
} else {
target_size = target_critter->ranged_target_size();
}
} else {
target_size = here.ranged_target_size( target_arg );
}
projectile_attack_aim aim = projectile_attack_roll( dispersion, range, target_size );

if( target_critter && target_critter->as_character() &&
Expand Down

0 comments on commit 774f85b

Please sign in to comment.