Add shrinkability and cursed items
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
module Dodge.Item.Weapon.Utility where
|
||||
import Dodge.Data
|
||||
import Dodge.Default
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.Creature.Action
|
||||
import Dodge.Item.Weapon.TriggerType
|
||||
import Dodge.Default.Weapon
|
||||
import Geometry
|
||||
import Picture
|
||||
--import qualified IntMapHelp as IM
|
||||
import Shape
|
||||
--import ShapePicture
|
||||
|
||||
import Control.Lens
|
||||
shrinkGun :: Item
|
||||
shrinkGun = defaultGun
|
||||
{ _itName = "SHRINKER"
|
||||
, _itIdentity = Generic
|
||||
, _wpMaxAmmo = 100
|
||||
, _wpLoadedAmmo = 100
|
||||
, _wpReloadTime = 20
|
||||
, _wpReloadState = 0
|
||||
, _itUseRate = 0
|
||||
, _itUseTime = 0
|
||||
, _itAimStance = TwoHandFlat
|
||||
, _itUse = useShrinkGun
|
||||
, _itUseModifiers =
|
||||
[ ammoCheckI
|
||||
, hammerCheckI
|
||||
]
|
||||
, _itLeftClickUse = Nothing
|
||||
, _wpSpread = 0.05
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2[(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)]
|
||||
, _itAimingSpeed = 1
|
||||
, _itAimingRange = 0
|
||||
, _itAttachment = ItBool True
|
||||
}
|
||||
|
||||
useShrinkGun :: Item -> Creature -> World -> World
|
||||
useShrinkGun it cr = case _itBool $ _itAttachment it of
|
||||
True -> sizeSelf 0.5 cr . f False UndroppableIdentified
|
||||
. stripNoItems cr
|
||||
. dropUnselected cr
|
||||
False -> sizeSelf 1 cr . f True Uncursed
|
||||
. setMinInvSize defaultInvSize cr
|
||||
where
|
||||
f isInUse cstatus = creatures . ix (_crID cr) . crInv . ix (_crInvSel cr) %~
|
||||
( (itAttachment . itBool .~ isInUse) . (itCurseStatus .~ cstatus) )
|
||||
|
||||
blinkGun :: Item
|
||||
blinkGun = defaultGun
|
||||
{ _itName = "BLINKER"
|
||||
, _itIdentity = Blinker
|
||||
, _wpMaxAmmo = 100
|
||||
, _wpLoadedAmmo = 100
|
||||
, _wpReloadTime = 20
|
||||
, _wpReloadState = 0
|
||||
, _itUseRate = 0
|
||||
, _itUseTime = 0
|
||||
, _itUse = const blinkAction
|
||||
, _itUseModifiers =
|
||||
[ ammoCheckI
|
||||
, hammerCheckI
|
||||
]
|
||||
, _itLeftClickUse = Just $ hammerCheckL $ shootL aSelfL
|
||||
, _wpSpread = 0.05
|
||||
, _wpRange = 20
|
||||
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2[(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)]
|
||||
, _itAimingSpeed = 1
|
||||
, _itAimingRange = 0
|
||||
}
|
||||
|
||||
|
||||
aSelf :: Creature -> World -> World
|
||||
aSelf = blinkAction
|
||||
|
||||
aSelfL :: Creature -> Int -> World -> World
|
||||
aSelfL cr _ = blinkAction cr
|
||||
Reference in New Issue
Block a user