Improve detector equipment, various cleanup

This commit is contained in:
2022-05-27 18:49:54 +01:00
parent 60fc2d44e8
commit 79b3a86520
15 changed files with 180 additions and 138 deletions
+15 -18
View File
@@ -1,6 +1,7 @@
module Dodge.Item.Equipment where
import Dodge.Data
import Dodge.Item.Draw
import Dodge.Item.Equipment.Shape
import Dodge.Item.Weapon.InventoryDisplay
import Dodge.LightSource
import Dodge.Default
@@ -58,7 +59,6 @@ frontArmour = defaultEquipment
[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
@@ -70,7 +70,6 @@ wristArmour = defaultEquipment
{ _itType = WRISTARMOUR
, _itName = "WRISTARMOUR"
, _itEquipPict = spicForWrist mempty
, _itEffect = NoItEffect
, _itID = Nothing
}
& itUse . eqSite .~ GoesOnWrist
@@ -109,22 +108,6 @@ setWristShieldPos itm cr w = w
| otherwise = id
f = (+.+ _crPos cr) . stripZ . rotate3 (_crDir cr) . handtrans cr
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
epos <- cr^? crInvEquipped . ix i
return $ equipPosition epos cr sp
equipPosition :: EquipPosition -> Creature -> SPic -> SPic
equipPosition epos cr sh = case epos of
OnLeftWrist -> translateToLeftHand cr sh
OnRightWrist -> translateToRightHand cr sh
OnLegs -> translateToLeftLeg cr sh <>
translateToRightLeg cr (mirrorSPxz sh)
OnHead -> translateToHead cr sh
OnChest -> translateToChest cr sh
_ -> sh
flatShield :: Item
flatShield = defaultEquipment
@@ -306,3 +289,17 @@ jumpLegs = powerLegs
{ _itType = JUMPLEGS
, _itName = "JUMPLEGS"
}
wristInvisibility :: Item
wristInvisibility = defaultEquipment
{ _itType = INVISIBILITYEQUIPMENT GoesOnWrist
, _itName = "WRISTINVISIBILITY"
, _itEquipPict = shapeForWrist (colorSH chartreuse $ upperPrismPoly 3 $ rectWH 2 2)
, _itID = Nothing
}
& itUse . eqSite .~ GoesOnWrist
& itUse . eqOnEquip .~ overCID (crCamouflage .~ Invisible)
& itUse . eqOnRemove .~ overCID (crCamouflage .~ FullyVisible)
overCID :: (Creature -> Creature) -> Item -> Creature -> World -> World
overCID f _ cr = creatures . ix (_crID cr) %~ f