From d3026b1fb76c68a32a3d616e18b833594c0d9029 Mon Sep 17 00:00:00 2001 From: falsycat Date: Wed, 16 Oct 2019 00:00:00 +0000 Subject: [PATCH] [fix] Fixed an issue that nearness_coe was ignored. --- sjplayer/src/sjplayer/CircleElement.d | 3 ++- sjplayer/src/sjplayer/SquareElement.d | 3 ++- sjplayer/src/sjplayer/TriangleElement.d | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sjplayer/src/sjplayer/CircleElement.d b/sjplayer/src/sjplayer/CircleElement.d index 635b169..dff1243 100644 --- a/sjplayer/src/sjplayer/CircleElement.d +++ b/sjplayer/src/sjplayer/CircleElement.d @@ -27,7 +27,8 @@ class CircleElement : AbstractShapeElement { if (d <= 1) { return DamageCalculationResult(damage, 0); } - return DamageCalculationResult(0, 1 - (d-1).clamp(0, 1)); + const nearness = 1 - (d-1).clamp(0, 1); + return DamageCalculationResult(0, nearness * nearness_coe); } } diff --git a/sjplayer/src/sjplayer/SquareElement.d b/sjplayer/src/sjplayer/SquareElement.d index 2da737e..b712497 100644 --- a/sjplayer/src/sjplayer/SquareElement.d +++ b/sjplayer/src/sjplayer/SquareElement.d @@ -43,7 +43,8 @@ class SquareElement : AbstractShapeElement { if (min_distance == 0) { return DamageCalculationResult(damage, 0); } - return DamageCalculationResult(0, 1-(min_distance-1).clamp(0f, 1f)); + const nearness = 1 - (min_distance-1).clamp(0f, 1f); + return DamageCalculationResult(0, nearness * nearness_coe); } } diff --git a/sjplayer/src/sjplayer/TriangleElement.d b/sjplayer/src/sjplayer/TriangleElement.d index 2fa0016..26dc884 100644 --- a/sjplayer/src/sjplayer/TriangleElement.d +++ b/sjplayer/src/sjplayer/TriangleElement.d @@ -50,7 +50,9 @@ class TriangleElement : AbstractShapeElement { if (min_distance == 0) { return DamageCalculationResult(damage, 0); } - return DamageCalculationResult(0, 1-(min_distance-1).clamp(0f, 1f)); + + const nearness = 1 - (min_distance-1).clamp(0f, 1f); + return DamageCalculationResult(0, nearness * nearness_coe); } }