Remove internal ammo
This commit is contained in:
+44
-31
@@ -81,7 +81,13 @@ itemBaseName it = case _iyBase $ _itType it of
|
||||
LEFT lit -> show lit
|
||||
EQUIP eit -> showEquipItem eit
|
||||
CONSUMABLE cit -> show cit
|
||||
ATTACH ait -> show ait
|
||||
ATTACH ait -> showAttachItem ait
|
||||
|
||||
showAttachItem :: AttachType -> String
|
||||
showAttachItem at = case at of
|
||||
SCROLLATTACH x -> show x
|
||||
AMMOATTACH x -> show x
|
||||
TARGETATTACH x -> show x
|
||||
|
||||
showEquipItem :: EquipItemType -> String
|
||||
showEquipItem eit = case eit of
|
||||
@@ -111,60 +117,67 @@ showAutoRechargeProgress lc = case lc of
|
||||
|
||||
itemNumberDisplay :: Creature -> Item -> [String]
|
||||
itemNumberDisplay cr itm = case iu of
|
||||
HeldUse{} -> [showReloadProgress cr itm]
|
||||
--HeldUse{} -> [showReloadProgress cr itm]
|
||||
HeldUse{} -> []
|
||||
LeftUse{} -> [showAutoRechargeProgress (_leftConsumption iu)]
|
||||
EquipUse{} -> showEquipmentNumber cr itm
|
||||
CraftUse x -> [show $ x ^. getItAmount]
|
||||
ConsumeUse {_useAmount = x} -> [show $ x ^. getItAmount]
|
||||
AttachUse {} -> []
|
||||
|
||||
AttachUse {} -> [showReloadProgress cr itm]
|
||||
-- this could be cleaner here...
|
||||
where
|
||||
iu = itm ^?! itUse
|
||||
|
||||
showEquipmentNumber :: Creature -> Item -> [String]
|
||||
showEquipmentNumber cr itm = case _eeUse ee of
|
||||
EFuelSource x _ -> [show x]
|
||||
EAmmoSource{} -> showAmmoSource cr itm
|
||||
EAmmoSource{_euseAmmoAmount = x} -> [show x]--showAmmoSource cr itm
|
||||
EBatterySource{_euseBatteryAmount = x} -> [show x]
|
||||
_ -> [""]
|
||||
where
|
||||
ee = itm ^?! itUse . equipEffect
|
||||
|
||||
showAmmoSource :: Creature -> Item -> [String]
|
||||
showAmmoSource cr itm = fromMaybe ["FAIL"] $ do
|
||||
eu <- itm ^? itUse . equipEffect . eeUse
|
||||
atype <- eu ^? euseAmmoSourceType
|
||||
x <- fmap showIntKMG' $ eu ^? euseAmmoAmount
|
||||
i <- itm ^? itLocation . ipInvID
|
||||
( do
|
||||
at' <- cr ^? crInv . ix (i + 1) . itUse . heldConsumption . laSourceType
|
||||
as <- cr ^? crInv . ix (i + 1) . itUse . heldConsumption . laSource
|
||||
guard (at' == atype && as == AboveSource)
|
||||
return ["vvvv", x]
|
||||
)
|
||||
<|> Just [x]
|
||||
--showAmmoSource :: Creature -> Item -> [String]
|
||||
--showAmmoSource cr itm = fromMaybe ["FAIL"] $ do
|
||||
-- eu <- itm ^? itUse . equipEffect . eeUse
|
||||
-- atype <- eu ^? euseAmmoSourceType
|
||||
-- x <- fmap showIntKMG' $ eu ^? euseAmmoAmount
|
||||
-- i <- itm ^? itLocation . ipInvID
|
||||
-- ( do
|
||||
-- at' <- cr ^? crInv . ix (i + 1) . itUse . heldConsumption . laSourceType
|
||||
-- as <- cr ^? crInv . ix (i + 1) . itUse . heldConsumption . laSource
|
||||
-- guard (at' == atype && as == AboveSource)
|
||||
-- return ["vvvv", x]
|
||||
-- )
|
||||
-- <|> Just [x]
|
||||
|
||||
showReloadProgress :: Creature -> Item -> String
|
||||
showReloadProgress cr itm = case ic ^? laSource of
|
||||
Just (InternalSource ia) -> case ia ^? iaProgress . _Just . ix 0 of
|
||||
Nothing -> maybe "" show $ ic ^? laSource . _InternalSource . iaLoaded
|
||||
Just la -> showLoadActionType la (_laSource ic)
|
||||
Just AboveSource -> fromMaybe "^^^^" $ do
|
||||
i <- fmap (subtract 1) $ itm ^? itLocation . ipInvID
|
||||
_ <- cr ^? crInv . ix i . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||
return ""
|
||||
_ -> ""
|
||||
where
|
||||
ic = itm ^?! itUse . heldConsumption
|
||||
showReloadProgress cr itm = fromMaybe [] $ do
|
||||
ia <- itm ^? itUse . attachParams . ammoAttachParams
|
||||
return $ case ia ^? iaProgress . _Just . ix 0 of
|
||||
Nothing -> maybe "" show $ ia ^? iaLoaded
|
||||
Just la -> showLoadActionType la ia
|
||||
--showReloadProgress :: Creature -> Item -> String
|
||||
--showReloadProgress cr itm = case ic ^? laSource of
|
||||
-- Just (InternalSource ia) -> case ia ^? iaProgress . _Just . ix 0 of
|
||||
-- Nothing -> maybe "" show $ ic ^? laSource . _InternalSource . iaLoaded
|
||||
-- Just la -> showLoadActionType la (_laSource ic)
|
||||
-- Just AboveSource -> fromMaybe "^^^^" $ do
|
||||
-- i <- fmap (subtract 1) $ itm ^? itLocation . ipInvID
|
||||
-- _ <- cr ^? crInv . ix i . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||
-- return ""
|
||||
-- _ -> ""
|
||||
-- where
|
||||
-- ic = itm ^?! itUse . heldConsumption
|
||||
|
||||
showLoadActionType :: LoadAction -> AmmoSource -> String
|
||||
showLoadActionType :: LoadAction -> InternalAmmo -> String
|
||||
showLoadActionType la as = case la of
|
||||
LoadEject{} -> "E"
|
||||
LoadInsert{} -> "L"
|
||||
LoadAdd{} -> "A" ++ x
|
||||
LoadPrime{} -> "P"
|
||||
where
|
||||
x = maybe "" show $ as ^? _InternalSource . iaLoaded
|
||||
x = maybe "" show $ as ^? iaLoaded
|
||||
|
||||
maybeWarmupStatus :: Item -> Maybe String
|
||||
maybeWarmupStatus it = case it ^? itUse . heldDelay . warmMax of
|
||||
|
||||
+70
-69
@@ -71,8 +71,6 @@ ammoPosition itm hit = case hit of
|
||||
TORCH -> NoAmmoPosition
|
||||
BANGSTICK i -> bangStickAmmoPos i itm
|
||||
PISTOL -> Magazine (V3 5 2 0) lhs
|
||||
REVOLVER -> revolverAmmoPos
|
||||
REVOLVERX _ -> revolverAmmoPos
|
||||
MACHINEPISTOL -> Magazine (V3 5 2 0) lhs
|
||||
AUTOPISTOL -> Magazine (V3 5 2 0) lhs
|
||||
SMG -> Magazine (V3 7 (-2) 0) rhs
|
||||
@@ -137,23 +135,21 @@ multigunAmmoPos i =
|
||||
where
|
||||
f n = fromIntegral n * 5 - ((fromIntegral i - 1) * 2.5)
|
||||
|
||||
revolverAmmoPos :: AmmoPosition
|
||||
revolverAmmoPos =
|
||||
Bullets
|
||||
[(V3 5 0 1 + Q.rotate q (V3 0 0 2), q) | q <- qs]
|
||||
where
|
||||
qs = [Q.axisAngle (V3 1 0 0) (f i) | i <- [1 .. 6 :: Int]]
|
||||
f i = fromIntegral i * pi / 3 + pi / 6
|
||||
--revolverAmmoPos :: AmmoPosition
|
||||
--revolverAmmoPos =
|
||||
-- Bullets
|
||||
-- [(V3 5 0 1 + Q.rotate q (V3 0 0 2), q) | q <- qs]
|
||||
-- where
|
||||
-- qs = [Q.axisAngle (V3 1 0 0) (f i) | i <- [1 .. 6 :: Int]]
|
||||
-- f i = fromIntegral i * pi / 3 + pi / 6
|
||||
|
||||
heldItemSPic :: HeldItemType -> Item -> SPic
|
||||
heldItemSPic ht it = case ht of
|
||||
FLATSHIELD -> flatShieldEquipSPic
|
||||
FORCEFIELDGUN -> defSPic
|
||||
TORCH -> noPic torchShape
|
||||
BANGSTICK i -> noPic $ baseStickShapeX it i <> addBullets it
|
||||
BANGSTICK i -> noPic $ baseStickShapeX it i -- <> addBullets it
|
||||
PISTOL -> noPic $ baseStickShape <> addTinClip it
|
||||
REVOLVER -> noPic $ baseStickShape <> addBullets it
|
||||
REVOLVERX _ -> noPic $ baseStickShape <> addBullets it
|
||||
MACHINEPISTOL -> noPic $ baseStickShape <> addTinClip it
|
||||
AUTOPISTOL -> noPic $ baseStickShape <> addTinClip it
|
||||
SMG -> noPic $ baseSMGShape <> addTinClip it
|
||||
@@ -161,17 +157,17 @@ heldItemSPic ht it = case ht of
|
||||
BLUNDERBUSS -> noPic $ bangConeShape 20
|
||||
GRAPECANNON _ -> noPic $ bangConeShape 20
|
||||
MINIGUNX i -> miniGunXPictItem i it
|
||||
VOLLEYGUN i -> noPic $ volleyGunShape i <> addBullets it
|
||||
MULTIGUN i -> noPic $ volleyGunShape i <> addBullets it
|
||||
RIFLE -> noPic $ baseRifleShape <> addBullets it
|
||||
VOLLEYGUN i -> noPic $ volleyGunShape i -- <> addBullets it
|
||||
MULTIGUN i -> noPic $ volleyGunShape i -- <> addBullets it
|
||||
RIFLE -> noPic $ baseRifleShape -- <> addBullets it
|
||||
REPEATER -> noPic $ baseRifleShape <> addTinClip it
|
||||
AUTORIFLE -> noPic $ baseRifleShape <> addTinClip it
|
||||
BURSTRIFLE -> noPic $ baseRifleShape <> addTinClip it
|
||||
BANGROD -> noPic $ baseRodShape <> addBullets it
|
||||
ELEPHANTGUN -> noPic $ baseAMRShape <> addBullets it
|
||||
BANGROD -> noPic $ baseRodShape -- <> addBullets it
|
||||
ELEPHANTGUN -> noPic $ baseAMRShape -- <> addBullets it
|
||||
AMR -> noPic $ baseAMRShape <> addTinClip it
|
||||
AUTOAMR -> noPic $ baseAMRShape <> addTinClip it
|
||||
SNIPERRIFLE -> noPic $ baseAMRShape <> addBullets it
|
||||
SNIPERRIFLE -> noPic $ baseAMRShape -- <> addBullets it
|
||||
MACHINEGUN -> noPic $ baseAMRShape <> addTinClip it
|
||||
FLAMESPITTER -> flamerPic it
|
||||
FLAMETHROWER -> flamerPic it
|
||||
@@ -251,12 +247,12 @@ baseRifleShape :: Shape
|
||||
--baseRifleShape = colorSH red $ xCylinder 4 2 25
|
||||
baseRifleShape = colorSH red $ xCylinderST 3 25
|
||||
|
||||
addBullets :: Item -> Shape
|
||||
addBullets itm = fromMaybe mempty $ do
|
||||
x <- itm ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
hit <- itm ^? itType . iyBase . ibtHeld
|
||||
ps <- fmap (take x) $ ammoPosition itm hit ^? amPosDirs
|
||||
return $ foldMap (uncurry (drawBullet itm)) ps
|
||||
--addBullets :: Item -> Shape
|
||||
--addBullets itm = fromMaybe mempty $ do
|
||||
-- x <- itm ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
-- hit <- itm ^? itType . iyBase . ibtHeld
|
||||
-- ps <- fmap (take x) $ ammoPosition itm hit ^? amPosDirs
|
||||
-- return $ foldMap (uncurry (drawBullet itm)) ps
|
||||
|
||||
-- why is this duplicated?
|
||||
drawBullet :: Item -> Point3 -> Q.Quaternion Float -> Shape
|
||||
@@ -293,47 +289,49 @@ drawBullet itm p q =
|
||||
rectNSWE 0.2 (- 0.2) (-2) (-1)
|
||||
|
||||
addTinClip :: Item -> Shape
|
||||
addTinClip itm = fromMaybe mempty $ do
|
||||
hit <- itm ^? itType . iyBase . ibtHeld
|
||||
let ap = ammoPosition itm hit
|
||||
p <- ap ^? amposPos
|
||||
d <- ap ^? amposDir
|
||||
return $ translateSH p $ overPosSH (Q.rotate d) $ makeTinClip itm
|
||||
|
||||
makeTinClip :: Item -> Shape
|
||||
makeTinClip it =
|
||||
colorSH
|
||||
midcol
|
||||
( upperPrismPolyTS
|
||||
1
|
||||
( reverse $
|
||||
rectNSWE 0 (- y) (-1) 1
|
||||
)
|
||||
)
|
||||
<> tips
|
||||
<> tails
|
||||
where
|
||||
midcol =
|
||||
maybe
|
||||
black
|
||||
bulletEffectColor
|
||||
(it ^? itUse . heldConsumption . laAmmoType . amBullet . buEffect)
|
||||
y = fromIntegral y' * 0.3
|
||||
y' = fromMaybe 0 $ it ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
tips = fromMaybe mempty $ do
|
||||
ebt <- it ^? itUse . heldConsumption . laAmmoType . amBullet . buSpawn
|
||||
return $
|
||||
colorSH (bulletPayloadColor ebt) $
|
||||
upperPrismPolyTS 1.1 $
|
||||
reverse $
|
||||
rectNSWE 0 (- y) 1 2
|
||||
tails = fromMaybe mempty $ do
|
||||
ebt <- it ^? itUse . heldConsumption . laAmmoType . amBullet . buTrajectory
|
||||
return $
|
||||
colorSH (bulletTrajColor ebt) $
|
||||
upperPrismPolyTS 1.1 $
|
||||
reverse $
|
||||
rectNSWE 0 (- y) (-2) (-1)
|
||||
addTinClip _ = mempty
|
||||
--addTinClip :: Item -> Shape
|
||||
--addTinClip itm = fromMaybe mempty $ do
|
||||
-- hit <- itm ^? itType . iyBase . ibtHeld
|
||||
-- let ap = ammoPosition itm hit
|
||||
-- p <- ap ^? amposPos
|
||||
-- d <- ap ^? amposDir
|
||||
-- return $ translateSH p $ overPosSH (Q.rotate d) $ makeTinClip itm
|
||||
--
|
||||
--makeTinClip :: Item -> Shape
|
||||
--makeTinClip it =
|
||||
-- colorSH
|
||||
-- midcol
|
||||
-- ( upperPrismPolyTS
|
||||
-- 1
|
||||
-- ( reverse $
|
||||
-- rectNSWE 0 (- y) (-1) 1
|
||||
-- )
|
||||
-- )
|
||||
-- <> tips
|
||||
-- <> tails
|
||||
-- where
|
||||
-- midcol =
|
||||
-- maybe
|
||||
-- black
|
||||
-- bulletEffectColor
|
||||
-- (it ^? itUse . heldConsumption . laAmmoType . amBullet . buEffect)
|
||||
-- y = fromIntegral y' * 0.3
|
||||
-- y' = fromMaybe 0 $ it ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
-- tips = fromMaybe mempty $ do
|
||||
-- ebt <- it ^? itUse . heldConsumption . laAmmoType . amBullet . buSpawn
|
||||
-- return $
|
||||
-- colorSH (bulletPayloadColor ebt) $
|
||||
-- upperPrismPolyTS 1.1 $
|
||||
-- reverse $
|
||||
-- rectNSWE 0 (- y) 1 2
|
||||
-- tails = fromMaybe mempty $ do
|
||||
-- ebt <- it ^? itUse . heldConsumption . laAmmoType . amBullet . buTrajectory
|
||||
-- return $
|
||||
-- colorSH (bulletTrajColor ebt) $
|
||||
-- upperPrismPolyTS 1.1 $
|
||||
-- reverse $
|
||||
-- rectNSWE 0 (- y) (-2) (-1)
|
||||
|
||||
bulletEffectColor :: BulletEffect -> Color
|
||||
bulletEffectColor x = case x of
|
||||
@@ -410,14 +408,15 @@ flamerPic it =
|
||||
( colorSH yellow $
|
||||
translateSHxy tx ty (upperPrismPolyST tz $ polyCirc 3 r)
|
||||
<> xCylinderST 5 18
|
||||
, color black $ translate3 (V3 tx ty (tz + 0.01)) $ circleSolid (r * am)
|
||||
--, color black $ translate3 (V3 tx ty (tz + 0.01)) $ circleSolid (r * am)
|
||||
, color black $ translate3 (V3 tx ty (tz + 0.01)) $ circleSolid (r * 0.5)
|
||||
)
|
||||
where
|
||||
tx = 4
|
||||
ty = - 6
|
||||
tz = 3
|
||||
r = 5
|
||||
am = fractionLoadedAmmo2 it
|
||||
-- am = fractionLoadedAmmo2 it
|
||||
|
||||
launcherPic :: Item -> SPic
|
||||
launcherPic _ = noPic . colorSH cyan $ xCylinderST 5 20
|
||||
@@ -454,7 +453,8 @@ lasGunPic it =
|
||||
, setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW 1 30 (-1) 0
|
||||
)
|
||||
where
|
||||
amFrac = fractionLoadedAmmo it
|
||||
--amFrac = fractionLoadedAmmo it
|
||||
amFrac = 0.5
|
||||
col = brightX 2 1.5 $ mixColors amFrac (1 - amFrac) green red
|
||||
|
||||
dualBeamPic :: Item -> SPic
|
||||
@@ -466,7 +466,8 @@ dualBeamPic it =
|
||||
, setLayer BloomNoZWrite . color col . setDepth 1.1 . polygon $ rectNESW gap 1 (- gap) (-1)
|
||||
)
|
||||
where
|
||||
amFrac = fractionLoadedAmmo it
|
||||
--amFrac = fractionLoadedAmmo it
|
||||
amFrac = 0.5
|
||||
col = brightX 2 1.5 $ mixColors amFrac (1 - amFrac) green red
|
||||
gap = _dbGap (_itParams it) - 3
|
||||
|
||||
|
||||
@@ -29,8 +29,6 @@ itemFromHeldType ht = case ht of
|
||||
SHATTERGUN -> shatterGun
|
||||
BANGSTICK i -> bangStick i
|
||||
PISTOL -> pistol
|
||||
REVOLVER -> revolver
|
||||
REVOLVERX i -> revolverX i
|
||||
MACHINEPISTOL -> machinePistol
|
||||
AUTOPISTOL -> autoPistol
|
||||
SMG -> smg
|
||||
|
||||
@@ -21,8 +21,6 @@ sparkGun =
|
||||
teslaGun :: Item
|
||||
teslaGun =
|
||||
defaultBatteryGun
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 200
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 10, loadInsert 10, loadPrime 60]
|
||||
& itDimension . dimRad .~ 9
|
||||
& itDimension . dimCenter .~ V3 4 0 0
|
||||
& itParams .~ teslaParams
|
||||
@@ -40,8 +38,6 @@ lasGun =
|
||||
defaultAutoBatteryGun
|
||||
& itUse . heldConsumption
|
||||
.~ ( defaultLoadable
|
||||
& laSource . _InternalSource . iaMax .~ 200000
|
||||
& laSource . _InternalSource . iaCycle .~ [loadEject 10, loadInsert 10, loadPrime 60]
|
||||
)
|
||||
& itParams
|
||||
.~ Refracting
|
||||
@@ -81,8 +77,6 @@ tractorGun =
|
||||
lasGun
|
||||
& itUse . heldConsumption
|
||||
.~ ( defaultLoadable
|
||||
& laSource . _InternalSource . iaMax .~ 10000
|
||||
& laSource . _InternalSource . iaCycle .~ [loadEject 10, loadInsert 10, loadPrime 60]
|
||||
)
|
||||
& itParams .~ Attracting{_attractionPower = 1}
|
||||
& itTweaks
|
||||
@@ -137,7 +131,6 @@ lasCircle =
|
||||
& itType . iyBase .~ HELD LASCIRCLE
|
||||
& itParams . lasColor .~ orange
|
||||
& itParams . lasDamage .~ 2
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 10000
|
||||
& itUse . heldUse .~ HeldLaser --shootLaser
|
||||
& itUse . heldDelay .~ NoDelay
|
||||
& itUse . heldUse .~ HeldCircleLaser --circleLaser
|
||||
|
||||
@@ -34,8 +34,6 @@ defaultBangCane =
|
||||
& itUse . heldAim . aimStance .~ OneHand
|
||||
-- & itUse . heldAim . aimHandlePos .~ 5
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01]
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 1
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadPartialInsert 10 1]
|
||||
|
||||
volleyGun :: Int -> Item
|
||||
volleyGun i =
|
||||
@@ -46,7 +44,6 @@ volleyGun i =
|
||||
& itUse . heldAim . aimStance .~ TwoHandFlat
|
||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 3]
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i
|
||||
& itParams . torqueAfter .~ 0.15 + 0.05 * fromIntegral i
|
||||
& itType . iyBase .~ HELD (VOLLEYGUN i)
|
||||
|
||||
@@ -59,7 +56,6 @@ multiGun i =
|
||||
& itUse . heldAim . aimStance .~ TwoHandFlat
|
||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 3]
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i
|
||||
& itParams . torqueAfter .~ 0.15 + 0.05 * fromIntegral i
|
||||
& itType . iyBase .~ HELD (MULTIGUN i)
|
||||
|
||||
@@ -68,9 +64,6 @@ rifle =
|
||||
defaultBangCane
|
||||
& itUse . heldAim . aimStance .~ TwoHandUnder
|
||||
& itType . iyBase .~ HELD RIFLE
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 1
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle
|
||||
.~ [loadEject 5, loadInsert 5, loadPrime 5]
|
||||
& itUse . heldAim . aimWeight .~ 6
|
||||
& itUse . heldAim . aimRange .~ 1
|
||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||
@@ -82,8 +75,6 @@ repeater =
|
||||
rifle
|
||||
& itType . iyModules . at ModRifleMag ?~ EMPTYMODULE
|
||||
& itType . iyBase .~ HELD REPEATER
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 20, loadInsert 20, loadPrime 20]
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 15
|
||||
|
||||
autoRifle :: Item
|
||||
autoRifle =
|
||||
@@ -111,10 +102,6 @@ miniGunUse i =
|
||||
& heldAim . aimRange .~ 1
|
||||
& heldAim . aimStance .~ TwoHandUnder
|
||||
& heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||
& heldConsumption
|
||||
.~ (defaultBulletLoadable & laSource .~ AboveSource)
|
||||
-- & heldConsumption . laSource . _InternalSource . iaCycle
|
||||
-- .~ [loadEject 40, loadInsert 40, loadPrime 40]
|
||||
|
||||
miniGunX :: Int -> Item
|
||||
miniGunX i =
|
||||
|
||||
@@ -27,14 +27,10 @@ bangCone =
|
||||
-- & itUse . heldAim . aimHandlePos .~ 5
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.5]
|
||||
& itType . iyBase .~ HELD BANGCONE
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 5
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 20, loadPrime 5]
|
||||
|
||||
blunderbuss :: Item
|
||||
blunderbuss =
|
||||
bangCone
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 25
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 30, loadPrime 5]
|
||||
& itUse . heldAim . aimStance .~ TwoHandUnder
|
||||
& itUse . heldAim . aimWeight .~ 6
|
||||
-- & itUse . heldAim . aimHandlePos .~ 5
|
||||
@@ -45,8 +41,6 @@ grapeCannon :: Int -> Item
|
||||
grapeCannon i =
|
||||
blunderbuss
|
||||
& itType . iyBase .~ HELD (GRAPECANNON i)
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 25 + 25 * i
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert (30 + i * 10), loadPrime 5]
|
||||
& itParams . recoil .~ (150 + fromIntegral i * 50)
|
||||
& itParams . torqueAfter .~ (0.1 + 0.2 * fromIntegral i)
|
||||
& itParams . randomOffset .~ (12 + 4 * fromIntegral i)
|
||||
|
||||
@@ -39,9 +39,6 @@ launcher =
|
||||
, _amPjDraw = DrawShell
|
||||
, _amPjCreation = CreateShell
|
||||
}
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 1
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaLoaded .~ 1
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 30, loadInsert 30, loadPrime 10]
|
||||
& itType . iyBase .~ HELD LAUNCHER
|
||||
& itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
|
||||
|
||||
@@ -49,8 +46,6 @@ launcherX :: Int -> Item
|
||||
launcherX i =
|
||||
launcher
|
||||
& itType . iyBase .~ HELD (LAUNCHERX i)
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaLoaded .~ i
|
||||
& itUse . heldUse .~ HeldPJCreationX i
|
||||
& itUse . heldMods .~ LauncherXMod i
|
||||
|
||||
|
||||
@@ -30,8 +30,6 @@ bangRod =
|
||||
& itUse . heldMods .~ BangRodMod
|
||||
& itDimension . dimRad .~ 12
|
||||
& itDimension . dimCenter .~ V3 5 0 0
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 1
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 10, loadPrime 5]
|
||||
& itType . iyBase .~ HELD BANGROD
|
||||
& itUse . heldAim . aimWeight .~ 8
|
||||
& itUse . heldAim . aimRange .~ 1
|
||||
@@ -54,7 +52,6 @@ amr :: Item
|
||||
amr =
|
||||
elephantGun
|
||||
& itType . iyBase .~ HELD AMR
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 15
|
||||
|
||||
autoAmr :: Item
|
||||
autoAmr =
|
||||
@@ -80,7 +77,5 @@ machineGun =
|
||||
& itUse . heldAim . aimStance .~ TwoHandUnder
|
||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||
& itUse . heldDelay .~ VariableRate{_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 100
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 10, loadInsert 40, loadPrime 10]
|
||||
& itInvSize .~ 3
|
||||
& itParams . torqueAfter .~ 0.2 -- not sure if this is necessary?
|
||||
|
||||
@@ -28,8 +28,6 @@ flameSpitter :: Item
|
||||
flameSpitter =
|
||||
flameThrower
|
||||
& itType . iyBase .~ HELD FLAMESPITTER
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 10
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 10, loadPrime 20]
|
||||
& itParams . sprayNozzles . ix 0 . nzPressure .~ 4
|
||||
& itUse . heldAim . aimStance .~ OneHand
|
||||
& itUse . heldDelay .~ FixedRate{_rateMax = 12, _rateTime = 0}
|
||||
@@ -96,12 +94,10 @@ flameThrower =
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 18 0) 0 0]
|
||||
& itUse . heldConsumption
|
||||
.~ ( defaultLoadable
|
||||
& laSource . _InternalSource . iaMax .~ 250
|
||||
& laAmmoType
|
||||
.~ GasAmmo
|
||||
{ _amString = "FLAME"
|
||||
, _amCreateGas = CreateFlame --aFlame
|
||||
}
|
||||
& laSource . _InternalSource . iaCycle .~ [loadEject 5, loadInsert 10, loadPrime 20]
|
||||
)
|
||||
& itType . iyBase .~ HELD FLAMETHROWER
|
||||
|
||||
@@ -4,8 +4,6 @@ module Dodge.Item.Held.Stick (
|
||||
autoPistol,
|
||||
machinePistol,
|
||||
smg,
|
||||
revolver,
|
||||
revolverX,
|
||||
) where
|
||||
|
||||
import Dodge.Base
|
||||
@@ -34,28 +32,15 @@ bangStick i =
|
||||
& itUse . heldDelay . rateMax .~ 8
|
||||
& itUse . heldMods .~ BangStickMod
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 10 0) a 0.01 | a <- spreadAroundCenter i baseStickSpread]
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaCycle .~ [loadPartialInsert 10 1]
|
||||
|
||||
baseStickSpread :: Float
|
||||
baseStickSpread = 0.2
|
||||
|
||||
revolver :: Item
|
||||
revolver =
|
||||
pistol
|
||||
& itUse . heldConsumption
|
||||
.~ ( defaultBulletLoadable
|
||||
& laSource . _InternalSource . iaMax .~ 6
|
||||
& laSource . _InternalSource . iaCycle .~ [loadPartialInsert 10 1]
|
||||
)
|
||||
& itType . iyBase .~ HELD REVOLVER
|
||||
|
||||
pistol :: Item
|
||||
pistol =
|
||||
bangStick 1
|
||||
& itUse . heldConsumption
|
||||
.~ ( defaultBulletLoadable
|
||||
& laSource .~ BelowSource
|
||||
)
|
||||
& itUse . heldDelay . rateMax .~ 6
|
||||
& itUse . heldMods .~ PistolMod
|
||||
@@ -94,11 +79,3 @@ smg =
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0]
|
||||
-- & itUse . heldAim . aimHandlePos .~ 2
|
||||
& itParams . torqueAfter .~ 0.05
|
||||
|
||||
revolverX :: Int -> Item
|
||||
revolverX i =
|
||||
revolver
|
||||
& itUse . heldDelay . rateMax .~ 8
|
||||
& itUse . heldMods .~ RevolverXMod
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ i * 6
|
||||
& itType . iyBase .~ HELD (REVOLVERX i)
|
||||
|
||||
@@ -63,8 +63,6 @@ heldInfo hit = case hit of
|
||||
BANGSTICK 1 -> "A firearm with a short barrel that requires reloading after each shot."
|
||||
BANGSTICK i -> over _head toUpper (showInt i) ++ " small gun barrels strapped together. Each barrel must be individually loaded, but not all need be loaded for the weapon to fire. All loaded barrels discharge simultaneously, with significant spread."
|
||||
PISTOL -> "A small firearm fed by a magazine. The entire magazine must be replaced when reloading the weapon."
|
||||
REVOLVER -> "A small firearm fed by a revolving cylinder. Single shot and load."
|
||||
REVOLVERX i -> "A small firearm fed by " ++ showInt i ++ "revolving cylinders."
|
||||
MACHINEPISTOL -> "A small firearm automatically, and extremely rapidly, fed by a magazine. The entire magazine must be replaced when reloading the weapon."
|
||||
AUTOPISTOL -> "A small firearm automatically fed by a magazine. The entire magazine must be replaced when reloading the weapon."
|
||||
SMG -> "A small firearm with an attached stock for stability."
|
||||
|
||||
@@ -28,8 +28,6 @@ heldBounds :: HeldItemType -> Point3
|
||||
heldBounds hit = case hit of
|
||||
BANGSTICK _ -> V3 0 0 0
|
||||
PISTOL -> bss
|
||||
REVOLVER -> bss
|
||||
REVOLVERX _ -> bss
|
||||
MACHINEPISTOL -> bss
|
||||
AUTOPISTOL -> bss
|
||||
SMG -> smgs
|
||||
|
||||
@@ -17,7 +17,6 @@ droneLauncher =
|
||||
& itUse . heldAim . aimRange .~ 0.5
|
||||
& itUse . heldAim . aimStance .~ TwoHandOver
|
||||
& itUse . heldConsumption . laAmmoType .~ DroneAmmo{_amString = "LASDRONE"}
|
||||
& itUse . heldConsumption . laSource . _InternalSource . iaMax .~ 2
|
||||
& itType . iyBase .~ HELD DRONELAUNCHER
|
||||
|
||||
lasDronesPic :: Item -> SPic
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
module Dodge.Item.Weapon.FractionLoaded (
|
||||
fractionLoadedAmmo,
|
||||
fractionLoadedAmmo2,
|
||||
-- fractionLoadedAmmo,
|
||||
-- fractionLoadedAmmo2,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import Data.Maybe
|
||||
import Dodge.Data.Item
|
||||
|
||||
---- this shouldn't really be used
|
||||
loadedAmmo :: Item -> Int
|
||||
loadedAmmo itm = fromMaybe 0 $ itm ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
|
||||
-- | _laTransfer (_itConsumption it) == NoTransfer = _laLoaded (_itConsumption it)
|
||||
-- | otherwise = 0
|
||||
|
||||
fractionLoadedAmmo :: Item -> Float
|
||||
fractionLoadedAmmo it = fromIntegral (loadedAmmo it) / fromIntegral itmaxammo
|
||||
where
|
||||
itmaxammo = fromMaybe 1 $ it ^? itUse . heldConsumption . laSource . _InternalSource . iaMax
|
||||
|
||||
fractionLoadedAmmo2 :: Item -> Float
|
||||
fractionLoadedAmmo2 it =
|
||||
1 - (1 - fromIntegral (loadedAmmo it) / fromIntegral itmaxammo) ** 2
|
||||
where
|
||||
itmaxammo = fromMaybe 1 $ it ^? itUse . heldConsumption . laSource . _InternalSource . iaMax
|
||||
-- ---- this shouldn't really be used
|
||||
-- loadedAmmo :: Item -> Int
|
||||
-- loadedAmmo itm = fromMaybe 0 $ itm ^? itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
--
|
||||
-- -- | _laTransfer (_itConsumption it) == NoTransfer = _laLoaded (_itConsumption it)
|
||||
-- -- | otherwise = 0
|
||||
--
|
||||
-- fractionLoadedAmmo :: Item -> Float
|
||||
-- fractionLoadedAmmo it = fromIntegral (loadedAmmo it) / fromIntegral itmaxammo
|
||||
-- where
|
||||
-- itmaxammo = fromMaybe 1 $ it ^? itUse . heldConsumption . laSource . _InternalSource . iaMax
|
||||
--
|
||||
-- fractionLoadedAmmo2 :: Item -> Float
|
||||
-- fractionLoadedAmmo2 it =
|
||||
-- 1 - (1 - fromIntegral (loadedAmmo it) / fromIntegral itmaxammo) ** 2
|
||||
-- where
|
||||
-- itmaxammo = fromMaybe 1 $ it ^? itUse . heldConsumption . laSource . _InternalSource . iaMax
|
||||
|
||||
@@ -140,23 +140,11 @@ withThickSmokeI eff item cr w =
|
||||
-- TODO create a trigger that does different things on first and continued
|
||||
-- fire.
|
||||
ammoCheckI :: ChainEffect
|
||||
ammoCheckI eff itm cr w = case itm ^? itUse . heldConsumption . laSource of
|
||||
Just (InternalSource ia)
|
||||
| _iaLoaded ia <= 0 || not (_iaPrimed ia) ->
|
||||
failsound w
|
||||
Just AboveSource
|
||||
| fromMaybe True $ do
|
||||
invid <- itm ^? itLocation . ipInvID
|
||||
x <- cr ^? crInv . ix (invid - 1) . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||
return $ x <= 0 ->
|
||||
failsound w
|
||||
Just BelowSource
|
||||
| fromMaybe True $ do
|
||||
invid <- itm ^? itLocation . ipInvID
|
||||
x <- cr ^? crInv . ix (invid + 1) . itUse . attachParams . ammoAttachParams . iaLoaded
|
||||
return $ x <= 0 ->
|
||||
failsound w
|
||||
_ -> eff itm cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
|
||||
ammoCheckI eff itm cr w = fromMaybe (failsound w) $ do
|
||||
invid <- itm ^? itLocation . ipInvID
|
||||
x <- cr ^? crInv . ix (invid + 1) . itUse . attachParams . ammoAttachParams . iaLoaded
|
||||
guard $ x > 0
|
||||
return $ eff itm cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
|
||||
where
|
||||
failsound = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
|
||||
Just 0 -> soundStart (CrReloadSound (_crID cr)) (_crPos cr) click1S Nothing
|
||||
@@ -165,8 +153,8 @@ ammoCheckI eff itm cr w = case itm ^? itUse . heldConsumption . laSource of
|
||||
itUseCharge :: Int -> Item -> Item
|
||||
itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x)
|
||||
|
||||
itUseAmmo :: Int -> Item -> Item
|
||||
itUseAmmo x = itUse . heldConsumption . laSource . _InternalSource . iaLoaded %~ (max 0 . subtract x)
|
||||
--itUseAmmo :: Int -> Item -> Item
|
||||
--itUseAmmo x = itUse . heldConsumption . laSource . _InternalSource . iaLoaded %~ (max 0 . subtract x)
|
||||
|
||||
{- | Fires at an increasing rate.
|
||||
Has different effect after first fire.
|
||||
@@ -183,7 +171,7 @@ rateIncAB exeffFirst exeffCont eff item cr w
|
||||
w
|
||||
& pointItem
|
||||
%~ ( (itUse . heldDelay . rateMax .~ max fastRate (currentRate - 1))
|
||||
. itUseAmmo 1
|
||||
-- . itUseAmmo 1
|
||||
. (itUse . heldDelay . rateTime .~ currentRate)
|
||||
)
|
||||
& exeffCont eff item cr
|
||||
@@ -191,7 +179,7 @@ rateIncAB exeffFirst exeffCont eff item cr w
|
||||
w
|
||||
& pointItem
|
||||
%~ ( (itUse . heldDelay . rateMax .~ startRate - 1)
|
||||
. itUseAmmo 1
|
||||
-- . itUseAmmo 1
|
||||
. (itUse . heldDelay . rateTime .~ startRate)
|
||||
)
|
||||
& exeffFirst eff item cr
|
||||
@@ -352,7 +340,7 @@ useAllAmmo eff item cr = fromMaybe id $ do
|
||||
invid <- item ^? itLocation . ipInvID
|
||||
return $ eff item cr
|
||||
. (cWorld . lWorld . creatures . ix (_crID cr) . crInv . ix (invid + 1)
|
||||
. itUse . heldConsumption . laSource . _InternalSource . iaLoaded .~ 0)
|
||||
. itUse . attachParams . ammoAttachParams . iaLoaded .~ 0)
|
||||
|
||||
useAmmoUpTo :: Int -> ChainEffect
|
||||
useAmmoUpTo amAmount eff itm cr = fromMaybe id $ do
|
||||
@@ -370,18 +358,7 @@ useAmmoAmount amAmount eff item cr =
|
||||
itref = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
||||
|
||||
useAmmoAmount' :: Int -> Int -> IM.IntMap Item -> IM.IntMap Item
|
||||
useAmmoAmount' itref x inv = case inv ^? ix itref . itUse . heldConsumption . laSource of
|
||||
Just InternalSource{} ->
|
||||
inv & ix itref . itUse . heldConsumption . laSource . _InternalSource . iaLoaded -~ x
|
||||
Just AboveSource ->
|
||||
inv & ix (itref - 1) . itUse . equipEffect . eeUse . euseAmmoAmount -~ x
|
||||
Just BelowSource ->
|
||||
inv & ix (itref + 1) . itUse . equipEffect . eeUse . euseAmmoAmount -~ x
|
||||
Just EitherSource -> case inv ^? ix (itref - 1) . itUse . equipEffect . eeUse . euseAmmoAmount of
|
||||
Just amamount | amamount > 0 ->
|
||||
inv & ix (itref - 1) . itUse . equipEffect . eeUse . euseAmmoAmount -~ x
|
||||
_ -> inv & ix (itref + 1) . itUse . equipEffect . eeUse . euseAmmoAmount -~ x
|
||||
_ -> inv
|
||||
useAmmoAmount' itref x inv = inv & ix (itref + 1) . itUse . attachParams . ammoAttachParams . iaLoaded -~ x
|
||||
|
||||
-- . crInv . ix itRef . itUse . heldConsumption . laSource
|
||||
|
||||
@@ -677,10 +654,12 @@ repeatOnFrames is hm f it cr w =
|
||||
-- return $ f it cr' w'
|
||||
|
||||
duplicateLoaded :: ChainEffect
|
||||
duplicateLoaded eff it cr w = foldr f w [1 .. numBul]
|
||||
duplicateLoaded eff it cr w = foldr f w (take numbul [1 .. ])
|
||||
where
|
||||
f _ = eff it cr
|
||||
numBul = it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
numbul = fromMaybe 0 $ do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
cr ^? crInv . ix (i+1) . itUse . attachParams . ammoAttachParams . iaLoaded
|
||||
|
||||
duplicateNumBarrels :: Int -> ChainEffect
|
||||
duplicateNumBarrels n eff itm cr w = foldr f w (take n $ itm ^?! itUse . heldAim . aimMuzzles)
|
||||
@@ -697,9 +676,12 @@ duplicateNumBarrels n eff itm cr w = foldr f w (take n $ itm ^?! itUse . heldAim
|
||||
(a,g) = randomR (-inacc,inacc) $ _randGen w'
|
||||
|
||||
duplicateLoadedBarrels :: ChainEffect
|
||||
duplicateLoadedBarrels eff itm = duplicateNumBarrels numbul eff itm
|
||||
duplicateLoadedBarrels eff itm cr = duplicateNumBarrels numbul eff itm cr
|
||||
where
|
||||
numbul = itm ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded
|
||||
numbul :: Int
|
||||
numbul = fromMaybe 0 $ do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
cr ^? crInv . ix (i+1) . itUse . attachParams . ammoAttachParams . iaLoaded
|
||||
|
||||
duplicateOffsetsFocus :: [Float] -> ChainEffect
|
||||
duplicateOffsetsFocus xs eff item cr w = foldr f w poss
|
||||
|
||||
Reference in New Issue
Block a user