Remove functions from left use item use field
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
module Dodge.Luse where
|
||||
import Dodge.Data
|
||||
import Dodge.Item.Weapon.TriggerType
|
||||
import Dodge.Creature.Action
|
||||
import Dodge.Item.Equipment.Booster
|
||||
import Dodge.Default.Creature
|
||||
import LensHelp
|
||||
|
||||
useL :: Luse -> Item -> Creature -> World -> World
|
||||
useL lu = case lu of
|
||||
LDoNothing -> const $ const id
|
||||
LRewind -> useRewindGun
|
||||
LShrink -> hammerCheckL useShrinkGun
|
||||
LBlink -> hammerCheckL (shootL $ const blinkAction)
|
||||
LUnsafeBlink -> hammerCheckL (shootL $ const unsafeBlinkAction)
|
||||
LBoost -> boostSelfL 10
|
||||
|
||||
useRewindGun :: Item -> Creature -> World -> World
|
||||
useRewindGun _ _ w = case _rewindWorlds w of
|
||||
[w'] -> rewindusing w' [w']
|
||||
(w':ws) -> rewindusing w' ws
|
||||
_ -> w
|
||||
where
|
||||
rewindusing w' ws = w
|
||||
& maybeWorld .~ Just' ( w'
|
||||
-- & creatures . ix (_crID cr) .~ cr
|
||||
& upbuts
|
||||
& rewindWorlds .~ ws
|
||||
)
|
||||
upbuts = (keys .~ _keys w) . (mouseButtons .~ _mouseButtons w)
|
||||
|
||||
-- be careful changing this around; potential problems include updating the
|
||||
-- creature but using the old crInvSel value
|
||||
-- 22.05.23 this has been changed from using invids to items
|
||||
useShrinkGun :: Item -> Creature -> World -> World
|
||||
useShrinkGun it cr w = if _atBool $ _itAttachment it
|
||||
then tryResize 0.5 $ stripNoItems cr . f False UndroppableIdentified . dropExcept cr invid
|
||||
else tryResize 1 $ f True Uncursed . setMinInvSize defaultInvSize cr
|
||||
where
|
||||
invid = _ipInvID $ _itPos it
|
||||
tryResize x g = maybe w g $ sizeSelf x cr w
|
||||
f isInUse cstatus = creatures . ix (_crID cr) . crInv . ix invid %~
|
||||
( (itAttachment . atBool .~ isInUse) . (itCurseStatus .~ cstatus) )
|
||||
Reference in New Issue
Block a user