Fix blinking bug, shrinker and shield broken

This commit is contained in:
2021-11-28 00:34:16 +00:00
parent fe02739621
commit 3e64e33232
10 changed files with 36 additions and 42 deletions
+3 -5
View File
@@ -258,16 +258,14 @@ ammoUseCheck f item cr w
Arbitrary inventory position. -}
hammerCheckL
:: (Creature -> Int -> World -> World) -- ^ Underlying effect
-> Creature
-> Int
-> World
-> World
-> Creature -> Int -> World -> World
hammerCheckL f cr invid w = case (_crInv cr IM.! invid) ^? itUse . useHammer . hammerPosition of
Just HammerUp -> f cr invid $ setHammerDown w
_ -> setHammerDown w
where
cid = _crID cr
setHammerDown = creatures . ix cid . crInv . ix invid . itUse . useHammer . hammerPosition .~ HammerDown
setHammerDown = creatures . ix cid . crInv . ix invid
. itUse . useHammer . hammerPosition .~ HammerDown
{- | Applies a world effect after an ammo check.
Arbitrary inventory position. -}
shootL
+7 -4
View File
@@ -48,9 +48,9 @@ useRewindGun _ _ w = case _rewindWorlds w of
-- & creatures . ix (_crID cr) .~ cr
& upbuts
& rewindWorlds .~ ws
& lClickHammer .~ HammerUp
upbuts = (keys .~ _keys w) . (mouseButtons .~ _mouseButtons w)
-- needs to shift this item to the current inventory slot
shrinkGun :: Item
shrinkGun = defaultGun
{ _itName = "SHRINKER"
@@ -60,7 +60,8 @@ shrinkGun = defaultGun
, _wpLoadedAmmo = 100
, _wpReloadTime = 20
}
, _itUse = defaultlUse {_lUse = \cr invid -> useShrinkGun (_crInv cr IM.! invid) cr}
, _itUse = defaultlUse {_lUse = hammerCheckL $ \cr invid -> useShrinkGun (_crInv cr IM.! invid) cr}
& useHammer .~ upHammer
, _wpSpread = 0.05
, _wpRange = 20
, _itFloorPict = shrinkGunPic
@@ -90,10 +91,12 @@ blinkGun = defaultGun
, _wpLoadedAmmo = 100
, _wpReloadTime = 20
}
, _itUse = defaultlUse {_lUse = hammerCheckL $ shootL aSelfL}
, _itUse = defaultlUse
{_lUse = hammerCheckL $ shootL aSelfL
} & useHammer .~ upHammer
, _wpSpread = 0.05
, _wpRange = 20
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2[(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)]
, _itFloorPict = const . noPic . colorSH chartreuse $ upperPrismPoly 2 $ square 2
}