Add burst fire, tentative inventory locking
This commit is contained in:
@@ -59,7 +59,10 @@ data ItZoom = ItZoom
|
||||
, _itZoomMin :: Float
|
||||
, _itZoomFac :: Float
|
||||
}
|
||||
data CurseStatus = Uncursed | UndroppableIdentified | UndroppableUnidentified
|
||||
data CurseStatus
|
||||
= Uncursed
|
||||
| UndroppableIdentified
|
||||
| UndroppableUnidentified
|
||||
data AimParams = AimParams
|
||||
{ _aimSpeed :: Float
|
||||
, _aimRange :: Float
|
||||
|
||||
@@ -55,10 +55,9 @@ withVelWthHiteff
|
||||
-> World
|
||||
withVelWthHiteff vel drag width hiteff cr = particles .:~ newbul
|
||||
where
|
||||
cid = _crID cr
|
||||
newbul = aGenBulAt (Just cid) pos (rotateV dir vel) drag hiteff width
|
||||
newbul = aGenBulAt (Just (_crID cr)) pos (rotateV dir vel) drag hiteff width
|
||||
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle dir
|
||||
dir = _crDir cr
|
||||
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
|
||||
|
||||
{- | Creates a bullet with a given velocity, width, and 'HitEffect' -}
|
||||
withDelayedVelWthHiteff
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
module Dodge.Item.Weapon.BulletGuns
|
||||
( pistol
|
||||
, revolver
|
||||
, revolverX
|
||||
, bangStick
|
||||
, bangRod
|
||||
, bangCane
|
||||
@@ -156,9 +157,30 @@ bangRod = bangCane
|
||||
& itUse . useAim . aimStance .~ TwoHandTwist
|
||||
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
|
||||
|
||||
revolverX :: Int -> Item
|
||||
revolverX i = revolver
|
||||
{ _itName = "REVx"++show i
|
||||
, _itCombineType = REVOLVERX i
|
||||
, _itUse = useAmmoParamsRate 8 upHammer
|
||||
[ ammoHammerCheck
|
||||
, useTimeCheck
|
||||
-- rather than locking the inventory, a better solution may be to check
|
||||
-- that the weapon is still in your hands in the repeated frames
|
||||
, lockInvFor 10
|
||||
, \f it -> repeatOnFrames (take (_ammoLoaded (_itConsumption it) - 1) [2,4,6,8,10]) f it
|
||||
, withSoundStart tap3S
|
||||
, useAmmoUpTo 1
|
||||
-- , applyInaccuracy
|
||||
, withMuzFlareI
|
||||
-- , spreadLoaded
|
||||
, withRecoilI 25
|
||||
]
|
||||
} & itConsumption . ammoMax .~ i * 6
|
||||
|
||||
revolver :: Item
|
||||
revolver = pistol
|
||||
{ _itName = "REVOLVER"
|
||||
, _itCombineType = REVOLVER
|
||||
, _itConsumption = defaultAmmo
|
||||
{ _aoType = basicBullet
|
||||
, _ammoMax = 6
|
||||
@@ -180,11 +202,10 @@ pistol = defaultGun
|
||||
, _reloadType = ActiveClear
|
||||
}
|
||||
, _itUse = useAmmoParamsRate 8 upHammer
|
||||
[ ammoCheckI
|
||||
, hammerCheckI
|
||||
[ ammoHammerCheck
|
||||
, useTimeCheck
|
||||
, withSoundStart tap3S
|
||||
, useAmmoAmount 1
|
||||
, withSoundStart tap3S
|
||||
, applyInaccuracy
|
||||
, withMuzFlareI
|
||||
]
|
||||
@@ -261,10 +282,10 @@ ltAutoGun = defaultAutoGun
|
||||
{ _itName = "AUTO-LT"
|
||||
, _itCombineType = LTAUTOGUN
|
||||
, _itConsumption = defaultAmmo
|
||||
{ _aoType = ltBullet
|
||||
, _ammoMax = 25
|
||||
, _ammoLoaded = 25
|
||||
, _reloadTime = 80
|
||||
{ _aoType = basicBullet
|
||||
, _ammoMax = 15
|
||||
, _ammoLoaded = 0
|
||||
, _reloadTime = 90
|
||||
}
|
||||
, _itUse = useAmmoParamsRate 2 NoHammer
|
||||
[ ammoCheckI
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
{- |
|
||||
Weapon effects when pulling the trigger. -}
|
||||
module Dodge.Item.Weapon.TriggerType
|
||||
( useAmmoAmount
|
||||
, useAllAmmo
|
||||
, useAmmoUpTo
|
||||
, lockInvFor
|
||||
, withMuzFlareI
|
||||
, withOldDir
|
||||
, trigDoAlso
|
||||
@@ -27,6 +30,7 @@ module Dodge.Item.Weapon.TriggerType
|
||||
, withWarmUp
|
||||
, spreadNumI
|
||||
, spreadLoaded
|
||||
, repeatOnFrames
|
||||
-- , numBarrels
|
||||
, duplicateLoadedBarrels
|
||||
, randWalkAngle -- ^ should be made into a modifier, perhaps
|
||||
@@ -45,15 +49,17 @@ import Dodge.SoundLogic
|
||||
import Dodge.Reloading
|
||||
import Dodge.WorldEvent
|
||||
import Dodge.RandomHelp
|
||||
import Dodge.Inventory.Lock
|
||||
--import Dodge.Default
|
||||
import Sound.Data
|
||||
import Geometry
|
||||
--import Geometry.Vector3D
|
||||
import Dodge.LightSource
|
||||
--import Data.Preload
|
||||
import LensHelp
|
||||
|
||||
import System.Random
|
||||
import Control.Lens
|
||||
--import Control.Lens
|
||||
import Control.Monad.State
|
||||
import Data.Maybe
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
@@ -66,6 +72,10 @@ type ChainEffect
|
||||
-> World
|
||||
-> World
|
||||
|
||||
lockInvFor :: Int -> ChainEffect
|
||||
lockInvFor i f it cr = f it cr . (delayedEvents .:~ (i, unlockInv (_crID cr)))
|
||||
. lockInv (_crID cr)
|
||||
|
||||
-- Note that this uses the "base" creature and item values
|
||||
trigDoAlso
|
||||
:: (Item -> Creature -> World -> World)
|
||||
@@ -239,6 +249,10 @@ withSidePushAfterI maxSide eff item cr w = over (creatures . ix cid) push . eff
|
||||
useAllAmmo :: ChainEffect
|
||||
useAllAmmo eff item cr = eff item cr
|
||||
. (creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itConsumption . ammoLoaded .~ 0)
|
||||
useAmmoUpTo :: Int -> ChainEffect
|
||||
useAmmoUpTo amAmount eff item cr = eff item cr
|
||||
. (creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itConsumption . ammoLoaded
|
||||
%~ (max 0 . subtract amAmount))
|
||||
useAmmoAmount :: Int -> ChainEffect
|
||||
useAmmoAmount amAmount eff item cr = eff item cr
|
||||
. (creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) . itConsumption . ammoLoaded -~ amAmount)
|
||||
@@ -430,6 +444,15 @@ spreadLoaded eff item cr w = foldr f w dirs
|
||||
-- loadedSpreadParam = 0.5 * (fromIntegral (numBulLoaded - numBarrels) + 1)
|
||||
numBulLoaded = _ammoLoaded $ _itConsumption item
|
||||
|
||||
-- pump the updated creature into the chain in later frames
|
||||
repeatOnFrames :: [Int] -> ChainEffect
|
||||
repeatOnFrames is f it cr w = f it cr w
|
||||
& delayedEvents .++~ (is <&> (, f'))
|
||||
where
|
||||
f' w' = fromMaybe w' $ do
|
||||
cr' <- w' ^? creatures . ix (_crID cr)
|
||||
return $ f it cr' w'
|
||||
|
||||
duplicateLoadedBarrels :: ChainEffect
|
||||
duplicateLoadedBarrels eff item cr w = foldr f w poss
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user