module Dodge.WorldEvent.Shockwave ( makeShockwaveAt, inverseShockwaveAt, ) where import Dodge.Data.World import Geometry import LensHelp import Picture -- currently very effective against walls makeShockwaveAt :: -- | IDs of invulnerable creatures. [Int] -> -- | Center of shockwave. Point3 -> -- | Maximal radius. Float -> -- | Damage caused per frame. Int -> -- | Amount of pushback per frame. Float -> -- | Color of shockwave. Color -> -- | Start world. World -> World makeShockwaveAt is p rad dam push col = cWorld . lWorld . shockwaves .:~ Shockwave { _swInvulnerableCrs = is , _swDirection = OutwardShockwave , _swColor = col , _swPos = p , _swRad = rad , _swDam = dam , _swPush = push , _swMaxTime = 10 , _swTimer = 10 } {- Create a shockwave going from an outside circle into a center point. -} inverseShockwaveAt :: Point3 -> -- Center position Float -> -- Radius Int -> -- Damage Float -> -- Push amount World -> World inverseShockwaveAt p rad dam push = cWorld . lWorld . shockwaves .:~ Shockwave { _swDirection = InwardShockwave , _swInvulnerableCrs = [] , _swColor = cyan , _swPos = p , _swRad = rad , _swDam = dam , _swPush = push , _swMaxTime = 10 , _swTimer = 10 }