Expose recoil, torque etc as item parameters
This commit is contained in:
@@ -586,6 +586,9 @@ data ItemParams
|
|||||||
, _rifling :: Float
|
, _rifling :: Float
|
||||||
, _bore :: Float
|
, _bore :: Float
|
||||||
, _gunBarrels :: GunBarrels
|
, _gunBarrels :: GunBarrels
|
||||||
|
, _recoil :: Float
|
||||||
|
, _torqueAfter :: Float
|
||||||
|
, _randomOffset :: Float
|
||||||
}
|
}
|
||||||
| Sprayer
|
| Sprayer
|
||||||
{ _nozzleSpread :: Float
|
{ _nozzleSpread :: Float
|
||||||
|
|||||||
@@ -149,7 +149,17 @@ defItDimCol col = ItemDimension
|
|||||||
}
|
}
|
||||||
, _dimSPic = const $ noPic $ colorSH col $ upperPrismPoly 3 $ square 4
|
, _dimSPic = const $ noPic $ colorSH col $ upperPrismPoly 3 $ square 4
|
||||||
}
|
}
|
||||||
|
defBulletShooter :: ItemParams
|
||||||
|
defBulletShooter = BulletShooter
|
||||||
|
{ _muzVel = 1
|
||||||
|
, _rifling = 0.8
|
||||||
|
, _bore = 2
|
||||||
|
, _gunBarrels = SingleBarrel 0
|
||||||
|
, _recoil = 0
|
||||||
|
, _torqueAfter = 0
|
||||||
|
, _randomOffset = 0
|
||||||
|
}
|
||||||
|
|
||||||
defaultAutoGun :: Item
|
defaultAutoGun :: Item
|
||||||
defaultAutoGun = defaultGun
|
defaultAutoGun = defaultGun
|
||||||
& itUse . useAim . aimStance .~ TwoHandTwist
|
& itUse . useAim . aimStance .~ TwoHandTwist
|
||||||
|
|||||||
@@ -51,6 +51,9 @@ bangCane = defaultGun
|
|||||||
, _gunBarrels = SingleBarrel
|
, _gunBarrels = SingleBarrel
|
||||||
{ _brlInaccuracy = 0.01
|
{ _brlInaccuracy = 0.01
|
||||||
}
|
}
|
||||||
|
, _recoil = 50
|
||||||
|
, _torqueAfter = 0.1
|
||||||
|
, _randomOffset = 0
|
||||||
}
|
}
|
||||||
, _itConsumption = defaultAmmo
|
, _itConsumption = defaultAmmo
|
||||||
{ _aoType = basicBullet
|
{ _aoType = basicBullet
|
||||||
@@ -63,9 +66,9 @@ bangCane = defaultGun
|
|||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, withSoundStart tap3S
|
, withSoundStart tap3S
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, torqueAfterI 0.1
|
, withTorqueAfter
|
||||||
, applyInaccuracy
|
, applyInaccuracy
|
||||||
, withRecoilI 50
|
, withRecoil
|
||||||
, withSmoke 1 black 20 200 5
|
, withSmoke 1 black 20 200 5
|
||||||
, withMuzFlareI
|
, withMuzFlareI
|
||||||
]
|
]
|
||||||
@@ -244,7 +247,7 @@ miniGunUse i = ruseInstant (useAmmoParams $ Just 1) NoHammer $
|
|||||||
[ withSidePushI 50
|
[ withSidePushI 50
|
||||||
, torqueBefore 0.05
|
, torqueBefore 0.05
|
||||||
, afterRecoil recoilAmount
|
, afterRecoil recoilAmount
|
||||||
, withRandomOffsetI 10
|
, withRandomOffset
|
||||||
, withOldDir x
|
, withOldDir x
|
||||||
, trigDoAlso (useAmmoParams $ Just x)
|
, trigDoAlso (useAmmoParams $ Just x)
|
||||||
] | x <- map ((/fromIntegral i) . fromIntegral) [1..i-1]
|
] | x <- map ((/fromIntegral i) . fromIntegral) [1..i-1]
|
||||||
@@ -252,7 +255,7 @@ miniGunUse i = ruseInstant (useAmmoParams $ Just 1) NoHammer $
|
|||||||
<>
|
<>
|
||||||
[ withSidePushI 50
|
[ withSidePushI 50
|
||||||
, afterRecoil recoilAmount
|
, afterRecoil recoilAmount
|
||||||
, withRandomOffsetI 10
|
, withRandomOffset
|
||||||
]
|
]
|
||||||
where
|
where
|
||||||
recoilAmount = 5
|
recoilAmount = 5
|
||||||
@@ -283,6 +286,9 @@ miniGunX i = defaultAutoGun
|
|||||||
,_brlNum = i
|
,_brlNum = i
|
||||||
,_brlInaccuracy = 0
|
,_brlInaccuracy = 0
|
||||||
}
|
}
|
||||||
|
, _recoil = 10
|
||||||
|
, _torqueAfter = 0
|
||||||
|
, _randomOffset = 10
|
||||||
}
|
}
|
||||||
, _itEquipPict = pictureWeaponAim (miniGunXPictItem i)
|
, _itEquipPict = pictureWeaponAim (miniGunXPictItem i)
|
||||||
, _itTweaks = defaultBulletSelTweak
|
, _itTweaks = defaultBulletSelTweak
|
||||||
|
|||||||
@@ -44,17 +44,20 @@ bangRod = defaultGun
|
|||||||
, _rifling = 1
|
, _rifling = 1
|
||||||
, _bore = 2
|
, _bore = 2
|
||||||
, _gunBarrels = SingleBarrel 0.1
|
, _gunBarrels = SingleBarrel 0.1
|
||||||
|
, _recoil = 50
|
||||||
|
, _torqueAfter = 0.3
|
||||||
|
, _randomOffset = 0
|
||||||
}
|
}
|
||||||
, _itUse = ruseAmmoParamsRate 12 upHammer
|
, _itUse = ruseAmmoParamsRate 12 upHammer
|
||||||
[ ammoHammerCheck
|
[ ammoHammerCheck
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, withSoundStart bangEchoS
|
, withSoundStart bangEchoS
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, torqueAfterI 0.3
|
, withTorqueAfter
|
||||||
, applyInaccuracy
|
, applyInaccuracy
|
||||||
, withThickSmokeI
|
, withThickSmokeI
|
||||||
, withMuzFlareI
|
, withMuzFlareI
|
||||||
, withRecoilI 50
|
, withRecoil
|
||||||
]
|
]
|
||||||
, _itDimension = ItemDimension
|
, _itDimension = ItemDimension
|
||||||
{ _dimRad = 12
|
{ _dimRad = 12
|
||||||
|
|||||||
@@ -58,10 +58,10 @@ bangStick i = defaultGun
|
|||||||
, withSoundItemChoiceStart bangStickSoundChoice
|
, withSoundItemChoiceStart bangStickSoundChoice
|
||||||
, useAllAmmo
|
, useAllAmmo
|
||||||
, withMuzFlareI
|
, withMuzFlareI
|
||||||
, torqueAfterI (0.18 + 0.02 * fromIntegral i)
|
, withTorqueAfter
|
||||||
, spreadLoaded
|
, spreadLoaded
|
||||||
-- , applyInaccuracy
|
-- , applyInaccuracy
|
||||||
, withRecoilI 25
|
, withRecoil
|
||||||
]
|
]
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
, _itInvColor = white
|
, _itInvColor = white
|
||||||
@@ -74,6 +74,9 @@ bangStick i = defaultGun
|
|||||||
,_brlSpread = SpreadBarrels baseStickSpread
|
,_brlSpread = SpreadBarrels baseStickSpread
|
||||||
,_brlInaccuracy = 0.01
|
,_brlInaccuracy = 0.01
|
||||||
}
|
}
|
||||||
|
, _recoil = 25
|
||||||
|
, _torqueAfter = 0.18 + 0.02 * fromIntegral i
|
||||||
|
, _randomOffset = 0
|
||||||
}
|
}
|
||||||
, _itTweaks = defaultBulletSelTweak
|
, _itTweaks = defaultBulletSelTweak
|
||||||
, _itInvSize = fromIntegral i / 3
|
, _itInvSize = fromIntegral i / 3
|
||||||
@@ -184,14 +187,14 @@ pistol = (bangStick 1)
|
|||||||
-- , _itEquipPict = pictureWeaponAim pistolPic
|
-- , _itEquipPict = pictureWeaponAim pistolPic
|
||||||
, _itID = Nothing
|
, _itID = Nothing
|
||||||
, _itInvColor = white
|
, _itInvColor = white
|
||||||
, _itParams = BulletShooter
|
|
||||||
{ _muzVel = 0.8
|
|
||||||
, _rifling = 0.8
|
|
||||||
, _bore = 2
|
|
||||||
, _gunBarrels = SingleBarrel 0.05
|
|
||||||
}
|
|
||||||
, _itTweaks = defaultBulletSelTweak
|
, _itTweaks = defaultBulletSelTweak
|
||||||
} & itDimension . dimSPic .~ (\it -> noPic $ baseStickShape <> makeTinClipAt pi (V3 5 2 0) it)
|
} & itDimension . dimSPic .~ (\it -> noPic $ baseStickShape <> makeTinClipAt pi (V3 5 2 0) it)
|
||||||
|
& itParams %~
|
||||||
|
( ( muzVel .~ 0.8 )
|
||||||
|
. ( rifling .~ 0.8 )
|
||||||
|
. ( bore .~ 2 )
|
||||||
|
. ( gunBarrels .~ SingleBarrel 0.05 )
|
||||||
|
)
|
||||||
autoPistol :: Item
|
autoPistol :: Item
|
||||||
autoPistol = pistol
|
autoPistol = pistol
|
||||||
& itUse . useMods .~ (ammoCheckI : pistolAfterHamMods)
|
& itUse . useMods .~ (ammoCheckI : pistolAfterHamMods)
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ autoGun = defaultAutoGun
|
|||||||
, _rifling = 0.9
|
, _rifling = 0.9
|
||||||
, _bore = 2
|
, _bore = 2
|
||||||
, _gunBarrels = SingleBarrel 0.1
|
, _gunBarrels = SingleBarrel 0.1
|
||||||
|
, _recoil = 0
|
||||||
|
, _torqueAfter = 0
|
||||||
|
, _randomOffset = 0
|
||||||
}
|
}
|
||||||
, _itTweaks = defaultBulletSelTweak
|
, _itTweaks = defaultBulletSelTweak
|
||||||
}
|
}
|
||||||
@@ -119,21 +122,23 @@ bangCone = defaultGun
|
|||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, withSoundStart bangEchoS
|
, withSoundStart bangEchoS
|
||||||
, useAllAmmo
|
, useAllAmmo
|
||||||
, torqueAfterI 0.1
|
, withTorqueAfter
|
||||||
, withRecoilI 150
|
, withRecoil
|
||||||
, duplicateLoaded
|
, duplicateLoaded
|
||||||
, withMuzFlareI
|
, withMuzFlareI
|
||||||
, applyInaccuracy
|
, applyInaccuracy
|
||||||
, withRandomOffsetI 12
|
, withRandomOffset
|
||||||
, withRandomItemUpdate coneRandItemUpdate
|
, withRandomItemUpdate coneRandItemUpdate
|
||||||
, withRandomItemParams coneRandItemParams
|
, withRandomItemParams coneRandItemParams
|
||||||
]
|
]
|
||||||
& useAim . aimSpeed .~ 0.4
|
|
||||||
, _itParams = BulletShooter
|
, _itParams = BulletShooter
|
||||||
{ _muzVel = 0.7
|
{ _muzVel = 0.7
|
||||||
, _rifling = 0.8
|
, _rifling = 0.8
|
||||||
, _bore = 5
|
, _bore = 5
|
||||||
, _gunBarrels = SingleBarrel 0.5
|
, _gunBarrels = SingleBarrel 0.5
|
||||||
|
, _recoil = 150
|
||||||
|
, _torqueAfter = 0.1
|
||||||
|
, _randomOffset = 12
|
||||||
}
|
}
|
||||||
, _itDimension = ItemDimension
|
, _itDimension = ItemDimension
|
||||||
{ _dimRad = 8
|
{ _dimRad = 8
|
||||||
@@ -151,22 +156,33 @@ 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 . aoType . amBulWth .~ wth)
|
||||||
coneRandItemParams :: State StdGen ItemParams
|
coneRandItemParams :: State StdGen (ItemParams -> ItemParams)
|
||||||
coneRandItemParams = do
|
coneRandItemParams = do
|
||||||
muzv <- state $ randomR (0.5,1)
|
muzv <- state $ randomR (0.5,1)
|
||||||
rifl <- state $ randomR (0.3,0.9)
|
rifl <- state $ randomR (0.3,0.9)
|
||||||
return $ BulletShooter
|
return $ \itparams -> itparams
|
||||||
{ _muzVel = muzv
|
{ _muzVel = muzv
|
||||||
, _rifling = rifl
|
, _rifling = rifl
|
||||||
, _bore = 5
|
|
||||||
, _gunBarrels = SingleBarrel 0.5
|
|
||||||
}
|
}
|
||||||
|
|
||||||
blunderbuss :: Item
|
blunderbuss :: Item
|
||||||
blunderbuss = bangCone
|
blunderbuss = bangCone
|
||||||
{_itName = "BLUNDERBUSS"
|
{_itName = "BLUNDERBUSS"
|
||||||
,_itType = BLUNDERBUSS
|
,_itType = BLUNDERBUSS
|
||||||
,_itUse = ruseAmmoParamsRate 20 upHammer
|
, _itDimension = ItemDimension
|
||||||
|
{ _dimRad = 8
|
||||||
|
, _dimCenter = V3 5 0 0
|
||||||
|
, _dimPortage = HeldItem
|
||||||
|
{_handlePos = 5
|
||||||
|
,_muzPos = 30
|
||||||
|
}
|
||||||
|
, _dimSPic = const $ noPic $ colorSH cyan $ upperPrismPoly 3 (rectXH 20 2)
|
||||||
|
<> upperPrismPoly 6 (rectNSEW 4 (-4) 30 20)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
& itConsumption . ammoBaseMax .~ 25
|
||||||
|
& itConsumption . reloadTime .~ 30
|
||||||
|
& itUse . useMods .~
|
||||||
[ ammoCheckI
|
[ ammoCheckI
|
||||||
, hammerCheckI
|
, hammerCheckI
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
@@ -181,21 +197,8 @@ blunderbuss = bangCone
|
|||||||
, withRandomItemUpdate coneRandItemUpdate
|
, withRandomItemUpdate coneRandItemUpdate
|
||||||
, withRandomItemParams coneRandItemParams
|
, withRandomItemParams coneRandItemParams
|
||||||
]
|
]
|
||||||
& useAim . aimStance .~ TwoHandTwist
|
& itUse . useAim . aimStance .~ TwoHandTwist
|
||||||
& useAim . aimSpeed .~ 0.4
|
& itUse . useAim . aimSpeed .~ 0.4
|
||||||
, _itDimension = ItemDimension
|
|
||||||
{ _dimRad = 8
|
|
||||||
, _dimCenter = V3 5 0 0
|
|
||||||
, _dimPortage = HeldItem
|
|
||||||
{_handlePos = 5
|
|
||||||
,_muzPos = 30
|
|
||||||
}
|
|
||||||
, _dimSPic = const $ noPic $ colorSH cyan $ upperPrismPoly 3 (rectXH 20 2)
|
|
||||||
<> upperPrismPoly 6 (rectNSEW 4 (-4) 30 20)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
& itConsumption . ammoBaseMax .~ 25
|
|
||||||
& itConsumption . reloadTime .~ 30
|
|
||||||
bigBlunderbuss :: Item
|
bigBlunderbuss :: Item
|
||||||
bigBlunderbuss = blunderbuss
|
bigBlunderbuss = blunderbuss
|
||||||
{_itName = "BIGBLUNDERBUSS"
|
{_itName = "BIGBLUNDERBUSS"
|
||||||
@@ -349,7 +352,7 @@ ltAutoGun = defaultAutoGun
|
|||||||
, modClock 2 withMuzFlareI
|
, modClock 2 withMuzFlareI
|
||||||
]
|
]
|
||||||
-- , _itFloorPict = ltAutoGunPic
|
-- , _itFloorPict = ltAutoGunPic
|
||||||
, _itParams = BulletShooter
|
, _itParams = defBulletShooter
|
||||||
{ _muzVel = 1
|
{ _muzVel = 1
|
||||||
, _rifling = 0.8
|
, _rifling = 0.8
|
||||||
, _bore = 2
|
, _bore = 2
|
||||||
@@ -377,7 +380,7 @@ spreadGun = defaultGun
|
|||||||
, withMuzFlareI
|
, withMuzFlareI
|
||||||
, spreadNumI
|
, spreadNumI
|
||||||
]
|
]
|
||||||
, _itParams = BulletShooter
|
, _itParams = defBulletShooter
|
||||||
{ _muzVel = 0.7
|
{ _muzVel = 0.7
|
||||||
, _rifling = 0.8
|
, _rifling = 0.8
|
||||||
, _bore = 2
|
, _bore = 2
|
||||||
@@ -416,7 +419,7 @@ multGun = defaultGun
|
|||||||
& useAim . aimStance .~ TwoHandTwist
|
& useAim . aimStance .~ TwoHandTwist
|
||||||
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
|
& useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
|
||||||
-- , _itFloorPict = multGunSPic
|
-- , _itFloorPict = multGunSPic
|
||||||
, _itParams = BulletShooter
|
, _itParams = defBulletShooter
|
||||||
{ _muzVel = 1
|
{ _muzVel = 1
|
||||||
, _rifling = 0.9
|
, _rifling = 0.9
|
||||||
, _bore = 3
|
, _bore = 3
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ module Dodge.Item.Weapon.TriggerType
|
|||||||
, torqueBefore
|
, torqueBefore
|
||||||
, torqueBeforeAtLeast
|
, torqueBeforeAtLeast
|
||||||
, torqueAfterI
|
, torqueAfterI
|
||||||
|
, withTorqueAfter
|
||||||
, torqueSideEffect
|
, torqueSideEffect
|
||||||
, withRandomItemParams
|
, withRandomItemParams
|
||||||
, withRandomItemUpdate
|
, withRandomItemUpdate
|
||||||
@@ -29,8 +30,10 @@ module Dodge.Item.Weapon.TriggerType
|
|||||||
, withPositionWallCheck
|
, withPositionWallCheck
|
||||||
, withPosDirWallCheck
|
, withPosDirWallCheck
|
||||||
, withRandomOffsetI
|
, withRandomOffsetI
|
||||||
|
, withRandomOffset
|
||||||
, withRandomDirI
|
, withRandomDirI
|
||||||
, withRecoilI
|
, withRecoilI
|
||||||
|
, withRecoil
|
||||||
, afterRecoil
|
, afterRecoil
|
||||||
, withSidePushAfterI
|
, withSidePushAfterI
|
||||||
, withSidePushI
|
, withSidePushI
|
||||||
@@ -242,6 +245,12 @@ withRecoilI recoilAmount eff item cr = eff item cr . over (creatures . ix cid) p
|
|||||||
where
|
where
|
||||||
cid = _crID cr
|
cid = _crID cr
|
||||||
pushback = over crPos (+.+ rotateV (_crDir cr) (V2 ((-recoilAmount) / _crMass cr ) 0))
|
pushback = over crPos (+.+ rotateV (_crDir cr) (V2 ((-recoilAmount) / _crMass cr ) 0))
|
||||||
|
withRecoil :: ChainEffect
|
||||||
|
withRecoil eff it cr = eff it cr . over (creatures . ix cid) pushback
|
||||||
|
where
|
||||||
|
cid = _crID cr
|
||||||
|
recoilAmount = fromMaybe 0 $ it ^? itParams . recoil
|
||||||
|
pushback = over crPos (+.+ rotateV (_crDir cr) (V2 ((-recoilAmount) / _crMass cr ) 0))
|
||||||
{- | Pushes a creature sideways by a random amount.
|
{- | Pushes a creature sideways by a random amount.
|
||||||
Applied before the underlying effect. -}
|
Applied before the underlying effect. -}
|
||||||
withSidePushI
|
withSidePushI
|
||||||
@@ -395,12 +404,10 @@ withRandomItemUpdate randItUp eff it cr w = eff (f it) cr $ w & randGen .~ g
|
|||||||
where
|
where
|
||||||
(f,g) = runState randItUp (_randGen w)
|
(f,g) = runState randItUp (_randGen w)
|
||||||
|
|
||||||
withRandomItemParams
|
withRandomItemParams :: State StdGen (ItemParams -> ItemParams) -> ChainEffect
|
||||||
:: State StdGen ItemParams
|
withRandomItemParams rip eff it cr w = eff (it & itParams %~ f) cr $ w & randGen .~ g
|
||||||
-> ChainEffect
|
|
||||||
withRandomItemParams rip eff it cr w = eff (it & itParams .~ it') cr $ w & randGen .~ g
|
|
||||||
where
|
where
|
||||||
(it',g) = runState rip (_randGen w)
|
(f,g) = runState rip (_randGen w)
|
||||||
|
|
||||||
withPositionOffset
|
withPositionOffset
|
||||||
:: (Item -> Creature -> World -> (Point2,Float))
|
:: (Item -> Creature -> World -> (Point2,Float))
|
||||||
@@ -434,6 +441,13 @@ withRandomOffsetI offsetAmount f item cr w = f item (cr & crPos %~ (+.+ offV)) $
|
|||||||
where
|
where
|
||||||
(offsetVal , g) = randomR (-offsetAmount,offsetAmount) $ _randGen w
|
(offsetVal , g) = randomR (-offsetAmount,offsetAmount) $ _randGen w
|
||||||
offV = rotateV (_crDir cr) (V2 0 offsetVal)
|
offV = rotateV (_crDir cr) (V2 0 offsetVal)
|
||||||
|
{- | Apply the effect to a translated creature. -}
|
||||||
|
withRandomOffset :: ChainEffect
|
||||||
|
withRandomOffset f item cr w = f item (cr & crPos %~ (+.+ offV)) $ set randGen g w
|
||||||
|
where
|
||||||
|
(offsetVal , g) = randomR (-offsetAmount,offsetAmount) $ _randGen w
|
||||||
|
offV = rotateV (_crDir cr) (V2 0 offsetVal)
|
||||||
|
offsetAmount = fromMaybe 0 $ item ^? itParams . randomOffset
|
||||||
-- | Rotates a creature
|
-- | Rotates a creature
|
||||||
torqueBefore
|
torqueBefore
|
||||||
:: Float -- ^ Max possible rotation
|
:: Float -- ^ Max possible rotation
|
||||||
@@ -465,8 +479,7 @@ torqueBeforeAtLeast minTorque exTorque feff item cr w
|
|||||||
rot' | rot < 0 = rot - minTorque
|
rot' | rot < 0 = rot - minTorque
|
||||||
| otherwise = rot + minTorque
|
| otherwise = rot + minTorque
|
||||||
-- | Rotate a randomly creature after applying an effect.
|
-- | Rotate a randomly creature after applying an effect.
|
||||||
torqueAfterI
|
torqueAfterI :: Float -- ^ Max possible rotation
|
||||||
:: Float -- ^ Max possible rotation
|
|
||||||
-> ChainEffect
|
-> ChainEffect
|
||||||
torqueAfterI torque feff item cr w
|
torqueAfterI torque feff item cr w
|
||||||
-- | cid == 0 = rotateScope $ set randGen g $ over cameraRot (+rot) $ feff item cr w
|
-- | cid == 0 = rotateScope $ set randGen g $ over cameraRot (+rot) $ feff item cr w
|
||||||
@@ -477,6 +490,17 @@ torqueAfterI torque feff item cr w
|
|||||||
(rot, g) = randomR (-torque,torque) $ _randGen w
|
(rot, g) = randomR (-torque,torque) $ _randGen w
|
||||||
-- rotateScope = creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
|
-- rotateScope = creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
|
||||||
-- . itAttachment . scopePos %~ rotateV rot
|
-- . itAttachment . scopePos %~ rotateV rot
|
||||||
|
--
|
||||||
|
-- | Rotate a randomly creature after applying an effect.
|
||||||
|
withTorqueAfter :: ChainEffect
|
||||||
|
withTorqueAfter feff item cr w
|
||||||
|
-- | cid == 0 = rotateScope $ set randGen g $ over cameraRot (+rot) $ feff item cr w
|
||||||
|
| cid == 0 = set randGen g $ over cameraRot (+rot) $ feff item cr w
|
||||||
|
| otherwise = set randGen g $ over (creatures . ix cid . crDir) (+rot) $ feff item cr w
|
||||||
|
where
|
||||||
|
cid = _crID cr
|
||||||
|
(rot, g) = randomR (-torque,torque) $ _randGen w
|
||||||
|
torque = fromMaybe 0 $ item ^? itParams. torqueAfter
|
||||||
|
|
||||||
spreadNumI :: ChainEffect
|
spreadNumI :: ChainEffect
|
||||||
spreadNumI eff item cr w = foldr f w dirs
|
spreadNumI eff item cr w = foldr f w dirs
|
||||||
|
|||||||
Reference in New Issue
Block a user