Add dimensions to all items

This commit is contained in:
2021-11-20 00:01:54 +00:00
parent 9f4ff3a75a
commit 20cf2ce26d
8 changed files with 26 additions and 11 deletions
+1 -1
View File
@@ -309,7 +309,7 @@ sizeSelf x cr w
| otherwise = Nothing
where
cr1 = colCrWall w (cr {_crRad = 10* x})
cr2 = colCrWall w cr1
--cr2 = colCrWall w cr1
distR = 120
distortionBulge
| _crRad cr < 10*x = raddist 1.9
+4
View File
@@ -346,6 +346,7 @@ data Item
, _itHammer :: HammerPosition
, _itAimStance :: AimStance
, _itCurseStatus :: CurseStatus
, _itDimension :: ItemDimension
}
| Craftable
{ _itName :: String
@@ -359,6 +360,7 @@ data Item
, _itInvColor :: Color
, _itAimStance :: AimStance
, _itCurseStatus :: CurseStatus
, _itDimension :: ItemDimension
}
| Equipment
{ _itName :: String
@@ -376,6 +378,7 @@ data Item
, _itHammer :: HammerPosition
, _itAimStance :: AimStance
, _itCurseStatus :: CurseStatus
, _itDimension :: ItemDimension
}
| Throwable
{ _itName :: String
@@ -403,6 +406,7 @@ data Item
, _itScroll :: Float -> Creature -> Item -> Item
, _itAimStance :: AimStance
, _itCurseStatus :: CurseStatus
, _itDimension :: ItemDimension
}
| NoItem
data CurseStatus = Uncursed | UndroppableIdentified | UndroppableUnidentified
+4
View File
@@ -6,6 +6,7 @@ This module contains prototypical data structures.
-}
module Dodge.Default where
import Dodge.Item.Weapon.ExtraEffect
import Dodge.Default.Weapon
import Dodge.Data
import Dodge.SoundLogic
import Dodge.Picture.Layer
@@ -145,6 +146,7 @@ defaultEquipment = Equipment
, _itInvColor = yellow
, _itInvDisplay = _itName
, _itAimStance = LeaveHolstered
, _itDimension = defaultItemDimension
}
defaultItZoom :: ItZoom
defaultItZoom = ItZoom 20 0.2 1
@@ -164,6 +166,7 @@ defaultConsumable = Consumable
, _itEffect = wpRecock
, _itHammer = HammerUp
, _itAimStance = LeaveHolstered
, _itDimension = defaultItemDimension
}
defaultApplyDamage :: [DamageType] -> Creature -> (World -> World, Creature)
defaultApplyDamage ds cr = (id, doPoisonDam $ foldl' (flip $ \d c -> snd $ applyIndividualDamage d c) cr ds')
@@ -199,6 +202,7 @@ defaultFlIt = FlIt {_flItRot=0,_flIt = defaultIt, _flItPos = V2 0 0, _flItID = 0
defaultIt :: Item
defaultIt = Consumable
{ _itIdentity = Medkit25
, _itDimension = defaultItemDimension
, _itCurseStatus = Uncursed
, _itName = "defaultIt"
, _itMaxStack = 3
+1
View File
@@ -235,6 +235,7 @@ remoteBombUnarmedPic = color (dark $ dark orange) $ circleSolid 5
pipe :: Item
pipe = Craftable
{ _itIdentity = Generic
, _itDimension = defaultItemDimension
, _itCurseStatus = Uncursed
, _itName = "PIPE"
, _itMaxStack = 3
+2
View File
@@ -6,6 +6,7 @@ import Dodge.Picture.Layer
import Dodge.WorldEvent.Explosion
import Dodge.Item.Weapon.TriggerType
import Dodge.Default
import Dodge.Default.Weapon
import Dodge.Base
import Dodge.Zone
import Dodge.SoundLogic
@@ -24,6 +25,7 @@ import qualified Data.IntMap.Strict as IM
grenade :: Item
grenade = Throwable
{ _itName = "GRENADE " ++ show fuseTime
, _itDimension = defaultItemDimension
, _itCurseStatus = Uncursed
, _itIdentity = Grenade
, _itMaxStack = 8
+2
View File
@@ -6,6 +6,7 @@ import Dodge.Default.Room
--import Dodge.LevelGen.Data
--import Dodge.LightSources.Lamp
import Dodge.Placement.Instance
import Dodge.PlacementSpot
import Geometry
import Tile
@@ -20,6 +21,7 @@ corridor = defaultRoom
, _rmPmnts = [ spanLightI (V2 0 40) (V2 40 40) ]
, _rmBound = [ rectNSWE 50 30 0 40 ]
, _rmFloor = [makeTileFromPoly poly 2]
, _rmRandPSs = [psRandRanges (10,30) (30,60) (0,2*pi)]
}
where
poly = rectNSWE 80 0 0 40
+11 -9
View File
@@ -33,26 +33,28 @@ import System.Random
minigunfakeout :: RandomGen g => State g (Tree (Either Room Room))
minigunfakeout = do
rcol <- rezColor
ncor <- state $ randomR (1,3)
ncor <- state $ randomR (0,2)
roomwithmini <- randomiseAllLinks $ roomRectAutoLinks 150 150
& rmPmnts %~ ([plRRpt 0 (PutFlIt miniGun),plRRpt 0 (PutFlIt shrinkGun)]++)
& rmPmnts %~ (plRRpt 0 (PutFlIt miniGun):)
randcors <- replicateM ncor $ (fmap Left . randomiseOutLinks) corridor
return $ ([Left $ rezBox rcol
,Left door
,Left roomwithmini
,Left door
]
++ replicate ncor (Left corridor)
++ [Left keyholeCorridor,Left corridor])
++ randcors
++ [Left $ corridor & rmPmnts %~ ( plRRpt 0 (PutFlIt shrinkGun) :)
,Left keyholeCorridor,Left corridor])
`treeFromPost` Right door
startRoom :: RandomGen g => State g (Tree (Either Room Room))
startRoom = join $ takeOne
[ minigunfakeout
--, rezBoxesWp
--, rezBoxesThenWeaponRoom
--, rezBoxThenWeaponRoom
--, rezBoxesWpCrit
--, runPastStart
, rezBoxesWp
, rezBoxesThenWeaponRoom
, rezBoxThenWeaponRoom
, rezBoxesWpCrit
, runPastStart
]
runPastStart :: RandomGen g => State g (Tree (Either Room Room))
+1 -1
View File
@@ -107,7 +107,7 @@ pushOutFromWall rad cp2 (wp1,wp2)
-- isOnWall = circOnSeg wp1 wp2 cp2 rad
pushOutFromCorners :: Float -> [(Point2,Point2)] -> Point2 -> Point2
pushOutFromCorners r ls p = foldr (intersectCirclePoint r) p (map fst ls)
pushOutFromCorners r ls p = foldr (intersectCirclePoint r . fst) p ls
--pushOutFromCorners' :: World -> Creature -> Creature
--pushOutFromCorners' w cr = cr & crPos .~ newPos