Make aiming speed be gouverned by strength

This commit is contained in:
2022-05-22 14:33:34 +01:00
parent 6891bd7541
commit fd40da2d4a
15 changed files with 35 additions and 37 deletions
+9 -2
View File
@@ -3,18 +3,20 @@ module Dodge.Creature.Statistics
) where
import Dodge.Data
import qualified IntMapHelp as IM
import LensHelp
import Data.Maybe
import Data.IntMap.Merge.Strict
getCrStrength :: Creature -> Int
getCrStrength cr = strFromEquipment cr + _crStrength (_crStatistics cr)
getCrStrength cr = strFromHeldItem cr + strFromEquipment cr + _crStrength (_crStatistics cr)
strFromEquipment :: Creature -> Int
strFromEquipment = sum . fmap equipmentStrValue . crCurrentEquipment
equipmentStrValue :: Item -> Int
equipmentStrValue itm = case _itType itm of
FRONTARMOUR -> negate 2
FRONTARMOUR -> negate 1
POWERLEGS -> 3
_ -> 0
@@ -23,3 +25,8 @@ crCurrentEquipment cr = merge dropMissing dropMissing (zipWithMatched (\_ _ itm
(_crInvEquipped cr)
(_crInv cr)
strFromHeldItem :: Creature -> Int
strFromHeldItem cr
| _posture (_crStance cr) == Aiming || _posture (_crStance cr) == Reloading
= negate $ fromMaybe 0 $ cr ^? crInv . ix (_crInvSel cr) . itUse . useAim . aimWeight
| otherwise = 0