Abstract out direction accuracy
This commit is contained in:
@@ -61,7 +61,8 @@ pistol = Weapon
|
||||
, _wpFireRate = 8
|
||||
, _wpFireState = 0
|
||||
, _wpFire = shootWithSound 0
|
||||
$ withAccVelWthHiteff' 0.1 (30,0) 2
|
||||
. withRandomDir 0.1
|
||||
. withVelWthHiteff (30,0) 2
|
||||
$ threeEff' bulHitCr' bulHitWall' bulHitFF'
|
||||
, _wpSpread = 0.02
|
||||
, _wpRange = 20
|
||||
@@ -125,12 +126,14 @@ autoGun = defaultGun
|
||||
autoFireMode = shootWithSound (fromIntegral autoGunSound)
|
||||
$ withRecoil 40
|
||||
$ torqueBefore 0.05
|
||||
$ withAccVelWthHiteff' (autogunSpread/2) (50,0) 3
|
||||
$ withRandomDir (autogunSpread/2)
|
||||
$ withVelWthHiteff (50,0) 3
|
||||
$ threeEff' bulHitCr' bulHitWall' bulHitFF'
|
||||
singleFireMode = shootWithSound (fromIntegral autoGunSound)
|
||||
$ withRecoil 40
|
||||
$ torqueAfter 0.03
|
||||
$ withAccVelWthHiteff' (autogunSpread/2) (50,0) 3
|
||||
$ withRandomDir (autogunSpread/2)
|
||||
$ withVelWthHiteff (50,0) 3
|
||||
$ threeEff' bulHitCr' bulHitWall' bulHitFF'
|
||||
|
||||
incMode :: Int -> World -> World
|
||||
@@ -417,7 +420,7 @@ hvAutoGun = defaultAutoGun
|
||||
}
|
||||
where mkHvBul = withSound (fromIntegral longGunSound)
|
||||
$ withThinSmoke
|
||||
$ withAccVelWthHiteff' 0 (80,0) 6
|
||||
$ withVelWthHiteff (80,0) 6
|
||||
$ threeEff'
|
||||
hvBulHitCr' hvBulHitWall' bulHitFF'
|
||||
|
||||
@@ -430,7 +433,7 @@ ltAutoGun = defaultAutoGun
|
||||
, _wpReloadState = 0
|
||||
, _wpFireRate = 4
|
||||
, _wpFireState = 0
|
||||
, _wpFire = shootWithSound 0 $ withAccVelWthHiteff' 0.3 (30,0) 2 bulletEffect'
|
||||
, _wpFire = shootWithSound 0 . withRandomDir 0.3 $ withVelWthHiteff (30,0) 2 bulletEffect'
|
||||
, _wpSpread = 0.5
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = onLayer FlItLayer $ color green $ pictures [polygon $ rectNSWE 4 (-4) (-4) 0
|
||||
@@ -549,7 +552,7 @@ longGun = defaultGun
|
||||
, _wpFire = shootWithSound (fromIntegral longGunSound)
|
||||
$ withThickSmoke
|
||||
$ torqueAfter 0.05
|
||||
$ withAccVelWthHiteff' 0 (60,0) 6
|
||||
$ withVelWthHiteff (60,0) 6
|
||||
$ threeEff'
|
||||
hvBulHitCr' hvBulHitWall' bulHitFF'
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
{-# LANGUAGE BangPatterns #-}
|
||||
module Dodge.Item.Weapon.Recock
|
||||
where
|
||||
import Dodge.Data
|
||||
|
||||
import Control.Lens
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
|
||||
wpRecock :: ItEffect
|
||||
wpRecock = ItInvEffect {_itInvEffect = f
|
||||
,_itEffectCounter = 0
|
||||
}
|
||||
where f cr i = creatures . ix (_crID cr) . crInv
|
||||
%~ IM.adjust fOnIt i
|
||||
moveHammerUp !HammerDown = HammerReleased
|
||||
moveHammerUp !HammerReleased = HammerUp
|
||||
moveHammerUp !HammerUp = HammerUp
|
||||
fOnIt it = it & itHammer %~ moveHammerUp
|
||||
|
||||
bezierRecock :: ItEffect
|
||||
bezierRecock = ItInvEffect {_itInvEffect = f
|
||||
,_itEffectCounter = 0
|
||||
}
|
||||
where f cr i = creatures . ix (_crID cr) . crInv
|
||||
%~ IM.adjust fOnIt i
|
||||
fOnIt it = case _itHammer it of
|
||||
HammerDown -> it & itHammer .~ HammerUp
|
||||
_ -> it & itAttachment .~ Nothing
|
||||
@@ -112,8 +112,8 @@ withRandomDir acc f cid w = over (creatures . ix cid . crDir) (\d -> d - a)
|
||||
w
|
||||
where (a, g) = randomR (-acc,acc) $ _randGen w
|
||||
|
||||
withAccVelWthHiteff' :: Float -> Point2 -> Float -> HitEffect' -> Int -> World -> World
|
||||
withAccVelWthHiteff' acc vel width hiteff cid w
|
||||
withVelWthHiteff :: Point2 -> Float -> HitEffect' -> Int -> World -> World
|
||||
withVelWthHiteff vel width hiteff cid w
|
||||
= over particles' ((:) newbul)
|
||||
. over tempLightSources ((:) (tLightAt 4 pos))
|
||||
. lowLightAt pos2
|
||||
@@ -122,11 +122,12 @@ withAccVelWthHiteff' acc vel width hiteff cid w
|
||||
where cr = _creatures w IM.! cid
|
||||
newbul = aGenBulAt' (Just cid) (numColor colid) pos (rotateV dir vel) hiteff width
|
||||
(colid, g) = randomR (0,11) $ _randGen w
|
||||
(a, _) = randomR (-acc,acc) $ _randGen w
|
||||
dir = _crDir cr + a
|
||||
dir = _crDir cr
|
||||
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
|
||||
pos2 = _crPos cr +.+ (2 * _crRad cr) *.* unitVectorAtAngle (_crDir cr)
|
||||
|
||||
|
||||
|
||||
withOffsetAccVelWthHiteff' :: Float -> Float -> Point2 -> Float -> HitEffect' -> Int -> World -> World
|
||||
withOffsetAccVelWthHiteff' offsetAmount acc vel width hiteff cid w
|
||||
= over particles' ((:) newbul )
|
||||
|
||||
Reference in New Issue
Block a user