Require weapon also primed on ammo check

This commit is contained in:
2022-06-22 21:03:06 +01:00
parent fff5c87092
commit ee47ee8e95
3 changed files with 13 additions and 11 deletions
+6 -5
View File
@@ -64,7 +64,7 @@ performAimAt cr w tcid p = ([TurnToward tpos aimSp], Just $ AimAt tcid tpos)
aimSp = case cr ^? crMvType . mvAimSpeed of
Just f -> f $ safeAngleVV (unitVectorAtAngle cdir) (tpos - cpos)
Nothing -> error "creature without aiming type"
tpos | canSee' = _crPos (_creatures w IM.! tcid)
tpos | canSee' = _crPos (_creatures w IM.! tcid)
| otherwise = p
performPathTo :: Creature -> World -> Point2 -> OutAction
@@ -243,7 +243,9 @@ stripNoItems cr = organiseInvKeys (_crID cr) .
organiseInvKeys :: Int -> World -> World
organiseInvKeys cid w = w & creatures . ix cid %~
( ( crInvSel . iselPos .~ newSelKey ) . (crInv .~ newInv ) )
( ( crInvSel . iselPos .~ newSelKey )
. ( crInv .~ newInv )
. ( crInvSel . iselAction .~ NoInvSelAction) )
where
cr = _creatures w IM.! cid
pairs = IM.toList (_crInv cr)
@@ -281,13 +283,13 @@ youDropItem' w = case yourItem w ^? _Just . itCurseStatus of
_ -> w
where
cr = you w
{- | Copy an inventory item to the floor. -}
copyInvItemToFloor :: Creature -> Int -> World -> World
copyInvItemToFloor cr i = copyItemToFloor (_crPos cr)
(_crInv cr IM.! i
$ _crInv cr IM.! i
& itInvPos .~ Nothing
& itIsHeld .~ False
)
sizeSelf :: Float -> Creature -> World -> Maybe World
sizeSelf x cr w
@@ -314,7 +316,6 @@ sizeSelf x cr w
pickUpItemID :: Int -> Int -> World -> World
pickUpItemID cid flid w = pickUpItem cid (_floorItems w IM.! flid) w
{- | Pick up a specific item. -}
pickUpItem :: Int -> FloorItem -> World -> World
pickUpItem cid flit w = maybe w (soundStart (CrSound cid) (_flItPos flit) pickUpS Nothing . snd)