Abstract out direction accuracy
This commit is contained in:
@@ -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