Fold some ammo data into its own type
This commit is contained in:
@@ -152,20 +152,20 @@ startReloadingWeapon cr w =
|
|||||||
it = _crInv cr IM.! _crInvSel cr
|
it = _crInv cr IM.! _crInvSel cr
|
||||||
itRef = creatures . ix cid . crInv . ix (_crInvSel cr)
|
itRef = creatures . ix cid . crInv . ix (_crInvSel cr)
|
||||||
in case it of
|
in case it of
|
||||||
Weapon {_wpMaxAmmo=maxA,_wpLoadedAmmo=lA,_wpReloadState=rS,_wpReloadTime=rT}
|
Weapon {_wpAmmo = LoadableAmmo {_wpMaxAmmo=maxA,_wpLoadedAmmo=lA },_wpReloadState=rS,_wpReloadTime=rT}
|
||||||
| lA < maxA && rS == 0 -> Just $ set ( itRef . wpLoadedAmmo) maxA
|
| lA < maxA && rS == 0 -> Just $ set ( itRef . wpAmmo . wpLoadedAmmo) maxA
|
||||||
$ set ( itRef . wpReloadState) rT w
|
$ set ( itRef . wpReloadState) rT w
|
||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
{- | Start reloading if clip is empty. -}
|
{- | Start reloading if clip is empty. -}
|
||||||
crAutoReload :: Creature -> Creature
|
crAutoReload :: Creature -> Creature
|
||||||
crAutoReload cr = case cr ^? crInv . ix (_crInvSel cr) . wpLoadedAmmo of
|
crAutoReload cr = case cr ^? crInv . ix (_crInvSel cr) . wpAmmo . wpLoadedAmmo of
|
||||||
Just 0 | _posture (_crStance cr) /= Aiming
|
Just 0 | _posture (_crStance cr) /= Aiming
|
||||||
-> cr & crInv . ix (_crInvSel cr) . wpReloadState %~ (`fromMaybe` reloadT)
|
-> cr & crInv . ix (_crInvSel cr) . wpReloadState %~ (`fromMaybe` reloadT)
|
||||||
& crInv . ix (_crInvSel cr) . wpLoadedAmmo %~ (`fromMaybe` maxA)
|
& crInv . ix (_crInvSel cr) . wpAmmo . wpLoadedAmmo %~ (`fromMaybe` maxA)
|
||||||
_ -> cr
|
_ -> cr
|
||||||
where
|
where
|
||||||
reloadT = cr ^? crInv . ix (_crInvSel cr) . wpReloadTime
|
reloadT = cr ^? crInv . ix (_crInvSel cr) . wpReloadTime
|
||||||
maxA = cr ^? crInv . ix (_crInvSel cr) . wpMaxAmmo
|
maxA = cr ^? crInv . ix (_crInvSel cr) . wpAmmo . wpMaxAmmo
|
||||||
{- | Teleport a creature to the mouse position -}
|
{- | Teleport a creature to the mouse position -}
|
||||||
blinkAction
|
blinkAction
|
||||||
:: Creature
|
:: Creature
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ reloadOverrideR
|
|||||||
:: Creature
|
:: Creature
|
||||||
-> Reader World Creature
|
-> Reader World Creature
|
||||||
reloadOverrideR cr
|
reloadOverrideR cr
|
||||||
| cr ^? crInv . ix (_crInvSel cr) . wpLoadedAmmo == Just 0
|
| cr ^? crInv . ix (_crInvSel cr) . wpAmmo . wpLoadedAmmo == Just 0
|
||||||
&& cr ^. crStance . posture == Aiming
|
&& cr ^. crStance . posture == Aiming
|
||||||
= return $ cr & crActionPlan . crStrategy .~ StrategyActions Reload reloadActions
|
= return $ cr & crActionPlan . crStrategy .~ StrategyActions Reload reloadActions
|
||||||
| otherwise = return cr
|
| otherwise = return cr
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ crAwayFromPostR cr = return $ case find sentinelGoal $ _crGoal $ _crActionPlan c
|
|||||||
sentinelGoal _ = False
|
sentinelGoal _ = False
|
||||||
|
|
||||||
crHasAmmo :: (World,Creature) -> Bool
|
crHasAmmo :: (World,Creature) -> Bool
|
||||||
crHasAmmo (_,cr) = maybe False (> 0) $ cr ^? crInv . ix (_crInvSel cr) . wpLoadedAmmo
|
crHasAmmo (_,cr) = maybe False (> 0) $ cr ^? crInv . ix (_crInvSel cr) . wpAmmo . wpLoadedAmmo
|
||||||
|
|
||||||
crCanShoot :: (World,Creature) -> Bool
|
crCanShoot :: (World,Creature) -> Bool
|
||||||
crCanShoot p = crIsAiming p && crHasAmmo p
|
crCanShoot p = crIsAiming p && crHasAmmo p
|
||||||
|
|||||||
+6
-6
@@ -294,15 +294,15 @@ data ItemUse
|
|||||||
| LeftUse { _lUse :: Creature -> Int -> World -> World }
|
| LeftUse { _lUse :: Creature -> Int -> World -> World }
|
||||||
| NoUse
|
| NoUse
|
||||||
data ItemAmmo
|
data ItemAmmo
|
||||||
= LoadbleAmmo
|
= LoadableAmmo
|
||||||
{ _aoType :: AmmoType
|
{ _aoType :: AmmoType
|
||||||
}
|
|
||||||
data Item
|
|
||||||
= Weapon
|
|
||||||
{ _itName :: String
|
|
||||||
, _wpMaxAmmo :: Int
|
, _wpMaxAmmo :: Int
|
||||||
, _wpLoadedAmmo :: Int
|
, _wpLoadedAmmo :: Int
|
||||||
, _wpAmmo :: AmmoType
|
}
|
||||||
|
data Item
|
||||||
|
= Weapon
|
||||||
|
{ _itName :: String
|
||||||
|
, _wpAmmo :: ItemAmmo
|
||||||
, _wpReloadTime :: Int
|
, _wpReloadTime :: Int
|
||||||
, _wpReloadState :: Int
|
, _wpReloadState :: Int
|
||||||
, _wpReloadType :: ReloadType
|
, _wpReloadType :: ReloadType
|
||||||
|
|||||||
@@ -10,14 +10,19 @@ import Shape
|
|||||||
import Geometry.Vector3D
|
import Geometry.Vector3D
|
||||||
import Geometry
|
import Geometry
|
||||||
|
|
||||||
|
defaultAmmo :: ItemAmmo
|
||||||
|
defaultAmmo = LoadableAmmo
|
||||||
|
{ _aoType = GenericAmmo
|
||||||
|
, _wpMaxAmmo = 15
|
||||||
|
, _wpLoadedAmmo = 15
|
||||||
|
}
|
||||||
|
|
||||||
defaultGun :: Item
|
defaultGun :: Item
|
||||||
defaultGun = Weapon
|
defaultGun = Weapon
|
||||||
{ _itName = "default"
|
{ _itName = "default"
|
||||||
, _itCurseStatus = Uncursed
|
, _itCurseStatus = Uncursed
|
||||||
, _itIdentity = Pistol
|
, _itIdentity = Pistol
|
||||||
, _wpMaxAmmo = 15
|
, _wpAmmo = defaultAmmo
|
||||||
, _wpLoadedAmmo = 15
|
|
||||||
, _wpAmmo = GenericAmmo
|
|
||||||
, _wpReloadTime = 40
|
, _wpReloadTime = 40
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _wpReloadType = ActiveReload
|
, _wpReloadType = ActiveReload
|
||||||
|
|||||||
+5
-5
@@ -120,16 +120,16 @@ wheelEvent y w = case (_carteDisplay w, _inventoryMode w) of
|
|||||||
invKeyDown = ScancodeCapsLock `S.member` _keys w
|
invKeyDown = ScancodeCapsLock `S.member` _keys w
|
||||||
|
|
||||||
moveYourAmmoSel :: Int -> World -> World
|
moveYourAmmoSel :: Int -> World -> World
|
||||||
moveYourAmmoSel i w = case yourItem w ^? wpAmmo . amPjParams of
|
moveYourAmmoSel i w = case yourItem w ^? wpAmmo . aoType. amPjParams of
|
||||||
Just l -> w & creatures . ix (_yourID w) . crInv . ix (_crInvSel (you w))
|
Just l -> w & creatures . ix (_yourID w) . crInv . ix (_crInvSel (you w))
|
||||||
. wpAmmo . amParamSel %~ (`mod` length l) . subtract i
|
. wpAmmo . aoType. amParamSel %~ (`mod` length l) . subtract i
|
||||||
_ -> w
|
_ -> w
|
||||||
moveYourAmmoParam :: Int -> World -> World
|
moveYourAmmoParam :: Int -> World -> World
|
||||||
moveYourAmmoParam i w = case yourItem w ^? wpAmmo . amPjParams . ix paramid . pjMaxParam of
|
moveYourAmmoParam i w = case yourItem w ^? wpAmmo . aoType. amPjParams . ix paramid . pjMaxParam of
|
||||||
Just n -> w & creatures . ix (_yourID w) . crInv . ix (_crInvSel (you w))
|
Just n -> w & creatures . ix (_yourID w) . crInv . ix (_crInvSel (you w))
|
||||||
. wpAmmo . amPjParams . ix paramid . pjIntParam %~ (`mod` n) . (+ i)
|
. wpAmmo . aoType. amPjParams . ix paramid . pjIntParam %~ (`mod` n) . (+ i)
|
||||||
_ -> w
|
_ -> w
|
||||||
where
|
where
|
||||||
paramid = _amParamSel $ _wpAmmo $ yourItem w
|
paramid = _amParamSel $ _aoType $ _wpAmmo $ yourItem w
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ import Geometry
|
|||||||
import Control.Lens
|
import Control.Lens
|
||||||
|
|
||||||
useAmmoParams :: ItemUse
|
useAmmoParams :: ItemUse
|
||||||
useAmmoParams = RightUse $ \it -> let b = _wpAmmo it
|
useAmmoParams = RightUse $ \it -> let b = _aoType $ _wpAmmo it
|
||||||
in withVelWthHiteff (_amBulVel b) (_amBulWth b) (_amBulEff b)
|
in withVelWthHiteff (_amBulVel b) (_amBulWth b) (_amBulEff b)
|
||||||
|
|
||||||
useAmmoParamsVelMod :: Float -> Item -> Creature -> World -> World
|
useAmmoParamsVelMod :: Float -> Item -> Creature -> World -> World
|
||||||
useAmmoParamsVelMod vfact it = withDelayedVelWthHiteff vfact (_amBulVel b) (_amBulWth b) (_amBulEff b)
|
useAmmoParamsVelMod vfact it = withDelayedVelWthHiteff vfact (_amBulVel b) (_amBulWth b) (_amBulEff b)
|
||||||
where
|
where
|
||||||
b = _wpAmmo it
|
b = _aoType $ _wpAmmo it
|
||||||
|
|
||||||
{- | Creates a bullet with a given velocity, width, and 'HitEffect' -}
|
{- | Creates a bullet with a given velocity, width, and 'HitEffect' -}
|
||||||
withVelWthHiteff
|
withVelWthHiteff
|
||||||
@@ -53,11 +53,11 @@ withDelayedVelWthHiteff vfact vel width hiteff cr = over particles (newbul : )
|
|||||||
|
|
||||||
loadedAmmo :: Item -> Int
|
loadedAmmo :: Item -> Int
|
||||||
loadedAmmo it
|
loadedAmmo it
|
||||||
| _wpReloadState it == 0 = _wpLoadedAmmo it
|
| _wpReloadState it == 0 = _wpLoadedAmmo (_wpAmmo it)
|
||||||
| otherwise = 0
|
| otherwise = 0
|
||||||
|
|
||||||
fractionLoadedAmmo :: Item -> Float
|
fractionLoadedAmmo :: Item -> Float
|
||||||
fractionLoadedAmmo it = fromIntegral (loadedAmmo it) / fromIntegral (_wpMaxAmmo it)
|
fractionLoadedAmmo it = fromIntegral (loadedAmmo it) / fromIntegral (_wpMaxAmmo (_wpAmmo it))
|
||||||
|
|
||||||
fractionLoadedAmmo2 :: Item -> Float
|
fractionLoadedAmmo2 :: Item -> Float
|
||||||
fractionLoadedAmmo2 it = 1 - (1 - fromIntegral (loadedAmmo it) / fromIntegral (_wpMaxAmmo it))**2
|
fractionLoadedAmmo2 it = 1 - (1 - fromIntegral (loadedAmmo it) / fromIntegral (_wpMaxAmmo (_wpAmmo it)))**2
|
||||||
|
|||||||
@@ -37,8 +37,10 @@ teslaGun :: Item
|
|||||||
teslaGun = defaultGun
|
teslaGun = defaultGun
|
||||||
{ _itName = "TESLA"
|
{ _itName = "TESLA"
|
||||||
, _itIdentity = TeslaGun
|
, _itIdentity = TeslaGun
|
||||||
, _wpMaxAmmo = 200
|
, _wpAmmo = defaultAmmo
|
||||||
, _wpLoadedAmmo = 200
|
{ _wpMaxAmmo = 200
|
||||||
|
, _wpLoadedAmmo = 200
|
||||||
|
}
|
||||||
, _wpReloadTime = 80
|
, _wpReloadTime = 80
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 0
|
, _itUseRate = 0
|
||||||
@@ -71,8 +73,10 @@ lasGun :: Item
|
|||||||
lasGun = defaultAutoGun
|
lasGun = defaultAutoGun
|
||||||
{ _itName = "LASGUN ////"
|
{ _itName = "LASGUN ////"
|
||||||
, _itIdentity = LasGun
|
, _itIdentity = LasGun
|
||||||
, _wpMaxAmmo = 200
|
, _wpAmmo = defaultAmmo
|
||||||
, _wpLoadedAmmo = 200
|
{ _wpMaxAmmo = 200
|
||||||
|
, _wpLoadedAmmo = 200
|
||||||
|
}
|
||||||
, _wpReloadTime = 80
|
, _wpReloadTime = 80
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 0
|
, _itUseRate = 0
|
||||||
@@ -111,8 +115,10 @@ tractorGun :: Item
|
|||||||
tractorGun = defaultAutoGun
|
tractorGun = defaultAutoGun
|
||||||
{ _itName = "TRACTORGUN"
|
{ _itName = "TRACTORGUN"
|
||||||
, _itIdentity = TractorGun
|
, _itIdentity = TractorGun
|
||||||
, _wpMaxAmmo = 10000
|
, _wpAmmo = defaultAmmo
|
||||||
, _wpLoadedAmmo = 10000
|
{ _wpMaxAmmo = 10000
|
||||||
|
, _wpLoadedAmmo = 10000
|
||||||
|
}
|
||||||
, _wpReloadTime = 40
|
, _wpReloadTime = 40
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 0
|
, _itUseRate = 0
|
||||||
|
|||||||
@@ -40,7 +40,9 @@ bezierGun = defaultGun
|
|||||||
, _itEffect = rbSetTarget
|
, _itEffect = rbSetTarget
|
||||||
, _itZoom = defaultItZoom
|
, _itZoom = defaultItZoom
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _wpMaxAmmo = 50
|
, _wpAmmo = defaultAmmo
|
||||||
|
{ _wpMaxAmmo = 50
|
||||||
|
}
|
||||||
, _itUseRate = 6
|
, _itUseRate = 6
|
||||||
, _itAimStance = TwoHandTwist
|
, _itAimStance = TwoHandTwist
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ boostSelfL
|
|||||||
-> World
|
-> World
|
||||||
-> World
|
-> World
|
||||||
boostSelfL x cr invid w = case boostPoint x cr w of
|
boostSelfL x cr invid w = case boostPoint x cr w of
|
||||||
Left p -> crEff p (wpLoadedAmmo .~ 0)
|
Left p -> crEff p (wpAmmo . wpLoadedAmmo .~ 0)
|
||||||
Right p -> crEff p (wpLoadedAmmo -~ 1)
|
Right p -> crEff p (wpAmmo . wpLoadedAmmo -~ 1)
|
||||||
where
|
where
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
cpos = _crPos cr
|
cpos = _crPos cr
|
||||||
@@ -113,8 +113,10 @@ boosterGun :: Item
|
|||||||
boosterGun = defaultGun
|
boosterGun = defaultGun
|
||||||
{ _itName = "BOOSTER"
|
{ _itName = "BOOSTER"
|
||||||
, _itIdentity = Blinker
|
, _itIdentity = Blinker
|
||||||
, _wpMaxAmmo = 100
|
, _wpAmmo = defaultAmmo
|
||||||
, _wpLoadedAmmo = 100
|
{ _wpMaxAmmo = 100
|
||||||
|
, _wpLoadedAmmo = 100
|
||||||
|
}
|
||||||
, _wpReloadTime = 20
|
, _wpReloadTime = 20
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 0
|
, _itUseRate = 0
|
||||||
|
|||||||
@@ -35,8 +35,11 @@ autoGun :: Item
|
|||||||
autoGun = defaultAutoGun
|
autoGun = defaultAutoGun
|
||||||
{ _itName = "AUTOGUN"
|
{ _itName = "AUTOGUN"
|
||||||
, _itIdentity = AutoGun
|
, _itIdentity = AutoGun
|
||||||
, _wpMaxAmmo = 30
|
, _wpAmmo = LoadableAmmo
|
||||||
, _wpLoadedAmmo = 30
|
{_aoType = basicBullet
|
||||||
|
, _wpMaxAmmo = 30
|
||||||
|
, _wpLoadedAmmo = 30
|
||||||
|
}
|
||||||
, _wpReloadTime = 80
|
, _wpReloadTime = 80
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 5
|
, _itUseRate = 5
|
||||||
@@ -70,7 +73,6 @@ autoGun = defaultAutoGun
|
|||||||
, _itAttachment = ItCharMode $ Seq.fromList "MS"
|
, _itAttachment = ItCharMode $ Seq.fromList "MS"
|
||||||
, _itScroll = scrollCharMode
|
, _itScroll = scrollCharMode
|
||||||
, _itInvDisplay = basicWeaponDisplay
|
, _itInvDisplay = basicWeaponDisplay
|
||||||
, _wpAmmo = basicBullet
|
|
||||||
}
|
}
|
||||||
autoGunPic :: Item -> SPic
|
autoGunPic :: Item -> SPic
|
||||||
autoGunPic it = noPic $
|
autoGunPic it = noPic $
|
||||||
@@ -86,8 +88,11 @@ pistol :: Item
|
|||||||
pistol = defaultGun
|
pistol = defaultGun
|
||||||
{ _itName = "PISTOL"
|
{ _itName = "PISTOL"
|
||||||
, _itIdentity = Pistol
|
, _itIdentity = Pistol
|
||||||
, _wpMaxAmmo = 15
|
, _wpAmmo = LoadableAmmo
|
||||||
, _wpLoadedAmmo = 15
|
{ _aoType = basicBullet
|
||||||
|
, _wpMaxAmmo = 15
|
||||||
|
, _wpLoadedAmmo = 15
|
||||||
|
}
|
||||||
, _wpReloadTime = 40
|
, _wpReloadTime = 40
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 8
|
, _itUseRate = 8
|
||||||
@@ -114,7 +119,6 @@ pistol = defaultGun
|
|||||||
, _itInvColor = white
|
, _itInvColor = white
|
||||||
, _itTargeting = Nothing
|
, _itTargeting = Nothing
|
||||||
, _itWorldTrigger = Nothing
|
, _itWorldTrigger = Nothing
|
||||||
, _wpAmmo = basicBullet
|
|
||||||
}
|
}
|
||||||
pistolPic :: Item -> SPic
|
pistolPic :: Item -> SPic
|
||||||
pistolPic it = noPic $ colorSH green (prismPoly
|
pistolPic it = noPic $ colorSH green (prismPoly
|
||||||
@@ -134,8 +138,11 @@ hvAutoGun :: Item
|
|||||||
hvAutoGun = defaultAutoGun
|
hvAutoGun = defaultAutoGun
|
||||||
{ _itName = "AUTO-HV"
|
{ _itName = "AUTO-HV"
|
||||||
, _itIdentity = HvAutoGun
|
, _itIdentity = HvAutoGun
|
||||||
, _wpMaxAmmo = 100
|
, _wpAmmo = LoadableAmmo
|
||||||
, _wpLoadedAmmo = 100
|
{ _aoType = hvBullet
|
||||||
|
, _wpMaxAmmo = 100
|
||||||
|
, _wpLoadedAmmo = 100
|
||||||
|
}
|
||||||
, _wpReloadTime = 200
|
, _wpReloadTime = 200
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 25
|
, _itUseRate = 25
|
||||||
@@ -152,7 +159,6 @@ hvAutoGun = defaultAutoGun
|
|||||||
, _itFloorPict = hvAutoGunPic
|
, _itFloorPict = hvAutoGunPic
|
||||||
, _itAimingSpeed = 0.2
|
, _itAimingSpeed = 0.2
|
||||||
, _itAimingRange = 1
|
, _itAimingRange = 1
|
||||||
, _wpAmmo = hvBullet
|
|
||||||
}
|
}
|
||||||
hvAutoGunPic :: Item -> SPic
|
hvAutoGunPic :: Item -> SPic
|
||||||
hvAutoGunPic it =
|
hvAutoGunPic it =
|
||||||
@@ -169,8 +175,11 @@ ltAutoGun :: Item
|
|||||||
ltAutoGun = defaultAutoGun
|
ltAutoGun = defaultAutoGun
|
||||||
{ _itName = "AUTO-LT"
|
{ _itName = "AUTO-LT"
|
||||||
, _itIdentity = LtAutoGun
|
, _itIdentity = LtAutoGun
|
||||||
, _wpMaxAmmo = 25
|
, _wpAmmo = LoadableAmmo
|
||||||
, _wpLoadedAmmo = 25
|
{ _aoType = ltBullet
|
||||||
|
, _wpMaxAmmo = 25
|
||||||
|
, _wpLoadedAmmo = 25
|
||||||
|
}
|
||||||
, _wpReloadTime = 80
|
, _wpReloadTime = 80
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 3
|
, _itUseRate = 3
|
||||||
@@ -193,7 +202,6 @@ ltAutoGun = defaultAutoGun
|
|||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _itZoom = defaultItZoom
|
, _itZoom = defaultItZoom
|
||||||
, _itAimStance = OneHand
|
, _itAimStance = OneHand
|
||||||
, _wpAmmo = ltBullet
|
|
||||||
}
|
}
|
||||||
& itDimension . muzzleLength .~ 10
|
& itDimension . muzzleLength .~ 10
|
||||||
ltAutoGunPic :: Item -> SPic
|
ltAutoGunPic :: Item -> SPic
|
||||||
@@ -210,8 +218,11 @@ miniGun :: Item
|
|||||||
miniGun = defaultAutoGun
|
miniGun = defaultAutoGun
|
||||||
{ _itName = "MINI-G"
|
{ _itName = "MINI-G"
|
||||||
, _itIdentity = MiniGun
|
, _itIdentity = MiniGun
|
||||||
, _wpMaxAmmo = 1500
|
, _wpAmmo = LoadableAmmo
|
||||||
, _wpLoadedAmmo = 1500
|
{ _aoType = basicBullet
|
||||||
|
, _wpMaxAmmo = 1500
|
||||||
|
, _wpLoadedAmmo = 1500
|
||||||
|
}
|
||||||
, _wpReloadTime = 200
|
, _wpReloadTime = 200
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _wpMaxWarmUp = 100
|
, _wpMaxWarmUp = 100
|
||||||
@@ -256,7 +267,6 @@ miniGun = defaultAutoGun
|
|||||||
, _itAimingSpeed = 0.4
|
, _itAimingSpeed = 0.4
|
||||||
, _itAimingRange = 1
|
, _itAimingRange = 1
|
||||||
, _itEquipPict = pictureWeaponAim miniGunPictItem
|
, _itEquipPict = pictureWeaponAim miniGunPictItem
|
||||||
, _wpAmmo = basicBullet
|
|
||||||
} & itDimension . muzzleLength .~ 15
|
} & itDimension . muzzleLength .~ 15
|
||||||
where
|
where
|
||||||
recoilAmount = 5
|
recoilAmount = 5
|
||||||
@@ -273,7 +283,7 @@ miniGun = defaultAutoGun
|
|||||||
miniGunPictItem :: Item -> SPic
|
miniGunPictItem :: Item -> SPic
|
||||||
miniGunPictItem it = miniGunPict spin (loadedAmmo it)
|
miniGunPictItem it = miniGunPict spin (loadedAmmo it)
|
||||||
where
|
where
|
||||||
spin = (-10) * _wpLoadedAmmo it + _wpCurWarmUp it
|
spin = (-10) * _wpLoadedAmmo (_wpAmmo it) + _wpCurWarmUp it
|
||||||
|
|
||||||
miniGunPict :: Int -> Int -> SPic
|
miniGunPict :: Int -> Int -> SPic
|
||||||
miniGunPict spin am =
|
miniGunPict spin am =
|
||||||
@@ -301,8 +311,11 @@ spreadGun :: Item
|
|||||||
spreadGun = defaultGun
|
spreadGun = defaultGun
|
||||||
{ _itName = "SPREAD"
|
{ _itName = "SPREAD"
|
||||||
, _itIdentity = SpreadGun
|
, _itIdentity = SpreadGun
|
||||||
, _wpMaxAmmo = 5
|
, _wpAmmo = LoadableAmmo
|
||||||
, _wpLoadedAmmo = 5
|
{ _aoType = basicBullet
|
||||||
|
, _wpMaxAmmo = 5
|
||||||
|
, _wpLoadedAmmo = 5
|
||||||
|
}
|
||||||
, _wpReloadTime = 80
|
, _wpReloadTime = 80
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 20
|
, _itUseRate = 20
|
||||||
@@ -324,7 +337,6 @@ spreadGun = defaultGun
|
|||||||
, _itFloorPict = spreadGunPic
|
, _itFloorPict = spreadGunPic
|
||||||
, _itAimingSpeed = 1
|
, _itAimingSpeed = 1
|
||||||
, _itAimingRange = 0
|
, _itAimingRange = 0
|
||||||
, _wpAmmo = basicBullet
|
|
||||||
, _wpNumBarrels = 50
|
, _wpNumBarrels = 50
|
||||||
}
|
}
|
||||||
spreadGunPic :: Item -> SPic
|
spreadGunPic :: Item -> SPic
|
||||||
@@ -339,8 +351,11 @@ multGun :: Item
|
|||||||
multGun = defaultGun
|
multGun = defaultGun
|
||||||
{ _itName = "MULTGUN"
|
{ _itName = "MULTGUN"
|
||||||
, _itIdentity = MultGun
|
, _itIdentity = MultGun
|
||||||
, _wpMaxAmmo = 2
|
, _wpAmmo = LoadableAmmo
|
||||||
, _wpLoadedAmmo = 2
|
{ _aoType = basicBullet
|
||||||
|
, _wpMaxAmmo = 2
|
||||||
|
, _wpLoadedAmmo = 2
|
||||||
|
}
|
||||||
, _wpReloadTime = 40
|
, _wpReloadTime = 40
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 20
|
, _itUseRate = 20
|
||||||
@@ -364,7 +379,6 @@ multGun = defaultGun
|
|||||||
, _itZoom = defaultItZoom
|
, _itZoom = defaultItZoom
|
||||||
, _itAimZoom = defaultItZoom {_itZoomFac = 1.5}
|
, _itAimZoom = defaultItZoom {_itZoomFac = 1.5}
|
||||||
, _itAimStance = TwoHandTwist
|
, _itAimStance = TwoHandTwist
|
||||||
, _wpAmmo = basicBullet
|
|
||||||
, _wpNumBarrels = 5
|
, _wpNumBarrels = 5
|
||||||
}
|
}
|
||||||
multGunSPic :: Item -> SPic
|
multGunSPic :: Item -> SPic
|
||||||
@@ -386,8 +400,11 @@ longGun :: Item
|
|||||||
longGun = defaultGun
|
longGun = defaultGun
|
||||||
{ _itName = "LONGGUN"
|
{ _itName = "LONGGUN"
|
||||||
, _itIdentity = LongGun
|
, _itIdentity = LongGun
|
||||||
, _wpMaxAmmo = 1
|
, _wpAmmo = LoadableAmmo
|
||||||
, _wpLoadedAmmo = 1
|
{ _aoType = hvBullet
|
||||||
|
, _wpMaxAmmo = 1
|
||||||
|
, _wpLoadedAmmo = 1
|
||||||
|
}
|
||||||
, _wpReloadTime = 100
|
, _wpReloadTime = 100
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _wpReloadType = PassiveReload skwareFadeTwoSecS
|
, _wpReloadType = PassiveReload skwareFadeTwoSecS
|
||||||
@@ -413,7 +430,6 @@ longGun = defaultGun
|
|||||||
, _itScroll = zoomLongGun
|
, _itScroll = zoomLongGun
|
||||||
, _itAttachment = ItScope (V2 0 0) 0 1 False
|
, _itAttachment = ItScope (V2 0 0) 0 1 False
|
||||||
, _itEffect = itemLaserScopeEffect
|
, _itEffect = itemLaserScopeEffect
|
||||||
, _wpAmmo = hvBullet
|
|
||||||
, _itAimStance = TwoHandTwist
|
, _itAimStance = TwoHandTwist
|
||||||
}
|
}
|
||||||
longGunSPic :: Item -> SPic
|
longGunSPic :: Item -> SPic
|
||||||
|
|||||||
@@ -22,8 +22,11 @@ lasDrones :: Item
|
|||||||
lasDrones = defaultGun
|
lasDrones = defaultGun
|
||||||
{ _itName = "DRONES"
|
{ _itName = "DRONES"
|
||||||
, _itIdentity = Generic
|
, _itIdentity = Generic
|
||||||
, _wpMaxAmmo = 2
|
, _wpAmmo = LoadableAmmo
|
||||||
, _wpLoadedAmmo = 2
|
{ _aoType = DroneAmmo { _amString = "LASDRONE" }
|
||||||
|
, _wpMaxAmmo = 2
|
||||||
|
, _wpLoadedAmmo = 2
|
||||||
|
}
|
||||||
, _wpReloadTime = 80
|
, _wpReloadTime = 80
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 20
|
, _itUseRate = 20
|
||||||
@@ -42,8 +45,6 @@ lasDrones = defaultGun
|
|||||||
, _itAimingRange = 0.5
|
, _itAimingRange = 0.5
|
||||||
, _itHammer = NoHammer
|
, _itHammer = NoHammer
|
||||||
, _itEffect = NoItEffect
|
, _itEffect = NoItEffect
|
||||||
, _wpAmmo = DroneAmmo
|
|
||||||
{ _amString = "LASDRONE" }
|
|
||||||
, _itAimStance = TwoHandTwist
|
, _itAimStance = TwoHandTwist
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +72,7 @@ aDroneWithItemParams it cr w = over props (IM.insert i theShell) w
|
|||||||
{ _pjPos = pos
|
{ _pjPos = pos
|
||||||
, _pjStartPos = pos
|
, _pjStartPos = pos
|
||||||
, _pjVel = rotateV dir (V2 1 0)
|
, _pjVel = rotateV dir (V2 1 0)
|
||||||
, _prDraw = _amPjDraw am
|
, _prDraw = _amPjDraw $ _aoType am
|
||||||
, _pjID = i
|
, _pjID = i
|
||||||
, _pjUpdate = const id
|
, _pjUpdate = const id
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ itemLaserScopeEffect
|
|||||||
-- _ -> ep -.- 2 *.* unitVectorAtAngle d
|
-- _ -> ep -.- 2 *.* unitVectorAtAngle d
|
||||||
it = (cr ^. crInv) IM.! invid
|
it = (cr ^. crInv) IM.! invid
|
||||||
reloadFrac
|
reloadFrac
|
||||||
| _wpLoadedAmmo it == 0 = 1
|
| _wpLoadedAmmo (_wpAmmo it) == 0 = 1
|
||||||
| otherwise = fromIntegral (_wpReloadState it) / fromIntegral (_wpReloadTime it)
|
| otherwise = fromIntegral (_wpReloadState it) / fromIntegral (_wpReloadTime it)
|
||||||
--col = mixColors reloadFrac (1-reloadFrac) red green
|
--col = mixColors reloadFrac (1-reloadFrac) red green
|
||||||
{- | Automatically send out radar pulses that detect walls. -}
|
{- | Automatically send out radar pulses that detect walls. -}
|
||||||
|
|||||||
@@ -17,6 +17,6 @@ basicWeaponDisplay it = case it ^? itAttachment of
|
|||||||
_ -> midPadL 10 ' ' (_itName it) (' ' : aIfLoaded)
|
_ -> midPadL 10 ' ' (_itName it) (' ' : aIfLoaded)
|
||||||
where
|
where
|
||||||
aIfLoaded = case it ^? wpReloadState of
|
aIfLoaded = case it ^? wpReloadState of
|
||||||
Just 0 -> show $ _wpLoadedAmmo it
|
Just 0 -> show $ _wpLoadedAmmo (_wpAmmo it)
|
||||||
Just x -> "R" ++ show x
|
Just x -> "R" ++ show x
|
||||||
_ -> ""
|
_ -> ""
|
||||||
|
|||||||
@@ -37,8 +37,16 @@ launcher :: Item
|
|||||||
launcher = defaultGun
|
launcher = defaultGun
|
||||||
{ _itName = "ROCKO"
|
{ _itName = "ROCKO"
|
||||||
, _itIdentity = Launcher
|
, _itIdentity = Launcher
|
||||||
, _wpMaxAmmo = 30
|
, _wpAmmo = LoadableAmmo
|
||||||
, _wpLoadedAmmo = 30
|
{ _aoType = defaultShellAmmo
|
||||||
|
{ _amPayload = makeExplosionAt
|
||||||
|
, _amString = ""
|
||||||
|
, _amPjParams = basicAmPjMoves
|
||||||
|
, _amPjDraw = shellPic
|
||||||
|
}
|
||||||
|
, _wpMaxAmmo = 30
|
||||||
|
, _wpLoadedAmmo = 30
|
||||||
|
}
|
||||||
, _wpReloadTime = 80
|
, _wpReloadTime = 80
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 20
|
, _itUseRate = 20
|
||||||
@@ -57,12 +65,6 @@ launcher = defaultGun
|
|||||||
, _itAimingRange = 0.5
|
, _itAimingRange = 0.5
|
||||||
, _itHammer = NoHammer
|
, _itHammer = NoHammer
|
||||||
, _itEffect = NoItEffect
|
, _itEffect = NoItEffect
|
||||||
, _wpAmmo = defaultShellAmmo
|
|
||||||
{ _amPayload = makeExplosionAt
|
|
||||||
, _amString = ""
|
|
||||||
, _amPjParams = basicAmPjMoves
|
|
||||||
, _amPjDraw = shellPic
|
|
||||||
}
|
|
||||||
, _itAimStance = TwoHandTwist
|
, _itAimStance = TwoHandTwist
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,16 +149,16 @@ aRocketWithItemParams it cr w = over props (IM.insert i theShell) w
|
|||||||
i = IM.newKey $ _props w
|
i = IM.newKey $ _props w
|
||||||
pos = _crPos cr +.+ ((_crRad cr +1) *.* unitVectorAtAngle dir)
|
pos = _crPos cr +.+ ((_crRad cr +1) *.* unitVectorAtAngle dir)
|
||||||
dir = _crDir cr
|
dir = _crDir cr
|
||||||
ammoMvs pj w' = foldr (\pjP -> _pjMoveParam pjP (_pjIntParam pjP) it cr pj) w' (_amPjParams am)
|
ammoMvs pj w' = foldr (\pjP -> _pjMoveParam pjP (_pjIntParam pjP) it cr pj) w' (_amPjParams $ _aoType am)
|
||||||
theShell = defaultShell
|
theShell = defaultShell
|
||||||
{ _pjPos = pos
|
{ _pjPos = pos
|
||||||
, _pjStartPos = pos
|
, _pjStartPos = pos
|
||||||
, _pjVel = rotateV dir (V2 1 0)
|
, _pjVel = rotateV dir (V2 1 0)
|
||||||
, _pjAcc = rotateV dir (V2 3 0)
|
, _pjAcc = rotateV dir (V2 3 0)
|
||||||
, _prDraw = _amPjDraw am
|
, _prDraw = _amPjDraw $ _aoType am
|
||||||
, _pjID = i
|
, _pjID = i
|
||||||
, _pjUpdate = \pj -> ammoMvs pj . decTimMvVel pj . moveShell pj
|
, _pjUpdate = \pj -> ammoMvs pj . decTimMvVel pj . moveShell pj
|
||||||
, _pjPayload = _amPayload am
|
, _pjPayload = _amPayload $ _aoType am
|
||||||
, _pjTimer = 50
|
, _pjTimer = 50
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,8 +240,16 @@ remoteLauncher :: Item
|
|||||||
remoteLauncher = defaultGun
|
remoteLauncher = defaultGun
|
||||||
{ _itName = "ROCKO-REM"
|
{ _itName = "ROCKO-REM"
|
||||||
, _itIdentity = RemoteLauncher
|
, _itIdentity = RemoteLauncher
|
||||||
, _wpMaxAmmo = 1
|
, _wpAmmo = LoadableAmmo
|
||||||
, _wpLoadedAmmo = 1
|
{ _aoType = defaultShellAmmo
|
||||||
|
{ _amPayload = makeExplosionAt
|
||||||
|
, _amString = ""
|
||||||
|
, _amPjParams = basicAmPjMoves
|
||||||
|
, _amPjDraw = shellPic
|
||||||
|
}
|
||||||
|
, _wpMaxAmmo = 30
|
||||||
|
, _wpLoadedAmmo = 30
|
||||||
|
}
|
||||||
, _wpReloadTime = 80
|
, _wpReloadTime = 80
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 10
|
, _itUseRate = 10
|
||||||
|
|||||||
@@ -20,8 +20,10 @@ radar :: Item
|
|||||||
radar = defaultGun
|
radar = defaultGun
|
||||||
{ _itName = "RADAR"
|
{ _itName = "RADAR"
|
||||||
, _itIdentity = Generic
|
, _itIdentity = Generic
|
||||||
, _wpMaxAmmo = 100
|
, _wpAmmo = defaultAmmo
|
||||||
, _wpLoadedAmmo = 100
|
{ _wpMaxAmmo = 100
|
||||||
|
, _wpLoadedAmmo = 100
|
||||||
|
}
|
||||||
, _wpReloadTime = 200
|
, _wpReloadTime = 200
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 120
|
, _itUseRate = 120
|
||||||
@@ -45,8 +47,10 @@ sonar :: Item
|
|||||||
sonar = defaultGun
|
sonar = defaultGun
|
||||||
{ _itName = "SONAR"
|
{ _itName = "SONAR"
|
||||||
, _itIdentity = Generic
|
, _itIdentity = Generic
|
||||||
, _wpMaxAmmo = 100
|
, _wpAmmo = defaultAmmo
|
||||||
, _wpLoadedAmmo = 100
|
{ _wpMaxAmmo = 100
|
||||||
|
, _wpLoadedAmmo = 100
|
||||||
|
}
|
||||||
, _wpReloadTime = 200
|
, _wpReloadTime = 200
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 120
|
, _itUseRate = 120
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ Creates a creature next to the creature using the item. -}
|
|||||||
spawnGun :: Creature -> Item
|
spawnGun :: Creature -> Item
|
||||||
spawnGun cr = defaultGun
|
spawnGun cr = defaultGun
|
||||||
{ _itName = "SPAWNER"
|
{ _itName = "SPAWNER"
|
||||||
, _wpMaxAmmo = 1
|
, _wpAmmo = defaultAmmo
|
||||||
, _wpLoadedAmmo = 1
|
{ _wpMaxAmmo = 1
|
||||||
|
, _wpLoadedAmmo = 1
|
||||||
|
}
|
||||||
, _wpReloadTime = 80
|
, _wpReloadTime = 80
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 100
|
, _itUseRate = 100
|
||||||
|
|||||||
@@ -34,8 +34,10 @@ poisonSprayer :: Item
|
|||||||
poisonSprayer = defaultAutoGun
|
poisonSprayer = defaultAutoGun
|
||||||
{ _itName = "POISON"
|
{ _itName = "POISON"
|
||||||
, _itIdentity = PoisonSprayer
|
, _itIdentity = PoisonSprayer
|
||||||
, _wpMaxAmmo = 500
|
, _wpAmmo = defaultAmmo
|
||||||
, _wpLoadedAmmo = 500
|
{ _wpMaxAmmo = 500
|
||||||
|
, _wpLoadedAmmo = 500
|
||||||
|
}
|
||||||
, _wpReloadTime = 100
|
, _wpReloadTime = 100
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 0
|
, _itUseRate = 0
|
||||||
@@ -60,8 +62,10 @@ flamer :: Item
|
|||||||
flamer = defaultAutoGun
|
flamer = defaultAutoGun
|
||||||
{ _itName = "FLAMER"
|
{ _itName = "FLAMER"
|
||||||
, _itIdentity = Flamethrower
|
, _itIdentity = Flamethrower
|
||||||
, _wpMaxAmmo = 250
|
, _wpAmmo = defaultAmmo
|
||||||
, _wpLoadedAmmo = 250
|
{ _wpMaxAmmo = 250
|
||||||
|
, _wpLoadedAmmo = 250
|
||||||
|
}
|
||||||
, _wpReloadTime = 100
|
, _wpReloadTime = 100
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 0
|
, _itUseRate = 0
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ withThickSmokeI eff item cr w = eff item cr
|
|||||||
-- fire.
|
-- fire.
|
||||||
ammoCheckI :: ChainEffect
|
ammoCheckI :: ChainEffect
|
||||||
ammoCheckI eff item cr w
|
ammoCheckI eff item cr w
|
||||||
| _wpLoadedAmmo item <= 0
|
| _wpLoadedAmmo (_wpAmmo item) <= 0
|
||||||
= fromMaybe w (startReloadingWeapon cr w)
|
= fromMaybe w (startReloadingWeapon cr w)
|
||||||
| _wpReloadState item > 0 = w
|
| _wpReloadState item > 0 = w
|
||||||
| otherwise = eff item cr w
|
| otherwise = eff item cr w
|
||||||
@@ -111,12 +111,12 @@ rateIncABI
|
|||||||
rateIncABI startRate fastRate exeffFirst exeffCont eff item cr w
|
rateIncABI startRate fastRate exeffFirst exeffCont eff item cr w
|
||||||
| repeatFire = w
|
| repeatFire = w
|
||||||
& pointItem %~ ( (itUseRate .~ max fastRate (currentRate - 1))
|
& pointItem %~ ( (itUseRate .~ max fastRate (currentRate - 1))
|
||||||
. (wpLoadedAmmo -~ 1)
|
. (wpAmmo . wpLoadedAmmo -~ 1)
|
||||||
. (itUseTime .~ currentRate) )
|
. (itUseTime .~ currentRate) )
|
||||||
& exeffCont eff item cr
|
& exeffCont eff item cr
|
||||||
| firstFire = w
|
| firstFire = w
|
||||||
& pointItem %~ ( (itUseRate .~ startRate - 1)
|
& pointItem %~ ( (itUseRate .~ startRate - 1)
|
||||||
. (wpLoadedAmmo -~ 1)
|
. (wpAmmo . wpLoadedAmmo -~ 1)
|
||||||
. (itUseTime .~ startRate) )
|
. (itUseTime .~ startRate) )
|
||||||
& exeffFirst eff item cr
|
& exeffFirst eff item cr
|
||||||
| otherwise = w
|
| otherwise = w
|
||||||
@@ -217,7 +217,7 @@ useAmmo
|
|||||||
:: Int -- ^ amount of ammo to use
|
:: Int -- ^ amount of ammo to use
|
||||||
-> ChainEffect
|
-> ChainEffect
|
||||||
useAmmo amAmount eff item cr = eff item cr
|
useAmmo amAmount eff item cr = eff item cr
|
||||||
. (creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . wpLoadedAmmo -~ amAmount)
|
. (creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . wpAmmo . wpLoadedAmmo -~ amAmount)
|
||||||
{- |
|
{- |
|
||||||
Applies a world effect after an item use cooldown check. -}
|
Applies a world effect after an item use cooldown check. -}
|
||||||
useTimeCheckI :: ChainEffect
|
useTimeCheckI :: ChainEffect
|
||||||
@@ -240,7 +240,7 @@ hammerCheckI f it cr w = case it ^? itHammer of
|
|||||||
ammoUseCheckI :: ChainEffect
|
ammoUseCheckI :: ChainEffect
|
||||||
ammoUseCheckI f item cr w
|
ammoUseCheckI f item cr w
|
||||||
| fireCondition = f item cr w & pointerToItem %~
|
| fireCondition = f item cr w & pointerToItem %~
|
||||||
( (wpLoadedAmmo -~ 1) . (itUseTime .~ _itUseRate item) )
|
( (wpAmmo . wpLoadedAmmo -~ 1) . (itUseTime .~ _itUseRate item) )
|
||||||
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
|
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
|
||||||
| otherwise = w
|
| otherwise = w
|
||||||
where
|
where
|
||||||
@@ -249,8 +249,8 @@ ammoUseCheckI f item cr w
|
|||||||
pointerToItem = creatures . ix cid . crInv . ix itRef
|
pointerToItem = creatures . ix cid . crInv . ix itRef
|
||||||
fireCondition = _wpReloadState item == 0
|
fireCondition = _wpReloadState item == 0
|
||||||
&& _itUseTime item == 0
|
&& _itUseTime item == 0
|
||||||
&& _wpLoadedAmmo item > 0
|
&& _wpLoadedAmmo (_wpAmmo item) > 0
|
||||||
reloadCondition = _wpLoadedAmmo item == 0
|
reloadCondition = _wpLoadedAmmo (_wpAmmo item) == 0
|
||||||
{- | Applies a world effect after a hammer position check.
|
{- | Applies a world effect after a hammer position check.
|
||||||
Arbitrary inventory position. -}
|
Arbitrary inventory position. -}
|
||||||
hammerCheckL
|
hammerCheckL
|
||||||
@@ -276,7 +276,7 @@ shootL
|
|||||||
-> World
|
-> World
|
||||||
shootL f cr invid w
|
shootL f cr invid w
|
||||||
| fireCondition = f cr invid w & pointerToItem %~
|
| fireCondition = f cr invid w & pointerToItem %~
|
||||||
( (wpLoadedAmmo -~ 1) . (itUseTime .~ _itUseRate item) )
|
( (wpAmmo . wpLoadedAmmo -~ 1) . (itUseTime .~ _itUseRate item) )
|
||||||
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
|
| reloadCondition = fromMaybe w $ startReloadingWeapon cr w
|
||||||
| otherwise = w
|
| otherwise = w
|
||||||
where
|
where
|
||||||
@@ -285,8 +285,8 @@ shootL f cr invid w
|
|||||||
pointerToItem = creatures . ix cid . crInv . ix invid
|
pointerToItem = creatures . ix cid . crInv . ix invid
|
||||||
fireCondition = _wpReloadState item == 0
|
fireCondition = _wpReloadState item == 0
|
||||||
&& _itUseTime item == 0
|
&& _itUseTime item == 0
|
||||||
&& _wpLoadedAmmo item > 0
|
&& _wpLoadedAmmo (_wpAmmo item) > 0
|
||||||
reloadCondition = _wpLoadedAmmo item == 0
|
reloadCondition = _wpLoadedAmmo (_wpAmmo item) == 0
|
||||||
withTempLight :: Int -> Float -> V3 Float -> ChainEffect
|
withTempLight :: Int -> Float -> V3 Float -> ChainEffect
|
||||||
withTempLight time rad col eff item cr = eff item cr
|
withTempLight time rad col eff item cr = eff item cr
|
||||||
. over tempLightSources (theTLS :)
|
. over tempLightSources (theTLS :)
|
||||||
|
|||||||
@@ -20,17 +20,19 @@ rewindGun :: Item
|
|||||||
rewindGun = defaultGun
|
rewindGun = defaultGun
|
||||||
{ _itName = "REWINDER"
|
{ _itName = "REWINDER"
|
||||||
, _itIdentity = Rewinder
|
, _itIdentity = Rewinder
|
||||||
, _wpMaxAmmo = 0
|
, _wpAmmo = defaultAmmo
|
||||||
, _wpLoadedAmmo = 0
|
{ _wpMaxAmmo = 0
|
||||||
|
, _wpLoadedAmmo = 0
|
||||||
|
}
|
||||||
, _itEffect = ItRewindEffect rewindEffect []
|
, _itEffect = ItRewindEffect rewindEffect []
|
||||||
, _itUse = LeftUse $ \cr invid -> useRewindGun (_crInv cr IM.! invid) cr
|
, _itUse = LeftUse $ \cr invid -> useRewindGun (_crInv cr IM.! invid) cr
|
||||||
}
|
}
|
||||||
rewindEffect :: ItEffect -> Creature -> Int -> World -> World
|
rewindEffect :: ItEffect -> Creature -> Int -> World -> World
|
||||||
rewindEffect _ cr invid w
|
rewindEffect _ cr invid w
|
||||||
| Just invid == _crLeftInvSel cr = w & rewindWorlds %~ (take 250 . (w' : ))
|
| Just invid == _crLeftInvSel cr = w & rewindWorlds %~ (take 250 . (w' : ))
|
||||||
& creatures . ix (_crID cr) . crInv . ix invid . wpLoadedAmmo .~ length (_rewindWorlds w)
|
& creatures . ix (_crID cr) . crInv . ix invid . wpAmmo . wpLoadedAmmo .~ length (_rewindWorlds w)
|
||||||
| otherwise = w & rewindWorlds .~ []
|
| otherwise = w & rewindWorlds .~ []
|
||||||
& creatures . ix (_crID cr) . crInv . ix invid . wpLoadedAmmo .~ 0
|
& creatures . ix (_crID cr) . crInv . ix invid . wpAmmo . wpLoadedAmmo .~ 0
|
||||||
where
|
where
|
||||||
w' = w & rewindWorlds .~ []
|
w' = w & rewindWorlds .~ []
|
||||||
& rewinding .~ True
|
& rewinding .~ True
|
||||||
@@ -52,8 +54,10 @@ shrinkGun :: Item
|
|||||||
shrinkGun = defaultGun
|
shrinkGun = defaultGun
|
||||||
{ _itName = "SHRINKER"
|
{ _itName = "SHRINKER"
|
||||||
, _itIdentity = Generic
|
, _itIdentity = Generic
|
||||||
, _wpMaxAmmo = 100
|
, _wpAmmo = defaultAmmo
|
||||||
, _wpLoadedAmmo = 100
|
{ _wpMaxAmmo = 100
|
||||||
|
, _wpLoadedAmmo = 100
|
||||||
|
}
|
||||||
, _wpReloadTime = 20
|
, _wpReloadTime = 20
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 0
|
, _itUseRate = 0
|
||||||
@@ -90,8 +94,10 @@ blinkGun :: Item
|
|||||||
blinkGun = defaultGun
|
blinkGun = defaultGun
|
||||||
{ _itName = "BLINKER"
|
{ _itName = "BLINKER"
|
||||||
, _itIdentity = Blinker
|
, _itIdentity = Blinker
|
||||||
, _wpMaxAmmo = 100
|
, _wpAmmo = defaultAmmo
|
||||||
, _wpLoadedAmmo = 100
|
{ _wpMaxAmmo = 100
|
||||||
|
, _wpLoadedAmmo = 100
|
||||||
|
}
|
||||||
, _wpReloadTime = 20
|
, _wpReloadTime = 20
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 0
|
, _itUseRate = 0
|
||||||
@@ -129,8 +135,10 @@ forceFieldGun :: Item
|
|||||||
forceFieldGun = defaultGun
|
forceFieldGun = defaultGun
|
||||||
{ _itName = "FORCEFIELD"
|
{ _itName = "FORCEFIELD"
|
||||||
, _itIdentity = ForceFieldGun
|
, _itIdentity = ForceFieldGun
|
||||||
, _wpMaxAmmo = 100
|
, _wpAmmo = defaultAmmo
|
||||||
, _wpLoadedAmmo = 100
|
{ _wpMaxAmmo = 100
|
||||||
|
, _wpLoadedAmmo = 100
|
||||||
|
}
|
||||||
, _wpReloadTime = 40
|
, _wpReloadTime = 40
|
||||||
, _wpReloadState = 0
|
, _wpReloadState = 0
|
||||||
, _itUseRate = 10
|
, _itUseRate = 10
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ subInventoryDisplay w = case _inventoryMode w of
|
|||||||
col = itCol it
|
col = itCol it
|
||||||
|
|
||||||
cursorsZ :: World -> Int -> Item -> Picture
|
cursorsZ :: World -> Int -> Item -> Picture
|
||||||
cursorsZ w ipos it = case it ^? wpAmmo . amParamSel of
|
cursorsZ w ipos it = case it ^? wpAmmo . aoType . amParamSel of
|
||||||
Nothing -> f $ zConnect sp (V2 (155- hw) ( hh - 77.5))
|
Nothing -> f $ zConnect sp (V2 (155- hw) ( hh - 77.5))
|
||||||
Just jpos -> f $ zConnect sp (V2 (155 - hw) ( hh - (20 * fromIntegral jpos + 77.5)))
|
Just jpos -> f $ zConnect sp (V2 (155 - hw) ( hh - (20 * fromIntegral jpos + 77.5)))
|
||||||
where
|
where
|
||||||
@@ -74,12 +74,12 @@ topInvCursor col iPos w
|
|||||||
| otherwise = mainListCursor col iPos w
|
| otherwise = mainListCursor col iPos w
|
||||||
|
|
||||||
ammoTweakStrings :: Item -> [String]
|
ammoTweakStrings :: Item -> [String]
|
||||||
ammoTweakStrings it = case it ^? wpAmmo . amPjParams of
|
ammoTweakStrings it = case it ^? wpAmmo . aoType . amPjParams of
|
||||||
Just l -> map pjTweakString l
|
Just l -> map pjTweakString l
|
||||||
_ -> ["NOT TWEAKABLE"]
|
_ -> ["NOT TWEAKABLE"]
|
||||||
|
|
||||||
mCurs :: Item -> World -> Picture
|
mCurs :: Item -> World -> Picture
|
||||||
mCurs it w = case it ^? wpAmmo . amParamSel of
|
mCurs it w = case it ^? wpAmmo . aoType . amParamSel of
|
||||||
Nothing -> []
|
Nothing -> []
|
||||||
Just i
|
Just i
|
||||||
| ButtonRight `S.member` _mouseButtons w ->
|
| ButtonRight `S.member` _mouseButtons w ->
|
||||||
|
|||||||
Reference in New Issue
Block a user