Make items recoverable from base type
This commit is contained in:
@@ -9,22 +9,17 @@ import Color
|
||||
--import Geometry
|
||||
import Control.Lens
|
||||
|
||||
makeTypeCraftNum :: Int -> ItemBaseType -> Item
|
||||
makeTypeCraftNum :: Int -> CraftType -> Item
|
||||
makeTypeCraftNum i ct = defaultCraftable
|
||||
{ _itInvSize = 0.5
|
||||
, _itCurseStatus = Uncursed
|
||||
, _itConsumption = ItemItselfConsumable $ IcAmount i
|
||||
}
|
||||
& itType . iyBase .~ ct
|
||||
& itType . iyBase .~ CRAFT ct
|
||||
|
||||
makeTypeCraft :: ItemBaseType -> Item
|
||||
makeTypeCraft :: CraftType -> Item
|
||||
makeTypeCraft = makeTypeCraftNum 1
|
||||
|
||||
makeModule :: ItemBaseType -> Item
|
||||
makeModule ct = makeTypeCraft ct
|
||||
& itInvSize .~ 1
|
||||
& itInvColor .~ chartreuse
|
||||
|
||||
incendiaryModule :: Item
|
||||
incendiaryModule = makeTypeCraft INCENDIARYMODULE
|
||||
& itInvSize .~ 1
|
||||
|
||||
+17
-12
@@ -1,7 +1,23 @@
|
||||
module Dodge.Item.Equipment where
|
||||
module Dodge.Item.Equipment
|
||||
( module Dodge.Item.Equipment.Booster
|
||||
, magShield
|
||||
, powerLegs
|
||||
, flatShield
|
||||
, wristInvisibility
|
||||
, wristArmour
|
||||
, brainHat
|
||||
, frontArmour
|
||||
, headLamp
|
||||
, headLamp1
|
||||
, jetPack
|
||||
, speedLegs
|
||||
, jumpLegs
|
||||
, flameShield
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Item.Draw
|
||||
import Dodge.Item.Equipment.Shape
|
||||
import Dodge.Item.Equipment.Booster
|
||||
import Dodge.LightSource
|
||||
import Dodge.Default
|
||||
import Dodge.Default.Wall
|
||||
@@ -134,17 +150,6 @@ flatShieldEquipSPic _ =
|
||||
( colorSH yellow $ upperPrismPoly 10 (rectWH 2 10)
|
||||
, mempty
|
||||
)
|
||||
effectOnEquip :: (Creature -> Item -> World -> World) -> ItEffect
|
||||
effectOnEquip f = ItInvEffectID
|
||||
{ _ieInv = g f
|
||||
, _ieMID = Nothing
|
||||
}
|
||||
where
|
||||
g f' itm cr w
|
||||
| _crInvSel cr == invid = f' cr (_crInv (_creatures w IM.! _crID cr) IM.! invid) w
|
||||
| otherwise = w
|
||||
where
|
||||
invid = fromJust $ _itInvPos itm
|
||||
|
||||
shieldWall :: Int -> Wall
|
||||
shieldWall crid = defaultWall
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module Dodge.Item.Weapon.Booster
|
||||
module Dodge.Item.Equipment.Booster
|
||||
( boosterGun
|
||||
) where
|
||||
import Dodge.Data
|
||||
@@ -0,0 +1,7 @@
|
||||
module Dodge.Item.Family where
|
||||
|
||||
data ItemFamily = HeldFamily
|
||||
| CraftingFamily
|
||||
| EquipmentFamily
|
||||
| LeftClickFamily
|
||||
| ConsumableFamily
|
||||
@@ -13,8 +13,11 @@ module Dodge.Item.Weapon
|
||||
, module Dodge.Item.Weapon.SprayGuns
|
||||
, module Dodge.Item.Weapon.BatteryGuns
|
||||
, module Dodge.Item.Weapon.Launcher
|
||||
, module Dodge.Item.Weapon.Drone
|
||||
) where
|
||||
import Dodge.Item.Weapon.Utility
|
||||
import Dodge.Item.Weapon.BulletGuns
|
||||
import Dodge.Item.Weapon.Drone
|
||||
import Dodge.Item.Weapon.TriggerType
|
||||
import Dodge.Item.Weapon.SonicGuns
|
||||
import Dodge.Item.Weapon.ExtraEffect
|
||||
@@ -22,7 +25,6 @@ import Dodge.Item.Weapon.UseEffect
|
||||
import Dodge.Item.Weapon.Remote
|
||||
import Dodge.Item.Weapon.Grenade
|
||||
import Dodge.Item.Weapon.Spawn
|
||||
import Dodge.Item.Weapon.Utility
|
||||
import Dodge.Item.Weapon.Radar
|
||||
import Dodge.Item.Weapon.SprayGuns
|
||||
import Dodge.Item.Weapon.BatteryGuns
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
module Dodge.Item.Weapon.BatteryGuns
|
||||
( lasGun
|
||||
, lasGunDual
|
||||
, lasGunWide
|
||||
, lasGunWidePulse
|
||||
, lasGunSway
|
||||
, lasGunSwing
|
||||
, lasGunFocus
|
||||
, lasGunPulse
|
||||
, lasDual
|
||||
, lasWide
|
||||
, lasWidePulse
|
||||
, lasSway
|
||||
, lasSwing
|
||||
, lasFocus
|
||||
, lasPulse
|
||||
, sparkGun
|
||||
, teslaGun
|
||||
, teslaParams
|
||||
@@ -104,8 +104,8 @@ teslaGunPic _ = noPic $ colorSH blue $
|
||||
where
|
||||
xa = 1
|
||||
xb = 9
|
||||
lasGunPulse :: Item
|
||||
lasGunPulse = lasGun
|
||||
lasPulse :: Item
|
||||
lasPulse = lasGun
|
||||
& itType . iyBase .~ LASPULSE
|
||||
& itUse . useMods .~
|
||||
[ ammoCheckI
|
||||
@@ -123,8 +123,8 @@ lasGunPulse = lasGun
|
||||
frac it = 0.5 * (1 + sin (pi * fromIntegral (_lasCycle $ _itParams it) * 0.1))
|
||||
|
||||
|
||||
lasGunWide :: Int -> Item
|
||||
lasGunWide n = lasGun
|
||||
lasWide :: Int -> Item
|
||||
lasWide n = lasGun
|
||||
& itType . iyBase .~ LASGUNWIDE n
|
||||
& itParams . lasColor .~ orange
|
||||
& itParams . lasDamage .~ 2
|
||||
@@ -143,8 +143,8 @@ lasGunWide n = lasGun
|
||||
where
|
||||
n' = 9 * n
|
||||
xs = [ 0.25 * (fromIntegral x - fromIntegral (n'-1) /2) | x <- [0..n'-1] ]
|
||||
lasGunWidePulse :: Item
|
||||
lasGunWidePulse = lasGun
|
||||
lasWidePulse :: Item
|
||||
lasWidePulse = lasGun
|
||||
& itType . iyBase .~ LASGUNWIDEPULSE
|
||||
& itParams . lasColor .~ orange
|
||||
& itParams . lasDamage .~ 2
|
||||
@@ -170,8 +170,8 @@ lasGunWidePulse = lasGun
|
||||
xs it = [ 0.25 * (fromIntegral x - fromIntegral (n'-1) /2) | x <- [0..n'-1] ]
|
||||
where
|
||||
n' = (ceiling $ (150 :: Float) * frac it) :: Int
|
||||
lasGunSway :: Item
|
||||
lasGunSway = lasGun
|
||||
lasSway :: Item
|
||||
lasSway = lasGun
|
||||
& itType . iyBase .~ LASGUNSWAY
|
||||
& itParams . lasColor .~ orange
|
||||
& itParams . lasDamage .~ 11
|
||||
@@ -192,8 +192,8 @@ lasGunSway = lasGun
|
||||
x it = [ 15 * sin (pi * fromIntegral x' * 0.05) ]
|
||||
where
|
||||
x' = _lasCycle $ _itParams it
|
||||
lasGunFocus :: Int -> Item
|
||||
lasGunFocus n = lasGunWide n
|
||||
lasFocus :: Int -> Item
|
||||
lasFocus n = lasWide n
|
||||
& itType . iyBase .~ LASGUNFOCUS n
|
||||
& itParams . lasColor .~ red
|
||||
& itUse . useMods .~
|
||||
@@ -208,8 +208,8 @@ lasGunFocus n = lasGunWide n
|
||||
n' = 9 * n
|
||||
xs = [ 0.25 * (fromIntegral x - fromIntegral (n'-1) /2) | x <- [0..n'-1] ]
|
||||
|
||||
lasGunDual :: Item
|
||||
lasGunDual = lasGun
|
||||
lasDual :: Item
|
||||
lasDual = lasGun
|
||||
& itType . iyBase .~ LASGUNDUAL
|
||||
& itParams .~ DualBeam
|
||||
{ _phaseV = 1
|
||||
@@ -233,8 +233,8 @@ lasGunDual = lasGun
|
||||
& useAim . aimStance .~ TwoHandTwist
|
||||
)
|
||||
& itType . iyModules . at ModDualBeam ?~ EMPTYMODULE
|
||||
lasGunSwing :: Item
|
||||
lasGunSwing = lasGun
|
||||
lasSwing :: Item
|
||||
lasSwing = lasGun
|
||||
& itType . iyBase .~ LASGUNSWING
|
||||
& itParams . lasColor .~ orange
|
||||
& itUse . useMods .~
|
||||
|
||||
@@ -18,8 +18,8 @@ import Control.Lens
|
||||
--import Control.Monad.State
|
||||
--import System.Random
|
||||
|
||||
lasDrones :: Item
|
||||
lasDrones = defaultGun
|
||||
droneLauncher :: Item
|
||||
droneLauncher = defaultGun
|
||||
{ _itConsumption = defaultAmmo
|
||||
{ _laType = DroneAmmo { _amString = "LASDRONE" }
|
||||
, _laMax = 2
|
||||
|
||||
Reference in New Issue
Block a user