Improve radar/sonar
This commit is contained in:
@@ -5,6 +5,7 @@ Extra weapon effects, supplementing explicit use effects.
|
||||
module Dodge.Item.Weapon.ExtraEffect
|
||||
(-- itemLaserScopeEffect
|
||||
autoSonarEffect
|
||||
, autoEffect
|
||||
, autoRadarEffect
|
||||
, targetRBPress
|
||||
, targetRBCreature
|
||||
@@ -26,33 +27,29 @@ import Geometry.Vector
|
||||
import Geometry.Data
|
||||
import LensHelp
|
||||
import qualified FoldlHelp as L
|
||||
import Sound.Data
|
||||
|
||||
--import Data.Bifunctor
|
||||
import Data.Maybe
|
||||
--import qualified Control.Foldl as L
|
||||
import qualified Data.Set as S
|
||||
import qualified SDL
|
||||
{- | Automatically send out radar pulses that detect walls. -}
|
||||
autoRadarEffect :: Item -> Creature -> World -> World
|
||||
autoRadarEffect itm cr w
|
||||
| _eparamInt (_eqParams (_itUse itm)) < 1 = aRadarPulse cr w
|
||||
autoEffect :: (Creature -> World -> World) -> Int -> SoundID -> Item -> Creature -> World -> World
|
||||
autoEffect eff t sid itm cr w
|
||||
| _eparamInt (_eqParams (_itUse itm)) < 1 = eff cr w
|
||||
& creatures . ix (_crID cr) . crInv . ix (fromJust $ _itInvPos itm)
|
||||
. itUse . eqParams . eparamInt .~ 100
|
||||
& soundStart OnceSound (_crPos cr) click1S Nothing
|
||||
| otherwise = w
|
||||
& creatures . ix (_crID cr) . crInv . ix (fromJust $ _itInvPos itm)
|
||||
. itUse . eqParams . eparamInt -~ 1
|
||||
{- | Automatically send out sonar pulses that detect creatures. -}
|
||||
autoSonarEffect :: Item -> Creature -> World -> World
|
||||
autoSonarEffect itm cr w
|
||||
| _eparamInt (_eqParams (_itUse itm)) < 1 = aSonarPulse cr w
|
||||
& creatures . ix (_crID cr) . crInv . ix (fromJust $ _itInvPos itm)
|
||||
. itUse . eqParams . eparamInt .~ 50
|
||||
& soundStart OnceSound (_crPos cr) click1S Nothing
|
||||
. itUse . eqParams . eparamInt .~ t
|
||||
& soundStart OnceSound (_crPos cr) sid Nothing
|
||||
| otherwise = w
|
||||
& creatures . ix (_crID cr) . crInv . ix (fromJust $ _itInvPos itm)
|
||||
. itUse . eqParams . eparamInt -~ 1
|
||||
|
||||
{- | Automatically send out radar pulses that detect walls. -}
|
||||
autoRadarEffect :: Item -> Creature -> World -> World
|
||||
autoRadarEffect = autoEffect aRadarPulse 100 click1S
|
||||
{- | Automatically send out sonar pulses that detect creatures. -}
|
||||
autoSonarEffect :: Item -> Creature -> World -> World
|
||||
autoSonarEffect = autoEffect aSonarPulse 50 click1S
|
||||
defaultTargeting :: Targeting
|
||||
defaultTargeting = Targeting
|
||||
{ _tgPos = Nothing
|
||||
|
||||
Reference in New Issue
Block a user