Tell json to be more strict about missing fields to avoid that bug in the future, then fix all of the data.

master
Zed A. Shaw 10 months ago
parent b6831b75a3
commit 27bb08d62c
  1. 33
      assets/devices.json
  2. 18
      assets/enemies.json
  3. 42
      assets/items.json
  4. 2
      dinky_components.hpp

@ -3,39 +3,48 @@
"id": "STAIRS_DOWN", "id": "STAIRS_DOWN",
"name": "Stairs Down", "name": "Stairs Down",
"placement": "fixed", "placement": "fixed",
"foreground": [24, 205, 189],
"background": [24, 205, 189],
"description": "Stairs that go down further into the dungeon.", "description": "Stairs that go down further into the dungeon.",
"inventory_count": 0, "inventory_count": 0,
"randomized": false, "randomized": false,
"components": [ "components": [
{"_type": "Tile", "chr": "\u2ac5"}, {"_type": "Tile", "chr": "\u2ac5",
{"_type": "Device", "test": true, "events": ["Events::GUI::STAIRS_DOWN"]} "foreground": [24, 205, 189],
"background": [24, 205, 189]
},
{"_type": "Device",
"config": {"test": true},
"events": ["Events::GUI::STAIRS_DOWN"]}
] ]
}, },
"STAIRS_UP": { "STAIRS_UP": {
"id": "STAIRS_UP", "id": "STAIRS_UP",
"name": "Stairs Up", "name": "Stairs Up",
"foreground": [24, 205, 189],
"background": [24, 205, 189],
"description": "Stairs that go up, for the weak.", "description": "Stairs that go up, for the weak.",
"inventory_count": 0, "inventory_count": 0,
"placement": "fixed", "placement": "fixed",
"components": [ "components": [
{"_type": "Tile", "chr": "\u2259"}, {"_type": "Tile", "chr": "\u2259",
{"_type": "Device", "test": true, "events": ["Events::GUI::STAIRS_UP"]} "foreground": [24, 205, 189],
"background": [24, 205, 189]
},
{"_type": "Device",
"config": {"test": true},
"events": ["Events::GUI::STAIRS_UP"]}
] ]
}, },
"SPIKE_TRAP": { "SPIKE_TRAP": {
"id": "SPIKE_TRAP", "id": "SPIKE_TRAP",
"name": "Spike trap", "name": "Spike trap",
"foreground": [24, 205, 189],
"background": [24, 205, 189],
"description": "Spikes stab you from the floor.", "description": "Spikes stab you from the floor.",
"inventory_count": 0, "inventory_count": 0,
"components": [ "components": [
{"_type": "Tile", "chr": "\u1ac7"}, {"_type": "Tile", "chr": "\u1ac7",
{"_type": "Device", "test": true, "events": ["Events::GUI::TRAP"]} "foreground": [24, 205, 189],
"background": [24, 205, 189]
},
{"_type": "Device",
"config": {"test": true},
"events": ["Events::GUI::TRAP"]}
] ]
} }
} }

@ -1,21 +1,23 @@
{ {
"PLAYER_TILE": { "PLAYER_TILE": {
"foreground": [255, 200, 125],
"background": [30, 20, 75],
"components": [ "components": [
{"_type": "Tile", "chr": "\ua66b"}, {"_type": "Tile", "chr": "\ua66b",
{"_type": "Combat", "hp": 200, "damage": 15}, "foreground": [255, 200, 125],
"background": [30, 20, 75]
},
{"_type": "Combat", "hp": 200, "damage": 15, "dead": false},
{"_type": "Motion", "dx": 0, "dy": 0, "random": false}, {"_type": "Motion", "dx": 0, "dy": 0, "random": false},
{"_type": "LightSource", "strength": 70, "radius": 2}, {"_type": "LightSource", "strength": 70, "radius": 2},
{"_type": "EnemyConfig", "hearing_distance": 5} {"_type": "EnemyConfig", "hearing_distance": 5}
] ]
}, },
"EVIL_EYE": { "EVIL_EYE": {
"foreground": [75, 200, 125],
"background": [30, 20, 75],
"components": [ "components": [
{"_type": "Tile", "chr": "\u08ac"}, {"_type": "Tile", "chr": "\u08ac",
{"_type": "Combat", "hp": 100, "damage": 50}, "foreground": [75, 200, 125],
"background": [30, 20, 75]
},
{"_type": "Combat", "hp": 100, "damage": 50, "dead": false},
{"_type": "Motion", "dx": 0, "dy": 0, "random": false}, {"_type": "Motion", "dx": 0, "dy": 0, "random": false},
{"_type": "EnemyConfig", "hearing_distance": 10} {"_type": "EnemyConfig", "hearing_distance": 10}
] ]

@ -2,48 +2,52 @@
"TORCH_BAD": { "TORCH_BAD": {
"id": "TORCH_BAD", "id": "TORCH_BAD",
"name": "Crappy Torch", "name": "Crappy Torch",
"foreground": [24, 120, 189],
"background": [230,120, 120],
"description": "A torch that barely lights the way. You wonder if it'd be better to not see the person who murders you.", "description": "A torch that barely lights the way. You wonder if it'd be better to not see the person who murders you.",
"inventory_count": 1, "inventory_count": 1,
"components": [ "components": [
{"_type": "LightSource", "strength": 70, "radius": 2.0}, {"_type": "LightSource", "strength": 70, "radius": 2.0},
{"_type": "Tile", "chr": "\u0f08"} {"_type": "Tile", "chr": "\u0f08",
"foreground": [24, 120, 189],
"background": [230,120, 120]
}
] ]
}, },
"SWORD_RUSTY": { "SWORD_RUSTY": {
"id": "SWORD_RUSTY", "id": "SWORD_RUSTY",
"name": "Rusty Junk Sword", "name": "Rusty Junk Sword",
"foreground": [24, 120, 189],
"background": [24, 120, 189],
"description": "A sword left to rot in a deep hole where it acquired a patina of dirt and tetanus. You aren't sure if it's more deadly for you to hold it or for the people you stab with it.", "description": "A sword left to rot in a deep hole where it acquired a patina of dirt and tetanus. You aren't sure if it's more deadly for you to hold it or for the people you stab with it.",
"inventory_count": 1, "inventory_count": 1,
"components": [ "components": [
{"_type": "Weapon", "damage": 15}, {"_type": "Weapon", "damage": 15},
{"_type": "Tile", "chr": "\u1e37"} {"_type": "Tile", "chr": "\u1e37",
"foreground": [24, 120, 189],
"background": [24, 120, 189]
}
] ]
}, },
"SWORD_LIGHT_AND_FLAME": { "SWORD_LIGHT_AND_FLAME": {
"id": "SWORD_LIGHT_AND_FLAME", "id": "SWORD_LIGHT_AND_FLAME",
"name": "Sword of Light and Flame", "name": "Sword of Light and Flame",
"foreground": [24, 205, 210],
"background": [24, 205, 210],
"description": "A sword so powerful, a great man from the Land of The Rising Sun thrust it into the ocean of Nerf to chill its effects.", "description": "A sword so powerful, a great man from the Land of The Rising Sun thrust it into the ocean of Nerf to chill its effects.",
"inventory_count": 1, "inventory_count": 1,
"components": [ "components": [
{"_type": "LightSource", "strength": 70, "radius": 1.8}, {"_type": "LightSource", "strength": 70, "radius": 1.8},
{"_type": "Tile", "chr": "\u0236"}, {"_type": "Tile", "chr": "\u0236",
"foreground": [24, 205, 210],
"background": [24, 205, 210]
},
{"_type": "Weapon", "damage": 30} {"_type": "Weapon", "damage": 30}
] ]
}, },
"CHEST_SMALL": { "CHEST_SMALL": {
"id": "CHEST_SMALL", "id": "CHEST_SMALL",
"name": "Small Chest", "name": "Small Chest",
"foreground": [150, 100, 189],
"background": [150, 100, 189],
"description": "A small chest of gold. You wonder who would leave something like this around.", "description": "A small chest of gold. You wonder who would leave something like this around.",
"components": [ "components": [
{"_type": "Tile", "chr": "\uaaea"}, {"_type": "Tile", "chr": "\uaaea",
"foreground": [150, 100, 189],
"background": [150, 100, 189]
},
{"_type": "Loot", "amount": 10} {"_type": "Loot", "amount": 10}
], ],
"inventory_count": 1 "inventory_count": 1
@ -51,24 +55,26 @@
"WALL_TORCH": { "WALL_TORCH": {
"id": "WALL_TORCH", "id": "WALL_TORCH",
"name": "Basic Wall Torch", "name": "Basic Wall Torch",
"foreground": [24, 205, 210],
"background": [24, 205, 210],
"description": "A torch on a wall you can't pick up.", "description": "A torch on a wall you can't pick up.",
"inventory_count": 0, "inventory_count": 0,
"components": [ "components": [
{"_type": "Tile", "chr": "\u077e"}, {"_type": "Tile", "chr": "\u077e",
"foreground": [24, 205, 210],
"background": [24, 205, 210]
},
{"_type": "LightSource", "strength": 60, "radius": 1.8} {"_type": "LightSource", "strength": 60, "radius": 1.8}
] ]
}, },
"POTION_HEALING_SMALL": { "POTION_HEALING_SMALL": {
"id": "POTION_HEALING_SMALL", "id": "POTION_HEALING_SMALL",
"name": "Small Healing Potion", "name": "Small Healing Potion",
"foreground": [255, 205, 189],
"background": [255, 205, 189],
"description": "A small healing potion.", "description": "A small healing potion.",
"inventory_count": 1, "inventory_count": 1,
"components": [ "components": [
{"_type": "Tile", "chr": "\u03eb"}, {"_type": "Tile", "chr": "\u03eb",
"foreground": [255, 205, 189],
"background": [255, 205, 189]
},
{"_type": "Curative", "hp": 20} {"_type": "Curative", "hp": 20}
] ]
} }

@ -6,7 +6,7 @@
#define ENROLL_COMPONENT(COMPONENT, ...) \ #define ENROLL_COMPONENT(COMPONENT, ...) \
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(COMPONENT, __VA_ARGS__); \ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(COMPONENT, __VA_ARGS__); \
template <> struct NameOf<COMPONENT> { \ template <> struct NameOf<COMPONENT> { \
static constexpr const char *name = #COMPONENT; \ static constexpr const char *name = #COMPONENT; \
}; };