diff --git a/src/Dodge/Data.hs b/src/Dodge/Data.hs index e20d16483..238f56a8d 100644 --- a/src/Dodge/Data.hs +++ b/src/Dodge/Data.hs @@ -294,22 +294,6 @@ data FloorItem = FlIt { _flIt :: Item , _flItPos :: Point2 , _flItRot :: Float, data ItemPos = InInv { _itCrId :: Int , _itInvId :: Int } | OnFloor { _itFlID :: Int } -data UseDelay -- should just be Delay - = NoDelay - | FixedRate - {_rateMax :: Int - ,_rateTime :: Int - } - | VariableRate - {_rateMax :: Int - ,_rateTime :: Int - ,_rateMaxMax :: Int - ,_rateMinMax :: Int - } - | WarmUpNoDelay - {_warmTime :: Int - ,_warmMax :: Int - } data ItemUse = RightUse { _rUse :: Item -> Creature -> World -> World @@ -324,12 +308,6 @@ data ItemUse , _useHammer :: HammerType } | NoUse -data AimParams = AimParams - { _aimSpeed :: Float - , _aimRange :: Float - , _aimZoom :: ItZoom - , _aimStance :: AimStance - } _itUseAimStance :: Item -> AimStance _itUseAimStance = _aimStance . _useAim . _itUse data ItemConsumption @@ -349,21 +327,13 @@ data ItemConsumption { _itMaxStack' :: Int , _itAmount' :: Int } -data ItemType - = Weapon' - { _wpSpread :: Float - , _wpRange :: Float - , _wpNumBarrels :: Int - } - | UtilityItem - | ConsumableItem data Item = Weapon { _itName :: String , _itConsumption :: ItemConsumption , _itUse :: ItemUse , _itFloorPict :: Item -> SPic - , _itZoom :: ItZoom +-- , _itZoom :: ItZoom , _itEquipPict :: Creature -> Int -> SPic , _itScroll :: Float -> Creature -> Item -> Item , _itIdentity :: ItemIdentity @@ -373,7 +343,6 @@ data Item , _itInvDisplay :: Item -> String , _itInvColor :: Color , _itTargeting :: Maybe (World -> Maybe Point2, Int -> Item -> Creature -> World -> Picture) - , _itWorldTrigger :: Maybe (Int -> World -> Bool) , _itDimension :: ItemDimension , _itCurseStatus :: CurseStatus , _itType :: ItemType @@ -427,7 +396,7 @@ data Item , _twMaxRange :: Float , _twAccuracy :: Float , _itUse :: ItemUse - , _itZoom :: ItZoom +-- , _itZoom :: ItZoom , _itEquipPict :: Creature -> Int -> SPic , _itIdentity :: ItemIdentity , _itID :: Maybe Int @@ -440,7 +409,6 @@ data Item , _itDimension :: ItemDimension } | NoItem -data CurseStatus = Uncursed | UndroppableIdentified | UndroppableUnidentified data ItemDimension = ItemDimension { _itDim :: Point3 -- length width height @@ -453,7 +421,8 @@ data ItemDimension = ItemDimension data ReloadType = ActiveReload | PassiveReload SoundID -- I believe this is called every frame, not sure when though -data ItEffect = NoItEffect +data ItEffect + = NoItEffect | ItSimpleInvEffect {_itInvEffect :: ItEffect -> Creature -> Int -> World -> World -- the Int is the items inventory position @@ -477,11 +446,6 @@ data ItEffect = NoItEffect -- the Int is the items inventory position ,_itEffectID :: Maybe Int } -data ItZoom = ItZoom - { _itZoomMax :: Float - , _itZoomMin :: Float - , _itZoomFac :: Float - } data IntID a = IntID Int a {- Objects without ids. Update themselves, perhaps with side effects. -} @@ -888,7 +852,6 @@ makeLenses ''Item makeLenses ''ItemUse makeLenses ''ItemPos makeLenses ''ItEffect -makeLenses ''ItZoom makeLenses ''FloorItem makeLenses ''ItemConsumption makeLenses ''AmmoType @@ -913,8 +876,5 @@ makeLenses ''MachineType makeLenses ''Zone makeLenses ''ItemDimension makeLenses ''Vocalization -makeLenses ''UseDelay -makeLenses ''AimParams makeLenses ''Universe makeLenses ''LSParam -makeLenses ''ItemType diff --git a/src/Dodge/Default/Weapon.hs b/src/Dodge/Default/Weapon.hs index 13fe5303c..517f6dcd2 100644 --- a/src/Dodge/Default/Weapon.hs +++ b/src/Dodge/Default/Weapon.hs @@ -86,13 +86,11 @@ defaultGun = Weapon , _itIdentity = Pistol , _itConsumption = defaultAmmo , _itUse = defaultrUse - , _wpSpread = 0.02 - , _wpRange = 20 , _itFloorPict = const $ noPic $ colorSH green (prismPoly (map (addZ 3) $ rectNESW 3 3 (-3) (-3)) (map (addZ 0) $ rectNESW 5 3 (-5) (-7)) ) - , _itZoom = ItZoom 20 0.2 1 +-- , _itZoom = ItZoom 20 0.2 1 , _itEquipPict = pictureWeaponOnAim , _itScroll = \_ _ -> id , _itAttachment = NoItAttachment @@ -101,8 +99,11 @@ defaultGun = Weapon , _itInvDisplay = basicWeaponDisplay , _itInvColor = white , _itTargeting = Nothing - , _itWorldTrigger = Nothing - , _wpNumBarrels = 1 + , _itType = Weapon' + { _wpSpread = 0.02 + , _wpRange = 20 + , _wpNumBarrels = 1 + } , _itDimension = defaultItemDimension } defaultItemDimension :: ItemDimension diff --git a/src/Dodge/Item.hs b/src/Dodge/Item.hs index 2dd58f6f0..835a4f5f9 100644 --- a/src/Dodge/Item.hs +++ b/src/Dodge/Item.hs @@ -18,7 +18,7 @@ keyToken n = defaultEquipment , _itEquipPict = \_ _ -> (,) emptySH $ setDepth 0 $ translate (-5) (-5) $ rotate (pi/2.5) keyPic , _itEffect = NoItEffect , _itID = Nothing - , _itZoom = defaultItZoom +-- , _itZoom = defaultItZoom , _itInvColor = yellow , _itInvDisplay = _itName } @@ -39,7 +39,7 @@ latchkey n = defaultEquipment , _itEquipPict = \_ _ -> (,) emptySH $ setDepth 0 $ translate (-5) (-5) $ rotate (pi/2.5) latchkeyPic , _itEffect = NoItEffect , _itID = Nothing - , _itZoom = defaultItZoom +-- , _itZoom = defaultItZoom , _itInvColor = yellow , _itInvDisplay = _itName } diff --git a/src/Dodge/Item/Data.hs b/src/Dodge/Item/Data.hs index b7ffe1851..81ae2dfa8 100644 --- a/src/Dodge/Item/Data.hs +++ b/src/Dodge/Item/Data.hs @@ -54,4 +54,44 @@ data AimStance | LeaveHolstered deriving (Eq,Show,Ord,Enum) +data ItZoom = ItZoom + { _itZoomMax :: Float + , _itZoomMin :: Float + , _itZoomFac :: Float + } +data CurseStatus = Uncursed | UndroppableIdentified | UndroppableUnidentified +data AimParams = AimParams + { _aimSpeed :: Float + , _aimRange :: Float + , _aimZoom :: ItZoom + , _aimStance :: AimStance + } +data UseDelay -- should just be Delay + = NoDelay + | FixedRate + {_rateMax :: Int + ,_rateTime :: Int + } + | VariableRate + {_rateMax :: Int + ,_rateTime :: Int + ,_rateMaxMax :: Int + ,_rateMinMax :: Int + } + | WarmUpNoDelay + {_warmTime :: Int + ,_warmMax :: Int + } +data ItemType + = Weapon' + { _wpSpread :: Float + , _wpRange :: Float + , _wpNumBarrels :: Int + } + | UtilityItem + | ConsumableItem makeLenses ''HammerType +makeLenses ''ItZoom +makeLenses ''AimParams +makeLenses ''UseDelay +makeLenses ''ItemType diff --git a/src/Dodge/Item/Weapon/BatteryGuns.hs b/src/Dodge/Item/Weapon/BatteryGuns.hs index 3bc59c969..948934e6e 100644 --- a/src/Dodge/Item/Weapon/BatteryGuns.hs +++ b/src/Dodge/Item/Weapon/BatteryGuns.hs @@ -10,7 +10,7 @@ import Dodge.Particle.TeslaArc import Dodge.SoundLogic.LoadSound import Dodge.WorldEvent import Dodge.WorldEvent.Damage -import Dodge.Default +--import Dodge.Default import Dodge.Item.Weapon.InventoryDisplay import Dodge.Item.Weapon.TriggerType import Dodge.Item.Weapon.AmmoParams @@ -50,11 +50,9 @@ teslaGun = defaultGun ] & useAim . aimSpeed .~ 0.4 & useAim . aimStance .~ TwoHandFlat - , _wpSpread = 0.001 - , _wpRange = 20 , _itFloorPict = teslaGunPic - , _itZoom = defaultItZoom - } +-- , _itZoom = defaultItZoom + } & itType . wpSpread .~ 0.001 teslaGunPic :: Item -> SPic teslaGunPic _ = noPic $ colorSH blue $ upperPrismPoly 5 (rectNESW xb y xa (-y)) @@ -81,8 +79,6 @@ lasGun = defaultAutoGun & useAim . aimSpeed .~ 0.4 & useAim . aimRange .~ 1 & useAim . aimStance .~ TwoHandTwist - , _wpSpread = 0.001 - , _wpRange = 20 , _itFloorPict = lasGunPic , _itAttachment = ItCharMode $ Seq.fromList "/VZ" , _itScroll = scrollCharMode @@ -116,8 +112,6 @@ tractorGun = defaultAutoGun & useAim . aimSpeed .~ 0.4 & useAim . aimRange .~ 1 & useAim . aimStance .~ TwoHandTwist - , _wpSpread = 0.00001 - , _wpRange = 20 , _itFloorPict = tractorGunSPic } -- TODO own picture for tractor gun diff --git a/src/Dodge/Item/Weapon/Bezier.hs b/src/Dodge/Item/Weapon/Bezier.hs index 9ca2d3424..439451c44 100644 --- a/src/Dodge/Item/Weapon/Bezier.hs +++ b/src/Dodge/Item/Weapon/Bezier.hs @@ -8,7 +8,7 @@ import Dodge.Item.Weapon.Targeting import Dodge.Item.Weapon.BulletGuns import Dodge.Item.Weapon.TriggerType import Dodge.Item.Weapon.ExtraEffect -import Dodge.Default +--import Dodge.Default import Dodge.Particle.Bullet.Spawn import Dodge.Particle.Bullet.HitEffect import Dodge.WorldEvent.HitEffect @@ -41,7 +41,7 @@ bezierGun = defaultGun , _itAttachment = NoItAttachment , _itScroll = \_ _ -> removeItTarget , _itEffect = rbSetTarget - , _itZoom = defaultItZoom +-- , _itZoom = defaultItZoom , _itConsumption = defaultAmmo { _wpMaxAmmo = 50 } diff --git a/src/Dodge/Item/Weapon/Booster.hs b/src/Dodge/Item/Weapon/Booster.hs index 5b5f3acd2..b4167f06b 100644 --- a/src/Dodge/Item/Weapon/Booster.hs +++ b/src/Dodge/Item/Weapon/Booster.hs @@ -119,10 +119,9 @@ boosterGun = defaultGun , _wpReloadTime = 20 } , _itUse = luseInstantNoH $ boostSelfL 10 - , _wpSpread = 0.05 - , _wpRange = 20 , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-2,-2),(-2,2),(2,2),(2,0),(0,0),(0,-2)] , _itEffect = resetAttachmentID + , _itType = UtilityItem } resetAttachmentID :: ItEffect resetAttachmentID = ItInvEffect f 0 diff --git a/src/Dodge/Item/Weapon/BulletGuns.hs b/src/Dodge/Item/Weapon/BulletGuns.hs index 6e787feee..5082312be 100644 --- a/src/Dodge/Item/Weapon/BulletGuns.hs +++ b/src/Dodge/Item/Weapon/BulletGuns.hs @@ -61,15 +61,13 @@ autoGun = defaultAutoGun & useAim . aimRange .~ 1 & useAim . aimStance .~ TwoHandTwist & useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} - , _wpSpread = autogunSpread - , _wpRange = 20 , _itFloorPict = autoGunPic - , _itZoom = defaultItZoom +-- , _itZoom = defaultItZoom , _itEquipPict = pictureWeaponOnAim , _itAttachment = ItCharMode $ Seq.fromList "MS" , _itScroll = scrollCharMode , _itInvDisplay = basicWeaponDisplay - } + } & itType . wpSpread .~ autogunSpread autoGunPic :: Item -> SPic autoGunPic it = noPic $ colorSH red (prismPoly @@ -99,16 +97,13 @@ pistol = defaultGun , randSpreadDir , withMuzFlareI ] - , _wpSpread = 0.02 - , _wpRange = 20 , _itFloorPict = pistolPic - , _itZoom = defaultItZoom +-- , _itZoom = defaultItZoom , _itEquipPict = pictureWeaponAim pistolPic , _itID = Nothing , _itInvDisplay = basicWeaponDisplay , _itInvColor = white , _itTargeting = Nothing - , _itWorldTrigger = Nothing } pistolPic :: Item -> SPic pistolPic it = noPic $ colorSH green (prismPoly @@ -146,7 +141,6 @@ hvAutoGun = defaultAutoGun & useAim . aimStance .~ TwoHandTwist & useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} & useDelay .~ VariableRate {_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0} - , _wpRange = 20 , _itFloorPict = hvAutoGunPic } hvAutoGunPic :: Item -> SPic @@ -180,12 +174,11 @@ ltAutoGun = defaultAutoGun , withSidePushI 50 , modClock 2 withMuzFlareI ] - , _wpSpread = 0.5 - , _wpRange = 20 , _itFloorPict = ltAutoGunPic - , _itZoom = defaultItZoom +-- , _itZoom = defaultItZoom } & itDimension . muzzleLength .~ 10 + & itType . wpSpread .~ 0.5 ltAutoGunPic :: Item -> SPic ltAutoGunPic it = ( colorSH green $ prismPoly @@ -243,7 +236,6 @@ miniGun = defaultAutoGun & useAim . aimRange .~ 1 & useAim . aimStance .~ TwoHandTwist & useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} - , _wpRange = 20 , _itFloorPict = miniGunPictItem , _itEquipPict = pictureWeaponAim miniGunPictItem } & itDimension . muzzleLength .~ 15 @@ -306,11 +298,9 @@ spreadGun = defaultGun , withMuzFlareI , spreadNumI ] - , _wpSpread = spreadGunSpread - , _wpRange = 20 , _itFloorPict = spreadGunPic - , _wpNumBarrels = 50 - } + } & itType . wpSpread .~ spreadGunSpread + & itType . wpNumBarrels .~ 50 spreadGunPic :: Item -> SPic spreadGunPic it = ( colorSH green (upperPrismPoly 5 $ map toV2[(-3,0),(3,6),(3,-6)]) @@ -343,12 +333,9 @@ multGun = defaultGun & useAim . aimRange .~ 1 & useAim . aimStance .~ TwoHandTwist & useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5} - , _wpSpread = spreadGunSpread - , _wpRange = 20 , _itFloorPict = multGunSPic - , _itZoom = defaultItZoom - , _wpNumBarrels = 5 - } +-- , _itZoom = defaultItZoom + } & itType . wpNumBarrels .~ 5 multGunSPic :: Item -> SPic multGunSPic it = ( colorSH red ( @@ -389,13 +376,12 @@ longGun = defaultGun & useAim . aimRange .~ 1 & useAim . aimStance .~ TwoHandTwist & useAim . aimZoom .~ defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5} - , _wpRange = 200 , _itFloorPict = longGunSPic - , _itZoom = defaultItZoom +-- , _itZoom = defaultItZoom , _itScroll = zoomLongGun , _itAttachment = ItScope (V2 0 0) 0 1 False , _itEffect = itemLaserScopeEffect - } + } & itType . wpRange .~ 200 longGunSPic :: Item -> SPic longGunSPic _ = ( colorSH orange $ upperPrismPoly 5 $ rectWH 12 2 diff --git a/src/Dodge/Item/Weapon/Drone.hs b/src/Dodge/Item/Weapon/Drone.hs index d0bc2c1b3..3a3c71faa 100644 --- a/src/Dodge/Item/Weapon/Drone.hs +++ b/src/Dodge/Item/Weapon/Drone.hs @@ -37,8 +37,6 @@ lasDrones = defaultGun & useAim . aimSpeed .~ 0.2 & useAim . aimRange .~ 0.5 & useAim . aimStance .~ TwoHandTwist - , _wpSpread = 0.02 - , _wpRange = 20 , _itFloorPict = lasDronesPic , _itEffect = NoItEffect } diff --git a/src/Dodge/Item/Weapon/Grenade.hs b/src/Dodge/Item/Weapon/Grenade.hs index a2578c650..0cea3af93 100644 --- a/src/Dodge/Item/Weapon/Grenade.hs +++ b/src/Dodge/Item/Weapon/Grenade.hs @@ -37,7 +37,7 @@ grenade = Throwable [ useTimeCheck ] & useAim . aimZoom .~ defaultItZoom {_itZoomMax = f fuseTime, _itZoomMin = f fuseTime} - , _itZoom = defaultItZoom +-- , _itZoom = defaultItZoom , _itEquipPict = pictureWeaponOnAim' $ \_ -> grenadePic fuseTime , _itID = Nothing , _itAttachment = ItFuse fuseTime diff --git a/src/Dodge/Item/Weapon/Launcher.hs b/src/Dodge/Item/Weapon/Launcher.hs index 76ba12e2d..9bc910b5d 100644 --- a/src/Dodge/Item/Weapon/Launcher.hs +++ b/src/Dodge/Item/Weapon/Launcher.hs @@ -57,8 +57,6 @@ launcher = defaultGun & useAim . aimSpeed .~ 0.2 & useAim . aimRange .~ 0.5 & useAim . aimStance .~ TwoHandTwist - , _wpSpread = 0.02 - , _wpRange = 20 , _itFloorPict = launcherPic , _itEffect = NoItEffect } @@ -258,8 +256,6 @@ remoteLauncher = defaultGun & useAim . aimSpeed .~ 0.2 & useAim . aimRange .~ 0.5 & useAim . aimStance .~ TwoHandTwist - , _wpSpread = 0.02 - , _wpRange = 20 , _itFloorPict = launcherPic , _itAttachment = ItScope (V2 0 0) 0 1 True } diff --git a/src/Dodge/Item/Weapon/Radar.hs b/src/Dodge/Item/Weapon/Radar.hs index 2b961e875..f718ca7fb 100644 --- a/src/Dodge/Item/Weapon/Radar.hs +++ b/src/Dodge/Item/Weapon/Radar.hs @@ -3,7 +3,6 @@ import Dodge.Data import Dodge.Picture.Layer import Dodge.Default import Dodge.Item.Draw -import Dodge.Item.Weapon.BulletGuns import Dodge.Item.Weapon.TriggerType import Dodge.Item.Weapon.ExtraEffect import Dodge.Item.Weapon.UseEffect @@ -32,10 +31,8 @@ radar = defaultGun ] & useAim . aimRange .~ 1 & useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1} - , _wpSpread = autogunSpread - , _wpRange = 20 , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color blue $ polygon $ rectNESW 5 5 (-5) (-5) - , _itZoom = defaultItZoom { _itZoomMax = 1} +-- , _itZoom = defaultItZoom { _itZoomMax = 1} , _itEquipPict = pictureWeaponOnAim' $ \_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5) } {- | @@ -54,9 +51,8 @@ sonar = defaultGun ] & useAim . aimRange .~ 1 & useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1} - , _wpRange = 20 , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color blue $ polygon $ rectNESW 5 5 (-5) (-5) - , _itZoom = defaultItZoom {_itZoomMax = 1} +-- , _itZoom = defaultItZoom {_itZoomMax = 1} , _itEquipPict = pictureWeaponOnAim' $ \_ -> (,) emptySH $ color blue $ polygon $ rectNESW 5 5 (-5) (-5) } {- | @@ -71,7 +67,7 @@ autoSonar = defaultEquipment , _itEquipPict = \_ _ -> (,) emptySH blank , _itEffect = autoSonarEffect , _itID = Nothing - , _itZoom = defaultItZoom {_itZoomMax = 1} +-- , _itZoom = defaultItZoom {_itZoomMax = 1} } {- | Automatically sends out pulses that display walls. -} @@ -85,5 +81,5 @@ autoRadar = defaultEquipment , _itEquipPict = \_ _ -> (,) emptySH blank , _itEffect = autoRadarEffect , _itID = Nothing - , _itZoom = defaultItZoom {_itZoomMax = 1} +-- , _itZoom = defaultItZoom {_itZoomMax = 1} } diff --git a/src/Dodge/Item/Weapon/SprayGuns.hs b/src/Dodge/Item/Weapon/SprayGuns.hs index aeb2b14ad..67f86e307 100644 --- a/src/Dodge/Item/Weapon/SprayGuns.hs +++ b/src/Dodge/Item/Weapon/SprayGuns.hs @@ -48,11 +48,13 @@ poisonSprayer = defaultAutoGun & useAim . aimSpeed .~ 0.2 & useAim . aimRange .~ 0 & useAim . aimStance .~ TwoHandTwist - , _wpRange = 8 + , _itType = Weapon' + { _wpRange = 8 + , _wpSpread = 0.1 + , _wpNumBarrels = 3 + } , _itFloorPict = flamerPic - , _itZoom = defaultItZoom - , _wpSpread = 0.1 - , _wpNumBarrels = 3 +-- , _itZoom = defaultItZoom } flamer :: Item flamer = defaultAutoGun @@ -73,12 +75,10 @@ flamer = defaultAutoGun & useAim . aimSpeed .~ 0.5 & useAim . aimZoom .~ defaultItZoom {_itZoomMax = 5, _itZoomMin = 1.5} & useAim . aimStance .~ TwoHandTwist - , _wpSpread = 0 - , _wpRange = 8 , _itFloorPict = flamerPic - , _itZoom = defaultItZoom +-- , _itZoom = defaultItZoom , _itAttachment = NoItAttachment - } + } & itType . wpRange .~ 8 flamerPic :: Item -> SPic flamerPic it = ( colorSH yellow $ diff --git a/src/Dodge/Item/Weapon/TriggerType.hs b/src/Dodge/Item/Weapon/TriggerType.hs index 18a8d8336..fc12ab564 100644 --- a/src/Dodge/Item/Weapon/TriggerType.hs +++ b/src/Dodge/Item/Weapon/TriggerType.hs @@ -320,7 +320,7 @@ withMuzFlareI f it cr w = makeTlsTimeRadColPos 3 100 (V3 1 1 0.5) flashPos randSpreadDir :: ChainEffect randSpreadDir f it cr w = f it (cr & crDir +~ a) $ set randGen g w where - acc = _wpSpread it + acc = _wpSpread $ _itType it (a, g) = randomR (-acc,acc) $ _randGen w {- | Applies the effect to a randomly rotated creature. -} withRandomDirI @@ -391,8 +391,8 @@ spreadNumI eff item cr w = foldr f w dirs [-spread,-spread+(2*spread/fromIntegral numBul)..spread] (randomRs (0,spread/fromIntegral numBul) (_randGen w)) f dir = eff item (cr & crDir +~ dir) - spread = _wpSpread item - numBul = _wpNumBarrels item + spread = _wpSpread $ _itType item + numBul = _wpNumBarrels $ _itType item numI :: ChainEffect numI eff item cr w = foldr f w poss where @@ -401,7 +401,7 @@ numI eff item cr w = foldr f w poss poss :: [V2 Float] poss = map (rotateV (_crDir cr) . V2 0 . (*5) . (+ cp) . fromIntegral) [0 .. numBul - 1] f pos = eff item (cr & crPos %~ (+.+ pos)) - numBul = _wpNumBarrels item + numBul = _wpNumBarrels $ _itType item {- | Uses '_wpSpread' as a parameter for the current offset angle. -} randWalkAngle :: Float -- ^ Max offset angle @@ -412,10 +412,10 @@ randWalkAngle -> World randWalkAngle ma aspeed f cr w = w & f (cr & crDir +~ a) - & creatures . ix cid . crInv . ix i . wpSpread .~ newa + & creatures . ix cid . crInv . ix i . itType . wpSpread .~ newa where cid = _crID cr - a = _wpSpread $ _crInv (_creatures w IM.! cid) IM.! i + a = _wpSpread $ _itType $ _crInv (_creatures w IM.! cid) IM.! i (walka, _) = randomR (-aspeed,aspeed) (_randGen w) newa = min ma $ max (negate ma) (a + walka) i = _crInvSel $ _creatures w IM.! cid diff --git a/src/Dodge/Item/Weapon/Utility.hs b/src/Dodge/Item/Weapon/Utility.hs index da39c561d..77edab8e2 100644 --- a/src/Dodge/Item/Weapon/Utility.hs +++ b/src/Dodge/Item/Weapon/Utility.hs @@ -63,8 +63,7 @@ shrinkGun = defaultGun } , _itUse = defaultlUse {_lUse = hammerCheckL useShrinkGun} & useHammer .~ upHammer - , _wpSpread = 0.05 - , _wpRange = 20 + , _itType = UtilityItem , _itFloorPict = shrinkGunPic , _itAttachment = ItBool True } @@ -96,8 +95,7 @@ blinkGun = defaultGun , _itUse = defaultlUse {_lUse = hammerCheckL $ shootL aSelfL } & useHammer .~ upHammer - , _wpSpread = 0.05 - , _wpRange = 20 + , _itType = UtilityItem , _itFloorPict = const . noPic . colorSH chartreuse $ upperPrismPoly 2 $ square 2 } @@ -129,8 +127,6 @@ forceFieldGun = defaultGun , _wpReloadState = 0 } , _itUse = undefined - , _wpSpread = 0.02 - , _wpRange = 20 , _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-4,-4),(-4,4),(4,4),(4,0),(0,0),(0,-4)] } -- grapGun = defaultGun