This commit is contained in:
2024-12-20 17:35:02 +00:00
parent e34a17a027
commit 056b8be534
2 changed files with 14 additions and 55 deletions
-45
View File
@@ -1,45 +0,0 @@
--{-# LANGUAGE BangPatterns #-}
{- |
Extra weapon effects, supplementing explicit use effects.
-}
module Dodge.Item.Weapon.ExtraEffect (
-- autoSonarEffect,
autoEffect,
-- autoRadarEffect,
) where
import Dodge.Data.World
--import Dodge.RadarSweep
import Dodge.SoundLogic
import LensHelp
import Sound.Data
autoEffect :: (Item -> Creature -> World -> World) -> Int -> SoundID -> Item -> Creature -> World -> World
autoEffect eff t sid itm cr w
| _eparamInt (_eeParams (_uequipEffect $ _itUse itm)) < 1 =
eff itm cr w
& cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (_ilInvID $ _itLocation itm)
. itUse
. uequipEffect
. eeParams
. eparamInt
.~ t
& soundStart OnceSound (_crPos cr) sid Nothing
| otherwise =
w
& cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (_ilInvID $ _itLocation itm)
. itUse
. uequipEffect
. eeParams
. eparamInt
-~ 1
---- | Automatically send out radar pulses that detect walls.
--autoRadarEffect :: Item -> Creature -> World -> World
--autoRadarEffect = autoEffect (const (aRadarPulse ObWall)) 100 click1S
-- | Automatically send out sonar pulses that detect creatures.
--autoSonarEffect :: Item -> Creature -> World -> World
--autoSonarEffect = autoEffect (const (aRadarPulse ObCreature)) 50 click1S