Refactor crPos to be a V3
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
module Dodge.Barreloid (updateBarreloid) where
|
||||
|
||||
import Linear
|
||||
import Data.List
|
||||
import Data.Maybe
|
||||
import Dodge.Creature.State
|
||||
@@ -29,16 +30,16 @@ updateExpBarrel ps cr w = case cr ^. crHP of
|
||||
& flip (foldl' f) ps
|
||||
HP _ ->
|
||||
w
|
||||
& makeExplosionAt ((cr ^. crPos) `v2z` 20) 0
|
||||
& makeExplosionAt ((cr ^. crPos) & _z +~ 20) 0
|
||||
& cWorld . lWorld . creatures . ix (_crID cr) . crHP .~ CrIsGibs
|
||||
_ -> w
|
||||
where
|
||||
f w' p = makeSpark NormalSpark (p + normalizeV p + cr ^. crPos) (argV p) w'
|
||||
f w' p = makeSpark NormalSpark (p + normalizeV p + cr ^. crPos . _xy) (argV p) w'
|
||||
damages = cr ^. crDamage
|
||||
hiss
|
||||
| null ps = id
|
||||
| otherwise = soundContinue
|
||||
(BarrelHiss (_crID cr)) (_crPos cr) foamSprayLoopS (Just 1)
|
||||
(BarrelHiss (_crID cr)) (cr ^. crPos . _xy) foamSprayLoopS (Just 1)
|
||||
|
||||
updateBarrel :: Creature -> World -> World
|
||||
updateBarrel cr = case cr ^. crHP of
|
||||
@@ -53,7 +54,7 @@ damToExpBarrel :: Creature -> Damage -> Creature
|
||||
damToExpBarrel cr dm = case dm of
|
||||
Piercing x p _ ->
|
||||
cr & crHP . _HP -~ div x 200
|
||||
& crType . barrelType . piercedPoints .:~ (p - _crPos cr)
|
||||
& crType . barrelType . piercedPoints .:~ (p - cr ^. crPos . _xy)
|
||||
Poison{} -> cr
|
||||
Sparking{} -> cr
|
||||
_ -> cr & crHP . _HP -~ fromMaybe 0 (dm ^? dmAmount)
|
||||
|
||||
Reference in New Issue
Block a user