Move background item effects out of records
This commit is contained in:
@@ -13,6 +13,7 @@ module Dodge.Creature.Action (
|
||||
youDropItem,
|
||||
) where
|
||||
|
||||
import Dodge.Item.BackgroundEffect
|
||||
import Control.Applicative
|
||||
import Control.Monad
|
||||
import Data.Bifunctor
|
||||
@@ -178,9 +179,10 @@ dropItem cr invid =
|
||||
. copyItemToFloor (_crPos cr) itm -- . mayberemoveequip
|
||||
. soundStart (CrSound (_crID cr)) (_crPos cr) whiteNoiseFadeOutS Nothing
|
||||
where
|
||||
doanyitemdropeffect = fromMaybe id $ do
|
||||
rmf <- itm ^? itEffect . ieOnDrop
|
||||
return $ doInvEffect rmf itm cr
|
||||
--doanyitemdropeffect = fromMaybe id $ do
|
||||
-- rmf <- itm ^? itEffect . ieOnDrop
|
||||
-- return $ doInvEffect rmf itm cr
|
||||
doanyitemdropeffect = itEffectOnDrop itm cr
|
||||
itm = fromMaybe (error "dropItem cannot find item") $ cr ^? crInv . ix invid
|
||||
maybeshiftseldown w = fromMaybe w $ do
|
||||
3 <- w ^? hud . hudElement . diSelection . _Just . _1
|
||||
|
||||
@@ -3,6 +3,7 @@ module Dodge.Creature.State (
|
||||
doDamage,
|
||||
) where
|
||||
|
||||
import Dodge.Item.BackgroundEffect
|
||||
import Dodge.Item.MaxAmmo
|
||||
import Control.Applicative
|
||||
import Dodge.HeldUse
|
||||
@@ -166,7 +167,8 @@ applyPastDamages cr w
|
||||
invSideEff :: Creature -> World -> World
|
||||
invSideEff cr = alaf Endo foldMap f (_crInv cr) . updateHeldRootItem cr
|
||||
where
|
||||
f it = maybe id (\g -> doInvEffect g it cr) (it ^? itEffect . ieInv)
|
||||
--f it = maybe id (\g -> doInvEffect g it cr) (it ^? itEffect . ieInv)
|
||||
f it = itBackgroundEffect it cr
|
||||
|
||||
-- a loop going over all root inventory items
|
||||
invRootItemEffs :: Creature -> World -> World
|
||||
@@ -358,7 +360,6 @@ shineTorch cr itmtree (p, q) = fromMaybe id $ do
|
||||
guard $ i >= x
|
||||
invid <- mag ^? ldtValue . _1 . itLocation . ilInvID
|
||||
return $
|
||||
--(cWorld . lWorld . tempLightSources .:~ tlsTimeRadColPos 1 250 0.7 pos'')
|
||||
(cWorld . lWorld . lights .:~ LSParam pos'' 250 0.7)
|
||||
. (cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix invid . itConsumables . _Just -~ x)
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user