Defunction-ify item modules, requires more cleanup
This commit is contained in:
@@ -91,9 +91,3 @@ creatureTurnToward p turnSpeed cr
|
||||
{- | Speed modifier of an item when not aiming. -}
|
||||
equipSpeed :: Item -> Float
|
||||
equipSpeed _ = 1
|
||||
{- | Speed modifier of an item when aiming. -}
|
||||
equipAimSpeed :: Item -> Float -- TODO remove/rethink
|
||||
equipAimSpeed it
|
||||
| _itType it == FRONTARMOUR = 0.5
|
||||
| _itType it == FLAMESHIELD = 0.5
|
||||
| otherwise = 1
|
||||
|
||||
@@ -49,7 +49,7 @@ ltAutoCrit = defaultCreature
|
||||
, _crStrategy = StrategyActions WatchAndWait [StartSentinelPost]
|
||||
, _crGoal = []
|
||||
}
|
||||
, _crInv = IM.fromList [(0,ltAutoGun),(1,medkit 100)]
|
||||
, _crInv = IM.fromList [(0,autoPistol),(1,medkit 100)]
|
||||
, _crInvSel = 0
|
||||
, _crRad = 10
|
||||
, _crHP = 500
|
||||
|
||||
@@ -185,7 +185,7 @@ movementSideEff cr w
|
||||
_ -> w
|
||||
| otherwise = footstepSideEffect cr w
|
||||
where
|
||||
hasJetPack = any (\it -> it ^? itType == Just JETPACK) $ _crInv cr
|
||||
hasJetPack = any (\it -> it ^? itType . iyBase == Just JETPACK) $ _crInv cr
|
||||
oldPos = _crOldPos cr
|
||||
momentum' = 0.97 *.* (_crPos cr -.- _crOldPos cr)
|
||||
momentum'' | magV momentum' > 3 = 3 *.* normalizeV momentum'
|
||||
|
||||
@@ -15,7 +15,7 @@ strFromEquipment :: Creature -> Int
|
||||
strFromEquipment = sum . fmap equipmentStrValue . crCurrentEquipment
|
||||
|
||||
equipmentStrValue :: Item -> Int
|
||||
equipmentStrValue itm = case _itType itm of
|
||||
equipmentStrValue itm = case _iyBase $ _itType itm of
|
||||
FRONTARMOUR -> negate 3
|
||||
POWERLEGS -> 3
|
||||
_ -> 0
|
||||
|
||||
@@ -89,7 +89,7 @@ crIsArmouredFrom = hasFrontArmour
|
||||
hasFrontArmour :: Point2 -> Creature -> Bool
|
||||
hasFrontArmour p cr = fromMaybe False $ do
|
||||
invid <- cr ^? crEquipment . ix OnChest
|
||||
ittype <- cr ^? crInv . ix invid . itType
|
||||
ittype <- cr ^? crInv . ix invid . itType . iyBase
|
||||
return $ FRONTARMOUR == ittype
|
||||
&& p /= _crOldPos cr
|
||||
&& angleVV (unitVectorAtAngle (_crDir cr + frontarmdirection)) (p -.- _crOldPos cr) < pi/2
|
||||
|
||||
Reference in New Issue
Block a user