Files
loop/src/Dodge/Update/Cloud.hs
T
2025-10-10 13:47:31 +01:00

18 lines
545 B
Haskell

module Dodge.Update.Cloud (cloudPoisonDamage) where
import Data.Foldable
import Dodge.Creature.Radius
import Dodge.Data.World
import Dodge.Zoning.Creature
import Geometry.Vector3D
import LensHelp
import Linear
cloudPoisonDamage :: Cloud -> World -> World
cloudPoisonDamage c w = foldl' (flip doDam) w (filter f $ crsNearPoint clpos w)
where
doDam cr =
cWorld . lWorld . creatures . ix (_crID cr) . crDamage .:~ Poison 1
f cr = dist3 (_crPos cr & _z +~ 20) (_clPos c) < crRad (cr ^. crType) + 20
clpos = stripZ $ _clPos c