Allow for stacking of items and combining sensibly
This commit is contained in:
@@ -72,7 +72,6 @@ autoGun = defaultAutoGun
|
||||
, _itEquipPict = pictureWeaponOnAim
|
||||
, _itAttachment = ItCharMode $ Seq.fromList "MS"
|
||||
, _itScroll = scrollCharMode
|
||||
, _itInvDisplay = basicWeaponDisplay
|
||||
, _itParams = BulletShooter
|
||||
{ _muzVel = 1
|
||||
, _rifling = 0.9
|
||||
@@ -90,15 +89,14 @@ autoGunPic it = noPic $
|
||||
<> translateSHf 0 (-1) (rotateSHx (negate $ pi/4) . upperPrismPoly 2 $ rectNESW (negate $ 3 + 0.25 * x) 0 3 (-5))
|
||||
where
|
||||
x = fromIntegral $ _ammoLoaded $ _itConsumption it
|
||||
bangStick :: Item
|
||||
bangStick = defaultGun
|
||||
{ _itName = "BANGSTICK"
|
||||
, _itCombineType = BANGSTICK
|
||||
bangStick :: Int -> Item
|
||||
bangStick i = defaultGun
|
||||
{ _itName = "BANGSTICK"++ show i
|
||||
, _itCombineType = BANGSTICK i
|
||||
, _itConsumption = defaultAmmo
|
||||
{ _aoType = basicBullet
|
||||
, _ammoMax = 1
|
||||
, _ammoLoaded = 1
|
||||
, _reloadTime = 20
|
||||
, _ammoMax = i
|
||||
, _reloadTime = 15
|
||||
, _reloadType = ActivePartial 1
|
||||
}
|
||||
, _itUse = useAmmoParamsRate 8 upHammer
|
||||
@@ -106,27 +104,31 @@ bangStick = defaultGun
|
||||
, hammerCheckI
|
||||
, useTimeCheck
|
||||
, withSoundStart tap3S
|
||||
, useAmmoAmount 1
|
||||
, applyInaccuracy
|
||||
, useAllAmmo
|
||||
-- , applyInaccuracy
|
||||
, withMuzFlareI
|
||||
, spreadLoaded
|
||||
, withRecoilI 25
|
||||
]
|
||||
, _itFloorPict = pistolPic
|
||||
-- , _itZoom = defaultItZoom
|
||||
, _itEquipPict = pictureWeaponAim pistolPic
|
||||
, _itID = Nothing
|
||||
, _itInvDisplay = basicWeaponDisplay
|
||||
, _itInvColor = white
|
||||
, _itTargeting = Nothing
|
||||
, _itParams = BulletShooter
|
||||
{ _muzVel = 0.8
|
||||
, _rifling = 0.8
|
||||
, _bore = 2
|
||||
, _gunBarrels = SingleBarrel 0.05
|
||||
, _gunBarrels = MultiBarrel
|
||||
{_brlNum = i
|
||||
,_brlSpread = SpreadBarrels 0.2
|
||||
}
|
||||
}
|
||||
, _itTweaks = defaultBulletSelTweak
|
||||
}
|
||||
bangCane,bangRod :: Item
|
||||
bangCane = bangStick
|
||||
bangCane = defaultGun
|
||||
{ _itParams = BulletShooter
|
||||
{ _muzVel = 0.8
|
||||
, _rifling = 0.9
|
||||
@@ -175,7 +177,6 @@ pistol = defaultGun
|
||||
-- , _itZoom = defaultItZoom
|
||||
, _itEquipPict = pictureWeaponAim pistolPic
|
||||
, _itID = Nothing
|
||||
, _itInvDisplay = basicWeaponDisplay
|
||||
, _itInvColor = white
|
||||
, _itTargeting = Nothing
|
||||
, _itParams = BulletShooter
|
||||
@@ -224,7 +225,7 @@ hvAutoGun = defaultAutoGun
|
||||
& useDelay .~ VariableRate {_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
|
||||
, _itFloorPict = hvAutoGunPic
|
||||
, _itInvSize = 3
|
||||
, _itInvDisplay = \it -> basicWeaponDisplay it ++
|
||||
, _itInvDisplay = \it -> basicItemDisplay it ++
|
||||
["* FRATE: *"
|
||||
,"* " ++ fromMaybe " " (maybeRateStatus it) ++ " *"
|
||||
]
|
||||
@@ -339,7 +340,7 @@ miniGun = defaultAutoGun
|
||||
, _itEquipPict = pictureWeaponAim miniGunPictItem
|
||||
, _itTweaks = defaultBulletSelTweak
|
||||
, _itInvSize = 4
|
||||
, _itInvDisplay = \it -> basicWeaponDisplay it ++
|
||||
, _itInvDisplay = \it -> basicItemDisplay it ++
|
||||
["*" ++ replicate 8 ' ' ++ "*"
|
||||
,"* " ++ fromMaybe " " (maybeWarmupStatus it) ++ " *"
|
||||
,"*" ++ replicate 8 ' ' ++ "*" ]
|
||||
@@ -446,7 +447,7 @@ multGun = defaultGun
|
||||
, useAllAmmo
|
||||
, withRecoilI 200
|
||||
, withMuzFlareI
|
||||
, duplicateEachLoadedBarrel
|
||||
, duplicateLoadedBarrels
|
||||
]
|
||||
& useAim . aimSpeed .~ 0.4
|
||||
& useAim . aimRange .~ 1
|
||||
|
||||
@@ -30,7 +30,6 @@ grenade = Throwable
|
||||
, _itDimension = defaultItemDimension
|
||||
, _itCurseStatus = Uncursed
|
||||
, _itMaxStack = 8
|
||||
, _itAmount = 1
|
||||
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
|
||||
, _twMaxRange = 150
|
||||
, _twAccuracy = 30
|
||||
@@ -43,7 +42,7 @@ grenade = Throwable
|
||||
, _itID = Nothing
|
||||
, _itAttachment = ItFuse fuseTime
|
||||
, _itInvColor = white
|
||||
, _itInvDisplay = basicWeaponDisplay
|
||||
, _itInvDisplay = basicItemDisplay
|
||||
, _itEffect = NoItEffect
|
||||
, _itScroll = changeFuse
|
||||
}
|
||||
@@ -215,7 +214,6 @@ remoteBomb = defaultThrowable
|
||||
{ _itName = "REMOTEBOMB"
|
||||
, _itCombineType = REMOTEBOMB
|
||||
, _itMaxStack = 1
|
||||
, _itAmount = 1
|
||||
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ polygon $ map toV2
|
||||
[(-3,-3),(-3,3),(3,3),(3,-3)]
|
||||
, _twMaxRange = 150
|
||||
|
||||
@@ -2,19 +2,22 @@
|
||||
Display of weapon strings in the inventory.
|
||||
-}
|
||||
module Dodge.Item.Weapon.InventoryDisplay
|
||||
( basicWeaponDisplay
|
||||
( basicItemDisplay
|
||||
, maybeWarmupStatus
|
||||
, maybeRateStatus
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Padding
|
||||
import Dodge.Inventory.ItemSpace
|
||||
|
||||
import Data.Maybe
|
||||
import Data.Sequence
|
||||
import Control.Lens
|
||||
{- | Displays the item name, ammo if loaded, and any selected '_itCharMode'. -}
|
||||
basicWeaponDisplay :: Item -> [String]
|
||||
basicWeaponDisplay it = [midPadL 10 ' ' thename (' ' : thenumber) ++ theparam]
|
||||
basicItemDisplay :: Item -> [String]
|
||||
basicItemDisplay it = Prelude.take (itSlotsTaken it) $
|
||||
[midPadL 15 ' ' thename (' ' : thenumber) ++ theparam]
|
||||
++ repeat "*"
|
||||
where
|
||||
thename = _itName it
|
||||
thenumber = case it ^? itConsumption of
|
||||
@@ -22,7 +25,7 @@ basicWeaponDisplay it = [midPadL 10 ' ' thename (' ' : thenumber) ++ theparam]
|
||||
Nothing' -> show (_ammoLoaded am)
|
||||
Just' x -> show x ++ "R" ++ show (_ammoLoaded am)
|
||||
Just am@ChargeableAmmo{} -> show $ _wpCharge am
|
||||
Just x@ItemItselfConsumable{} -> show $ _itMaxStack' x
|
||||
Just x@ItemItselfConsumable{} -> "x" ++ show (_itAmount' x)
|
||||
Just NoConsumption -> "NOCONSUMPTION"
|
||||
Nothing -> ""
|
||||
theparam = fromMaybe []
|
||||
|
||||
@@ -69,7 +69,7 @@ launcher = defaultGun
|
||||
, _tweakParams = basicAmPjMoves
|
||||
}
|
||||
, _itInvSize = 3
|
||||
, _itInvDisplay = \it -> basicWeaponDisplay it ++
|
||||
, _itInvDisplay = \it -> basicItemDisplay it ++
|
||||
["!" ++ replicate 8 ch ++ "!"
|
||||
,"!" ++ replicate 8 ch ++ "!"]
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@ autoSonar = defaultEquipment
|
||||
{ _itCombineType = RADAR
|
||||
, _itName = "AUTOSONAR"
|
||||
, _itMaxStack = 1
|
||||
, _itAmount = 1
|
||||
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color yellow $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
|
||||
, _itEquipPict = \_ _ -> (,) emptySH blank
|
||||
, _itEffect = autoSonarEffect
|
||||
@@ -76,7 +75,6 @@ autoRadar = defaultEquipment
|
||||
{ _itCombineType = RADAR
|
||||
, _itName = "AUTORADAR"
|
||||
, _itMaxStack = 1
|
||||
, _itAmount = 1
|
||||
, _itFloorPict = \_ -> (,) emptySH $ onLayer FlItLayer $ color yellow $ polygon $ map toV2 [(-3,-3),(-3,3),(3,3),(3,-3)]
|
||||
, _itEquipPict = \_ _ -> (,) emptySH blank
|
||||
, _itEffect = autoRadarEffect
|
||||
|
||||
@@ -26,8 +26,9 @@ module Dodge.Item.Weapon.TriggerType
|
||||
, withSidePushI
|
||||
, withWarmUp
|
||||
, spreadNumI
|
||||
, numBarrels
|
||||
, duplicateEachLoadedBarrel
|
||||
, spreadLoaded
|
||||
-- , numBarrels
|
||||
, duplicateLoadedBarrels
|
||||
, randWalkAngle -- ^ should be made into a modifier, perhaps
|
||||
, hammerCheckI
|
||||
, hammerCheckL
|
||||
@@ -387,6 +388,7 @@ torqueAfterI torque feff item cr w
|
||||
(rot, g) = randomR (-torque,torque) $ _randGen w
|
||||
rotateScope = creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
|
||||
. itAttachment . scopePos %~ rotateV rot
|
||||
|
||||
spreadNumI :: ChainEffect
|
||||
spreadNumI eff item cr w = foldr f w dirs
|
||||
where
|
||||
@@ -396,8 +398,24 @@ spreadNumI eff item cr w = foldr f w dirs
|
||||
f dir = eff item (cr & crDir +~ dir)
|
||||
spread = _spreadAngle . _brlSpread . _gunBarrels $ _itParams item
|
||||
numBul = _brlNum . _gunBarrels $ _itParams item
|
||||
duplicateEachLoadedBarrel :: ChainEffect
|
||||
duplicateEachLoadedBarrel eff item cr w = foldr f w poss
|
||||
spreadLoaded :: ChainEffect
|
||||
spreadLoaded eff item cr w = foldr f w dirs
|
||||
where
|
||||
cd = 0.5 * spread * fromIntegral (numBulLoaded -1)
|
||||
ds = (subtract cd . (spread *) . fromIntegral) <$> [0 .. numBulLoaded - 1]
|
||||
-- dirs = ds
|
||||
dirs = zipWith (+)
|
||||
ds
|
||||
(randomRs (-spread,spread) (_randGen w))
|
||||
f dir = eff item (cr & crDir +~ dir)
|
||||
spread = (_spreadAngle . _brlSpread . _gunBarrels $ _itParams item)
|
||||
-- numBarrels = _brlNum . _gunBarrels $ _itParams item
|
||||
-- spread = (_spreadAngle . _brlSpread . _gunBarrels $ _itParams item) * loadedSpreadParam
|
||||
-- loadedSpreadParam = 0.5 * (fromIntegral (numBulLoaded - numBarrels) + 1)
|
||||
numBulLoaded = _ammoLoaded $ _itConsumption item
|
||||
|
||||
duplicateLoadedBarrels :: ChainEffect
|
||||
duplicateLoadedBarrels eff item cr w = foldr f w poss
|
||||
where
|
||||
cp :: Float
|
||||
cp = -0.5 * (fromIntegral numBar - 1)
|
||||
@@ -406,15 +424,15 @@ duplicateEachLoadedBarrel eff item cr w = foldr f w poss
|
||||
f pos = eff item (cr & crPos %~ (+.+ pos))
|
||||
numBar = _brlNum . _gunBarrels $ _itParams item
|
||||
numBul = _ammoLoaded $ _itConsumption item
|
||||
numBarrels :: ChainEffect
|
||||
numBarrels eff item cr w = foldr f w poss
|
||||
where
|
||||
cp :: Float
|
||||
cp = -0.5 * fromIntegral numBul
|
||||
poss :: [V2 Float]
|
||||
poss = map (rotateV (_crDir cr) . V2 0 . (*5) . (+ cp) . fromIntegral) [0 .. numBul - 1]
|
||||
f pos = eff item (cr & crPos %~ (+.+ pos))
|
||||
numBul = _brlNum . _gunBarrels $ _itParams item
|
||||
--numBarrels :: ChainEffect
|
||||
--numBarrels eff item cr w = foldr f w poss
|
||||
-- where
|
||||
-- cp :: Float
|
||||
-- cp = -0.5 * fromIntegral numBul
|
||||
-- poss :: [V2 Float]
|
||||
-- poss = map (rotateV (_crDir cr) . V2 0 . (*5) . (+ cp) . fromIntegral) [0 .. numBul - 1]
|
||||
-- f pos = eff item (cr & crPos %~ (+.+ pos))
|
||||
-- numBul = _brlNum . _gunBarrels $ _itParams item
|
||||
{- | Uses '_wpSpread' as a parameter for the current offset angle. -}
|
||||
randWalkAngle
|
||||
:: (Creature -> World -> World) -- ^ Underlying effect
|
||||
|
||||
Reference in New Issue
Block a user