Commit before attempting to move some data into a "local" world type

This commit is contained in:
2021-11-28 01:32:42 +00:00
parent 3e64e33232
commit 24480bbe52
10 changed files with 47 additions and 21 deletions
+6 -5
View File
@@ -60,7 +60,7 @@ shrinkGun = defaultGun
, _wpLoadedAmmo = 100
, _wpReloadTime = 20
}
, _itUse = defaultlUse {_lUse = hammerCheckL $ \cr invid -> useShrinkGun (_crInv cr IM.! invid) cr}
, _itUse = defaultlUse {_lUse = hammerCheckL useShrinkGun}
& useHammer .~ upHammer
, _wpSpread = 0.05
, _wpRange = 20
@@ -73,13 +73,14 @@ shrinkGunPic _ = noPic $ colorSH violet $ upperPrismPoly 5 $ square 5
-- be careful changing this around; potential problems include updating the
-- creature but using the old crInvSel value
useShrinkGun :: Item -> Creature -> World -> World
useShrinkGun it cr w = if _itBool $ _itAttachment it
then tryResize 0.5 $ stripNoItems cr . f False UndroppableIdentified . dropUnselected cr
useShrinkGun :: Creature -> Int -> World -> World
useShrinkGun cr invid w = if _itBool $ _itAttachment it
then tryResize 0.5 $ stripNoItems cr . f False UndroppableIdentified . dropExcept cr invid
else tryResize 1 $ f True Uncursed . setMinInvSize defaultInvSize cr
where
it = _crInv cr IM.! invid
tryResize x g = maybe w g $ sizeSelf x cr w
f isInUse cstatus = creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) %~
f isInUse cstatus = creatures . ix (_crID cr) . crInv . ix invid %~
( (itAttachment . itBool .~ isInUse) . (itCurseStatus .~ cstatus) )
blinkGun :: Item