Cleanup
This commit is contained in:
@@ -3,9 +3,6 @@ module Dodge.Creature.State (
|
|||||||
doDamage,
|
doDamage,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Dodge.Item.BackgroundEffect
|
|
||||||
import Dodge.Item.Location
|
|
||||||
import Dodge.Inventory.SelectionList
|
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
@@ -26,8 +23,11 @@ import Dodge.Data.World
|
|||||||
import Dodge.DoubleTree
|
import Dodge.DoubleTree
|
||||||
import Dodge.Euse
|
import Dodge.Euse
|
||||||
import Dodge.HeldUse
|
import Dodge.HeldUse
|
||||||
|
import Dodge.Inventory.SelectionList
|
||||||
|
import Dodge.Item.BackgroundEffect
|
||||||
import Dodge.Item.Grammar
|
import Dodge.Item.Grammar
|
||||||
import Dodge.Item.HeldOffset
|
import Dodge.Item.HeldOffset
|
||||||
|
import Dodge.Item.Location
|
||||||
import Dodge.Item.MaxAmmo
|
import Dodge.Item.MaxAmmo
|
||||||
import Dodge.Prop.Gib
|
import Dodge.Prop.Gib
|
||||||
import Dodge.SoundLogic
|
import Dodge.SoundLogic
|
||||||
@@ -66,10 +66,8 @@ crUpdate f =
|
|||||||
, checkDeath -- must be in this order 24/7/22
|
, checkDeath -- must be in this order 24/7/22
|
||||||
, updateWalkCycle
|
, updateWalkCycle
|
||||||
, f
|
, f
|
||||||
, -- , updateInv -- upInv must be called before invSideEff 22.05.23
|
, invRootItemEffs
|
||||||
invRootItemEffs
|
, updateHeldRootItem
|
||||||
, invSideEff
|
|
||||||
-- , equipmentEffects
|
|
||||||
]
|
]
|
||||||
|
|
||||||
-- I have changed the ordering of item/equipment effects, which may have
|
-- I have changed the ordering of item/equipment effects, which may have
|
||||||
@@ -127,9 +125,7 @@ dropAll :: Creature -> World -> World
|
|||||||
dropAll cr w = foldl' (flip (dropItem cr)) w $ IM.keys $ _crInv cr
|
dropAll cr w = foldl' (flip (dropItem cr)) w $ IM.keys $ _crInv cr
|
||||||
|
|
||||||
doDamage :: Creature -> World -> World
|
doDamage :: Creature -> World -> World
|
||||||
doDamage cr = applyPastDamages cr . applyCreatureDamage dams cr
|
doDamage cr = applyPastDamages cr . applyCreatureDamage (cr ^. crDamage) cr
|
||||||
where
|
|
||||||
dams = cr ^. crDamage
|
|
||||||
|
|
||||||
-- TODO generalise shake to arbitrary damage amounts
|
-- TODO generalise shake to arbitrary damage amounts
|
||||||
applyPastDamages :: Creature -> World -> World
|
applyPastDamages :: Creature -> World -> World
|
||||||
@@ -145,10 +141,6 @@ applyPastDamages cr w
|
|||||||
& cWorld . lWorld . creatures . ix (_crID cr) . crPastDamage -~ y
|
& cWorld . lWorld . creatures . ix (_crID cr) . crPastDamage -~ y
|
||||||
& randGen .~ g
|
& randGen .~ g
|
||||||
|
|
||||||
-- a loop going over all inventory items
|
|
||||||
invSideEff :: Creature -> World -> World
|
|
||||||
invSideEff cr = updateHeldRootItem cr
|
|
||||||
|
|
||||||
-- a loop going over all root inventory items
|
-- a loop going over all root inventory items
|
||||||
invRootItemEffs :: Creature -> World -> World
|
invRootItemEffs :: Creature -> World -> World
|
||||||
invRootItemEffs cr =
|
invRootItemEffs cr =
|
||||||
@@ -183,7 +175,6 @@ copierItemUpdate itm cr w = fromMaybe w $ do
|
|||||||
v <- getItemValue itm' w cr
|
v <- getItemValue itm' w cr
|
||||||
return $ w & pointerToItem itm . itUse . uValue .~ v
|
return $ w & pointerToItem itm . itUse . uValue .~ v
|
||||||
|
|
||||||
|
|
||||||
doAnyEquipmentEffect :: LocationLDT ItemLink ComposedItem -> Creature -> World -> World
|
doAnyEquipmentEffect :: LocationLDT ItemLink ComposedItem -> Creature -> World -> World
|
||||||
doAnyEquipmentEffect loc cr = case itm ^? itLocation . ilEquipSite . _Just of
|
doAnyEquipmentEffect loc cr = case itm ^? itLocation . ilEquipSite . _Just of
|
||||||
Just _ -> equipBackgroundEffect loc cr
|
Just _ -> equipBackgroundEffect loc cr
|
||||||
|
|||||||
Reference in New Issue
Block a user