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

feat(balance): make AoE damage falloff based on range #6035

Closed
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
14 changes: 14 additions & 0 deletions src/ranged_aoe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ struct aoe_flood_node {
namespace ranged
{

namespace
{

auto falloff_damage_multiplier( const shape &sh, const dealt_projectile_attack &atk ) -> double
{
const float dist = trig_dist( sh.get_origin(), atk.end_point );
const float range = std::max( 1, atk.proj.range );

return 1 - ( 0.5 * ( std::max( 0.0f, dist - 1 ) / range ) );
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return 1 - ( 0.5 * ( std::max( 0.0f, dist - 1 ) / range ) );
return 1 - ( 1 * ( std::max( 0.0f, dist - 1 ) / range ) );

}

} // namespace

void execute_shaped_attack( const shape &sh, const projectile &proj, Creature &attacker,
item *source_weapon, const vehicle *in_veh )
{
Expand Down Expand Up @@ -136,6 +149,7 @@ void execute_shaped_attack( const shape &sh, const projectile &proj, Creature &a
atk.end_point = point;
atk.hit_critter = critter;
atk.proj = proj;
atk.proj.impact.mult_damage( falloff_damage_multiplier( sh, atk ) );
atk.missed_by = rng_float( 0.15, 0.45 );
critter->deal_projectile_attack( &attacker, source_weapon, atk );
}
Expand Down
Loading