Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix projectile interaction with obstacles; remove ACID_DROP from documentation #17759

Merged
merged 7 commits into from
Jul 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion doc/JSON_FLAGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,6 @@ listings, as ids are constant throughout DDA's code. Happy chambering! :-)
### Effects

- ```ACIDBOMB``` Leaves a pool of acid on detonation.
- ```ACID_DROP``` Creates a tiny field of weak acid.
- ```BEANBAG``` Stuns the target.
- ```BLINDS_EYES``` Blinds the target if it hits the head (ranged projectiles can't actually hit the eyes at the moment).
- ```BOUNCE``` Inflicts target with `bounced` effect and rebounds to a nearby target without this effect.
Expand Down
1 change: 1 addition & 0 deletions src/projectile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ void apply_ammo_effects( const tripoint &p, const std::set<std::string> &effects
}
}


if( effects.count( "EXPLOSIVE_BIG" ) > 0 ) {
g->explosion( p, 40 );
}
Expand Down
9 changes: 8 additions & 1 deletion src/ranged.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ dealt_projectile_attack Creature::projectile_attack( const projectile &proj_arg,
const bool no_item_damage = proj_effects.count( "NO_ITEM_DAMAGE" ) > 0;
const bool do_draw_line = proj_effects.count( "DRAW_AS_LINE" ) > 0;
const bool null_source = proj_effects.count( "NULL_SOURCE" ) > 0;
// Determines whether it can penetrate obstacles
const bool is_bullet = proj_arg.speed >= 200 && std::any_of( proj_arg.impact.damage_units.begin(),
proj_arg.impact.damage_units.end(),
[]( const damage_unit &dam )
{
return dam.type == DT_CUT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will make thrown rocks stop at windows.

Copy link
Contributor Author

@sethsimon sethsimon Jul 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IRL, a rock that's badly aimed, weakly thrown, or thrown from far away might not go through a window. With 2 throwing, 5 strength, 5 dexterity, and from 1 tile away, 4 out of 14 throws broke a window. With 2 throwing, 8 strength, and 8 dexterity, you can reliably break it from 3 tiles away. With 0 throwing, 8 strength, and 8 dexterity, you can reliably break a window from 2 tiles away. With 1 throwing, 5 strength, and 5 dexterity, it's very difficult (but possible) to break a window from 1 tile away.

EDIT: All the tests had 7-8 perception.

} );

// If we were targetting a tile rather than a monster, don't overshoot
// Unless the target was a wall, then we are aiming high enough to overshoot
Expand Down Expand Up @@ -322,7 +329,7 @@ dealt_projectile_attack Creature::projectile_attack( const projectile &proj_arg,
has_momentum = proj.impact.total_damage() > 0;
}

if( !has_momentum && g->m.impassable( tp ) ) {
if( ( !has_momentum || !is_bullet ) && g->m.impassable( tp ) ) {
// Don't let flamethrowers go through walls
// TODO: Let them go through bars
traj_len = i;
Expand Down