Fix unsafe blink bugs
This commit is contained in:
@@ -10,6 +10,7 @@ module Dodge.Creature.Action
|
|||||||
, dropItem
|
, dropItem
|
||||||
-- , startReloadingWeapon
|
-- , startReloadingWeapon
|
||||||
, blinkAction
|
, blinkAction
|
||||||
|
, blinkActionFail
|
||||||
, unsafeBlinkAction
|
, unsafeBlinkAction
|
||||||
, sizeSelf
|
, sizeSelf
|
||||||
-- , crAutoReload
|
-- , crAutoReload
|
||||||
@@ -155,6 +156,26 @@ performAction cr w ac = case ac of
|
|||||||
(imps , _) -> (imps, Just $ DoReplicatePartial sac (t-1) sac)
|
(imps , _) -> (imps, Just $ DoReplicatePartial sac (t-1) sac)
|
||||||
NoAction -> ([],Nothing)
|
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
|
||||||
|
& distortions .:~ distortionBulge
|
||||||
|
& 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 = reflectPointWalls cpos p1 $ wallsAlongLine cpos p1 w
|
||||||
|
r = 1.5 * _crRad cr
|
||||||
|
p3 = maybe p1 (mvPointTowardAtSpeed r cpos . fst) p2
|
||||||
|
|
||||||
{- | Teleport a creature to the mouse position -}
|
{- | Teleport a creature to the mouse position -}
|
||||||
blinkAction
|
blinkAction
|
||||||
:: Creature
|
:: Creature
|
||||||
@@ -191,8 +212,10 @@ unsafeBlinkAction cr w
|
|||||||
. set (creatures . ix cid . crPos) mwp
|
. set (creatures . ix cid . crPos) mwp
|
||||||
. blinkShockwave cid mwp
|
. blinkShockwave cid mwp
|
||||||
$ inverseShockwaveAt cpos 40 2 2 w
|
$ inverseShockwaveAt cpos 40 2 2 w
|
||||||
| otherwise = blinkAction cr w & creatures . ix cid . crState . crDamage .:~
|
| otherwise = w
|
||||||
Damage ENTERREMENT 10000 mwp mwp mwp NoDamageEffect
|
& blinkActionFail cr
|
||||||
|
& creatures . ix cid . crState . crDamage .:~
|
||||||
|
Damage ENTERREMENT 10000 mwp mwp mwp NoDamageEffect
|
||||||
where
|
where
|
||||||
success = fromMaybe True $ do
|
success = fromMaybe True $ do
|
||||||
(_,wl) <- collidePointWallsWall mwp cpos $ wallsAlongLine mwp cpos w
|
(_,wl) <- collidePointWallsWall mwp cpos $ wallsAlongLine mwp cpos w
|
||||||
|
|||||||
@@ -59,15 +59,15 @@ foldCr xs cr w = foldr f w xs
|
|||||||
-- may affect whether the shield moves correctly
|
-- may affect whether the shield moves correctly
|
||||||
stateUpdate :: (Creature -> World -> World) -> Creature -> World -> World
|
stateUpdate :: (Creature -> World -> World) -> Creature -> World -> World
|
||||||
stateUpdate f = foldCr
|
stateUpdate f = foldCr
|
||||||
[ clearDamage
|
[ equipmentEffects
|
||||||
, equipmentEffects
|
|
||||||
, invSideEff
|
, invSideEff
|
||||||
, upInv -- upInv must be called before invSideEff 22.05.23
|
, upInv -- upInv must be called before invSideEff 22.05.23
|
||||||
, movementSideEff
|
, movementSideEff
|
||||||
, f
|
, f
|
||||||
, internalUpdate
|
, internalUpdate
|
||||||
, checkDeath
|
, clearDamage -- these three
|
||||||
, doDamage
|
, checkDeath -- must be in
|
||||||
|
, doDamage -- this order 22/06/05
|
||||||
]
|
]
|
||||||
|
|
||||||
checkDeath :: Creature -> World -> World
|
checkDeath :: Creature -> World -> World
|
||||||
|
|||||||
Reference in New Issue
Block a user