Rethink weapon repetitions

This commit is contained in:
2025-06-04 21:03:25 +01:00
parent 9797f610aa
commit 62cac29a59
7 changed files with 166 additions and 187 deletions
+7 -4
View File
@@ -90,6 +90,8 @@ hammerCheck f pt it cr
| BurstTrigger is <- baseTriggerType (it ^. ldtValue)
, pt == InitialPress = f it cr
. (cWorld . lWorld . delayedEvents .++~ map g is)
| BurstTrigger {} <- baseTriggerType (it ^. ldtValue)
, pt /= InitialPress = id
| t <- baseTriggerType (it ^. ldtValue)
, t == HammerTrigger || t == AlwaysSingleTrigger
, isNothing $ lookup MakeAutoLink (it ^. ldtRight)
@@ -101,8 +103,8 @@ hammerCheck f pt it cr
upitm x =
it -- & ldtValue . itUse . heldParams . weaponRepeat .~ []
& ldtValue . itUse . heldFrame .~ x
--g x = (x, WdWdBurstFireRepeats (_crID cr) (it ^?! ldtValue . itLocation . ilInvID))
-- | Applies a world effect after an item use cooldown check.
useTimeCheck :: ChainEffect
useTimeCheck f item cr w = case item ^? ldtValue . itUse . heldDelay of
@@ -135,7 +137,8 @@ heldEffectMuzzles t cr w =
-- & doWeaponRepetitions upitm cr
where
muzzles = t ^. ldtValue . itUse . heldMuzzles
(upitm, loadedmuzzles) = mapAccumR loadMuzzle t muzzles
--(upitm, loadedmuzzles) = mapAccumR loadMuzzle t muzzles
(_, loadedmuzzles) = mapAccumR loadMuzzle t muzzles
cmew = foldl' (useLoadedAmmo t cr) (CME 0 0 False, w) $ zip [0 ..] loadedmuzzles
doHeldUseEffect :: LabelDoubleTree ComposeLinkType Item -> Creature -> World -> World
@@ -263,9 +266,9 @@ applySoundCME itm cr = fromMaybe id $ do
cid = _crID cr
applyRecoil :: Item -> Creature -> World -> World
applyRecoil itm cr = cWorld . lWorld . creatures . ix (_crID cr) %~ pushback
applyRecoil itm cr = cWorld . lWorld . creatures . ix (_crID cr) . crPos +~ pushback
where
pushback = over crPos (+.+ rotateV (_crDir cr) (V2 ((- recoilAmount itm) / _crMass cr) 0))
pushback = rotateV (_crDir cr) (V2 ((- recoilAmount itm) / _crMass cr) 0)
recoilAmount :: Item -> Float
recoilAmount itm