Continue to refactor item datatypes, add a shape to rockets
This commit is contained in:
@@ -18,7 +18,7 @@ useAmmoParamsRate :: Int
|
||||
-> ItemUse
|
||||
useAmmoParamsRate rate ht usemods = RightUse
|
||||
{ _rUse = useAmmoParams
|
||||
, _useDelay = DelayRate {_rateMax = rate,_rateTime = 0}
|
||||
, _useDelay = FixedRate {_rateMax = rate,_rateTime = 0}
|
||||
, _useMods = usemods
|
||||
, _useHammer = ht
|
||||
, _useAim = defaultAimParams
|
||||
|
||||
@@ -41,7 +41,7 @@ autoGun = defaultAutoGun
|
||||
, _wpLoadedAmmo = 30
|
||||
, _wpReloadTime = 80
|
||||
}
|
||||
, _itUse = useAmmoParamsRate 5 NoHammer
|
||||
, _itUse = useAmmoParamsRate 4 NoHammer
|
||||
[ ammoCheckI
|
||||
, charFiringStratI
|
||||
[('S', hammerCheckI)
|
||||
@@ -137,7 +137,7 @@ hvAutoGun = defaultAutoGun
|
||||
}
|
||||
, _itUse = useAmmoParamsRate 25 NoHammer
|
||||
[ ammoCheckI
|
||||
, rateIncABI 24 7 (torqueBeforeAtLeast 0.1 0.1) (torqueAfterI 0.2)
|
||||
, rateIncAB (torqueBeforeAtLeast 0.1 0.1) (torqueAfterI 0.2)
|
||||
, withSoundStart bangEchoS
|
||||
, withThinSmokeI
|
||||
, withMuzFlareI
|
||||
@@ -146,6 +146,7 @@ hvAutoGun = defaultAutoGun
|
||||
& useAim . aimRange .~ 1
|
||||
& useAim . aimStance .~ TwoHandTwist
|
||||
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
|
||||
& useDelay .~ VariableRate {_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = hvAutoGunPic
|
||||
}
|
||||
@@ -170,7 +171,7 @@ ltAutoGun = defaultAutoGun
|
||||
, _wpLoadedAmmo = 25
|
||||
, _wpReloadTime = 80
|
||||
}
|
||||
, _itUse = useAmmoParamsRate 3 NoHammer
|
||||
, _itUse = useAmmoParamsRate 2 NoHammer
|
||||
[ ammoCheckI
|
||||
, useTimeCheck
|
||||
, withSoundStart tap1S
|
||||
@@ -206,10 +207,9 @@ miniGun = defaultAutoGun
|
||||
, _wpLoadedAmmo = 1500
|
||||
, _wpReloadTime = 200
|
||||
}
|
||||
, _wpMaxWarmUp = 100
|
||||
, _itUse = ruseInstant (useAmmoParamsVelMod vm4) NoHammer
|
||||
[ ammoCheckI
|
||||
, withWarmUpI crankSlowS
|
||||
, withWarmUp crankSlowS
|
||||
--, afterRecoil recoilAmount
|
||||
, withSoundForI mini1S 2
|
||||
--, withThinSmokeI
|
||||
@@ -230,15 +230,16 @@ miniGun = defaultAutoGun
|
||||
, withRandomOffsetI 10
|
||||
, withOldDir od2
|
||||
, trigDoAlso (useAmmoParamsVelMod vm3)
|
||||
, useAmmo 4
|
||||
--, torqueBeforeForcedI 0.001
|
||||
, withSidePushI 50
|
||||
, afterRecoil recoilAmount
|
||||
, withRandomOffsetI 9
|
||||
, withMuzFlareI
|
||||
, withOldDir od3
|
||||
, useAmmo 4
|
||||
, withMuzFlareI
|
||||
, withSmoke 1 black 20 200 5
|
||||
]
|
||||
& useDelay .~ WarmUpNoDelay {_warmTime = 0,_warmMax = 200}
|
||||
& useAim . aimSpeed .~ 0.4
|
||||
& useAim . aimRange .~ 1
|
||||
& useAim . aimStance .~ TwoHandTwist
|
||||
@@ -262,7 +263,7 @@ miniGun = defaultAutoGun
|
||||
miniGunPictItem :: Item -> SPic
|
||||
miniGunPictItem it = miniGunPict spin (loadedAmmo it)
|
||||
where
|
||||
spin = (-10) * _wpLoadedAmmo (_wpAmmo it) + _wpCurWarmUp it
|
||||
spin = (-10) * _wpLoadedAmmo (_wpAmmo it) + _warmTime (_useDelay $ _itUse it)
|
||||
|
||||
miniGunPict :: Int -> Int -> SPic
|
||||
miniGunPict spin am =
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
Extra weapon effects, supplementing explicit use effects.
|
||||
-}
|
||||
module Dodge.Item.Weapon.ExtraEffect
|
||||
( wpRecock
|
||||
, itemLaserScopeEffect
|
||||
(-- wpRecock
|
||||
itemLaserScopeEffect
|
||||
, autoSonarEffect
|
||||
, autoRadarEffect
|
||||
, rbSetTarget
|
||||
@@ -28,17 +28,17 @@ import qualified Data.Set as S
|
||||
import qualified SDL
|
||||
{- |
|
||||
Controls resetting a weapon, allows for non-continuous fire needing a button release. -}
|
||||
wpRecock :: ItEffect
|
||||
wpRecock = ItInvEffect
|
||||
{_itInvEffect = f
|
||||
,_itEffectCounter = 0
|
||||
}
|
||||
where
|
||||
f _ cr invid = creatures . ix (_crID cr) . crInv . ix invid
|
||||
. itUse . useHammer . hammerPosition %~ moveHammerUp
|
||||
moveHammerUp HammerDown = HammerReleased
|
||||
moveHammerUp HammerReleased = HammerUp
|
||||
moveHammerUp HammerUp = HammerUp
|
||||
--wpRecock :: ItEffect
|
||||
--wpRecock = ItInvEffect
|
||||
-- {_itInvEffect = f
|
||||
-- ,_itEffectCounter = 0
|
||||
-- }
|
||||
-- where
|
||||
-- f _ cr invid = creatures . ix (_crID cr) . crInv . ix invid
|
||||
-- . itUse . useHammer . hammerPosition %~ moveHammerUp
|
||||
-- moveHammerUp HammerDown = HammerReleased
|
||||
-- moveHammerUp HammerReleased = HammerUp
|
||||
-- moveHammerUp HammerUp = HammerUp
|
||||
--{- |
|
||||
--Special recock for the bezier gun.
|
||||
--Not sure of its purpose at this time... -}
|
||||
|
||||
@@ -12,7 +12,6 @@ import Dodge.Zone
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.Item.Draw
|
||||
import Dodge.Item.Weapon.InventoryDisplay
|
||||
import Dodge.Item.Weapon.ExtraEffect
|
||||
import Dodge.Item.Attachment
|
||||
import Picture
|
||||
import Geometry
|
||||
@@ -44,7 +43,7 @@ grenade = Throwable
|
||||
, _itAttachment = ItFuse fuseTime
|
||||
, _itInvColor = white
|
||||
, _itInvDisplay = basicWeaponDisplay
|
||||
, _itEffect = wpRecock
|
||||
, _itEffect = NoItEffect
|
||||
, _itScroll = changeFuse
|
||||
}
|
||||
where
|
||||
|
||||
@@ -7,6 +7,7 @@ module Dodge.Item.Weapon.InventoryDisplay
|
||||
import Dodge.Data
|
||||
import Padding
|
||||
|
||||
import Data.Maybe
|
||||
import Data.Sequence
|
||||
import Control.Lens
|
||||
{- | Displays the item name, ammo if loaded, and any selected '_itCharMode'. -}
|
||||
@@ -20,7 +21,29 @@ basicWeaponDisplay it = midPadL 10 ' ' thename (' ' : thenumber) ++ theparam
|
||||
x -> "R" ++ show x
|
||||
Just am@ChargeableAmmo{} -> show $ _wpCharge am
|
||||
Nothing -> ""
|
||||
theparam = case it ^? itAttachment of
|
||||
Just ItCharMode {_itCharMode = (c :<| _)} -> [' ',c]
|
||||
Just ItMode {_itMode = i} -> show i
|
||||
_ -> []
|
||||
theparam = fromMaybe []
|
||||
. listToMaybe
|
||||
$ mapMaybe ($ it)
|
||||
[ maybeModeStatus
|
||||
, maybeWarmupStatus
|
||||
, maybeRateStatus
|
||||
]
|
||||
|
||||
maybeModeStatus :: Item -> Maybe String
|
||||
maybeModeStatus it = case it ^? itAttachment of
|
||||
Just ItCharMode {_itCharMode = (c :<| _)} -> Just [' ',c]
|
||||
Just ItMode {_itMode = i} -> Just $ show i
|
||||
_ -> Nothing
|
||||
|
||||
maybeRateStatus :: Item -> Maybe String
|
||||
maybeRateStatus it = case it ^? itUse . useDelay . rateMaxMax of
|
||||
Nothing -> Nothing
|
||||
_ -> Just $ ' ' : "T" ++ leftPad 3 ' ' (show (_rateMax . _useDelay $ _itUse it))
|
||||
|
||||
maybeWarmupStatus :: Item -> Maybe String
|
||||
maybeWarmupStatus it = case it ^? itUse . useDelay . warmMax of
|
||||
Nothing -> Nothing
|
||||
Just m -> case m - (_warmTime . _useDelay $ _itUse it) of
|
||||
x | x <= 1 -> Just " WARM"
|
||||
| otherwise -> let n = show x
|
||||
in Just $ ' ' : Prelude.take (4 - Prelude.length n) "WARM" ++ n
|
||||
|
||||
@@ -188,11 +188,16 @@ reduceSpinBy :: Float -> Prop -> World -> World
|
||||
reduceSpinBy x pj = props . ix (_pjID pj) . pjSpin *~ x
|
||||
|
||||
shellPic :: Prop -> SPic
|
||||
shellPic pj = (,) mempty $ setDepth 20 . uncurryV translate pos $ rotate (argV accel) basePic
|
||||
shellPic pj = noPic $ translateSHz 18 . uncurryV translateSHf pos $ rotateSH (argV accel) basePic
|
||||
where
|
||||
basePic = color black $ polygon $ map toV2 [(-6,4),(-6,-4),(6,-4),(8,0),(6,4)]
|
||||
basePic = colorSH black $ upperPrismPoly 4 $ map toV2 [(-6,4),(-6,-4),(6,-4),(8,0),(6,4)]
|
||||
accel = _pjAcc pj
|
||||
pos = _pjPos pj
|
||||
--shellPic pj = (,) mempty $ setDepth 20 . uncurryV translate pos $ rotate (argV accel) basePic
|
||||
-- where
|
||||
-- basePic = color blackSH $ polygon $ map toV2 [(-6,4),(-6,-4),(6,-4),(8,0),(6,4)]
|
||||
-- accel = _pjAcc pj
|
||||
-- pos = _pjPos pj
|
||||
|
||||
pjEffTimeRange
|
||||
:: (Int,Int)
|
||||
|
||||
@@ -7,7 +7,7 @@ module Dodge.Item.Weapon.TriggerType
|
||||
, trigDoAlso
|
||||
, withTempLight
|
||||
, ammoUseCheck
|
||||
, rateIncABI
|
||||
, rateIncAB
|
||||
, torqueBefore
|
||||
, torqueBeforeAtLeast
|
||||
, torqueAfterI
|
||||
@@ -23,7 +23,7 @@ module Dodge.Item.Weapon.TriggerType
|
||||
, afterRecoil
|
||||
, withSidePushAfterI
|
||||
, withSidePushI
|
||||
, withWarmUpI
|
||||
, withWarmUp
|
||||
, spreadNumI
|
||||
, numI
|
||||
, randWalkAngle -- ^ should be made into a modifier, perhaps
|
||||
@@ -98,17 +98,14 @@ ammoCheckI eff item cr w
|
||||
= fromMaybe w (startReloadingWeapon cr w)
|
||||
| _wpReloadState (_wpAmmo item) > 0 = w
|
||||
| otherwise = eff item cr w
|
||||
{- |
|
||||
Fires at an increasing rate.
|
||||
{- | Fires at an increasing rate.
|
||||
Has different effect after first fire.
|
||||
Applies ammo check and use cooldown check. -}
|
||||
rateIncABI
|
||||
:: Int -- ^ Start rate
|
||||
-> Int -- ^ End rate
|
||||
-> ChainEffect -- ^ Extra effect on first fire
|
||||
rateIncAB
|
||||
:: ChainEffect -- ^ Extra effect on first fire
|
||||
-> ChainEffect -- ^ Extra effect on continued fire
|
||||
-> ChainEffect
|
||||
rateIncABI startRate fastRate exeffFirst exeffCont eff item cr w
|
||||
rateIncAB exeffFirst exeffCont eff item cr w
|
||||
| repeatFire = w
|
||||
& pointItem %~ ( (itUse . useDelay . rateMax .~ max fastRate (currentRate - 1))
|
||||
. (wpAmmo . wpLoadedAmmo -~ 1)
|
||||
@@ -121,6 +118,8 @@ rateIncABI startRate fastRate exeffFirst exeffCont eff item cr w
|
||||
& exeffFirst eff item cr
|
||||
| otherwise = w
|
||||
where
|
||||
fastRate = _rateMinMax . _useDelay $ _itUse item
|
||||
startRate = _rateMaxMax . _useDelay $ _itUse item
|
||||
cid = _crID cr
|
||||
itRef = _crInvSel cr
|
||||
pointItem = creatures . ix cid . crInv . ix itRef
|
||||
@@ -128,23 +127,24 @@ rateIncABI startRate fastRate exeffFirst exeffCont eff item cr w
|
||||
repeatFire = _wpReloadState (_wpAmmo item) == 0 && _rateTime (_useDelay (_itUse item)) == 1
|
||||
firstFire = _wpReloadState (_wpAmmo item) == 0 && _rateTime (_useDelay (_itUse item)) == 0
|
||||
{- | Apply effect after a warm up. -}
|
||||
withWarmUpI
|
||||
-- note this is quite unsafe, requires the item to have the correct delay type
|
||||
withWarmUp
|
||||
:: SoundID -- ^ warm up sound id
|
||||
-> ChainEffect
|
||||
withWarmUpI soundID f item cr w
|
||||
withWarmUp soundID f item cr w
|
||||
| _wpReloadState (_wpAmmo item) /= 0 = w
|
||||
| curWarmUp < maxWarmUp = w
|
||||
& pointerToItem . wpCurWarmUp +~ 2
|
||||
& pointerToItem . itUse . useDelay . warmTime +~ 2
|
||||
& soundContinue (CrWeaponSound cid 0) (_crPos cr) soundID (Just 2)
|
||||
| otherwise = w
|
||||
& pointerToItem . wpCurWarmUp .~ maxWarmUp
|
||||
& pointerToItem . itUse . useDelay . warmTime .~ maxWarmUp
|
||||
& f item cr
|
||||
where
|
||||
cid = _crID cr
|
||||
itRef = _crInvSel cr
|
||||
pointerToItem = creatures . ix cid . crInv . ix itRef
|
||||
curWarmUp = _wpCurWarmUp item
|
||||
maxWarmUp = _wpMaxWarmUp item
|
||||
curWarmUp = _warmTime . _useDelay $ _itUse item
|
||||
maxWarmUp = _warmMax . _useDelay $ _itUse item
|
||||
{- | Adds a sound to a creature based world effect.
|
||||
The sound is emitted from the creature's position. -}
|
||||
withSoundStart
|
||||
|
||||
Reference in New Issue
Block a user