module Dodge.Item.Equipment.Shape where
import Dodge.Data
import Dodge.Creature.HandPos
import Shape
import ShapePicture
import Geometry
import LensHelp

import Data.Maybe

shapeForWrist :: Shape -> Creature -> Item -> SPic
shapeForWrist = pictureOnEquip . noPic . translateSH (V3 0 4 (-4))

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
