Make aiming speed be gouverned by strength
This commit is contained in:
@@ -3,7 +3,7 @@ import Dodge.Data
|
||||
import Dodge.Creature.Statistics
|
||||
import Geometry
|
||||
|
||||
import Data.Maybe
|
||||
--import Data.Maybe
|
||||
--import qualified Data.IntMap.Strict as IM
|
||||
import Control.Lens
|
||||
{- | Creature attempts to moves under its own steam.
|
||||
@@ -23,16 +23,7 @@ crMvAbsolute p' cr = advanceStepCounter (magV p) cr
|
||||
& crPos %~ (+.+ p)
|
||||
& crMvDir .~ argV p
|
||||
where
|
||||
--p = (equipFactor * aimingFactor) *.* p'
|
||||
p = (strengthFactor (getCrStrength cr) * aimingFactor) *.* p'
|
||||
isAiming = _posture (_crStance cr) == Aiming || _posture (_crStance cr) == Reloading
|
||||
invItSpeed
|
||||
| isAiming = equipAimSpeed
|
||||
| otherwise = equipSpeed
|
||||
equipFactor = product $ invItSpeed <$> _crInv cr
|
||||
aimingFactor
|
||||
| isAiming = fromMaybe 1 $ cr ^? crInv . ix (_crInvSel cr) . itUse . useAim . aimSpeed
|
||||
| otherwise = 1
|
||||
p = strengthFactor (getCrStrength cr) *.* p'
|
||||
|
||||
strengthFactor :: Int -> Float
|
||||
strengthFactor i
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user