Allow flame particles to damage walls at distance

This commit is contained in:
2022-03-14 20:59:17 +00:00
parent f1dcda09ac
commit 4c116a82c9
+5 -2
View File
@@ -6,6 +6,7 @@ module Dodge.WorldEvent.SpawnParticle
) where
import Dodge.Data
import Dodge.Base
import Dodge.Zone
import Dodge.WorldEvent.HitEffect
import Dodge.WorldEvent.ThingsHit
import Dodge.WorldEvent.Cloud
@@ -78,9 +79,9 @@ moveFlame :: Point2 -- ^ Rotation direction
moveFlame rotd w pt
| time <= 0 = (makeFlamerSmokeAt (addZ 20 ep) w, Nothing)
| otherwise = case thingsHitExceptCr (_ptCrIgnore pt) sp ep w of
((_,Left _):_) -> (doSound damcrs , mvPt 0.7)
((_,Left _):_) -> (doSound $ damwls damcrs , mvPt 0.7)
(th@(p,Right wl):_) -> (doSound . fst $ hiteff [th] damcrs , rfl wl p)
_ -> (flameFlicker pt $ doSound damcrs , mvPt 0.98)
_ -> (flameFlicker pt . damwls $ doSound damcrs , mvPt 0.98)
where
time = _ptTimer pt
doSound = soundContinue Flame (V2 x y) fireLoudS (Just 2)
@@ -92,7 +93,9 @@ moveFlame rotd w pt
, _ptPos = ep
, _ptCrIgnore = Nothing
, _ptVel = speed *.* vel }
damwls w' = foldr (\wl -> fst . hiteff [(ep,Right wl)]) w' $ IM.filter closeWls $ wallsNearPoint ep w
damcrs = foldr (\cr -> fst . hiteff [(ep,Left cr)]) w $ IM.filter closeCrs $ _creatures w
closeWls wl = uncurry circOnSeg (_wlLine wl) ep 5
closeCrs cr = dist ep (_crPos cr)
< _crRad cr + 10 - min 9 (max 0 (fromIntegral time - 80))
+ 5 * angleCoeff (angleVV (ep -.- _crPos cr) rotd)