Improve possible manipulation of equipment
This commit is contained in:
+39
-16
@@ -20,11 +20,12 @@ magShield :: Item
|
||||
magShield = defaultEquipment
|
||||
{ _itType = MAGSHIELD
|
||||
, _itName = "MAGSHIELD"
|
||||
, _itUse = EquipUse useMagShield GoesOnWrist
|
||||
, _itEquipPict = \_ _ -> (,) emptySH blank
|
||||
, _itID = Nothing
|
||||
, _itAttachment = ItMInt Nothing
|
||||
}
|
||||
& itUse . eqUse .~ useMagShield
|
||||
& itUse . eqSite .~ GoesOnWrist
|
||||
useMagShield :: Creature -> Int -> World -> World
|
||||
useMagShield cr invid w = w & magnets . at mgid ?~ themagnet
|
||||
where
|
||||
@@ -43,29 +44,42 @@ flameShield :: Item
|
||||
flameShield = defaultEquipment
|
||||
{ _itType = FLAMESHIELD
|
||||
, _itName = "FLAMESHIELD"
|
||||
, _itUse = EquipUse
|
||||
{_eqUse = \_ _ -> id
|
||||
,_eqSite = GoesOnChest
|
||||
}
|
||||
, _itEquipPict = \cr _ -> (,) emptySH $ setDepth 20 $ pictures [color cyan $ circle (_crRad cr+2)]
|
||||
, _itID = Nothing
|
||||
}
|
||||
} & itUse . eqSite .~ GoesOnChest
|
||||
{- | Slows you down, blocks forward projectiles. -}
|
||||
frontArmour :: Item
|
||||
frontArmour = defaultEquipment
|
||||
{ _itType = FRONTARMOUR
|
||||
, _itName = "FARMOUR"
|
||||
, _itUse = EquipUse
|
||||
{_eqUse = \_ _ -> id
|
||||
,_eqSite = GoesOnChest
|
||||
}
|
||||
, _itEquipPict = pictureOnEquip (emptySH , setDepth 20 $ pictures
|
||||
[color (greyN 0.1) $ thickArc 0 (pi/2) 10 5
|
||||
,color (greyN 0.1) $ thickArc (3*pi/2) (2*pi) 10 5
|
||||
[color thecol $ thickArc 0 (pi/2) 10 5
|
||||
,color thecol $ thickArc (3*pi/2) (2*pi) 10 5
|
||||
])
|
||||
, _itEffect = NoItEffect
|
||||
, _itID = Nothing
|
||||
}
|
||||
& itUse . eqSite .~ GoesOnChest
|
||||
where
|
||||
thecol = yellow -- (greyN 0.1)
|
||||
|
||||
wristArmour :: Item
|
||||
wristArmour = defaultEquipment
|
||||
{ _itType = WRISTARMOUR
|
||||
, _itName = "WRISTARMOUR"
|
||||
, _itEquipPict = spicForWrist (emptySH , setDepth 20 $ pictures
|
||||
[color thecol $ thickArc 0 (pi/2) 10 5
|
||||
,color thecol $ thickArc (3*pi/2) (2*pi) 10 5
|
||||
])
|
||||
, _itEffect = NoItEffect
|
||||
, _itID = Nothing
|
||||
}
|
||||
& itUse . eqSite .~ GoesOnWrist
|
||||
where
|
||||
thecol = yellow -- (greyN 0.1)
|
||||
|
||||
spicForWrist :: SPic -> Creature -> Item -> SPic
|
||||
spicForWrist = pictureOnEquip . translateSP (V3 0 4 (-4))
|
||||
pictureOnEquip :: SPic -> Creature -> Item -> SPic
|
||||
pictureOnEquip sp cr itm = fromMaybe mempty $ do
|
||||
i <- _itInvPos itm
|
||||
@@ -77,6 +91,8 @@ equipPosition epos cr sh = case epos of
|
||||
OnRightWrist -> translateToRightHand cr $ mirrorSPxz sh
|
||||
OnLegs -> translateToLeftLeg cr sh <>
|
||||
translateToRightLeg cr (mirrorSPxz sh)
|
||||
OnHead -> translateToHead cr sh
|
||||
OnChest -> translateToChest cr sh
|
||||
_ -> sh
|
||||
|
||||
flatShield :: Item
|
||||
@@ -191,20 +207,27 @@ jetPack = defaultEquipment
|
||||
$ pictures [color yellow $ polygon $ rectNSEW 5 (-5) (-3) (-11) ]
|
||||
, _itEffect = NoItEffect
|
||||
, _itID = Nothing
|
||||
} & itUse . eqSite .~ GoesOnBack
|
||||
|
||||
brainHat :: Item
|
||||
brainHat = defaultEquipment
|
||||
{ _itType = BRAINHAT
|
||||
, _itName = "BRAINHAT"
|
||||
, _itEquipPict = pictureOnEquip (noPic $ colorSH yellow $ upperPrismPoly 3 $ rectWH 4 4)
|
||||
, _itEffect = NoItEffect
|
||||
, _itID = Nothing
|
||||
}
|
||||
& itUse . eqSite .~ GoesOnHead
|
||||
|
||||
powerLegs :: Item
|
||||
powerLegs = defaultEquipment
|
||||
{ _itType = POWERLEGS
|
||||
, _itName = "POWERLEGS"
|
||||
, _itUse = EquipUse
|
||||
{_eqUse = \_ _ -> id
|
||||
,_eqSite = GoesOnLegs
|
||||
}
|
||||
, _itEquipPict = pictureOnEquip (noPic $ translateSH (V3 0 4 0) $ colorSH yellow $ upperPrismPoly 3 $ rectWH 2 2)
|
||||
, _itEffect = NoItEffect
|
||||
, _itID = Nothing
|
||||
}
|
||||
& itUse . eqSite .~ GoesOnLegs
|
||||
speedLegs :: Item
|
||||
speedLegs = powerLegs
|
||||
{ _itType = SPEEDLEGS
|
||||
|
||||
Reference in New Issue
Block a user