Work on cleaning up item effects/attachments etc
This commit is contained in:
+29
-28
@@ -1,7 +1,6 @@
|
||||
module Dodge.Luse where
|
||||
|
||||
import Dodge.Base
|
||||
import Data.Maybe
|
||||
import Dodge.Creature.Action
|
||||
import Dodge.Data
|
||||
import Dodge.Default.Creature
|
||||
@@ -38,16 +37,16 @@ useRewindGun _ _ w = case _rewindWorlds (_cWorld w) of
|
||||
-- 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
|
||||
useShrinkGun it cr w = case it ^? itParams . shrinkGunStatus of
|
||||
Just FullSize -> tryResize 0.5 $ stripNoItems cr . f Shrunk UndroppableIdentified . dropExcept cr invid
|
||||
Just Shrunk -> tryResize 1 $ f FullSize Uncursed . setMinInvSize defaultInvSize cr
|
||||
Nothing -> error "useShrinkGun applied to item with incorrect ItParam"
|
||||
where
|
||||
invid = _ipInvID $ _itPos it
|
||||
invid = _ipInvID $ _itLocation it
|
||||
tryResize x g = maybe w g $ sizeSelf x cr w
|
||||
f isInUse cstatus =
|
||||
cWorld . creatures . ix (_crID cr) . crInv . ix invid
|
||||
%~ ((itAttachment . atBool .~ isInUse) . (itCurseStatus .~ cstatus))
|
||||
%~ ((itParams . shrinkGunStatus .~ isInUse) . (itCurseStatus .~ cstatus))
|
||||
|
||||
boostSelfL ::
|
||||
-- | boost amount
|
||||
@@ -56,27 +55,29 @@ boostSelfL ::
|
||||
Creature ->
|
||||
World ->
|
||||
World
|
||||
boostSelfL x itm cr w = case boostPoint x cr w of
|
||||
Left p -> crEff p (itUse . leftConsumption . arLoaded .~ 0)
|
||||
Right p -> crEff p (itUse . leftConsumption . arLoaded -~ 1)
|
||||
where
|
||||
invid = _ipInvID $ _itPos itm
|
||||
cid = _crID cr
|
||||
cpos = _crPos cr
|
||||
r = _crRad cr
|
||||
pid =
|
||||
fromMaybe
|
||||
(IM.newKey $ _props (_cWorld w))
|
||||
(cr ^? crInv . ix invid . itAttachment . atInt)
|
||||
crEff p ammoEff =
|
||||
addBoostShockwave pid p (r *.* normalizeV (p -.- cpos)) w
|
||||
& cWorld . creatures . ix cid
|
||||
%~ (crPos .~ p)
|
||||
. ( crInv . ix invid
|
||||
%~ ammoEff
|
||||
. (itEffect . ieCounter .~ 1)
|
||||
. (itAttachment .~ AttachInt pid)
|
||||
)
|
||||
boostSelfL = undefined
|
||||
|
||||
--boostSelfL x itm cr w = case boostPoint x cr w of
|
||||
-- Left p -> crEff p (itUse . leftConsumption . arLoaded .~ 0)
|
||||
-- Right p -> crEff p (itUse . leftConsumption . arLoaded -~ 1)
|
||||
-- where
|
||||
-- invid = _ipInvID $ _itLocation itm
|
||||
-- cid = _crID cr
|
||||
-- cpos = _crPos cr
|
||||
-- r = _crRad cr
|
||||
-- pid =
|
||||
-- fromMaybe
|
||||
-- (IM.newKey $ _props (_cWorld w))
|
||||
-- (cr ^? crInv . ix invid . itAttachment . atInt)
|
||||
-- crEff p ammoEff =
|
||||
-- addBoostShockwave pid p (r *.* normalizeV (p -.- cpos)) w
|
||||
-- & cWorld . creatures . ix cid
|
||||
-- %~ (crPos .~ p)
|
||||
-- . ( crInv . ix invid
|
||||
-- %~ ammoEff
|
||||
-- . (itEffect . ieCounter .~ 1)
|
||||
-- . (itAttachment .~ AttachInt pid)
|
||||
-- )
|
||||
|
||||
-- | Move a creature towards the mouse position, with shockwave
|
||||
boostPoint ::
|
||||
|
||||
Reference in New Issue
Block a user