Cleanup
This commit is contained in:
@@ -108,8 +108,8 @@ moduleCombinations =
|
|||||||
,burstRifle
|
,burstRifle
|
||||||
,fastBurstRifle
|
,fastBurstRifle
|
||||||
]
|
]
|
||||||
, [amod [DRUM,HARDWARE] "+DRUM MAG" (itConsumption . ammoBaseMax .~ 45)
|
, [amod [DRUM,HARDWARE] "+DRUM MAG" (itConsumption . laMax .~ 45)
|
||||||
,amod [MOTOR,HARDWARE] "+BELT FEED" (itConsumption . ammoBaseMax .~ 150)
|
,amod [MOTOR,HARDWARE] "+BELT FEED" (itConsumption . laMax .~ 150)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
, ( ModAutoMag
|
, ( ModAutoMag
|
||||||
@@ -138,13 +138,13 @@ moduleCombinations =
|
|||||||
, ( ModBulletTrajectory
|
, ( ModBulletTrajectory
|
||||||
, bulletWeapons
|
, bulletWeapons
|
||||||
, [amod [MAGNET,MICROCHIP,HARDWARE] "+MAGNETTRAJECTORY"
|
, [amod [MAGNET,MICROCHIP,HARDWARE] "+MAGNETTRAJECTORY"
|
||||||
( (itConsumption . aoType . amBulTraj .~ MagnetTrajectory)
|
( (itConsumption . laType . amBulTraj .~ MagnetTrajectory)
|
||||||
. (itConsumption . aoType . amBulVel .~ V2 10 0)
|
. (itConsumption . laType . amBulVel .~ V2 10 0)
|
||||||
)
|
)
|
||||||
,amod [MICROCHIP,HARDWARE] "+FLECHETTETRAJECTORY"
|
,amod [MICROCHIP,HARDWARE] "+FLECHETTETRAJECTORY"
|
||||||
(itConsumption . aoType . amBulTraj .~ FlechetteTrajectory)
|
(itConsumption . laType . amBulTraj .~ FlechetteTrajectory)
|
||||||
,amod [ANTIMATTER,HARDWARE] "+BEZIERTRAJECTORY"
|
,amod [ANTIMATTER,HARDWARE] "+BEZIERTRAJECTORY"
|
||||||
(itConsumption . aoType . amBulTraj .~ BezierTrajectory)
|
(itConsumption . laType . amBulTraj .~ BezierTrajectory)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
, ( ModDualBeam
|
, ( ModDualBeam
|
||||||
@@ -165,12 +165,12 @@ moduleCombinations =
|
|||||||
, ( ModLauncherHoming
|
, ( ModLauncherHoming
|
||||||
, homingLaunchers
|
, homingLaunchers
|
||||||
, [ amod [MICROCHIP,TRANSMITTER] "+TARGET HOMING"
|
, [ amod [MICROCHIP,TRANSMITTER] "+TARGET HOMING"
|
||||||
(itConsumption . aoType . amPjCreation .~ fireTrackingShell)
|
(itConsumption . laType . amPjCreation .~ fireTrackingShell)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
, ( ModBattery
|
, ( ModBattery
|
||||||
, batteryGuns
|
, batteryGuns
|
||||||
, [amod [BATTERY] "+BATTERY" (itConsumption . ammoBaseMax +~ 1000)
|
, [amod [BATTERY] "+BATTERY" (itConsumption . laMax +~ 1000)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
@@ -187,7 +187,7 @@ moduleCombinations =
|
|||||||
where
|
where
|
||||||
p = fromMaybe (_crPos cr) $ it ^? itTargeting . tgPos . _Just
|
p = fromMaybe (_crPos cr) $ it ^? itTargeting . tgPos . _Just
|
||||||
a = argV (mouseWorldPos w -.- p)
|
a = argV (mouseWorldPos w -.- p)
|
||||||
f ameff = itConsumption . aoType . amBulEff .~ ameff
|
f ameff = itConsumption . laType . amBulEff .~ ameff
|
||||||
amod cts str func = (cts,ItemModule [str] 1 func)
|
amod cts str func = (cts,ItemModule [str] 1 func)
|
||||||
|
|
||||||
homingLaunchers :: [Item]
|
homingLaunchers :: [Item]
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ doStrategyActions cr = case cr ^? crActionPlan . crStrategy of
|
|||||||
|
|
||||||
reloadOverride :: Creature -> Creature
|
reloadOverride :: Creature -> Creature
|
||||||
reloadOverride cr
|
reloadOverride cr
|
||||||
| cr ^? crInv . ix (_crInvSel cr) . itConsumption . ammoLoaded == Just 0
|
| cr ^? crInv . ix (_crInvSel cr) . itConsumption . laLoaded == Just 0
|
||||||
&& cr ^. crStance . posture == Aiming
|
&& cr ^. crStance . posture == Aiming
|
||||||
= cr & crActionPlan . crStrategy .~ StrategyActions Reload reloadActions
|
= cr & crActionPlan . crStrategy .~ StrategyActions Reload reloadActions
|
||||||
| otherwise = cr
|
| otherwise = cr
|
||||||
|
|||||||
@@ -234,15 +234,15 @@ doItemTargeting invid cr w = case cr ^? crInv . ix invid . itTargeting of
|
|||||||
|
|
||||||
weaponReloadSounds :: Creature -> World -> World
|
weaponReloadSounds :: Creature -> World -> World
|
||||||
weaponReloadSounds cr w = case cr ^? crInv . ix (_crInvSel cr) . itConsumption of
|
weaponReloadSounds cr w = case cr ^? crInv . ix (_crInvSel cr) . itConsumption of
|
||||||
Just am@LoadableAmmo{} -> case _reloadType am of
|
Just am@LoadableAmmo{} -> case _laReloadType am of
|
||||||
PassiveReload stype |Just' (_reloadTime am) == _reloadState am
|
PassiveReload stype | Just' (_laReloadTime am) == _laReloadState am
|
||||||
-> soundContinue (CrReloadSound 0) (_crPos cr) stype Nothing w
|
-> soundContinue (CrReloadSound 0) (_crPos cr) stype Nothing w
|
||||||
PassiveReload _ -> w
|
PassiveReload _ -> w
|
||||||
ActiveClear | _reloadState am == Just' 0 -> stopSoundFrom (CrReloadSound cid) w
|
ActiveClear | _laReloadState am == Just' 0 -> stopSoundFrom (CrReloadSound cid) w
|
||||||
ActiveClear | _reloadState am == Nothing' -> w
|
ActiveClear | _laReloadState am == Nothing' -> w
|
||||||
ActiveClear -> soundContinue (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
|
ActiveClear -> soundContinue (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
|
||||||
ActivePartial{} | _reloadState am == Just' 0 -> stopSoundFrom (CrReloadSound cid) w
|
ActivePartial{} | _laReloadState am == Just' 0 -> stopSoundFrom (CrReloadSound cid) w
|
||||||
ActivePartial{} | _reloadState am == Nothing' -> w
|
ActivePartial{} | _laReloadState am == Nothing' -> w
|
||||||
ActivePartial{} -> soundContinue (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
|
ActivePartial{} -> soundContinue (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
|
||||||
Just ChargeableAmmo {} -> w
|
Just ChargeableAmmo {} -> w
|
||||||
Just NoConsumption {} -> w
|
Just NoConsumption {} -> w
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ onBoth :: (a -> b -> c) -> (d -> a) -> (d -> b) -> d -> c
|
|||||||
onBoth f g h x = f (g x) (h x)
|
onBoth f g h x = f (g x) (h x)
|
||||||
|
|
||||||
crIsReloading :: Creature -> Bool
|
crIsReloading :: Creature -> Bool
|
||||||
crIsReloading cr = case cr ^? crInv . ix (_crInvSel cr) . itConsumption . reloadState . _Just' of
|
crIsReloading cr = case cr ^? crInv . ix (_crInvSel cr) . itConsumption . laReloadState . _Just' of
|
||||||
Just t -> t > 0
|
Just t -> t > 0
|
||||||
_ -> False
|
_ -> False
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ crStratConMatches :: Strategy -> Creature -> Bool
|
|||||||
crStratConMatches strat cr = eqConstr strat (_crStrategy $ _crActionPlan cr)
|
crStratConMatches strat cr = eqConstr strat (_crStrategy $ _crActionPlan cr)
|
||||||
|
|
||||||
crAwayFromPost :: Creature -> Bool
|
crAwayFromPost :: Creature -> Bool
|
||||||
crAwayFromPost cr = case find sentinelGoal $ _crGoal $ _crActionPlan cr of
|
crAwayFromPost cr = case find sentinelGoal . _crGoal $ _crActionPlan cr of
|
||||||
Just (SentinelAt p _) -> dist p (_crPos cr) > 15
|
Just (SentinelAt p _) -> dist p (_crPos cr) > 15
|
||||||
_ -> False
|
_ -> False
|
||||||
where
|
where
|
||||||
@@ -62,7 +62,7 @@ crAwayFromPost cr = case find sentinelGoal $ _crGoal $ _crActionPlan cr of
|
|||||||
sentinelGoal _ = False
|
sentinelGoal _ = False
|
||||||
|
|
||||||
crHasAmmo :: Creature -> Bool
|
crHasAmmo :: Creature -> Bool
|
||||||
crHasAmmo cr = maybe False (> 0) $ cr ^? crInv . ix (_crInvSel cr) . itConsumption . ammoLoaded
|
crHasAmmo cr = maybe False (> 0) $ cr ^? crInv . ix (_crInvSel cr) . itConsumption . laLoaded
|
||||||
|
|
||||||
crCanShoot :: Creature -> Bool
|
crCanShoot :: Creature -> Bool
|
||||||
crCanShoot p = crIsAiming p && crHasAmmo p
|
crCanShoot p = crIsAiming p && crHasAmmo p
|
||||||
|
|||||||
@@ -76,5 +76,5 @@ mouseActionsCr pkeys cr
|
|||||||
| rbPressed = cr & crStance . posture .~ Aiming
|
| rbPressed = cr & crStance . posture .~ Aiming
|
||||||
| otherwise = cr & crStance . posture .~ AtEase
|
| otherwise = cr & crStance . posture .~ AtEase
|
||||||
where
|
where
|
||||||
reloading = isJust $ cr ^? crInv . ix (_crInvSel cr) . itConsumption . reloadState . _Just'
|
reloading = isJust $ cr ^? crInv . ix (_crInvSel cr) . itConsumption . laReloadState . _Just'
|
||||||
rbPressed = SDL.ButtonRight `S.member` pkeys
|
rbPressed = SDL.ButtonRight `S.member` pkeys
|
||||||
|
|||||||
+8
-13
@@ -21,6 +21,7 @@ module Dodge.Data
|
|||||||
, module Dodge.Item.Data
|
, module Dodge.Item.Data
|
||||||
, module Dodge.Config.Data
|
, module Dodge.Config.Data
|
||||||
, module Dodge.Equipment.Data
|
, module Dodge.Equipment.Data
|
||||||
|
, module MaybeHelp
|
||||||
) where
|
) where
|
||||||
import Dodge.ShortShow
|
import Dodge.ShortShow
|
||||||
import Dodge.Creature.State.Data
|
import Dodge.Creature.State.Data
|
||||||
@@ -47,6 +48,7 @@ import Dodge.GameRoom
|
|||||||
import Color
|
import Color
|
||||||
import Shape
|
import Shape
|
||||||
import Data.Tile
|
import Data.Tile
|
||||||
|
import MaybeHelp
|
||||||
|
|
||||||
--import qualified Data.Vector as V
|
--import qualified Data.Vector as V
|
||||||
import qualified Linear.Quaternion as Q
|
import qualified Linear.Quaternion as Q
|
||||||
@@ -469,12 +471,12 @@ _itUseAimStance :: Item -> AimStance
|
|||||||
_itUseAimStance = _aimStance . _useAim . _itUse
|
_itUseAimStance = _aimStance . _useAim . _itUse
|
||||||
data ItemConsumption
|
data ItemConsumption
|
||||||
= LoadableAmmo
|
= LoadableAmmo
|
||||||
{ _aoType :: AmmoType
|
{ _laType :: AmmoType
|
||||||
, _ammoBaseMax :: Int
|
, _laMax :: Int
|
||||||
, _ammoLoaded :: Int
|
, _laLoaded :: Int
|
||||||
, _reloadTime :: Int
|
, _laReloadTime :: Int
|
||||||
, _reloadState :: Maybe' Int
|
, _laReloadState :: Maybe' Int
|
||||||
, _reloadType :: ReloadType
|
, _laReloadType :: ReloadType
|
||||||
}
|
}
|
||||||
| ChargeableAmmo
|
| ChargeableAmmo
|
||||||
{ _wpMaxCharge :: Int
|
{ _wpMaxCharge :: Int
|
||||||
@@ -1053,12 +1055,6 @@ data WallStructure
|
|||||||
{ _wlStCreature :: Int
|
{ _wlStCreature :: Int
|
||||||
, _wlStDamCreature :: Damage -> Wall -> Int -> World -> World
|
, _wlStDamCreature :: Damage -> Wall -> Int -> World -> World
|
||||||
}
|
}
|
||||||
-- | Strict maybe
|
|
||||||
data Maybe' a = Just' {__Just' :: a} | Nothing'
|
|
||||||
deriving (Eq,Ord,Show)
|
|
||||||
strictify :: Maybe a -> Maybe' a
|
|
||||||
strictify Nothing = Nothing'
|
|
||||||
strictify (Just x) = Just' x
|
|
||||||
|
|
||||||
data ActionPlan
|
data ActionPlan
|
||||||
= Inanimate
|
= Inanimate
|
||||||
@@ -1606,7 +1602,6 @@ makeLenses ''Universe
|
|||||||
makeLenses ''LSParam
|
makeLenses ''LSParam
|
||||||
makeLenses ''ItemParams
|
makeLenses ''ItemParams
|
||||||
makeLenses ''ItemTweaks
|
makeLenses ''ItemTweaks
|
||||||
makeLenses ''Maybe'
|
|
||||||
makeLenses ''ItemPortage
|
makeLenses ''ItemPortage
|
||||||
makeLenses ''Magnet
|
makeLenses ''Magnet
|
||||||
makeLenses ''Gust
|
makeLenses ''Gust
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ import Control.Lens
|
|||||||
|
|
||||||
defaultAmmo :: ItemConsumption
|
defaultAmmo :: ItemConsumption
|
||||||
defaultAmmo = LoadableAmmo
|
defaultAmmo = LoadableAmmo
|
||||||
{ _aoType = GenericAmmo
|
{ _laType = GenericAmmo
|
||||||
, _ammoBaseMax = 15
|
, _laMax = 15
|
||||||
, _ammoLoaded = 0
|
, _laLoaded = 0
|
||||||
, _reloadTime = 40
|
, _laReloadTime = 40
|
||||||
, _reloadState = Nothing'
|
, _laReloadState = Nothing'
|
||||||
, _reloadType = ActiveClear
|
, _laReloadType = ActiveClear
|
||||||
}
|
}
|
||||||
|
|
||||||
ruseRate :: Int
|
ruseRate :: Int
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ useAmmoParams vfact it cr w = w & instantParticles .:~ aBulAt
|
|||||||
sp = _crPos cr +.+ muzlength *.* unitVectorAtAngle dir
|
sp = _crPos cr +.+ muzlength *.* unitVectorAtAngle dir
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
dir = _crDir cr
|
dir = _crDir cr
|
||||||
bultype = _aoType $ _itConsumption it
|
bultype = _laType $ _itConsumption it
|
||||||
muzvel = _muzVel $ _itParams it
|
muzvel = _muzVel $ _itParams it
|
||||||
muzlength = aimingMuzzlePos cr it
|
muzlength = aimingMuzzlePos cr it
|
||||||
thetraj = case _amBulTraj bultype of
|
thetraj = case _amBulTraj bultype of
|
||||||
@@ -69,16 +69,16 @@ useAmmoParams vfact it cr w = w & instantParticles .:~ aBulAt
|
|||||||
-- this shouldn't really be used
|
-- this shouldn't really be used
|
||||||
loadedAmmo :: Item -> Int
|
loadedAmmo :: Item -> Int
|
||||||
loadedAmmo it
|
loadedAmmo it
|
||||||
| _reloadState (_itConsumption it) == Nothing' = _ammoLoaded (_itConsumption it)
|
| _laReloadState (_itConsumption it) == Nothing' = _laLoaded (_itConsumption it)
|
||||||
| otherwise = 0
|
| otherwise = 0
|
||||||
|
|
||||||
fractionLoadedAmmo :: Item -> Float
|
fractionLoadedAmmo :: Item -> Float
|
||||||
fractionLoadedAmmo it = fromIntegral (loadedAmmo it) / fromIntegral (itMaxAmmo it)
|
fractionLoadedAmmo it = fromIntegral (loadedAmmo it) / fromIntegral (itmaxammo it)
|
||||||
where
|
where
|
||||||
itMaxAmmo = _ammoBaseMax . _itConsumption
|
itmaxammo = _laMax . _itConsumption
|
||||||
|
|
||||||
fractionLoadedAmmo2 :: Item -> Float
|
fractionLoadedAmmo2 :: Item -> Float
|
||||||
fractionLoadedAmmo2 it = 1 -
|
fractionLoadedAmmo2 it = 1 -
|
||||||
(1 - fromIntegral (loadedAmmo it) / fromIntegral (itMaxAmmo it))**2
|
(1 - fromIntegral (loadedAmmo it) / fromIntegral (itMaxAmmo it))**2
|
||||||
where
|
where
|
||||||
itMaxAmmo = _ammoBaseMax . _itConsumption
|
itMaxAmmo = _laMax . _itConsumption
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ teslaGun = defaultBatteryGun
|
|||||||
{ _itName = "TESLA"
|
{ _itName = "TESLA"
|
||||||
, _itType = TESLAGUN
|
, _itType = TESLAGUN
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoBaseMax = 200
|
{ _laMax = 200
|
||||||
, _ammoLoaded = 200
|
, _laLoaded = 200
|
||||||
, _reloadTime = 80
|
, _laReloadTime = 80
|
||||||
}
|
}
|
||||||
, _itUse = ruseInstant shootTeslaArc NoHammer
|
, _itUse = ruseInstant shootTeslaArc NoHammer
|
||||||
[ ammoCheckI
|
[ ammoCheckI
|
||||||
@@ -271,9 +271,9 @@ lasGun = defaultAutoBatteryGun
|
|||||||
{ _itName = "LASGUN"
|
{ _itName = "LASGUN"
|
||||||
, _itType = LASGUN
|
, _itType = LASGUN
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoBaseMax = 200
|
{ _laMax = 200
|
||||||
, _ammoLoaded = 200
|
, _laLoaded = 200
|
||||||
, _reloadTime = 80
|
, _laReloadTime = 80
|
||||||
}
|
}
|
||||||
, _itUse = ruseInstant shootLaser NoHammer
|
, _itUse = ruseInstant shootLaser NoHammer
|
||||||
[ ammoCheckI
|
[ ammoCheckI
|
||||||
@@ -338,9 +338,9 @@ tractorGun = lasGun
|
|||||||
{ _itName = "TRACTORGUN"
|
{ _itName = "TRACTORGUN"
|
||||||
, _itType = TRACTORGUN
|
, _itType = TRACTORGUN
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoBaseMax = 10000
|
{ _laMax = 10000
|
||||||
, _ammoLoaded = 10000
|
, _laLoaded = 10000
|
||||||
, _reloadTime = 40
|
, _laReloadTime = 40
|
||||||
}
|
}
|
||||||
, _itUse = ruseInstant aTractorBeam NoHammer
|
, _itUse = ruseInstant aTractorBeam NoHammer
|
||||||
[ ammoCheckI
|
[ ammoCheckI
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ boostSelfL
|
|||||||
-> World
|
-> World
|
||||||
-> World
|
-> World
|
||||||
boostSelfL x itm cr w = case boostPoint x cr w of
|
boostSelfL x itm cr w = case boostPoint x cr w of
|
||||||
Left p -> crEff p (itConsumption . ammoLoaded .~ 0)
|
Left p -> crEff p (itConsumption . laLoaded .~ 0)
|
||||||
Right p -> crEff p (itConsumption . ammoLoaded -~ 1)
|
Right p -> crEff p (itConsumption . laLoaded -~ 1)
|
||||||
where
|
where
|
||||||
invid = fromJust $ _itInvPos itm
|
invid = fromJust $ _itInvPos itm
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
@@ -114,9 +114,9 @@ boosterGun = defaultGun
|
|||||||
, _itType = BOOSTER
|
, _itType = BOOSTER
|
||||||
, _itInvColor = cyan
|
, _itInvColor = cyan
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoBaseMax = 100
|
{ _laMax = 100
|
||||||
, _ammoLoaded = 100
|
, _laLoaded = 100
|
||||||
, _reloadTime = 20
|
, _laReloadTime = 20
|
||||||
}
|
}
|
||||||
, _itUse = luseInstantNoH $ boostSelfL 10
|
, _itUse = luseInstantNoH $ boostSelfL 10
|
||||||
, _itEffect = resetAttachmentID
|
, _itEffect = resetAttachmentID
|
||||||
|
|||||||
@@ -55,10 +55,10 @@ bangCane = defaultGun
|
|||||||
, _randomOffset = 0
|
, _randomOffset = 0
|
||||||
}
|
}
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = basicBullet
|
{ _laType = basicBullet
|
||||||
, _ammoBaseMax = 1
|
, _laMax = 1
|
||||||
, _reloadTime = 15
|
, _laReloadTime = 15
|
||||||
, _reloadType = ActivePartial 1
|
, _laReloadType = ActivePartial 1
|
||||||
}
|
}
|
||||||
, _itUse = ruseAmmoParamsRate 6 upHammer
|
, _itUse = ruseAmmoParamsRate 6 upHammer
|
||||||
[ ammoHammerCheck
|
[ ammoHammerCheck
|
||||||
@@ -114,7 +114,7 @@ bangCaneX i = bangCane
|
|||||||
& itUse . useAim . aimRange .~ 1
|
& itUse . useAim . aimRange .~ 1
|
||||||
& itUse . useAim . aimStance .~ TwoHandFlat
|
& itUse . useAim . aimStance .~ TwoHandFlat
|
||||||
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
|
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
|
||||||
& itConsumption . ammoBaseMax .~ i
|
& itConsumption . laMax .~ i
|
||||||
& itParams . gunBarrels .~ MultiBarrel
|
& itParams . gunBarrels .~ MultiBarrel
|
||||||
{_brlSpread = AlignedBarrels
|
{_brlSpread = AlignedBarrels
|
||||||
,_brlNum = i
|
,_brlNum = i
|
||||||
@@ -123,10 +123,10 @@ bangCaneX i = bangCane
|
|||||||
& itParams . torqueAfter .~ 0.48 + 0.2 * fromIntegral i
|
& itParams . torqueAfter .~ 0.48 + 0.2 * fromIntegral i
|
||||||
caneStickSoundChoice :: Item -> SoundID
|
caneStickSoundChoice :: Item -> SoundID
|
||||||
caneStickSoundChoice it
|
caneStickSoundChoice it
|
||||||
| _ammoLoaded (_itConsumption it) < 2 = tap3S
|
| _laLoaded (_itConsumption it) < 2 = tap3S
|
||||||
| otherwise = shotgunS
|
| otherwise = shotgunS
|
||||||
caneClipX :: Int -> Item -> Shape
|
caneClipX :: Int -> Item -> Shape
|
||||||
caneClipX i it = case it ^? itConsumption . ammoLoaded of
|
caneClipX i it = case it ^? itConsumption . laLoaded of
|
||||||
Just la | la > 0 -> foldMap
|
Just la | la > 0 -> foldMap
|
||||||
( (\y -> translateSH (V3 5 0 3) . upperPrismPoly 1 $ map (+.+ V2 0 y) $ square 1.5)
|
( (\y -> translateSH (V3 5 0 3) . upperPrismPoly 1 $ map (+.+ V2 0 y) $ square 1.5)
|
||||||
. (\k -> fromIntegral k * 5 - ((fromIntegral i - 1) * 2.5)))
|
. (\k -> fromIntegral k * 5 - ((fromIntegral i - 1) * 2.5)))
|
||||||
@@ -148,7 +148,7 @@ rifle = bangCane
|
|||||||
& itUse . useAim . aimStance .~ TwoHandTwist
|
& itUse . useAim . aimStance .~ TwoHandTwist
|
||||||
& itName .~ "RIFLE"
|
& itName .~ "RIFLE"
|
||||||
& itType .~ RIFLE
|
& itType .~ RIFLE
|
||||||
& itConsumption . ammoBaseMax .~ 1
|
& itConsumption . laMax .~ 1
|
||||||
& itUse . useAim . aimWeight .~ 6
|
& itUse . useAim . aimWeight .~ 6
|
||||||
& itUse . useAim . aimRange .~ 1
|
& itUse . useAim . aimRange .~ 1
|
||||||
-- & itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
|
-- & itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
|
||||||
@@ -158,9 +158,9 @@ repeater = rifle
|
|||||||
& itModules . at ModRifleMag ?~ DefaultModule
|
& itModules . at ModRifleMag ?~ DefaultModule
|
||||||
& itName .~ "REPEATER"
|
& itName .~ "REPEATER"
|
||||||
& itType .~ REPEATER
|
& itType .~ REPEATER
|
||||||
& itConsumption . reloadType .~ ActiveClear
|
& itConsumption . laReloadType .~ ActiveClear
|
||||||
& itConsumption . reloadTime .~ 80
|
& itConsumption . laReloadTime .~ 80
|
||||||
& itConsumption . ammoBaseMax .~ 15
|
& itConsumption . laMax .~ 15
|
||||||
& itDimension . dimSPic .~ (\it -> noPic $ baseRifleShape
|
& itDimension . dimSPic .~ (\it -> noPic $ baseRifleShape
|
||||||
<> makeTinClipAt 0 (V3 10 (-2) 0) it
|
<> makeTinClipAt 0 (V3 10 (-2) 0) it
|
||||||
)
|
)
|
||||||
@@ -189,7 +189,7 @@ burstRifle = repeater
|
|||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, sideEffectOnFrame 7 (torqueSideEffect 0.2)
|
, sideEffectOnFrame 7 (torqueSideEffect 0.2)
|
||||||
, lockInvFor 7
|
, lockInvFor 7
|
||||||
, \f it -> repeatOnFrames (take (_ammoLoaded (_itConsumption it) - 1) [3,6]) f it
|
, \f it -> repeatOnFrames (take (_laLoaded (_itConsumption it) - 1) [3,6]) f it
|
||||||
, withSoundStart tap3S
|
, withSoundStart tap3S
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, applyInaccuracy
|
, applyInaccuracy
|
||||||
@@ -207,7 +207,7 @@ fastBurstRifle = repeater
|
|||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, sideEffectOnFrame 9 (torqueSideEffect 0.4)
|
, sideEffectOnFrame 9 (torqueSideEffect 0.4)
|
||||||
, lockInvFor 9
|
, lockInvFor 9
|
||||||
, \f it -> repeatOnFrames (take (_ammoLoaded (_itConsumption it) - 1) [2,4,6,8]) f it
|
, \f it -> repeatOnFrames (take (_laLoaded (_itConsumption it) - 1) [2,4,6,8]) f it
|
||||||
, withSoundStart tap3S
|
, withSoundStart tap3S
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, applyInaccuracy
|
, applyInaccuracy
|
||||||
@@ -226,7 +226,7 @@ completeBurstRifle = repeater
|
|||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, sideEffectOnFrame 15 (torqueSideEffect 0.8)
|
, sideEffectOnFrame 15 (torqueSideEffect 0.8)
|
||||||
, lockInvFor 15
|
, lockInvFor 15
|
||||||
, \f it -> repeatOnFrames (take (_ammoLoaded (_itConsumption it) - 1) [1..14]) f it
|
, \f it -> repeatOnFrames (take (_laLoaded (_itConsumption it) - 1) [1..14]) f it
|
||||||
, withSoundStart tap3S
|
, withSoundStart tap3S
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, applyInaccuracy
|
, applyInaccuracy
|
||||||
@@ -265,10 +265,10 @@ miniGunX i = defaultAutoGun
|
|||||||
{ _itName = "MINIGUN-" ++ show i
|
{ _itName = "MINIGUN-" ++ show i
|
||||||
, _itType = MINIGUNX i
|
, _itType = MINIGUNX i
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = basicBullet
|
{ _laType = basicBullet
|
||||||
, _ammoBaseMax = 1500
|
, _laMax = 1500
|
||||||
, _ammoLoaded = 1500
|
, _laLoaded = 1500
|
||||||
, _reloadTime = 200
|
, _laReloadTime = 200
|
||||||
}
|
}
|
||||||
, _itUse = miniGunUse i
|
, _itUse = miniGunUse i
|
||||||
& useDelay .~ WarmUpNoDelay {_warmTime = 0,_warmMax = 200}
|
& useDelay .~ WarmUpNoDelay {_warmTime = 0,_warmMax = 200}
|
||||||
@@ -310,9 +310,9 @@ miniGunX i = defaultAutoGun
|
|||||||
& itDimension . dimPortage . muzPos .~ 40
|
& itDimension . dimPortage . muzPos .~ 40
|
||||||
|
|
||||||
miniGunXPictItem :: Int -> Item -> SPic
|
miniGunXPictItem :: Int -> Item -> SPic
|
||||||
miniGunXPictItem i it = miniGunXPict i spin (_ammoLoaded $ _itConsumption it)
|
miniGunXPictItem i it = miniGunXPict i spin (_laLoaded $ _itConsumption it)
|
||||||
where
|
where
|
||||||
spin = (-10) * _ammoLoaded (_itConsumption it) + _warmTime (_useDelay $ _itUse it)
|
spin = (-10) * _laLoaded (_itConsumption it) + _warmTime (_useDelay $ _itUse it)
|
||||||
|
|
||||||
miniGunXPict :: Int -> Int -> Int -> SPic
|
miniGunXPict :: Int -> Int -> Int -> SPic
|
||||||
miniGunXPict i spin _ =
|
miniGunXPict i spin _ =
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import Data.Maybe
|
|||||||
import Control.Lens
|
import Control.Lens
|
||||||
|
|
||||||
makeSingleClipAt :: Point3 -> Item -> Shape
|
makeSingleClipAt :: Point3 -> Item -> Shape
|
||||||
makeSingleClipAt p it = case it ^? itConsumption . ammoLoaded of
|
makeSingleClipAt p it = case it ^? itConsumption . laLoaded of
|
||||||
Just 0 -> mempty
|
Just 0 -> mempty
|
||||||
_ -> translateSH p $ upperPrismPoly 1 $ square 1.5
|
_ -> translateSH p $ upperPrismPoly 1 $ square 1.5
|
||||||
|
|
||||||
@@ -14,4 +14,4 @@ makeTinClipAt :: Float -> Point3 -> Item -> Shape
|
|||||||
makeTinClipAt r p it = translateSH p . overPosSH (rotate3z r) $ upperPrismPoly 1 $ rectNSEW 0 (-y) (-2) 2
|
makeTinClipAt r p it = translateSH p . overPosSH (rotate3z r) $ upperPrismPoly 1 $ rectNSEW 0 (-y) (-2) 2
|
||||||
where
|
where
|
||||||
y = fromIntegral y' * 0.3
|
y = fromIntegral y' * 0.3
|
||||||
y' = fromMaybe 0 $ it ^? itConsumption . ammoLoaded
|
y' = fromMaybe 0 $ it ^? itConsumption . laLoaded
|
||||||
|
|||||||
@@ -73,17 +73,17 @@ bangRod = defaultGun
|
|||||||
<> makeSingleClipAt (V3 5 0 3) it
|
<> makeSingleClipAt (V3 5 0 3) it
|
||||||
}
|
}
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = basicBullet
|
{ _laType = basicBullet
|
||||||
, _ammoBaseMax = 1
|
, _laMax = 1
|
||||||
, _reloadTime = 20
|
, _laReloadTime = 20
|
||||||
, _reloadType = ActiveClear
|
, _laReloadType = ActiveClear
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
& itUse . useAim . aimWeight .~ 8
|
& itUse . useAim . aimWeight .~ 8
|
||||||
& itUse . useAim . aimRange .~ 1
|
& itUse . useAim . aimRange .~ 1
|
||||||
& itUse . useAim . aimStance .~ OneHand
|
& itUse . useAim . aimStance .~ OneHand
|
||||||
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
|
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
|
||||||
& itConsumption . aoType . amBulEff .~ expireAndDamage heavyBulDams
|
& itConsumption . laType . amBulEff .~ expireAndDamage heavyBulDams
|
||||||
baseRodShape :: Shape
|
baseRodShape :: Shape
|
||||||
baseRodShape = colorSH orange $ upperPrismPoly 3 $ rectXH 20 2
|
baseRodShape = colorSH orange $ upperPrismPoly 3 $ rectXH 20 2
|
||||||
baseAMRShape :: Shape
|
baseAMRShape :: Shape
|
||||||
@@ -114,7 +114,7 @@ amr :: Item
|
|||||||
amr = elephantGun
|
amr = elephantGun
|
||||||
& itName .~ "ANTIMATERIELRIFLE"
|
& itName .~ "ANTIMATERIELRIFLE"
|
||||||
& itType .~ AMR
|
& itType .~ AMR
|
||||||
& itConsumption . ammoBaseMax .~ 15
|
& itConsumption . laMax .~ 15
|
||||||
& itDimension . dimSPic .~ (\it -> noPic $ baseAMRShape
|
& itDimension . dimSPic .~ (\it -> noPic $ baseAMRShape
|
||||||
<> makeTinClipAt 0 (V3 10 (-2) 0) it
|
<> makeTinClipAt 0 (V3 10 (-2) 0) it
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import LensHelp
|
|||||||
|
|
||||||
bangStickSoundChoice :: Item -> SoundID
|
bangStickSoundChoice :: Item -> SoundID
|
||||||
bangStickSoundChoice it
|
bangStickSoundChoice it
|
||||||
| _ammoLoaded (_itConsumption it) < 2 = tap3S
|
| _laLoaded (_itConsumption it) < 2 = tap3S
|
||||||
| otherwise = shotgunS
|
| otherwise = shotgunS
|
||||||
|
|
||||||
bangStick :: Int -> Item
|
bangStick :: Int -> Item
|
||||||
@@ -46,10 +46,10 @@ bangStick i = defaultGun
|
|||||||
_ -> "BANGSTICKx"++ show i
|
_ -> "BANGSTICKx"++ show i
|
||||||
, _itType = BANGSTICK i
|
, _itType = BANGSTICK i
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = basicBullet
|
{ _laType = basicBullet
|
||||||
, _ammoBaseMax = i
|
, _laMax = i
|
||||||
, _reloadTime = 10
|
, _laReloadTime = 10
|
||||||
, _reloadType = ActivePartial 1
|
, _laReloadType = ActivePartial 1
|
||||||
}
|
}
|
||||||
, _itUse = ruseAmmoParamsRate 8 upHammer
|
, _itUse = ruseAmmoParamsRate 8 upHammer
|
||||||
[ ammoHammerCheck
|
[ ammoHammerCheck
|
||||||
@@ -104,7 +104,7 @@ baseSMGShape = colorSH green $ upperPrismPoly 3 $ rectXH 20 2
|
|||||||
baseStickShape :: Shape
|
baseStickShape :: Shape
|
||||||
baseStickShape = colorSH green $ upperPrismPoly 3 $ rectXH 10 2
|
baseStickShape = colorSH green $ upperPrismPoly 3 $ rectXH 10 2
|
||||||
stickClip :: Item -> Shape
|
stickClip :: Item -> Shape
|
||||||
stickClip it = case it ^? itConsumption . ammoLoaded of
|
stickClip it = case it ^? itConsumption . laLoaded of
|
||||||
Just x | x > 0 -> foldMap f [0..x-1]
|
Just x | x > 0 -> foldMap f [0..x-1]
|
||||||
_ -> mempty
|
_ -> mempty
|
||||||
where
|
where
|
||||||
@@ -118,17 +118,17 @@ revolver = pistol
|
|||||||
{ _itName = "REVOLVER"
|
{ _itName = "REVOLVER"
|
||||||
, _itType = REVOLVER
|
, _itType = REVOLVER
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = basicBullet
|
{ _laType = basicBullet
|
||||||
, _ammoBaseMax = 6
|
, _laMax = 6
|
||||||
, _ammoLoaded = 0
|
, _laLoaded = 0
|
||||||
, _reloadTime = 10
|
, _laReloadTime = 10
|
||||||
, _reloadType = ActivePartial 1
|
, _laReloadType = ActivePartial 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
& itDimension . dimSPic .~ (\it -> noPic $ baseStickShape <> revolverClip it)
|
& itDimension . dimSPic .~ (\it -> noPic $ baseStickShape <> revolverClip it)
|
||||||
|
|
||||||
revolverClip :: Item -> Shape
|
revolverClip :: Item -> Shape
|
||||||
revolverClip it = case it ^? itConsumption . ammoLoaded of
|
revolverClip it = case it ^? itConsumption . laLoaded of
|
||||||
Just al | al > 0 -> translateSH (V3 5 0 1) $ foldMap f [1..al]
|
Just al | al > 0 -> translateSH (V3 5 0 1) $ foldMap f [1..al]
|
||||||
_ -> mempty
|
_ -> mempty
|
||||||
where
|
where
|
||||||
@@ -173,11 +173,11 @@ pistol = (bangStick 1)
|
|||||||
{ _itName = "PISTOL"
|
{ _itName = "PISTOL"
|
||||||
, _itType = PISTOL
|
, _itType = PISTOL
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = basicBullet
|
{ _laType = basicBullet
|
||||||
, _ammoBaseMax = 15
|
, _laMax = 15
|
||||||
, _ammoLoaded = 0
|
, _laLoaded = 0
|
||||||
, _reloadTime = 70
|
, _laReloadTime = 70
|
||||||
, _reloadType = ActiveClear
|
, _laReloadType = ActiveClear
|
||||||
}
|
}
|
||||||
, _itUse = ruseAmmoParamsRate 6 upHammer
|
, _itUse = ruseAmmoParamsRate 6 upHammer
|
||||||
(ammoHammerCheck : pistolAfterHamMods)
|
(ammoHammerCheck : pistolAfterHamMods)
|
||||||
@@ -228,7 +228,7 @@ revolverX i = revolver
|
|||||||
-- rather than locking the inventory, a better solution may be to check
|
-- rather than locking the inventory, a better solution may be to check
|
||||||
-- that the weapon is still in your hands in the repeated frames
|
-- that the weapon is still in your hands in the repeated frames
|
||||||
, lockInvFor 10
|
, lockInvFor 10
|
||||||
, \f it -> repeatOnFrames (take (_ammoLoaded (_itConsumption it) - 1) [2,4,6,8,10]) f it
|
, \f it -> repeatOnFrames (take (_laLoaded (_itConsumption it) - 1) [2,4,6,8,10]) f it
|
||||||
, withSoundStart tap3S
|
, withSoundStart tap3S
|
||||||
, useAmmoUpTo 1
|
, useAmmoUpTo 1
|
||||||
, applyInaccuracy
|
, applyInaccuracy
|
||||||
@@ -237,4 +237,4 @@ revolverX i = revolver
|
|||||||
, withTorqueAfter
|
, withTorqueAfter
|
||||||
, withRecoil
|
, withRecoil
|
||||||
]
|
]
|
||||||
} & itConsumption . ammoBaseMax .~ i * 6
|
} & itConsumption . laMax .~ i * 6
|
||||||
|
|||||||
@@ -50,10 +50,10 @@ autoGun = defaultAutoGun
|
|||||||
{ _itName = "AUTOGUN"
|
{ _itName = "AUTOGUN"
|
||||||
, _itType = AUTOGUN
|
, _itType = AUTOGUN
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = basicBullet
|
{ _laType = basicBullet
|
||||||
, _ammoBaseMax = 30
|
, _laMax = 30
|
||||||
, _ammoLoaded = 30
|
, _laLoaded = 30
|
||||||
, _reloadTime = 80
|
, _laReloadTime = 80
|
||||||
}
|
}
|
||||||
, _itUse = ruseAmmoParamsRate 4 NoHammer
|
, _itUse = ruseAmmoParamsRate 4 NoHammer
|
||||||
[ ammoCheckI
|
[ ammoCheckI
|
||||||
@@ -99,17 +99,17 @@ autoGunPic it = noPic $
|
|||||||
)
|
)
|
||||||
<> translateSHf 0 (-1) (rotateSHx (negate $ pi/4) . upperPrismPoly 2 $ rectNESW (negate $ 3 + 0.25 * x) 0 3 (-5))
|
<> translateSHf 0 (-1) (rotateSHx (negate $ pi/4) . upperPrismPoly 2 $ rectNESW (negate $ 3 + 0.25 * x) 0 3 (-5))
|
||||||
where
|
where
|
||||||
x = fromIntegral $ _ammoLoaded $ _itConsumption it
|
x = fromIntegral $ _laLoaded $ _itConsumption it
|
||||||
|
|
||||||
bangCone :: Item
|
bangCone :: Item
|
||||||
bangCone = defaultGun
|
bangCone = defaultGun
|
||||||
{ _itName = "BANGCONE"
|
{ _itName = "BANGCONE"
|
||||||
, _itType = BANGCONE
|
, _itType = BANGCONE
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = basicBullet
|
{ _laType = basicBullet
|
||||||
, _ammoBaseMax = 5
|
, _laMax = 5
|
||||||
, _reloadTime = 25
|
, _laReloadTime = 25
|
||||||
, _reloadType = ActiveClear
|
, _laReloadType = ActiveClear
|
||||||
}
|
}
|
||||||
, _itUse = ruseAmmoParamsRate 20 upHammer
|
, _itUse = ruseAmmoParamsRate 20 upHammer
|
||||||
[ ammoCheckI
|
[ ammoCheckI
|
||||||
@@ -149,7 +149,7 @@ bangCone = defaultGun
|
|||||||
coneRandItemUpdate :: State StdGen (Item -> Item)
|
coneRandItemUpdate :: State StdGen (Item -> Item)
|
||||||
coneRandItemUpdate = do
|
coneRandItemUpdate = do
|
||||||
wth <- state $ randomR (1,5)
|
wth <- state $ randomR (1,5)
|
||||||
return (\it -> it & itConsumption . aoType . amBulWth .~ wth)
|
return (\it -> it & itConsumption . laType . amBulWth .~ wth)
|
||||||
coneRandItemParams :: State StdGen (ItemParams -> ItemParams)
|
coneRandItemParams :: State StdGen (ItemParams -> ItemParams)
|
||||||
coneRandItemParams = do
|
coneRandItemParams = do
|
||||||
muzv <- state $ randomR (0.5,1)
|
muzv <- state $ randomR (0.5,1)
|
||||||
@@ -174,8 +174,8 @@ blunderbuss = bangCone
|
|||||||
<> upperPrismPoly 6 (rectNSEW 4 (-4) 30 20)
|
<> upperPrismPoly 6 (rectNSEW 4 (-4) 30 20)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
& itConsumption . ammoBaseMax .~ 25
|
& itConsumption . laMax .~ 25
|
||||||
& itConsumption . reloadTime .~ 30
|
& itConsumption . laReloadTime .~ 30
|
||||||
& itUse . useAim . aimStance .~ TwoHandTwist
|
& itUse . useAim . aimStance .~ TwoHandTwist
|
||||||
& itUse . useAim . aimWeight .~ 6
|
& itUse . useAim . aimWeight .~ 6
|
||||||
bigBlunderbuss :: Item
|
bigBlunderbuss :: Item
|
||||||
@@ -183,8 +183,8 @@ bigBlunderbuss = blunderbuss
|
|||||||
{_itName = "BIGBLUNDERBUSS"
|
{_itName = "BIGBLUNDERBUSS"
|
||||||
,_itType = BIGBLUNDERBUSS
|
,_itType = BIGBLUNDERBUSS
|
||||||
}
|
}
|
||||||
& itConsumption . ammoBaseMax .~ 50
|
& itConsumption . laMax .~ 50
|
||||||
& itConsumption . reloadTime .~ 36
|
& itConsumption . laReloadTime .~ 36
|
||||||
& itParams . recoil .~ 200
|
& itParams . recoil .~ 200
|
||||||
& itParams . torqueAfter .~ 0.3
|
& itParams . torqueAfter .~ 0.3
|
||||||
& itParams . randomOffset .~ 16
|
& itParams . randomOffset .~ 16
|
||||||
@@ -193,8 +193,8 @@ biggerBlunderbuss = bigBlunderbuss
|
|||||||
{_itName = "BIGGERBLUNDERBUSS"
|
{_itName = "BIGGERBLUNDERBUSS"
|
||||||
,_itType = BIGGERBLUNDERBUSS
|
,_itType = BIGGERBLUNDERBUSS
|
||||||
}
|
}
|
||||||
& itConsumption . ammoBaseMax .~ 75
|
& itConsumption . laMax .~ 75
|
||||||
& itConsumption . reloadTime .~ 43
|
& itConsumption . laReloadTime .~ 43
|
||||||
& itParams . recoil .~ 250
|
& itParams . recoil .~ 250
|
||||||
& itParams . torqueAfter .~ 0.5
|
& itParams . torqueAfter .~ 0.5
|
||||||
& itParams . randomOffset .~ 20
|
& itParams . randomOffset .~ 20
|
||||||
@@ -203,8 +203,8 @@ biggestBlunderbuss = biggerBlunderbuss
|
|||||||
{_itName = "BIGGESTBLUNDERBUSS"
|
{_itName = "BIGGESTBLUNDERBUSS"
|
||||||
,_itType = BIGGESTBLUNDERBUSS
|
,_itType = BIGGESTBLUNDERBUSS
|
||||||
}
|
}
|
||||||
& itConsumption . ammoBaseMax .~ 100
|
& itConsumption . laMax .~ 100
|
||||||
& itConsumption . reloadTime .~ 50
|
& itConsumption . laReloadTime .~ 50
|
||||||
& itParams . recoil .~ 300
|
& itParams . recoil .~ 300
|
||||||
& itParams . torqueAfter .~ 0.7
|
& itParams . torqueAfter .~ 0.7
|
||||||
& itParams . randomOffset .~ 24
|
& itParams . randomOffset .~ 24
|
||||||
@@ -217,10 +217,10 @@ hvAutoGun = defaultAutoGun
|
|||||||
{ _itName = "AUTO-HV"
|
{ _itName = "AUTO-HV"
|
||||||
, _itType = HVAUTOGUN
|
, _itType = HVAUTOGUN
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = hvBullet
|
{ _laType = hvBullet
|
||||||
, _ammoBaseMax = 100
|
, _laMax = 100
|
||||||
, _ammoLoaded = 100
|
, _laLoaded = 100
|
||||||
, _reloadTime = 200
|
, _laReloadTime = 200
|
||||||
}
|
}
|
||||||
, _itUse = ruseAmmoParamsRate 25 NoHammer
|
, _itUse = ruseAmmoParamsRate 25 NoHammer
|
||||||
[ ammoCheckI
|
[ ammoCheckI
|
||||||
@@ -247,10 +247,10 @@ ltAutoGun = defaultAutoGun
|
|||||||
{ _itName = "AUTO-LT"
|
{ _itName = "AUTO-LT"
|
||||||
, _itType = LTAUTOGUN
|
, _itType = LTAUTOGUN
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = basicBullet
|
{ _laType = basicBullet
|
||||||
, _ammoBaseMax = 15
|
, _laMax = 15
|
||||||
, _ammoLoaded = 0
|
, _laLoaded = 0
|
||||||
, _reloadTime = 90
|
, _laReloadTime = 90
|
||||||
}
|
}
|
||||||
, _itUse = ruseAmmoParamsRate 2 NoHammer
|
, _itUse = ruseAmmoParamsRate 2 NoHammer
|
||||||
[ ammoCheckI
|
[ ammoCheckI
|
||||||
@@ -275,11 +275,11 @@ longGun = defaultGun
|
|||||||
{ _itName = "LONGGUN"
|
{ _itName = "LONGGUN"
|
||||||
, _itType = LONGGUN
|
, _itType = LONGGUN
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = hvBullet
|
{ _laType = hvBullet
|
||||||
, _ammoBaseMax = 1
|
, _laMax = 1
|
||||||
, _ammoLoaded = 1
|
, _laLoaded = 1
|
||||||
, _reloadTime = 100
|
, _laReloadTime = 100
|
||||||
, _reloadType = PassiveReload skwareFadeTwoSecS
|
, _laReloadType = PassiveReload skwareFadeTwoSecS
|
||||||
}
|
}
|
||||||
, _itUse = ruseAmmoParamsRate 100 upHammer
|
, _itUse = ruseAmmoParamsRate 100 upHammer
|
||||||
[ ammoCheckI
|
[ ammoCheckI
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ lasDrones = defaultGun
|
|||||||
{ _itName = "DRONES"
|
{ _itName = "DRONES"
|
||||||
, _itType = DRONELAUNCHER
|
, _itType = DRONELAUNCHER
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = DroneAmmo { _amString = "LASDRONE" }
|
{ _laType = DroneAmmo { _amString = "LASDRONE" }
|
||||||
, _ammoBaseMax = 2
|
, _laMax = 2
|
||||||
, _ammoLoaded = 2
|
, _laLoaded = 2
|
||||||
, _reloadTime = 80
|
, _laReloadTime = 80
|
||||||
}
|
}
|
||||||
, _itUse = ruseRate 20 aDroneWithItemParams upHammer
|
, _itUse = ruseRate 20 aDroneWithItemParams upHammer
|
||||||
[ ammoCheckI
|
[ ammoCheckI
|
||||||
@@ -64,7 +64,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 $ _aoType am
|
, _prDraw = _amPjDraw $ _laType am
|
||||||
, _pjID = i
|
, _pjID = i
|
||||||
, _pjUpdate = const id
|
, _pjUpdate = const id
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -206,8 +206,8 @@ targetLaserUpdate it cr w t
|
|||||||
}
|
}
|
||||||
wpammo = _itConsumption it
|
wpammo = _itConsumption it
|
||||||
reloadFrac
|
reloadFrac
|
||||||
| _ammoLoaded wpammo == 0 = 1
|
| _laLoaded wpammo == 0 = 1
|
||||||
| otherwise = case _reloadState wpammo of
|
| otherwise = case _laReloadState wpammo of
|
||||||
Just' rs -> fromIntegral rs / fromIntegral (_reloadTime wpammo)
|
Just' rs -> fromIntegral rs / fromIntegral (_laReloadTime wpammo)
|
||||||
Nothing' -> 1
|
Nothing' -> 1
|
||||||
col = mixColors reloadFrac (1-reloadFrac) blue red
|
col = mixColors reloadFrac (1-reloadFrac) blue red
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ basicItemDisplay it = Prelude.take (itSlotsTaken it) $
|
|||||||
where
|
where
|
||||||
thename = _itName it
|
thename = _itName it
|
||||||
thenumber = case it ^? itConsumption of
|
thenumber = case it ^? itConsumption of
|
||||||
Just am@LoadableAmmo{} -> case _reloadState am of
|
Just am@LoadableAmmo{} -> case _laReloadState am of
|
||||||
Nothing' -> show (_ammoLoaded am)
|
Nothing' -> show (_laLoaded am)
|
||||||
Just' x -> show x ++ "R" ++ show (_ammoLoaded am)
|
Just' x -> show x ++ "R" ++ show (_laLoaded am)
|
||||||
Just am@ChargeableAmmo{} -> show $ _wpCharge am
|
Just am@ChargeableAmmo{} -> show $ _wpCharge am
|
||||||
Just x@ItemItselfConsumable{} -> "x" ++ show (_itAmount x)
|
Just x@ItemItselfConsumable{} -> "x" ++ show (_itAmount x)
|
||||||
Just NoConsumption -> ""
|
Just NoConsumption -> ""
|
||||||
|
|||||||
@@ -41,15 +41,15 @@ launcher = defaultGun
|
|||||||
{ _itName = "ROCKO"
|
{ _itName = "ROCKO"
|
||||||
, _itType = LAUNCHER
|
, _itType = LAUNCHER
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = ProjectileAmmo
|
{ _laType = ProjectileAmmo
|
||||||
{ _amPayload = makeExplosionAt
|
{ _amPayload = makeExplosionAt
|
||||||
, _amString = "EXPLOSIVE SHELL"
|
, _amString = "EXPLOSIVE SHELL"
|
||||||
, _amPjDraw = drawShell
|
, _amPjDraw = drawShell
|
||||||
, _amPjCreation = fireShell
|
, _amPjCreation = fireShell
|
||||||
}
|
}
|
||||||
, _ammoBaseMax = 1
|
, _laMax = 1
|
||||||
, _ammoLoaded = 1
|
, _laLoaded = 1
|
||||||
, _reloadTime = 80
|
, _laReloadTime = 80
|
||||||
}
|
}
|
||||||
, _itUse = ruseRate 20 usePjCreation upHammer
|
, _itUse = ruseRate 20 usePjCreation upHammer
|
||||||
[ hammerCheckI
|
[ hammerCheckI
|
||||||
@@ -88,8 +88,8 @@ launcherX :: Int -> Item
|
|||||||
launcherX i = launcher
|
launcherX i = launcher
|
||||||
& itName .~ ("ROCKO-" ++ show i)
|
& itName .~ ("ROCKO-" ++ show i)
|
||||||
& itType .~ LAUNCHERX i
|
& itType .~ LAUNCHERX i
|
||||||
& itConsumption . ammoBaseMax .~ i
|
& itConsumption . laMax .~ i
|
||||||
& itConsumption . ammoLoaded .~ i
|
& itConsumption . laLoaded .~ i
|
||||||
& itUse . rUse .~ usePjCreationX i
|
& itUse . rUse .~ usePjCreationX i
|
||||||
& itUse . useMods .~
|
& itUse . useMods .~
|
||||||
[ hammerCheckI
|
[ hammerCheckI
|
||||||
@@ -100,14 +100,14 @@ launcherX i = launcher
|
|||||||
]
|
]
|
||||||
|
|
||||||
usePjCreation :: Item -> Creature -> World -> World
|
usePjCreation :: Item -> Creature -> World -> World
|
||||||
usePjCreation it = _amPjCreation (_aoType (_itConsumption it)) it
|
usePjCreation it = _amPjCreation (_laType (_itConsumption it)) it
|
||||||
|
|
||||||
usePjCreationX :: Int -> Item -> Creature -> World -> World
|
usePjCreationX :: Int -> Item -> Creature -> World -> World
|
||||||
usePjCreationX i it cr = foldr f
|
usePjCreationX i it cr = foldr f
|
||||||
(_amPjCreation (_aoType (_itConsumption it)) it cr)
|
(_amPjCreation (_laType (_itConsumption it)) it cr)
|
||||||
[1..i-1]
|
[1..i-1]
|
||||||
where
|
where
|
||||||
f n = (. _amPjCreation (_aoType (_itConsumption it)) it (cr & crDir +~ (2*pi*fromIntegral n / fromIntegral i)))
|
f n = (. _amPjCreation (_laType (_itConsumption it)) it (cr & crDir +~ (2*pi*fromIntegral n / fromIntegral i)))
|
||||||
|
|
||||||
launcherPic :: Item -> SPic
|
launcherPic :: Item -> SPic
|
||||||
launcherPic _ =
|
launcherPic _ =
|
||||||
@@ -291,7 +291,7 @@ remoteLauncher = launcher
|
|||||||
& itType .~ REMOTELAUNCHER
|
& itType .~ REMOTELAUNCHER
|
||||||
& itUse . rUse .~ fireRemoteShell
|
& itUse . rUse .~ fireRemoteShell
|
||||||
& itScope .~ RemoteScope (V2 0 0) 1 True
|
& itScope .~ RemoteScope (V2 0 0) 1 True
|
||||||
& itConsumption . aoType . amPjDraw .~ drawRemoteShell
|
& itConsumption . laType . amPjDraw .~ drawRemoteShell
|
||||||
-- TODO consider allowing tweaking rocket speed
|
-- TODO consider allowing tweaking rocket speed
|
||||||
|
|
||||||
fireRemoteShell :: Item -> Creature -> World -> World
|
fireRemoteShell :: Item -> Creature -> World -> World
|
||||||
@@ -385,13 +385,13 @@ makeShell it cr theupdate w = w & props %~ IM.insert i Shell
|
|||||||
, _pjZ = 20
|
, _pjZ = 20
|
||||||
, _pjStartPos = pos
|
, _pjStartPos = pos
|
||||||
, _pjVel = rotateV dir (V2 1 0)
|
, _pjVel = rotateV dir (V2 1 0)
|
||||||
, _prDraw = _amPjDraw $ _aoType am
|
, _prDraw = _amPjDraw $ _laType am
|
||||||
, _pjID = i
|
, _pjID = i
|
||||||
, _pjUpdate = theupdate
|
, _pjUpdate = theupdate
|
||||||
, _pjAcc = rotateV dir (V2 3 0)
|
, _pjAcc = rotateV dir (V2 3 0)
|
||||||
, _pjDir = dir
|
, _pjDir = dir
|
||||||
, _pjSpin = 0
|
, _pjSpin = 0
|
||||||
, _pjPayload = _amPayload $ _aoType am
|
, _pjPayload = _amPayload $ _laType am
|
||||||
, _pjTimer = 50
|
, _pjTimer = 50
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
|
|||||||
@@ -26,10 +26,6 @@ clickDetector dt = defaultGun
|
|||||||
{ _itName = show dt
|
{ _itName = show dt
|
||||||
, _itType = CLICKDETECTOR dt
|
, _itType = CLICKDETECTOR dt
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoBaseMax = 100
|
|
||||||
, _ammoLoaded = 100
|
|
||||||
, _reloadTime = 200
|
|
||||||
}
|
|
||||||
, _itUse = ruseRate 20 (detectorEffect dt) upHammer
|
, _itUse = ruseRate 20 (detectorEffect dt) upHammer
|
||||||
[ ammoUseCheck
|
[ ammoUseCheck
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ sonicGun = defaultAutoGun
|
|||||||
{ _itName = "SONICGUN"
|
{ _itName = "SONICGUN"
|
||||||
, _itType = SONICGUN
|
, _itType = SONICGUN
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoBaseMax = 10
|
{ _laMax = 10
|
||||||
, _ammoLoaded = 10
|
, _laLoaded = 10
|
||||||
, _reloadTime = 80
|
, _laReloadTime = 80
|
||||||
}
|
}
|
||||||
, _itUse = ruseRate 8 aSonicWave (HasHammer HammerUp)
|
, _itUse = ruseRate 8 aSonicWave (HasHammer HammerUp)
|
||||||
[ ammoHammerCheck
|
[ ammoHammerCheck
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ spawnGun :: Creature -> Item
|
|||||||
spawnGun cr = defaultGun
|
spawnGun cr = defaultGun
|
||||||
{ _itName = "SPAWNER"
|
{ _itName = "SPAWNER"
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoBaseMax = 1
|
{ _laMax = 1
|
||||||
, _ammoLoaded = 1
|
, _laLoaded = 1
|
||||||
, _reloadTime = 80
|
, _laReloadTime = 80
|
||||||
}
|
}
|
||||||
, _itUse = ruseRate 100
|
, _itUse = ruseRate 100
|
||||||
(\_ -> spawnCrNextTo cr)
|
(\_ -> spawnCrNextTo cr)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ poisonSprayer = flameThrower
|
|||||||
{ _itName = "POISONSPRAYER"
|
{ _itName = "POISONSPRAYER"
|
||||||
, _itType = POISONSPRAYER
|
, _itType = POISONSPRAYER
|
||||||
}
|
}
|
||||||
& itConsumption . aoType .~ GasAmmo
|
& itConsumption . laType .~ GasAmmo
|
||||||
{ _amString = "POISONGAS"
|
{ _amString = "POISONGAS"
|
||||||
, _amCreateGas = aGasCloud
|
, _amCreateGas = aGasCloud
|
||||||
}
|
}
|
||||||
@@ -70,8 +70,8 @@ flameSpitter :: Item
|
|||||||
flameSpitter = flameThrower
|
flameSpitter = flameThrower
|
||||||
& itName .~ "FLAMESPITTER"
|
& itName .~ "FLAMESPITTER"
|
||||||
& itType .~ FLAMESPITTER
|
& itType .~ FLAMESPITTER
|
||||||
& itConsumption . ammoBaseMax .~ 10
|
& itConsumption . laMax .~ 10
|
||||||
& itConsumption . reloadTime .~ 20
|
& itConsumption . laReloadTime .~ 20
|
||||||
& itParams . sprayNozzles . ix 0 . nzPressure .~ 4
|
& itParams . sprayNozzles . ix 0 . nzPressure .~ 4
|
||||||
& itUse . useAim . aimStance .~ OneHand
|
& itUse . useAim . aimStance .~ OneHand
|
||||||
& itUse . useDelay .~ FixedRate {_rateMax =12,_rateTime = 0}
|
& itUse . useDelay .~ FixedRate {_rateMax =12,_rateTime = 0}
|
||||||
@@ -125,10 +125,10 @@ flameThrower = defaultAutoGun
|
|||||||
{ _itName = "FLAMETHROWER"
|
{ _itName = "FLAMETHROWER"
|
||||||
, _itType = FLAMETHROWER
|
, _itType = FLAMETHROWER
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoBaseMax = 250
|
{ _laMax = 250
|
||||||
, _ammoLoaded = 0
|
, _laLoaded = 0
|
||||||
, _reloadTime = 100
|
, _laReloadTime = 100
|
||||||
, _aoType = GasAmmo
|
, _laType = GasAmmo
|
||||||
{_amString = "FLAME"
|
{_amString = "FLAME"
|
||||||
,_amCreateGas = aFlame
|
,_amCreateGas = aFlame
|
||||||
}
|
}
|
||||||
@@ -199,7 +199,7 @@ overNozzle eff it cr w nz =
|
|||||||
wa = min maxa $ max (negate maxa) (_nzCurrentWalkAngle nz + walkamount)
|
wa = min maxa $ max (negate maxa) (_nzCurrentWalkAngle nz + walkamount)
|
||||||
|
|
||||||
useGasParams :: Nozzle -> Item -> Creature -> World -> World
|
useGasParams :: Nozzle -> Item -> Creature -> World -> World
|
||||||
useGasParams nz it cr = _amCreateGas (_aoType (_itConsumption it)) (_nzPressure nz) pos dir cr
|
useGasParams nz it cr = _amCreateGas (_laType (_itConsumption it)) (_nzPressure nz) pos dir cr
|
||||||
where
|
where
|
||||||
dir = _crDir cr
|
dir = _crDir cr
|
||||||
pos = _crPos cr +.+ (_nzLength nz *.* unitVectorAtAngle (_crDir cr))
|
pos = _crPos cr +.+ (_nzLength nz *.* unitVectorAtAngle (_crDir cr))
|
||||||
|
|||||||
@@ -127,7 +127,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
|
||||||
| _ammoLoaded (_itConsumption item) <= 0 = fromMaybe w (startReloadingWeapon cr w)
|
| _laLoaded (_itConsumption item) <= 0 = fromMaybe w (startReloadingWeapon cr w)
|
||||||
-- | _reloadState (_itConsumption item) /= Nothing' = w
|
-- | _reloadState (_itConsumption item) /= Nothing' = w
|
||||||
| otherwise = eff item cr $ w & creatures . ix (_crID cr) %~ crStopReloading
|
| otherwise = eff item cr $ w & creatures . ix (_crID cr) %~ crStopReloading
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ ammoCheckI eff item cr w
|
|||||||
-- hammer is down?
|
-- hammer is down?
|
||||||
ammoHammerCheck :: ChainEffect
|
ammoHammerCheck :: ChainEffect
|
||||||
ammoHammerCheck eff it cr w
|
ammoHammerCheck eff it cr w
|
||||||
| _ammoLoaded (_itConsumption it) <= 0 = fromMaybe w (startReloadingWeapon cr w)
|
| _laLoaded (_itConsumption it) <= 0 = fromMaybe w (startReloadingWeapon cr w)
|
||||||
& setHammerDown
|
& setHammerDown
|
||||||
| otherwise = case it ^? itUse . useHammer . hammerPosition of
|
| otherwise = case it ^? itUse . useHammer . hammerPosition of
|
||||||
Just HammerUp -> eff it cr $ setHammerDown w & creatures . ix (_crID cr) %~ crStopReloading
|
Just HammerUp -> eff it cr $ setHammerDown w & creatures . ix (_crID cr) %~ crStopReloading
|
||||||
@@ -147,7 +147,7 @@ ammoHammerCheck eff it cr w
|
|||||||
|
|
||||||
|
|
||||||
itUseAmmo :: Int -> Item -> Item
|
itUseAmmo :: Int -> Item -> Item
|
||||||
itUseAmmo x = itConsumption . ammoLoaded %~ (max 0 . subtract x)
|
itUseAmmo x = itConsumption . laLoaded %~ (max 0 . subtract x)
|
||||||
|
|
||||||
{- | Fires at an increasing rate.
|
{- | Fires at an increasing rate.
|
||||||
Has different effect after first fire.
|
Has different effect after first fire.
|
||||||
@@ -175,15 +175,15 @@ rateIncAB exeffFirst exeffCont eff item cr w
|
|||||||
itRef = _crInvSel cr
|
itRef = _crInvSel cr
|
||||||
pointItem = creatures . ix cid . crInv . ix itRef
|
pointItem = creatures . ix cid . crInv . ix itRef
|
||||||
currentRate = _rateMax (_useDelay (_itUse item))
|
currentRate = _rateMax (_useDelay (_itUse item))
|
||||||
repeatFire = _reloadState (_itConsumption item) == Nothing' && _rateTime (_useDelay (_itUse item)) == 1
|
repeatFire = _laReloadState (_itConsumption item) == Nothing' && _rateTime (_useDelay (_itUse item)) == 1
|
||||||
firstFire = _reloadState (_itConsumption item) == Nothing' && _rateTime (_useDelay (_itUse item)) == 0
|
firstFire = _laReloadState (_itConsumption item) == Nothing' && _rateTime (_useDelay (_itUse item)) == 0
|
||||||
{- | Apply effect after a warm up. -}
|
{- | Apply effect after a warm up. -}
|
||||||
-- note this is quite unsafe, requires the item to have the correct delay type
|
-- note this is quite unsafe, requires the item to have the correct delay type
|
||||||
withWarmUp
|
withWarmUp
|
||||||
:: SoundID -- ^ warm up sound id
|
:: SoundID -- ^ warm up sound id
|
||||||
-> ChainEffect
|
-> ChainEffect
|
||||||
withWarmUp soundID f item cr w
|
withWarmUp soundID f item cr w
|
||||||
| _reloadState (_itConsumption item) /= Nothing' = w
|
| _laReloadState (_itConsumption item) /= Nothing' = w
|
||||||
| curWarmUp < maxWarmUp = w
|
| curWarmUp < maxWarmUp = w
|
||||||
& pointerToItem . itUse . useDelay . warmTime +~ 2
|
& pointerToItem . itUse . useDelay . warmTime +~ 2
|
||||||
& soundContinue (CrWeaponSound cid 0) (_crPos cr) soundID (Just 2)
|
& soundContinue (CrWeaponSound cid 0) (_crPos cr) soundID (Just 2)
|
||||||
@@ -285,14 +285,14 @@ withSidePushAfterI maxSide eff item cr w = over (creatures . ix cid) push . eff
|
|||||||
(pushAmount, g) = randomR (-maxSide,maxSide) $ _randGen w
|
(pushAmount, g) = randomR (-maxSide,maxSide) $ _randGen w
|
||||||
useAllAmmo :: ChainEffect
|
useAllAmmo :: ChainEffect
|
||||||
useAllAmmo eff item cr = eff item cr
|
useAllAmmo eff item cr = eff item cr
|
||||||
. (creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itConsumption . ammoLoaded .~ 0)
|
. (creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itConsumption . laLoaded .~ 0)
|
||||||
useAmmoUpTo :: Int -> ChainEffect
|
useAmmoUpTo :: Int -> ChainEffect
|
||||||
useAmmoUpTo amAmount eff item cr = eff item cr
|
useAmmoUpTo amAmount eff item cr = eff item cr
|
||||||
. (creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itConsumption . ammoLoaded
|
. (creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itConsumption . laLoaded
|
||||||
%~ (max 0 . subtract amAmount))
|
%~ (max 0 . subtract amAmount))
|
||||||
useAmmoAmount :: Int -> ChainEffect
|
useAmmoAmount :: Int -> ChainEffect
|
||||||
useAmmoAmount amAmount eff item cr = eff item cr
|
useAmmoAmount amAmount eff item cr = eff item cr
|
||||||
. (creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itConsumption . ammoLoaded -~ amAmount)
|
. (creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itConsumption . laLoaded -~ amAmount)
|
||||||
{- |
|
{- |
|
||||||
Applies a world effect after an item use cooldown check. -}
|
Applies a world effect after an item use cooldown check. -}
|
||||||
useTimeCheck :: ChainEffect
|
useTimeCheck :: ChainEffect
|
||||||
@@ -325,10 +325,10 @@ ammoUseCheck f item cr w
|
|||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
itRef = _crInvSel cr
|
itRef = _crInvSel cr
|
||||||
pointerToItem = creatures . ix cid . crInv . ix itRef
|
pointerToItem = creatures . ix cid . crInv . ix itRef
|
||||||
fireCondition = _reloadState (_itConsumption item) == Nothing'
|
fireCondition = _laReloadState (_itConsumption item) == Nothing'
|
||||||
&& _rateTime (_useDelay (_itUse item)) == 0
|
&& _rateTime (_useDelay (_itUse item)) == 0
|
||||||
&& _ammoLoaded (_itConsumption item) > 0
|
&& _laLoaded (_itConsumption item) > 0
|
||||||
reloadCondition = _ammoLoaded (_itConsumption item) == 0
|
reloadCondition = _laLoaded (_itConsumption 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
|
||||||
@@ -361,10 +361,10 @@ shootL f item cr w
|
|||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
invid = fromJust $ _itInvPos item
|
invid = fromJust $ _itInvPos item
|
||||||
pointerToItem = creatures . ix cid . crInv . ix invid
|
pointerToItem = creatures . ix cid . crInv . ix invid
|
||||||
fireCondition = _reloadState (_itConsumption item) == Nothing'
|
fireCondition = _laReloadState (_itConsumption item) == Nothing'
|
||||||
&& _rateTime (_useDelay (_itUse item)) == 0
|
&& _rateTime (_useDelay (_itUse item)) == 0
|
||||||
&& _ammoLoaded (_itConsumption item) > 0
|
&& _laLoaded (_itConsumption item) > 0
|
||||||
reloadCondition = _ammoLoaded (_itConsumption item) == 0
|
reloadCondition = _laLoaded (_itConsumption item) == 0
|
||||||
withItem :: (Item -> ChainEffect) -> ChainEffect
|
withItem :: (Item -> ChainEffect) -> ChainEffect
|
||||||
withItem g f it = g it f it
|
withItem g f it = g it f it
|
||||||
withItemUpdate :: (Item -> Item) -> (Item -> ChainEffect) -> ChainEffect
|
withItemUpdate :: (Item -> Item) -> (Item -> ChainEffect) -> ChainEffect
|
||||||
@@ -530,7 +530,7 @@ spreadLoaded eff item cr w = foldr f w dirs
|
|||||||
dirs = subtract cd . (spread *) . fromIntegral <$> [0 .. numBulLoaded - 1]
|
dirs = subtract cd . (spread *) . fromIntegral <$> [0 .. numBulLoaded - 1]
|
||||||
f dir = eff item (cr & crDir +~ dir)
|
f dir = eff item (cr & crDir +~ dir)
|
||||||
spread = _spreadAngle . _brlSpread . _gunBarrels $ _itParams item
|
spread = _spreadAngle . _brlSpread . _gunBarrels $ _itParams item
|
||||||
numBulLoaded = _ammoLoaded $ _itConsumption item
|
numBulLoaded = _laLoaded $ _itConsumption item
|
||||||
|
|
||||||
sideEffectOnFrame :: Int
|
sideEffectOnFrame :: Int
|
||||||
-> (Item -> Creature -> World -> World)
|
-> (Item -> Creature -> World -> World)
|
||||||
@@ -563,7 +563,7 @@ duplicateLoaded :: ChainEffect
|
|||||||
duplicateLoaded eff it cr w = foldr f w [1..numBul]
|
duplicateLoaded eff it cr w = foldr f w [1..numBul]
|
||||||
where
|
where
|
||||||
f _ = eff it cr
|
f _ = eff it cr
|
||||||
numBul = _ammoLoaded $ _itConsumption it
|
numBul = _laLoaded $ _itConsumption it
|
||||||
|
|
||||||
duplicateLoadedBarrels :: ChainEffect
|
duplicateLoadedBarrels :: ChainEffect
|
||||||
duplicateLoadedBarrels eff item cr w = foldr f w poss
|
duplicateLoadedBarrels eff item cr w = foldr f w poss
|
||||||
@@ -574,7 +574,7 @@ duplicateLoadedBarrels eff item cr w = foldr f w poss
|
|||||||
poss = map (rotateV (_crDir cr) . V2 0 . (*5) . (+ cp) . fromIntegral) [0 .. numBul - 1]
|
poss = map (rotateV (_crDir cr) . V2 0 . (*5) . (+ cp) . fromIntegral) [0 .. numBul - 1]
|
||||||
f pos = eff item (cr & crPos %~ (+.+ pos))
|
f pos = eff item (cr & crPos %~ (+.+ pos))
|
||||||
numBar = _brlNum . _gunBarrels $ _itParams item
|
numBar = _brlNum . _gunBarrels $ _itParams item
|
||||||
numBul = _ammoLoaded $ _itConsumption item
|
numBul = _laLoaded $ _itConsumption item
|
||||||
|
|
||||||
duplicateOffsetsFocus :: [Float] -> ChainEffect
|
duplicateOffsetsFocus :: [Float] -> ChainEffect
|
||||||
duplicateOffsetsFocus xs eff item cr w = foldr f w poss
|
duplicateOffsetsFocus xs eff item cr w = foldr f w poss
|
||||||
|
|||||||
@@ -68,10 +68,6 @@ shrinkGun = defaultGun
|
|||||||
{ _itName = "SHRINKER"
|
{ _itName = "SHRINKER"
|
||||||
, _itType = SHRINKER
|
, _itType = SHRINKER
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoBaseMax = 100
|
|
||||||
, _ammoLoaded = 100
|
|
||||||
, _reloadTime = 20
|
|
||||||
}
|
|
||||||
, _itUse = defaultlUse {_lUse = hammerCheckL useShrinkGun}
|
, _itUse = defaultlUse {_lUse = hammerCheckL useShrinkGun}
|
||||||
& useHammer .~ upHammer
|
& useHammer .~ upHammer
|
||||||
-- , _itFloorPict = shrinkGunPic
|
-- , _itFloorPict = shrinkGunPic
|
||||||
@@ -100,10 +96,6 @@ blinkGun = defaultGun
|
|||||||
, _itType = BLINKER
|
, _itType = BLINKER
|
||||||
, _itInvColor = cyan
|
, _itInvColor = cyan
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _ammoBaseMax = 100
|
|
||||||
, _ammoLoaded = 100
|
|
||||||
, _reloadTime = 20
|
|
||||||
}
|
|
||||||
, _itUse = defaultlUse
|
, _itUse = defaultlUse
|
||||||
& lUse .~ hammerCheckL (shootL $ const blinkAction)
|
& lUse .~ hammerCheckL (shootL $ const blinkAction)
|
||||||
& useHammer .~ upHammer
|
& useHammer .~ upHammer
|
||||||
@@ -139,13 +131,7 @@ forceFieldGun :: Item
|
|||||||
forceFieldGun = defaultGun
|
forceFieldGun = defaultGun
|
||||||
{ _itName = "FORCEFIELDGUN"
|
{ _itName = "FORCEFIELDGUN"
|
||||||
, _itType = FORCEFIELDGUN
|
, _itType = FORCEFIELDGUN
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo & laType .~ ForceFieldAmmo forceField
|
||||||
{ _ammoBaseMax = 100
|
|
||||||
, _ammoLoaded = 100
|
|
||||||
, _reloadTime = 40
|
|
||||||
, _reloadState = Nothing'
|
|
||||||
, _aoType = ForceFieldAmmo forceField
|
|
||||||
}
|
|
||||||
, _itUse = ruseInstant useForceFieldGun (HasHammer HammerUp)
|
, _itUse = ruseInstant useForceFieldGun (HasHammer HammerUp)
|
||||||
[ hammerCheckI , ammoCheckI , useAmmoAmount 1]
|
[ hammerCheckI , ammoCheckI , useAmmoAmount 1]
|
||||||
-- , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-4,-4),(-4,4),(4,4),(4,0),(0,0),(0,-4)]
|
-- , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-4,-4),(-4,4),(4,4),(4,0),(0,0),(0,-4)]
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ updateTurret rotSpeed mc w
|
|||||||
thecreature = defaultCreature
|
thecreature = defaultCreature
|
||||||
& crID .~ cid
|
& crID .~ cid
|
||||||
& crInv . at 0 ?~ (_tuWeapon (_mcType mc) & itDimension . dimPortage . handlePos -~ 10
|
& crInv . at 0 ?~ (_tuWeapon (_mcType mc) & itDimension . dimPortage . handlePos -~ 10
|
||||||
& itConsumption . ammoLoaded .~ 1
|
& itConsumption . laLoaded .~ 1
|
||||||
)
|
)
|
||||||
& crPos .~ mcpos
|
& crPos .~ mcpos
|
||||||
& crOldPos .~ mcpos
|
& crOldPos .~ mcpos
|
||||||
|
|||||||
+19
-17
@@ -14,41 +14,43 @@ startReloadingWeapon :: Creature -> World -> Maybe World
|
|||||||
startReloadingWeapon cr = (creatures . ix (_crID cr) . crInv . ix (_crInvSel cr))
|
startReloadingWeapon cr = (creatures . ix (_crID cr) . crInv . ix (_crInvSel cr))
|
||||||
icTryStartReloading
|
icTryStartReloading
|
||||||
|
|
||||||
|
-- TODO clean this up, rethink datatypes
|
||||||
icTryStartReloading :: Item -> Maybe Item
|
icTryStartReloading :: Item -> Maybe Item
|
||||||
icTryStartReloading it = do
|
icTryStartReloading it = do
|
||||||
am <- it ^? itConsumption
|
am <- it ^? itConsumption
|
||||||
amloaded <- am ^? ammoLoaded
|
amloaded <- am ^? laLoaded
|
||||||
ammax <- am ^? ammoBaseMax
|
ammax <- am ^? laMax
|
||||||
rstate <- am ^? reloadState
|
rstate <- am ^? laReloadState
|
||||||
if amloaded < ammax && rstate == Nothing'
|
if amloaded < ammax && rstate == Nothing'
|
||||||
then Just $ it
|
then Just $ it
|
||||||
& itConsumption . reloadState .~ Just' (_reloadTime am)
|
& itConsumption . laReloadState .~ Just' (_laReloadTime am)
|
||||||
& if _reloadType am == ActiveClear
|
& if _laReloadType am == ActiveClear
|
||||||
then itConsumption . ammoLoaded .~ 0
|
then itConsumption . laLoaded .~ 0
|
||||||
else id
|
else id
|
||||||
else Nothing
|
else Nothing
|
||||||
|
|
||||||
crStopReloading :: Creature -> Creature
|
crStopReloading :: Creature -> Creature
|
||||||
crStopReloading cr = cr & crInv . ix (_crInvSel cr) . itConsumption . reloadState .~ Nothing'
|
crStopReloading cr = cr & crInv . ix (_crInvSel cr) . itConsumption . laReloadState .~ Nothing'
|
||||||
|
|
||||||
|
-- ugly TODO cleanup
|
||||||
stepReloading :: Creature -> Creature
|
stepReloading :: Creature -> Creature
|
||||||
stepReloading cr = case cr ^? crInv . ix isel . itConsumption . reloadState . _Just' of
|
stepReloading cr = case cr ^? crInv . ix isel . itConsumption . laReloadState . _Just' of
|
||||||
Just 0 -> cr & crInv . ix isel %~ doload
|
Just 0 -> cr & crInv . ix isel %~ doload
|
||||||
Just _ -> cr & crInv . ix isel . itConsumption . reloadState . _Just' %~ decreaseToZero
|
Just _ -> cr & crInv . ix isel . itConsumption . laReloadState . _Just' %~ decreaseToZero
|
||||||
Nothing -> cr
|
Nothing -> cr
|
||||||
where
|
where
|
||||||
isel = _crInvSel cr
|
isel = _crInvSel cr
|
||||||
doload it = case _reloadType itcon of
|
doload it = case _laReloadType itcon of
|
||||||
ActivePartial x
|
ActivePartial x
|
||||||
| x + _ammoLoaded itcon < itMaxAmmo -> it & itConsumption . ammoLoaded %~ (+ x)
|
| x + _laLoaded itcon < itMaxAmmo -> it & itConsumption . laLoaded %~ (+ x)
|
||||||
& itConsumption . reloadState .~ Just' (_reloadTime itcon)
|
& itConsumption . laReloadState .~ Just' (_laReloadTime itcon)
|
||||||
| otherwise -> it & itConsumption . ammoLoaded .~ itMaxAmmo
|
| otherwise -> it & itConsumption . laLoaded .~ itMaxAmmo
|
||||||
& itConsumption . reloadState .~ Nothing'
|
& itConsumption . laReloadState .~ Nothing'
|
||||||
_ -> it & itConsumption . ammoLoaded .~ itMaxAmmo
|
_ -> it & itConsumption . laLoaded .~ itMaxAmmo
|
||||||
& itConsumption . reloadState .~ Nothing'
|
& itConsumption . laReloadState .~ Nothing'
|
||||||
where
|
where
|
||||||
itcon = _itConsumption it
|
itcon = _itConsumption it
|
||||||
itMaxAmmo = _ammoBaseMax itcon
|
itMaxAmmo = _laMax itcon
|
||||||
|
|
||||||
--{- | Start reloading if clip is empty. -}
|
--{- | Start reloading if clip is empty. -}
|
||||||
--crAutoReload :: Creature -> Creature
|
--crAutoReload :: Creature -> Creature
|
||||||
|
|||||||
+15
-4
@@ -3,13 +3,24 @@
|
|||||||
module MaybeHelp where
|
module MaybeHelp where
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
|
|
||||||
-- | Strict maybe
|
data Maybe' a = Just' {__Just' :: a} | Nothing'
|
||||||
data Maybe' a
|
deriving (Eq,Ord,Show)
|
||||||
= Just' {__Just' :: a }
|
|
||||||
| Nothing'
|
|
||||||
|
|
||||||
fromJust' :: Maybe' a -> a
|
fromJust' :: Maybe' a -> a
|
||||||
fromJust' mx = case mx of
|
fromJust' mx = case mx of
|
||||||
Just' x -> x
|
Just' x -> x
|
||||||
Nothing' -> error "no fromJust'"
|
Nothing' -> error "no fromJust'"
|
||||||
|
|
||||||
|
isJust' :: Maybe' a -> Bool
|
||||||
|
isJust' Just' {} = True
|
||||||
|
isJust' Nothing' = False
|
||||||
|
|
||||||
|
isNothing' :: Maybe' a -> Bool
|
||||||
|
isNothing' Just' {} = False
|
||||||
|
isNothing' Nothing' = True
|
||||||
|
|
||||||
|
strictify :: Maybe a -> Maybe' a
|
||||||
|
strictify Nothing = Nothing'
|
||||||
|
strictify (Just x) = Just' x
|
||||||
|
|
||||||
makeLenses ''Maybe'
|
makeLenses ''Maybe'
|
||||||
|
|||||||
Reference in New Issue
Block a user