Refactor damages in circles

This commit is contained in:
2025-06-20 21:52:42 +01:00
parent edcd947c90
commit b2d64ce698
6 changed files with 56 additions and 56 deletions
+3 -5
View File
@@ -1,17 +1,15 @@
module Dodge.Update.Cloud where
module Dodge.Update.Cloud (cloudPoisonDamage) where
import Dodge.Creature.Radius
import Data.Foldable
import Dodge.Creature.Radius
import Dodge.Data.World
import Dodge.Zoning.Creature
import Geometry.Vector3D
import LensHelp
cloudPoisonDamage :: Cloud -> World -> World
cloudPoisonDamage c w = w & dodamagesto (filter f $ crsNearPoint clpos w)
cloudPoisonDamage c w = foldl' (flip doDam) w (filter f $ crsNearPoint clpos w)
where
dodamagesto :: [Creature] -> World -> World
dodamagesto scrs mcrs = foldl' (flip doDam) mcrs scrs
doDam cr =
cWorld . lWorld . creatures . ix (_crID cr) . crDamage .:~ Poison 1
f cr = dist3 (addZ 20 $ _crPos cr) (_clPos c) < crRad (cr ^. crType) + _clRad c + 10