Fix blink bug
This commit is contained in:
@@ -101,6 +101,17 @@ mvPointTowardAtSpeed
|
||||
mvPointTowardAtSpeed !speed !ep !p
|
||||
| dist p ep < speed = ep
|
||||
| otherwise = p +.+ speed *.* normalizeV (ep -.- p)
|
||||
{- | given a target and a start point, shift toward the end point by a given
|
||||
amount.
|
||||
If close enough, go past the end point -}
|
||||
mvPointAlongAtSpeed
|
||||
:: Float -- ^ Speed.
|
||||
-> Point2 -- ^ End point.
|
||||
-> Point2 -- ^ Start point.
|
||||
-> Point2
|
||||
mvPointAlongAtSpeed !speed !ep !p
|
||||
| dist p ep == 0 = ep
|
||||
| otherwise = p +.+ speed *.* normalizeV (ep -.- p)
|
||||
{- | given a target and a start point, shift toward the end point by 1.
|
||||
If close enough, end up on the end point -}
|
||||
mvPointToward
|
||||
|
||||
@@ -15,6 +15,7 @@ module Dodge.Base.Collide (
|
||||
collidePoint,
|
||||
collidePointWallsFilter,
|
||||
collidePointTestFilter,
|
||||
collideCircWalls,
|
||||
overlapSegWalls,
|
||||
overlapSegCrs,
|
||||
bounceBall,
|
||||
@@ -69,6 +70,7 @@ doBounce :: Float -> Point2 -> Point2 -> (Point2, Maybe Wall) -> Maybe (Point2,
|
||||
{-# INLINE doBounce #-}
|
||||
doBounce x sp ep (p, mwl) =
|
||||
mwl <&> \wl ->
|
||||
--( p +.+ normalizeV (vNormal (uncurry (-.-) (_wlLine wl)))
|
||||
( p +.+ normalizeV (vNormal (uncurry (-.-) (_wlLine wl)))
|
||||
, reflVelWallDamp x wl (ep -.- sp)
|
||||
)
|
||||
|
||||
@@ -8,7 +8,7 @@ module Dodge.Creature.Action (
|
||||
dropUnselected,
|
||||
dropExcept,
|
||||
dropItem,
|
||||
blinkAction,
|
||||
blinkActionMousePos,
|
||||
blinkActionFail,
|
||||
unsafeBlinkAction,
|
||||
sizeSelf,
|
||||
@@ -22,6 +22,7 @@ import Data.Bifunctor
|
||||
import Data.List (findIndex)
|
||||
import Data.Maybe
|
||||
import Dodge.Base
|
||||
import Dodge.Creature.Action.Blink
|
||||
import Dodge.CreatureEffect
|
||||
import Dodge.Data.World
|
||||
import Dodge.Default
|
||||
@@ -32,11 +33,9 @@ import Dodge.Inventory.Add
|
||||
import Dodge.Path
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.WallCreatureCollisions
|
||||
import Dodge.WorldEvent.Shockwave
|
||||
import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
import LensHelp
|
||||
import Picture
|
||||
|
||||
performActions :: World -> Creature -> Creature
|
||||
performActions w cr =
|
||||
@@ -145,88 +144,6 @@ performAction cr w ac = case ac of
|
||||
(imps, _) -> (imps, Just $ DoReplicatePartial startac (t -1) startac)
|
||||
NoAction -> ([], Nothing)
|
||||
|
||||
-- | Like a blink action, but no ingoing distortion
|
||||
blinkActionFail ::
|
||||
Creature ->
|
||||
World ->
|
||||
World
|
||||
blinkActionFail cr w =
|
||||
w
|
||||
& soundMultiFrom [TeleSound 0, TeleSound 1] p3 teleS Nothing
|
||||
& cWorld . distortions .:~ distortionBulge
|
||||
& cWorld . creatures . ix cid . crPos .~ p3
|
||||
& inverseShockwaveAt cpos 40 2 2
|
||||
where
|
||||
distR = 120
|
||||
distortionBulge = RadialDistortion cpos (cpos +.+ V2 distR 0) (cpos +.+ V2 0 distR) 1.9
|
||||
cid = _crID cr
|
||||
p1 = mouseWorldPos w
|
||||
cpos = _crPos cr
|
||||
p2 = bouncePoint (const True) 1 cpos p1 w
|
||||
r = 1.5 * _crRad cr
|
||||
p3 = maybe p1 (mvPointTowardAtSpeed r cpos . fst) p2
|
||||
|
||||
-- | Teleport a creature to the mouse position
|
||||
blinkAction :: Creature -> World -> World
|
||||
blinkAction cr w =
|
||||
w
|
||||
& soundMultiFrom [TeleSound 0, TeleSound 1] p3 teleS Nothing
|
||||
& cWorld . distortions .++~ distortionBulge
|
||||
& cWorld . creatures . ix cid . crPos .~ p3
|
||||
& blinkShockwave cid p3
|
||||
& inverseShockwaveAt cpos 40 2 2
|
||||
where
|
||||
distR = 120
|
||||
distortionBulge =
|
||||
[ RadialDistortion p3 (p3 +.+ V2 distR 0) (p3 +.+ V2 0 distR) 0.1
|
||||
, RadialDistortion cpos (cpos +.+ V2 distR 0) (cpos +.+ V2 0 distR) 1.9
|
||||
]
|
||||
cid = _crID cr
|
||||
p1 = mouseWorldPos w
|
||||
cpos = _crPos cr
|
||||
p2 = bouncePoint (const True) 1 cpos p1 w
|
||||
r = 1.5 * _crRad cr
|
||||
p3 = maybe p1 (mvPointTowardAtSpeed r cpos . fst) p2
|
||||
|
||||
{- | Teleport a creature to the mouse position.
|
||||
Can go through walls, if ending up in wall does big damage.
|
||||
-}
|
||||
unsafeBlinkAction ::
|
||||
Creature ->
|
||||
World ->
|
||||
World
|
||||
unsafeBlinkAction cr w
|
||||
| success =
|
||||
soundMultiFrom [TeleSound 0, TeleSound 1] mwp teleS Nothing
|
||||
. (cWorld . distortions .++~ distortionBulge)
|
||||
. set (cWorld . creatures . ix cid . crPos) mwp
|
||||
. blinkShockwave cid mwp
|
||||
$ inverseShockwaveAt cpos 40 2 2 w
|
||||
| otherwise =
|
||||
w
|
||||
& blinkActionFail cr
|
||||
& cWorld . creatures . ix cid . crState . csDamage
|
||||
.:~ Damage ENTERREMENT 10000 mwp mwp mwp NoDamageEffect
|
||||
where
|
||||
success = fromMaybe True $ do
|
||||
wl <- snd $ collidePointWallsFilter (const True) mwp cpos w
|
||||
return (isLHS mwp `uncurry` _wlLine wl)
|
||||
distR = 120
|
||||
distortionBulge =
|
||||
[ RadialDistortion mwp (mwp +.+ V2 distR 0) (mwp +.+ V2 0 distR) 0.1
|
||||
, RadialDistortion cpos (cpos +.+ V2 distR 0) (cpos +.+ V2 0 distR) 1.9
|
||||
]
|
||||
cid = _crID cr
|
||||
mwp = mouseWorldPos w
|
||||
cpos = _crPos cr
|
||||
|
||||
blinkShockwave ::
|
||||
-- | Blinking creature ID.
|
||||
Int ->
|
||||
Point2 ->
|
||||
World ->
|
||||
World
|
||||
blinkShockwave i p = makeShockwaveAt [i] p 60 1 2 cyan
|
||||
|
||||
setMinInvSize :: Int -> Creature -> World -> World
|
||||
setMinInvSize n cr = cWorld . creatures . ix (_crID cr) . crInvCapacity .~ n
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
module Dodge.Creature.Action.Blink (
|
||||
blinkActionMousePos,
|
||||
blinkActionFail,
|
||||
unsafeBlinkAction,
|
||||
) where
|
||||
|
||||
import Dodge.Zoning.Wall
|
||||
import Data.Maybe
|
||||
import Dodge.Base
|
||||
import Dodge.Data.World
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.WorldEvent.Shockwave
|
||||
import Geometry
|
||||
import LensHelp
|
||||
import Picture
|
||||
|
||||
-- | Teleport a creature to the mouse position
|
||||
blinkActionMousePos :: Creature -> World -> World
|
||||
blinkActionMousePos cr w =
|
||||
w
|
||||
& soundMultiFrom [TeleSound 0, TeleSound 1] p3 teleS Nothing
|
||||
& blinkDistortions cpos p3
|
||||
& cWorld . creatures . ix cid . crPos .~ p3
|
||||
& blinkShockwave cid p3
|
||||
& inverseShockwaveAt cpos 40 2 2
|
||||
where
|
||||
cid = _crID cr
|
||||
p1 = mouseWorldPos w
|
||||
cpos = _crPos cr
|
||||
--p2 = bouncePoint (const True) 1 cpos p1 w
|
||||
p2 = pushIntoMaybe $ collideCircWalls cpos p1 r (wlsNearSeg cpos p1 w)
|
||||
r = _crRad cr
|
||||
p3 = maybe p1 ((+.+ squashNormalizeV (cpos -.- p1)) . fst) p2
|
||||
--p3 = maybe p1 (const 0) p2
|
||||
--p3 = maybe p1 fst p2
|
||||
pushIntoMaybe :: (a, Maybe b) -> Maybe (a,b)
|
||||
pushIntoMaybe (x,my) = (x,) <$> my
|
||||
|
||||
blinkDistortions :: Point2 -> Point2 -> World -> World
|
||||
blinkDistortions sp ep = cWorld . distortions .++~ distortionBulge
|
||||
where
|
||||
distR = 120
|
||||
distortionBulge =
|
||||
[ RadialDistortion ep (ep +.+ V2 distR 0) (ep +.+ V2 0 distR) 0.1
|
||||
, RadialDistortion sp (sp +.+ V2 distR 0) (sp +.+ V2 0 distR) 1.9
|
||||
]
|
||||
|
||||
{- | Teleport a creature to the mouse position.
|
||||
Can go through walls, if ending up in wall does big damage.
|
||||
-}
|
||||
unsafeBlinkAction ::
|
||||
Creature ->
|
||||
World ->
|
||||
World
|
||||
unsafeBlinkAction cr w
|
||||
| success =
|
||||
soundMultiFrom [TeleSound 0, TeleSound 1] mwp teleS Nothing
|
||||
. blinkDistortions cpos mwp
|
||||
. set (cWorld . creatures . ix cid . crPos) mwp
|
||||
. blinkShockwave cid mwp
|
||||
$ inverseShockwaveAt cpos 40 2 2 w
|
||||
| otherwise =
|
||||
w
|
||||
& blinkActionFail cr
|
||||
& cWorld . creatures . ix cid . crState . csDamage
|
||||
.:~ Damage ENTERREMENT 10000 mwp mwp mwp NoDamageEffect
|
||||
where
|
||||
success = fromMaybe True $ do
|
||||
wl <- snd $ collidePointWallsFilter (const True) mwp cpos w
|
||||
return (isLHS mwp `uncurry` _wlLine wl)
|
||||
cid = _crID cr
|
||||
mwp = mouseWorldPos w
|
||||
cpos = _crPos cr
|
||||
|
||||
blinkShockwave ::
|
||||
-- | Blinking creature ID.
|
||||
Int ->
|
||||
Point2 ->
|
||||
World ->
|
||||
World
|
||||
blinkShockwave i p = makeShockwaveAt [i] p 60 1 2 cyan
|
||||
|
||||
-- | Like a blink action, but no ingoing distortion
|
||||
blinkActionFail ::
|
||||
Creature ->
|
||||
World ->
|
||||
World
|
||||
blinkActionFail cr w =
|
||||
w
|
||||
& soundMultiFrom [TeleSound 0, TeleSound 1] p3 teleS Nothing
|
||||
& cWorld . distortions .:~ distortionBulge
|
||||
& cWorld . creatures . ix cid . crPos .~ p3
|
||||
& inverseShockwaveAt cpos 40 2 2
|
||||
where
|
||||
distR = 120
|
||||
distortionBulge = RadialDistortion cpos (cpos +.+ V2 distR 0) (cpos +.+ V2 0 distR) 1.9
|
||||
cid = _crID cr
|
||||
p1 = mouseWorldPos w
|
||||
cpos = _crPos cr
|
||||
p2 = bouncePoint (const True) 1 cpos p1 w
|
||||
r = 1.5 * _crRad cr
|
||||
p3 = maybe p1 (mvPointTowardAtSpeed r cpos . fst) p2
|
||||
@@ -30,7 +30,7 @@ useItem cr' w = fromMaybe (f w) $ do
|
||||
itemEffect :: Creature -> Item -> World -> World
|
||||
itemEffect cr it w = case it ^. itUse of
|
||||
HeldUse{_heldUse = eff, _heldMods = usemods} ->
|
||||
hammerTest $ tryReload cr it w $ foldl' (flip ($)) (useHeld eff) (reverse $ useMod usemods) it cr
|
||||
hammerTest $ tryReload cr it w $ foldl' (&) (useHeld eff) (reverse $ useMod usemods) it cr
|
||||
LeftUse{} -> doequipmentchange
|
||||
EquipUse{} -> doequipmentchange
|
||||
-- ConsumeUse will cause problems if the item is not selected
|
||||
@@ -125,8 +125,7 @@ useLeftItem cid w
|
||||
itmIsConsumable =
|
||||
isJust (cr ^? crInv . ix (crSel cr) . itUse . cUse)
|
||||
itmIsEquipable =
|
||||
( isJust (cr ^? crInv . ix (crSel cr) . itUse . equipEffect . eeUse)
|
||||
isJust (cr ^? crInv . ix (crSel cr) . itUse . equipEffect . eeUse)
|
||||
&& _crLeftInvSel cr /= Just (crSel cr)
|
||||
)
|
||||
|
||||
-- TODO determine itmShouldBeUsed with reference to config options
|
||||
|
||||
@@ -202,7 +202,7 @@ movementSideEff cr w
|
||||
useUpdate :: ItemUse -> ItemUse
|
||||
useUpdate =
|
||||
(heldHammer %~ moveHammerUp)
|
||||
. (leftHammer %~ moveHammerUp)
|
||||
. (leftHammer %~ moveHammerUp)
|
||||
. (leftDelay . rateTime %~ decreaseToZero)
|
||||
. (heldDelay . warmTime %~ decreaseToZero)
|
||||
. (heldDelay . rateTime %~ decreaseToZero)
|
||||
@@ -246,7 +246,7 @@ itemUpdate cr i
|
||||
| otherwise = baseupdate False
|
||||
where
|
||||
baseupdate bool =
|
||||
updateAutoRecharge
|
||||
updateAutoRecharge
|
||||
. (itUse %~ useUpdate)
|
||||
. (itLocation .~ InInv (_crID cr) i)
|
||||
. (itIsHeld .~ bool)
|
||||
|
||||
+207
-209
@@ -28,309 +28,307 @@ useMod :: HeldMod -> [(Item -> Creature -> World -> World) -> Item -> Creature -
|
||||
useMod hm = case hm of
|
||||
HeldModNothing -> []
|
||||
PoisonSprayerMod ->
|
||||
[ ammoCheckI
|
||||
[ useAmmoAmount 1
|
||||
, withSoundForI foamSprayLoopS 5
|
||||
, useAmmoAmount 1
|
||||
, ammoCheckI
|
||||
]
|
||||
FlameSpitterMod ->
|
||||
[ ammoCheckI
|
||||
, useTimeCheck
|
||||
, lockInvFor 10
|
||||
, repeatOnFrames [1 .. 9] FlameSpitterRepeatMod
|
||||
, withRandomItemParams f
|
||||
, useAmmoAmount 1
|
||||
[ withSidePushAfterI 20
|
||||
, withSidePushI 5
|
||||
, withSidePushAfterI 20
|
||||
, useAmmoAmount 1
|
||||
, withRandomItemParams f
|
||||
, repeatOnFrames [1 .. 9] FlameSpitterRepeatMod
|
||||
, lockInvFor 10
|
||||
, useTimeCheck
|
||||
, ammoCheckI
|
||||
]
|
||||
FlameSpitterRepeatMod ->
|
||||
[ ammoCheckI
|
||||
, withRandomItemParams f
|
||||
, useAmmoAmount 1
|
||||
[ withSidePushAfterI 20
|
||||
, withSidePushI 5
|
||||
, withSidePushAfterI 20
|
||||
, useAmmoAmount 1
|
||||
, withRandomItemParams f
|
||||
, ammoCheckI
|
||||
]
|
||||
FlameThrowerMod ->
|
||||
[ ammoCheckI
|
||||
, useAmmoAmount 1
|
||||
[ withSidePushAfterI 20
|
||||
--, withTempLight 1 100 (V3 1 0 0)
|
||||
, withSidePushI 5
|
||||
, --, withTempLight 1 100 (V3 1 0 0)
|
||||
withSidePushAfterI 20
|
||||
, useAmmoAmount 1
|
||||
, ammoCheckI
|
||||
]
|
||||
LauncherMod ->
|
||||
[ hammerCheckI
|
||||
, ammoCheckI
|
||||
, useTimeCheck
|
||||
[ useAmmoAmount 1
|
||||
, withSoundStart tap4S
|
||||
, useAmmoAmount 1
|
||||
, useTimeCheck
|
||||
, ammoCheckI
|
||||
, hammerCheckI
|
||||
]
|
||||
TeslaMod ->
|
||||
[ ammoCheckI
|
||||
, withTempLight 1 100 (V3 0 0 1)
|
||||
[ useAmmoAmount 1
|
||||
, withSoundForI elecCrackleS 1
|
||||
, useAmmoAmount 1
|
||||
, withTempLight 1 100 (V3 0 0 1)
|
||||
, ammoCheckI
|
||||
]
|
||||
CircleLaserMod ->
|
||||
[ ammoCheckI
|
||||
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
, withSoundForI tone440sawtoothquietS 2
|
||||
, useAmmoAmount 1
|
||||
[ duplicateItem fLasCircle
|
||||
, withItemUpdate' increasecycleLasCircle
|
||||
, duplicateItem fLasCircle
|
||||
, useAmmoAmount 1
|
||||
, withSoundForI tone440sawtoothquietS 2
|
||||
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
, ammoCheckI
|
||||
]
|
||||
LasWideMod n ->
|
||||
[ ammoCheckI
|
||||
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
, withSoundForI tone440sawtoothquietS 2
|
||||
, useAmmoAmount 1
|
||||
, crAtMuzPos
|
||||
[ withItem $ \it -> duplicateOffsetsV2 (xsLasWide it)
|
||||
, withItemUpdate' (increasecycleLasWide n)
|
||||
, withItem $ \it -> duplicateOffsetsV2 (xsLasWide it)
|
||||
, crAtMuzPos
|
||||
, useAmmoAmount 1
|
||||
, withSoundForI tone440sawtoothquietS 2
|
||||
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
, ammoCheckI
|
||||
]
|
||||
DualBeamMod ->
|
||||
[ ammoCheckI
|
||||
, withItem $ \it -> withMuzPosShift (V2 0 (thegapDualBeam it)) $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
, withItem $ \it -> withMuzPosShift (V2 0 (- thegapDualBeam it)) $ flareCircleAt (_lasColor2 $ _itParams it) 0.8
|
||||
[ useAmmoAmount 1
|
||||
, withSoundForI tone440sawtoothquietS 2
|
||||
, useAmmoAmount 1
|
||||
, withItem $ \it -> withMuzPosShift (V2 0 (- thegapDualBeam it)) $ flareCircleAt (_lasColor2 $ _itParams it) 0.8
|
||||
, withItem $ \it -> withMuzPosShift (V2 0 (thegapDualBeam it)) $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
, ammoCheckI
|
||||
]
|
||||
LasMod ->
|
||||
[ ammoCheckI
|
||||
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
, withSoundForI tone440sawtoothquietS 2
|
||||
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
[ crAtMuzPos
|
||||
, useAmmoAmount 1
|
||||
, crAtMuzPos
|
||||
, withItem $ \it -> withMuzPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
, withSoundForI tone440sawtoothquietS 2
|
||||
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
, ammoCheckI
|
||||
]
|
||||
LauncherXMod i ->
|
||||
[ hammerCheckI
|
||||
, ammoCheckI
|
||||
, useTimeCheck
|
||||
[ useAmmoAmount i
|
||||
, withSoundStart tap4S
|
||||
, useAmmoAmount i
|
||||
, useTimeCheck
|
||||
, ammoCheckI
|
||||
, hammerCheckI
|
||||
]
|
||||
ShatterMod ->
|
||||
[ ammoHammerCheck
|
||||
[ useAmmoAmount 1
|
||||
-- , withSoundStart tap3S
|
||||
, useTimeCheck
|
||||
, -- , withSoundStart tap3S
|
||||
useAmmoAmount 1
|
||||
, ammoHammerCheck
|
||||
]
|
||||
AmmoCheckMod -> [ammoCheckI]
|
||||
AmmoUseCheckMod -> [ammoUseCheck]
|
||||
AmmoHammerTimeUseOneMod ->
|
||||
[ ammoHammerCheck
|
||||
[ useAmmoAmount 1
|
||||
, useTimeCheck
|
||||
, useAmmoAmount 1
|
||||
, ammoHammerCheck
|
||||
]
|
||||
BangCaneMod ->
|
||||
[ ammoHammerCheck
|
||||
, useTimeCheck
|
||||
, withSoundStart tap3S
|
||||
, useAmmoAmount 1
|
||||
, withTorqueAfter
|
||||
, applyInaccuracy
|
||||
, withRecoil
|
||||
[ withMuzFlareI
|
||||
, withSmoke 1 black 20 200 5
|
||||
, withMuzFlareI
|
||||
, withRecoil
|
||||
, applyInaccuracy
|
||||
, withTorqueAfter
|
||||
, useAmmoAmount 1
|
||||
, withSoundStart tap3S
|
||||
, useTimeCheck
|
||||
, ammoHammerCheck
|
||||
]
|
||||
VolleyGunMod ->
|
||||
[ ammoHammerCheck
|
||||
, useTimeCheck
|
||||
, withSoundItemChoiceStart caneStickSoundChoice
|
||||
, useAllAmmo
|
||||
, withTorqueAfter
|
||||
, duplicateLoadedBarrels
|
||||
, applyInaccuracy
|
||||
[ withRecoil
|
||||
, withMuzFlareI
|
||||
, withRecoil
|
||||
, applyInaccuracy
|
||||
, duplicateLoadedBarrels
|
||||
, withTorqueAfter
|
||||
, useAllAmmo
|
||||
, withSoundItemChoiceStart caneStickSoundChoice
|
||||
, useTimeCheck
|
||||
, ammoHammerCheck
|
||||
]
|
||||
AutoRifleMod ->
|
||||
-- note this is the same as BangCanemMod with the first changed
|
||||
[ ammoCheckI
|
||||
, useTimeCheck
|
||||
, withSoundStart tap3S
|
||||
, useAmmoAmount 1
|
||||
, withTorqueAfter
|
||||
, applyInaccuracy
|
||||
, withRecoil
|
||||
[ withMuzFlareI
|
||||
, withSmoke 1 black 20 200 5
|
||||
, withMuzFlareI
|
||||
, withRecoil
|
||||
, applyInaccuracy
|
||||
, withTorqueAfter
|
||||
, useAmmoAmount 1
|
||||
, withSoundStart tap3S
|
||||
, useTimeCheck
|
||||
, ammoCheckI
|
||||
]
|
||||
BangRodMod ->
|
||||
[ ammoHammerCheck
|
||||
, useTimeCheck
|
||||
, withSoundStart bangEchoS
|
||||
, useAmmoAmount 1
|
||||
, withTorqueAfter
|
||||
, applyInaccuracy
|
||||
, withThickSmokeI
|
||||
[ withRecoil
|
||||
, withMuzFlareI
|
||||
, withRecoil
|
||||
, withThickSmokeI
|
||||
, applyInaccuracy
|
||||
, withTorqueAfter
|
||||
, useAmmoAmount 1
|
||||
, withSoundStart bangEchoS
|
||||
, useTimeCheck
|
||||
, ammoHammerCheck
|
||||
]
|
||||
ElephantGunMod ->
|
||||
[ ammoHammerCheck
|
||||
, useTimeCheck
|
||||
, withSoundStart bangEchoS
|
||||
, useAmmoAmount 1
|
||||
, withTorqueAfter
|
||||
, applyInaccuracy
|
||||
, withThickSmokeI
|
||||
[ withRecoil
|
||||
, withMuzFlareI
|
||||
, withRecoil
|
||||
, withThickSmokeI
|
||||
, applyInaccuracy
|
||||
, withTorqueAfter
|
||||
, useAmmoAmount 1
|
||||
, withSoundStart bangEchoS
|
||||
, useTimeCheck
|
||||
, ammoHammerCheck
|
||||
]
|
||||
AutoAmrMod ->
|
||||
[ ammoCheckI -- cf ElephantGun
|
||||
, useTimeCheck
|
||||
, withSoundStart bangEchoS
|
||||
, useAmmoAmount 1
|
||||
, withTorqueAfter
|
||||
, applyInaccuracy
|
||||
, withThickSmokeI
|
||||
[ withRecoil
|
||||
, withMuzFlareI
|
||||
, withRecoil
|
||||
, withThickSmokeI
|
||||
, applyInaccuracy
|
||||
, withTorqueAfter
|
||||
, useAmmoAmount 1
|
||||
, withSoundStart bangEchoS
|
||||
, useTimeCheck
|
||||
, ammoCheckI -- cf ElephantGun
|
||||
]
|
||||
MachineGunMod ->
|
||||
[ ammoCheckI
|
||||
, rateIncAB (torqueBeforeAtLeast 0.1 0.1) withTorqueAfter
|
||||
, withSoundStart bangEchoS
|
||||
[ withMuzFlareI
|
||||
, withThinSmokeI
|
||||
, withMuzFlareI
|
||||
, withSoundStart bangEchoS
|
||||
, rateIncAB (torqueBeforeAtLeast 0.1 0.1) withTorqueAfter
|
||||
, ammoCheckI
|
||||
]
|
||||
ModWithDirectedTeleport hm' ->
|
||||
withPosDirWallCheck directedTelPos : useMod hm'
|
||||
reverse $ withPosDirWallCheck directedTelPos : useMod hm'
|
||||
BangStickMod ->
|
||||
[ ammoHammerCheck
|
||||
, useTimeCheck
|
||||
, withSoundItemChoiceStart bangStickSoundChoice
|
||||
, useAllAmmo
|
||||
, withMuzFlareI
|
||||
, withTorqueAfter
|
||||
[ withRecoil
|
||||
-- , applyInaccuracy
|
||||
, spreadLoaded
|
||||
, -- , applyInaccuracy
|
||||
withRecoil
|
||||
, withTorqueAfter
|
||||
, withMuzFlareI
|
||||
, useAllAmmo
|
||||
, withSoundItemChoiceStart bangStickSoundChoice
|
||||
, useTimeCheck
|
||||
, ammoHammerCheck
|
||||
]
|
||||
PistolMod ->
|
||||
[ ammoHammerCheck
|
||||
, useTimeCheck
|
||||
, useAmmoAmount 1
|
||||
, withSoundStart tap3S
|
||||
, applyInaccuracy
|
||||
, withTorqueAfter
|
||||
, withRecoil
|
||||
[ withMuzFlareI
|
||||
, withSidePushI 50
|
||||
, withMuzFlareI
|
||||
, withRecoil
|
||||
, withTorqueAfter
|
||||
, applyInaccuracy
|
||||
, withSoundStart tap3S
|
||||
, useAmmoAmount 1
|
||||
, useTimeCheck
|
||||
, ammoHammerCheck
|
||||
]
|
||||
AutoPistolMod ->
|
||||
[ ammoCheckI
|
||||
, useTimeCheck
|
||||
, useAmmoAmount 1
|
||||
, withSoundStart tap3S
|
||||
, applyInaccuracy
|
||||
, withTorqueAfter
|
||||
, withRecoil
|
||||
[ withMuzFlareI
|
||||
, withSidePushI 50
|
||||
, withMuzFlareI
|
||||
, withRecoil
|
||||
, withTorqueAfter
|
||||
, applyInaccuracy
|
||||
, withSoundStart tap3S
|
||||
, useAmmoAmount 1
|
||||
, useTimeCheck
|
||||
, ammoCheckI
|
||||
]
|
||||
MachinePistolMod ->
|
||||
[ ammoCheckI
|
||||
, useTimeCheck
|
||||
, useAmmoAmount 1
|
||||
, withSoundStart tap1S
|
||||
, applyInaccuracy
|
||||
, withTorqueAfter
|
||||
, withSidePushI 50
|
||||
[ withMuzFlareI
|
||||
, withRecoil
|
||||
, withMuzFlareI
|
||||
, withSidePushI 50
|
||||
, withTorqueAfter
|
||||
, applyInaccuracy
|
||||
, withSoundStart tap1S
|
||||
, useAmmoAmount 1
|
||||
, useTimeCheck
|
||||
, ammoCheckI
|
||||
]
|
||||
BurstRifleMod ->
|
||||
[ ammoHammerCheck
|
||||
, useTimeCheck
|
||||
, sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
|
||||
, lockInvFor 7
|
||||
, repeatOnFrames [3, 6] BurstRifleRepeatMod
|
||||
, withSoundStart tap3S
|
||||
, useAmmoAmount 1
|
||||
, applyInaccuracy
|
||||
[ withRecoil
|
||||
, withMuzFlareI
|
||||
, withRecoil
|
||||
, applyInaccuracy
|
||||
, useAmmoAmount 1
|
||||
, withSoundStart tap3S
|
||||
, repeatOnFrames [3, 6] BurstRifleRepeatMod
|
||||
, lockInvFor 7
|
||||
, sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
|
||||
, useTimeCheck
|
||||
, ammoHammerCheck
|
||||
]
|
||||
BurstRifleRepeatMod ->
|
||||
[ ammoCheckI
|
||||
, sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
|
||||
, withSoundStart tap3S
|
||||
, useAmmoAmount 1
|
||||
, applyInaccuracy
|
||||
[ withRecoil
|
||||
, withMuzFlareI
|
||||
, withRecoil
|
||||
, applyInaccuracy
|
||||
, useAmmoAmount 1
|
||||
, withSoundStart tap3S
|
||||
, sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
|
||||
, ammoCheckI
|
||||
]
|
||||
MiniGunMod i ->
|
||||
[ ammoCheckI
|
||||
, withWarmUp crankSlowS
|
||||
, withSoundForI mini1S 2
|
||||
, --, withThinSmokeI
|
||||
withSmoke 1 black 20 200 5
|
||||
, withMuzFlareI
|
||||
, useAmmoAmount i
|
||||
, withSidePushI (fromIntegral i * 50)
|
||||
, torqueBefore (fromIntegral i * 0.05)
|
||||
, afterRecoil (fromIntegral i * 5)
|
||||
]
|
||||
<> [ trigDoAlso' (moddelay x) (modcrpos x) useAmmoParams
|
||||
reverse [ trigDoAlso' (moddelay x) (modcrpos x) useAmmoParams
|
||||
| x <- map ((/ fromIntegral i) . fromIntegral) [1 .. i -1]
|
||||
]
|
||||
SmgMod ->
|
||||
[ ammoCheckI
|
||||
, useTimeCheck
|
||||
, useAmmoAmount 1
|
||||
, withSoundStart tap3S
|
||||
, applyInaccuracy
|
||||
, withTorqueAfter
|
||||
, withRecoil
|
||||
, withSidePushI 30
|
||||
<>
|
||||
[ afterRecoil (fromIntegral i * 5)
|
||||
, torqueBefore (fromIntegral i * 0.05)
|
||||
, withSidePushI (fromIntegral i * 50)
|
||||
, useAmmoAmount i
|
||||
, withMuzFlareI
|
||||
, withSmoke 1 black 20 200 5
|
||||
--, withThinSmokeI
|
||||
, withSoundForI mini1S 2
|
||||
, withWarmUp crankSlowS
|
||||
, ammoCheckI
|
||||
]
|
||||
SmgMod ->
|
||||
[ withMuzFlareI
|
||||
, withSidePushI 30
|
||||
, withRecoil
|
||||
, withTorqueAfter
|
||||
, applyInaccuracy
|
||||
, withSoundStart tap3S
|
||||
, useAmmoAmount 1
|
||||
, useTimeCheck
|
||||
, ammoCheckI
|
||||
]
|
||||
RevolverXMod ->
|
||||
[ 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
|
||||
, repeatOnFrames [2, 4, 6, 8, 10] RevolverXRepeatMod
|
||||
, withSoundStart tap3S
|
||||
, useAmmoUpTo 1
|
||||
, applyInaccuracy
|
||||
[ withRecoil
|
||||
, withTorqueAfter
|
||||
-- , spreadLoaded
|
||||
, withMuzFlareI
|
||||
, -- , spreadLoaded
|
||||
withTorqueAfter
|
||||
, withRecoil
|
||||
, applyInaccuracy
|
||||
, useAmmoUpTo 1
|
||||
, withSoundStart tap3S
|
||||
, repeatOnFrames [2, 4, 6, 8, 10] RevolverXRepeatMod
|
||||
, lockInvFor 10
|
||||
-- rather than locking the inventory, a better solution may be to check
|
||||
-- that the weapon is still in your hands in the repeated frames
|
||||
, useTimeCheck
|
||||
, ammoHammerCheck
|
||||
]
|
||||
RevolverXRepeatMod ->
|
||||
[ ammoCheckI
|
||||
, -- rather than locking the inventory, a better solution may be to check
|
||||
-- that the weapon is still in your hands in the repeated frames
|
||||
withSoundStart tap3S
|
||||
, useAmmoUpTo 1
|
||||
, applyInaccuracy
|
||||
[ withRecoil
|
||||
, withTorqueAfter
|
||||
, withMuzFlareI
|
||||
, -- , spreadLoaded
|
||||
withTorqueAfter
|
||||
, withRecoil
|
||||
, applyInaccuracy
|
||||
, useAmmoUpTo 1
|
||||
, withSoundStart tap3S
|
||||
, ammoCheckI
|
||||
]
|
||||
BangConeMod ->
|
||||
[ ammoCheckI
|
||||
, hammerCheckI
|
||||
, useTimeCheck
|
||||
, withSoundStart bangEchoS
|
||||
, useAllAmmo
|
||||
, withTorqueAfter
|
||||
, withRecoil
|
||||
, duplicateLoaded
|
||||
, withMuzFlareI
|
||||
, applyInaccuracy
|
||||
, withRandomOffset
|
||||
[ withRandomItemParams coneRandItemParams
|
||||
, withRandomItemUpdate coneRandItemUpdate
|
||||
, withRandomItemParams coneRandItemParams
|
||||
, withRandomOffset
|
||||
, applyInaccuracy
|
||||
, withMuzFlareI
|
||||
, duplicateLoaded
|
||||
, withRecoil
|
||||
, withTorqueAfter
|
||||
, useAllAmmo
|
||||
, withSoundStart bangEchoS
|
||||
, useTimeCheck
|
||||
, hammerCheckI
|
||||
, ammoCheckI
|
||||
]
|
||||
where
|
||||
f = do
|
||||
|
||||
@@ -13,7 +13,7 @@ import RandomHelp
|
||||
updateHumanoid :: Creature -> World -> World
|
||||
updateHumanoid cr = case cr ^?! crType . humanoidAI of
|
||||
ChaseAI ->
|
||||
defaultImpulsive
|
||||
humanoidAIList
|
||||
[ const doStrategyActions
|
||||
, performActions
|
||||
, const overrideMeleeCloseTarget
|
||||
@@ -181,6 +181,14 @@ updateHumanoid cr = case cr ^?! crType . humanoidAI of
|
||||
, WaitThen 1 $ DoActionWhileInterrupt NoAction (WdCrBlfromCrBl CrIsReloading) (DoImpulses [ChangeStrategy WatchAndWait])
|
||||
]
|
||||
|
||||
humanoidAIList ::
|
||||
[World -> Creature -> Creature] ->
|
||||
Creature ->
|
||||
World ->
|
||||
World
|
||||
humanoidAIList
|
||||
= stateUpdate . impulsiveAIBefore . chainCreatureUpdates
|
||||
|
||||
-- bit of a hack to get new random generators after each creature's update
|
||||
defaultImpulsive ::
|
||||
[World -> Creature -> Creature] ->
|
||||
|
||||
@@ -21,7 +21,7 @@ rewindGun =
|
||||
, _itUse =
|
||||
defaultLeftUse
|
||||
& leftUse .~ LRewind --useRewindGun
|
||||
& equipEffect . eeSite .~ GoesOnChest
|
||||
& equipEffect . eeSite .~ GoesOnWrist
|
||||
}
|
||||
& itEffect . ieInv .~ RewindEffect
|
||||
& itType . iyBase .~ LEFT REWINDER
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ useL lu = case lu of
|
||||
LDoNothing -> const $ const id
|
||||
LRewind -> useRewindGun
|
||||
LShrink -> hammerCheckL useShrinkGun
|
||||
LBlink -> hammerCheckL (shootL $ const blinkAction)
|
||||
LBlink -> hammerCheckL (shootL $ const blinkActionMousePos)
|
||||
LUnsafeBlink -> hammerCheckL (shootL $ const unsafeBlinkAction)
|
||||
LBoost -> boostSelfL 10
|
||||
|
||||
|
||||
+10
-7
@@ -2,15 +2,18 @@ module Dodge.TestString where
|
||||
|
||||
import Dodge.Data.Universe
|
||||
import Control.Lens
|
||||
import Data.Maybe
|
||||
--import Data.Maybe
|
||||
import ShortShow
|
||||
|
||||
testStringInit :: Universe -> [String]
|
||||
testStringInit u = [
|
||||
show $ u ^? uvWorld . hammers . ix DoubleMouseHam
|
||||
, show $ u ^? uvWorld . cWorld . creatures . ix 0 . crLeftInvSel . _Just
|
||||
, fromMaybe "" $ do
|
||||
i <- u ^? uvWorld . cWorld . creatures . ix 0 . crLeftInvSel . _Just
|
||||
h <- u ^? uvWorld . cWorld . creatures . ix 0 . crInv . ix i . itUse . leftHammer
|
||||
return $ show h
|
||||
shortShow $ u ^?! uvWorld . cWorld . creatures . ix 0 . crPos
|
||||
]
|
||||
-- [ show $ u ^? uvWorld . hammers . ix DoubleMouseHam
|
||||
-- , show $ u ^? uvWorld . cWorld . creatures . ix 0 . crLeftInvSel . _Just
|
||||
-- , fromMaybe "" $ do
|
||||
-- i <- u ^? uvWorld . cWorld . creatures . ix 0 . crLeftInvSel . _Just
|
||||
-- h <- u ^? uvWorld . cWorld . creatures . ix 0 . crInv . ix i . itUse . leftHammer
|
||||
-- return $ show h
|
||||
-- ]
|
||||
|
||||
|
||||
@@ -45,10 +45,10 @@ pesNearCirc p r = pesNearRect (p +.+ V2 r r) (p -.- V2 r r)
|
||||
peZoneSize :: Float
|
||||
peZoneSize = 50
|
||||
|
||||
zoneOfPe :: (PathEdgeNodes) -> [Int2]
|
||||
zoneOfPe :: PathEdgeNodes -> [Int2]
|
||||
zoneOfPe (PathEdgeNodes _ _ pe) = zoneOfSeg peZoneSize (_peStart pe) (_peEnd pe)
|
||||
|
||||
zonePe :: PathEdgeNodes -> IM.IntMap (IM.IntMap (Set PathEdgeNodes)) -> IM.IntMap (IM.IntMap (Set (PathEdgeNodes)))
|
||||
zonePe :: PathEdgeNodes -> IM.IntMap (IM.IntMap (Set PathEdgeNodes)) -> IM.IntMap (IM.IntMap (Set PathEdgeNodes))
|
||||
zonePe pe im = foldl' f im (zoneOfPe pe)
|
||||
where
|
||||
f im' i2 = zoneMonoid i2 (Set.singleton pe) im'
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
--{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Loop.Data where
|
||||
|
||||
|
||||
Reference in New Issue
Block a user