Allow for separate equipment positions on body
This commit is contained in:
@@ -42,17 +42,27 @@ itemEffect cr it w = case it ^? itUse of
|
||||
|
||||
toggleEquipmentAt :: Int -> Item -> Creature -> Creature
|
||||
toggleEquipmentAt invid itm cr
|
||||
| invid `IS.member` _crInvEquipped cr = cr & crInvEquipped . at invid .~ Nothing
|
||||
| invid `IM.member` _crInvEquipped cr = cr & crInvEquipped . at invid .~ Nothing
|
||||
& removeEquipmentUsingSite esite
|
||||
& setEquipmentSite esite Nothing'
|
||||
| otherwise = cr & crInvEquipped . at invid .~ Just ()
|
||||
| otherwise = cr & crInvEquipped . at invid .~ Just epos
|
||||
& removeEquipmentUsingSite esite
|
||||
& setEquipmentSite esite (Just' invid)
|
||||
where
|
||||
esite = _eqSite (_itUse itm)
|
||||
epos = eqSiteToPos cr esite
|
||||
f Nothing = Just ()
|
||||
f (Just ()) = Nothing
|
||||
|
||||
eqSiteToPos :: Creature -> EquipSite -> EquipPosition
|
||||
eqSiteToPos cr es = case es of
|
||||
GoesOnHead -> OnHead
|
||||
GoesOnChest -> OnChest
|
||||
GoesOnBack -> OnBack
|
||||
GoesOnWrist -> OnLeftWrist
|
||||
GoesOnLegs -> OnLegs
|
||||
GoesOnSpecial -> OnSpecial
|
||||
|
||||
removeEquipmentUsingSite :: EquipSite -> Creature -> Creature
|
||||
removeEquipmentUsingSite esite cr = case esite of
|
||||
GoesOnSpecial -> cr
|
||||
|
||||
Reference in New Issue
Block a user