Fix crsHitRadial, unify some radial damages

This commit is contained in:
2025-06-20 22:17:10 +01:00
parent 67d77fcb2b
commit 3019d95520
5 changed files with 20 additions and 33 deletions
+6 -6
View File
@@ -13,6 +13,8 @@ module Dodge.WorldEvent.ThingsHit (
crHit,
) where
import Dodge.Creature.Radius
import Control.Monad
import Control.Lens
import Data.Bifunctor
import qualified Data.IntSet as IS
@@ -103,9 +105,7 @@ wlsHitRadial p r = mapMaybe f . wlsNearCirc p r
crsHitRadial :: Point2 -> Float -> World -> [(Point2, Creature)]
crsHitRadial p r = mapMaybe f . crsNearCirc p r
where
f cr
| dist hitpos p <= r = Just (hitpos, cr)
| otherwise = Nothing
where
hitpos = cpos +.+ r *.* normalizeV (p -.- cpos)
cpos = _crPos cr
f cr = do
let cp = _crPos cr
guard $ dist p cp < r + crRad (_crType cr)
return $ (cp + (1 + crRad (_crType cr)) *.* (cp - p), cr)