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 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 (addZ 20 $ _crPos cr) (_clPos c) < crRad (cr ^. crType) + 20 clpos = stripZ $ _clPos c