Assorted changes, cleanup menu selection text
This commit is contained in:
@@ -14,6 +14,7 @@ import Shape
|
||||
import qualified IntMapHelp as IM
|
||||
import LensHelp
|
||||
|
||||
import Data.Maybe
|
||||
magShield :: Item
|
||||
magShield = defaultEquipment
|
||||
{ _itType = MAGSHIELD
|
||||
@@ -98,9 +99,11 @@ effectOnEquip f = ItInvEffectID
|
||||
, _itEffectID = Nothing
|
||||
}
|
||||
where
|
||||
g f' _ cr invid w
|
||||
g f' itm cr w
|
||||
| _crInvSel cr == invid = f' cr (_crInv (_creatures w IM.! _crID cr) IM.! invid) w
|
||||
| otherwise = w
|
||||
where
|
||||
invid = fromJust $ _itInvPos itm
|
||||
|
||||
shieldWall :: Int -> Wall
|
||||
shieldWall crid = defaultWall
|
||||
@@ -156,9 +159,11 @@ effectOnOffEquip f f' = ItInvEffectID
|
||||
, _itEffectID = Nothing
|
||||
}
|
||||
where
|
||||
g _ cr invid w
|
||||
g itm cr w
|
||||
| _crInvSel cr == invid = f cr invid w
|
||||
| otherwise = f' cr invid w
|
||||
where
|
||||
invid = fromJust $ _itInvPos itm
|
||||
|
||||
{- | Increases speed, reduces friction, cannot only move forwards. -}
|
||||
jetPack :: Item
|
||||
|
||||
@@ -123,8 +123,10 @@ boosterGun = defaultGun
|
||||
resetAttachmentID :: ItEffect
|
||||
resetAttachmentID = ItInvEffect f 0
|
||||
where
|
||||
f iteff cr invid w
|
||||
f itm cr w
|
||||
| _itEffectCounter iteff < 0 = w & pointToIt . itAttachment .~ NoItAttachment
|
||||
| otherwise = w & pointToIt . itEffect . itEffectCounter -~ 1
|
||||
where
|
||||
iteff = _itEffect itm
|
||||
invid = fromJust $ _itInvPos itm
|
||||
pointToIt = creatures . ix (_crID cr) . crInv . ix invid
|
||||
|
||||
@@ -35,22 +35,25 @@ import qualified SDL
|
||||
autoRadarEffect :: ItEffect
|
||||
autoRadarEffect = ItInvEffect {_itInvEffect = f 50 ,_itEffectCounter = 0 }
|
||||
where
|
||||
f :: Int -> ItEffect -> Creature -> Int -> World -> World
|
||||
f 0 _ cr i w = aRadarPulse cr w
|
||||
& creatures . ix (_crID cr) . crInv . ix i
|
||||
f :: Int -> Item -> Creature -> World -> World
|
||||
f 0 itm cr w = aRadarPulse cr w
|
||||
& creatures . ix (_crID cr) . crInv . ix (fromJust $ _itInvPos itm)
|
||||
. itEffect . itInvEffect .~ f 100
|
||||
f t _ cr i w = w
|
||||
& creatures . ix (_crID cr) . crInv . ix i
|
||||
f t itm cr w = w
|
||||
& creatures . ix (_crID cr) . crInv . ix (fromJust $ _itInvPos itm)
|
||||
. itEffect . itInvEffect .~ f (t-1)
|
||||
{- | Automatically send out sonar pulses that detect creatures. -}
|
||||
autoSonarEffect :: ItEffect
|
||||
autoSonarEffect = ItInvEffect {_itInvEffect = f 50 ,_itEffectCounter = 0 }
|
||||
autoSonarEffect = ItInvEffect {_itInvEffect = f ,_itEffectCounter = 50 }
|
||||
where
|
||||
f :: Int -> ItEffect -> Creature -> Int -> World -> World
|
||||
f 0 _ cr i w = aSonarPulse cr w
|
||||
& creatures . ix (_crID cr) . crInv . ix i . itEffect . itInvEffect .~ f 140
|
||||
f t _ cr i w = w
|
||||
& creatures . ix (_crID cr) . crInv . ix i . itEffect . itInvEffect .~ f (t-1)
|
||||
f :: Item -> Creature -> World -> World
|
||||
f itm cr w
|
||||
| _itEffectCounter (_itEffect itm) == 0 = aSonarPulse cr w
|
||||
& decreasecounter
|
||||
| otherwise = decreasecounter w
|
||||
where
|
||||
decreasecounter = creatures . ix (_crID cr) . crInv
|
||||
. ix (fromJust $ _itInvPos itm) . itEffect . itEffectCounter %~ (\i -> (i - 1) `mod` 50)
|
||||
|
||||
defaultTargeting :: Targeting
|
||||
defaultTargeting = Targeting
|
||||
|
||||
@@ -119,7 +119,9 @@ throwGrenade thePayload cr w = setWp $ removePict $ over props addG w
|
||||
throwArmReset :: Int -> ItEffect
|
||||
throwArmReset x = ItInvEffect {_itInvEffect = f ,_itEffectCounter = x }
|
||||
where
|
||||
f _ cr i = creatures . ix (_crID cr) . crInv %~ IM.adjust counterDown i
|
||||
f itm cr = creatures . ix (_crID cr) . crInv %~ IM.adjust counterDown i
|
||||
where
|
||||
i = fromJust $ _itInvPos itm
|
||||
counterDown it
|
||||
| _itEffectCounter (_itEffect it) == 0 = it
|
||||
& itUse . useHammer . hammerPosition .~ HammerUp
|
||||
|
||||
@@ -13,6 +13,7 @@ import qualified IntMapHelp as IM
|
||||
import Shape
|
||||
import ShapePicture
|
||||
|
||||
import Data.Maybe
|
||||
--import qualified Data.Map.Strict as M
|
||||
import Control.Lens
|
||||
|
||||
@@ -28,13 +29,14 @@ rewindGun = defaultGun
|
||||
, _itEffect = ItRewindEffect rewindEffect []
|
||||
, _itUse = defaultlUse {_lUse = \cr invid -> useRewindGun (_crInv cr IM.! invid) cr}
|
||||
}
|
||||
rewindEffect :: ItEffect -> Creature -> Int -> World -> World
|
||||
rewindEffect _ cr invid w
|
||||
rewindEffect :: Item -> Creature -> World -> World
|
||||
rewindEffect itm cr w
|
||||
| Just invid == _crLeftInvSel cr = w & rewindWorlds %~ (take maxcharge . (w' : ))
|
||||
& ptrWpCharge .~ length (_rewindWorlds w)
|
||||
| otherwise = w & rewindWorlds .~ []
|
||||
& ptrWpCharge .~ 0
|
||||
where
|
||||
invid = fromJust $ _itInvPos itm
|
||||
ptrWpCharge = creatures . ix (_crID cr) . crInv . ix invid . itConsumption . wpCharge
|
||||
maxcharge = _wpMaxCharge . _itConsumption $ _crInv cr IM.! invid
|
||||
w' = w & rewindWorlds .~ []
|
||||
|
||||
Reference in New Issue
Block a user