Add unsafe blink gun

This commit is contained in:
2022-06-03 10:18:47 +01:00
parent 5ff2fb4910
commit 0c5eeb405f
10 changed files with 79 additions and 54 deletions
+29 -1
View File
@@ -9,6 +9,7 @@ module Dodge.Creature.Action
, dropExcept
-- , startReloadingWeapon
, blinkAction
, unsafeBlinkAction
, sizeSelf
-- , crAutoReload
, copyInvItemToFloor
@@ -35,8 +36,8 @@ import Dodge.FloorItem
import Geometry
import Picture
import qualified IntMapHelp as IM
import LensHelp
import Control.Lens
--import Control.Monad
--import Control.Applicative
import Data.Maybe
@@ -177,6 +178,33 @@ blinkAction cr 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
. over distortions (distortionBulge ++)
. set (creatures . ix cid . crPos) mwp
. blinkShockwave cid mwp
$ inverseShockwaveAt cpos 40 2 2 w
| otherwise = blinkAction cr w & creatures . ix cid . crState . crDamage .:~
Damage ENTERREMENT 10000 mwp mwp mwp NoDamageEffect
where
success = fromMaybe True $ do
(_,wl) <- collidePointWallsWall mwp cpos $ wallsAlongLine 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
:: Int -- ^ Blinking creature ID.
-> Point2