Refactor crPos to be a V3
This commit is contained in:
@@ -5,6 +5,7 @@ module Dodge.Creature.Action.Blink (
|
||||
unsafeBlinkAction,
|
||||
) where
|
||||
|
||||
import Linear
|
||||
import Dodge.Creature.Radius
|
||||
import Dodge.Zoning.Wall
|
||||
import Data.Maybe
|
||||
@@ -25,13 +26,13 @@ blinkActionMousePos cr w =
|
||||
w
|
||||
& soundMultiFrom [TeleSound 0, TeleSound 1] p3 teleS Nothing
|
||||
& blinkDistortions cpos p3
|
||||
& cWorld . lWorld . creatures . ix cid . crPos .~ p3
|
||||
& cWorld . lWorld . creatures . ix cid . crPos . _xy .~ p3
|
||||
& blinkShockwave cid p3
|
||||
& inverseShockwaveAt (cpos `v2z` 20) 40 2 2
|
||||
where
|
||||
cid = _crID cr
|
||||
p1 = w ^. cWorld . lWorld . lAimPos
|
||||
cpos = _crPos cr
|
||||
cpos = cr ^. crPos . _xy
|
||||
--p2 = bouncePoint (const True) 1 cpos p1 w
|
||||
p2 = pushIntoMaybe $ collideCircWalls cpos p1 r (wlsNearSeg cpos p1 w)
|
||||
r = crRad $ cr ^. crType
|
||||
@@ -61,7 +62,7 @@ unsafeBlinkAction cr w
|
||||
| success =
|
||||
soundMultiFrom [TeleSound 0, TeleSound 1] mwp teleS Nothing
|
||||
. blinkDistortions cpos mwp
|
||||
. set (cWorld . lWorld . creatures . ix cid . crPos) mwp
|
||||
. set (cWorld . lWorld . creatures . ix cid . crPos . _xy) mwp
|
||||
. blinkShockwave cid mwp
|
||||
$ inverseShockwaveAt (cpos `v2z` 20) 40 2 2 w
|
||||
| otherwise =
|
||||
@@ -74,7 +75,7 @@ unsafeBlinkAction cr w
|
||||
return (isLHS mwp `uncurry` _wlLine wl)
|
||||
cid = _crID cr
|
||||
mwp = w ^. cWorld . lWorld . lAimPos
|
||||
cpos = _crPos cr
|
||||
cpos = cr ^. crPos . _xy
|
||||
|
||||
blinkShockwave ::
|
||||
-- | Blinking creature ID.
|
||||
@@ -93,14 +94,14 @@ blinkActionFail cr w =
|
||||
w
|
||||
& soundMultiFrom [TeleSound 0, TeleSound 1] p3 teleS Nothing
|
||||
& cWorld . lWorld . distortions .:~ distortionBulge
|
||||
& cWorld . lWorld . creatures . ix cid . crPos .~ p3
|
||||
& cWorld . lWorld . creatures . ix cid . crPos . _xy .~ p3
|
||||
& inverseShockwaveAt (cpos `v2z` 20) 40 2 2
|
||||
where
|
||||
distR = 120
|
||||
distortionBulge = RadialDistortion cpos (cpos +.+ V2 distR 0) (cpos +.+ V2 0 distR) 1.9
|
||||
cid = _crID cr
|
||||
p1 = w ^. cWorld . lWorld . lAimPos
|
||||
cpos = _crPos cr
|
||||
cpos = cr ^. crPos . _xy
|
||||
p2 = bouncePoint (const True) 1 cpos p1 w
|
||||
r = 1.5 * crRad (cr ^. crType)
|
||||
p3 = maybe p1 (mvPointTowardAtSpeed r cpos . fst) p2
|
||||
|
||||
Reference in New Issue
Block a user