Move towards working implementation of attachment tree ammo

This commit is contained in:
2024-09-14 10:44:35 +01:00
parent 51e133ebc1
commit cde7bc9aef
13 changed files with 496 additions and 351 deletions
+7 -2
View File
@@ -5,6 +5,9 @@ module Dodge.WorldEffect (
lineOutputTerminal,
) where
import Dodge.Item.Grammar
import Dodge.Data.ComposedItem
import Dodge.Data.DoubleTree
import Data.Foldable
import qualified Data.Map.Strict as M
import Data.Maybe
@@ -34,13 +37,15 @@ doWdWd we = case we of
WdWdNegateTrig trid -> cWorld . lWorld . triggers . ix trid %~ not
WdWdFromItixCrixWdWd itid crid f -> \w -> fromMaybe w $ do
cr <- w ^? cWorld . lWorld . creatures . ix crid
it <- getItem itid w
--it <- getItem itid w
itRef <- cr ^? crManipulation . manObject . inInventory . ispItem
it <- invTrees (_crInv cr) ^? ix itRef
return $ doItCrWdWd f it cr w
WdWdFromItCrixWdWd it crid f -> \w -> fromMaybe w $ do
cr <- w ^? cWorld . lWorld . creatures . ix crid
return $ doItCrWdWd f it cr w
doItCrWdWd :: ItCrWdWd -> Item -> Creature -> World -> World
doItCrWdWd :: ItCrWdWd -> LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
doItCrWdWd icww = case icww of
ItCrWdId -> \_ _ -> id
ItCrWdItemEffect -> flip itemEffect