This commit is contained in:
2024-12-19 23:40:04 +00:00
parent f3cfe8cb5f
commit e1989eaa1e
28 changed files with 285 additions and 300 deletions
+7 -18
View File
@@ -45,45 +45,34 @@ toggleEquipmentAt invid cr w = case getEquipmentAllocation w of
PutOnEquipment{_allocNewPos = newp} ->
w
& crpoint . crEquipment . at newp ?~ invid
-- & crpoint . crInvEquipped . at invid ?~ newp
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
& crpoint . crInv . ix invid . itLocation . ilEquipSite ?~ newp
& onequip itm cr
-- & crpoint %~ assignNewHotkey invid
& cWorld . lWorld %~ assignNewHotkey invid
MoveEquipment{_allocNewPos = newp, _allocOldPos = oldp} ->
w
& crpoint . crEquipment . at newp ?~ invid
& crpoint . crEquipment . at oldp .~ Nothing
-- & crpoint . crInvEquipped . at invid ?~ newp
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
& crpoint . crInv . ix invid . itLocation . ilEquipSite ?~ newp
SwapEquipment{_allocNewPos = newp, _allocOldPos = oldp, _allocSwapID = sid} ->
w
& crpoint . crEquipment . at newp ?~ invid
& crpoint . crEquipment . at oldp ?~ sid
-- & crpoint . crInvEquipped . at invid ?~ newp
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
-- & crpoint . crInvEquipped . at sid ?~ oldp
& crpoint . crInv . ix sid . itLocation . ilEquipPosition ?~ oldp
& crpoint . crInv . ix invid . itLocation . ilEquipSite ?~ newp
& crpoint . crInv . ix sid . itLocation . ilEquipSite ?~ oldp
ReplaceEquipment{_allocNewPos = newp, _allocRemoveID = rid} ->
w
& crpoint . crEquipment . at newp ?~ invid
-- & crpoint . crInvEquipped . at invid ?~ newp
& crpoint . crInv . ix invid . itLocation . ilEquipPosition ?~ newp
-- & crpoint . crInvEquipped . at rid .~ Nothing
& crpoint . crInv . ix rid . itLocation . ilEquipPosition .~ Nothing
& crpoint . crInv . ix invid . itLocation . ilEquipSite ?~ newp
& crpoint . crInv . ix rid . itLocation . ilEquipSite .~ Nothing
& onremove (itmat rid) cr
& onequip itm cr
-- & crpoint %~ removeHotkey rid
-- & crpoint %~ assignNewHotkey invid
& cWorld . lWorld %~ removeHotkey rid
& cWorld . lWorld %~ assignNewHotkey invid
RemoveEquipment{_allocOldPos = oldp} ->
w
& crpoint . crEquipment . at oldp .~ Nothing
-- & crpoint . crInvEquipped . at invid .~ Nothing
& crpoint . crInv . ix invid . itLocation . ilEquipPosition .~ Nothing
& crpoint . crInv . ix invid . itLocation . ilEquipSite .~ Nothing
& onremove itm cr
-- & crpoint %~ removeHotkey invid
& cWorld . lWorld %~ removeHotkey invid
where
crpoint = cWorld . lWorld . creatures . ix (_crID cr)
+1 -1
View File
@@ -178,7 +178,7 @@ invItemLocUpdate cr loc w = doAnyEquipmentEffect loc cr $ case itm ^. itType of
itm = loc ^. locLDT . ldtValue . _1
doAnyEquipmentEffect :: LocationLDT ItemLink ComposedItem -> Creature -> World -> World
doAnyEquipmentEffect loc cr = case itm ^? itLocation . ilEquipPosition . _Just of
doAnyEquipmentEffect loc cr = case itm ^? itLocation . ilEquipSite . _Just of
Just _ -> useE loc cr
_ -> id
where
+1 -1
View File
@@ -24,7 +24,7 @@ equipmentStrValue itm = case _itType itm of
_ -> 0
crCurrentEquipment :: Creature -> IM.IntMap Item
crCurrentEquipment = IM.filter (isJust . (^? itLocation . ilEquipPosition . _Just)) . _crInv
crCurrentEquipment = IM.filter (isJust . (^? itLocation . ilEquipSite . _Just)) . _crInv
strFromHeldItem :: Creature -> Int
strFromHeldItem cr