Add sounds, move data types out into separate folders
This commit is contained in:
@@ -14,6 +14,12 @@ import Data.List
|
||||
applyNoDamage :: [Damage] -> Creature -> World -> World
|
||||
applyNoDamage _ _ = id
|
||||
|
||||
applyCreatureDamage :: [Damage] -> Creature -> World -> World
|
||||
applyCreatureDamage dms cr = case _crMaterial cr of
|
||||
Flesh -> defaultApplyDamage dms cr
|
||||
Crystal -> id
|
||||
_-> defaultApplyDamage dms cr
|
||||
|
||||
defaultApplyDamage :: [Damage] -> Creature -> World -> World
|
||||
defaultApplyDamage ds cr w = foldl' (applyIndividualDamage cr) w ds'
|
||||
& creatures . ix (_crID cr) %~ doPoisonDam
|
||||
|
||||
@@ -54,8 +54,8 @@ explosiveBarrel = defaultInanimate
|
||||
{_csSpState = Barrel []
|
||||
}
|
||||
, _crInv = IM.empty -- IM.fromList [(0,frontArmour)]
|
||||
,_crApplyDamage = \_ _ -> id
|
||||
}
|
||||
& crMaterial .~ Crystal
|
||||
updateBarrel :: Creature -> World -> World
|
||||
updateBarrel cr
|
||||
| _crHP cr > 0 = doDamage cr
|
||||
|
||||
@@ -3,7 +3,7 @@ module Dodge.Creature.Lamp
|
||||
, colorLamp
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Material
|
||||
import Dodge.Material.Sound
|
||||
import Dodge.Default
|
||||
import Dodge.Creature.Picture
|
||||
import Dodge.LightSource
|
||||
|
||||
@@ -10,6 +10,7 @@ import Dodge.Prop.Gib
|
||||
import Dodge.Base
|
||||
import Dodge.Creature.State.WalkCycle
|
||||
import Dodge.Creature.Impulse.Movement
|
||||
import Dodge.Creature.Damage
|
||||
import Dodge.LightSource.Torch
|
||||
import Dodge.SoundLogic
|
||||
import RandomHelp
|
||||
@@ -134,7 +135,7 @@ clearDamage cr w = w
|
||||
doDamage :: Creature -> World -> World
|
||||
doDamage cr w = w
|
||||
& applyPastDamages cr
|
||||
& _crApplyDamage cr dams cr
|
||||
& applyCreatureDamage dams cr
|
||||
where
|
||||
dams = _csDamage $ _crState cr
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import qualified Data.Map.Strict as M
|
||||
{- | The AI equivalent for your control. -}
|
||||
yourControl :: Creature -> World -> World
|
||||
yourControl cr w
|
||||
| inTermFocus w = w
|
||||
| inTermFocus w = w & updateUsingInput
|
||||
| otherwise = w
|
||||
& creatures . ix (_crID cr) %~
|
||||
(wasdWithAiming w (_mvSpeed $ _crMvType cr) . mouseActionsCr (_mouseButtons w))
|
||||
|
||||
Reference in New Issue
Block a user