23 lines
687 B
Haskell
23 lines
687 B
Haskell
module Dodge.Item.Weapon.FractionLoaded
|
|
( fractionLoadedAmmo
|
|
, fractionLoadedAmmo2
|
|
) where
|
|
import Dodge.Data
|
|
|
|
---- this shouldn't really be used
|
|
loadedAmmo :: Item -> Int
|
|
loadedAmmo = _laLoaded . _itConsumption
|
|
-- | _laTransfer (_itConsumption it) == NoTransfer = _laLoaded (_itConsumption it)
|
|
-- | otherwise = 0
|
|
|
|
fractionLoadedAmmo :: Item -> Float
|
|
fractionLoadedAmmo it = fromIntegral (loadedAmmo it) / fromIntegral (itmaxammo it)
|
|
where
|
|
itmaxammo = _laMax . _itConsumption
|
|
|
|
fractionLoadedAmmo2 :: Item -> Float
|
|
fractionLoadedAmmo2 it = 1 -
|
|
(1 - fromIntegral (loadedAmmo it) / fromIntegral (itMaxAmmo it))**2
|
|
where
|
|
itMaxAmmo = _laMax . _itConsumption
|