Merge branch 'juliancoffee/dungeon_chests' into 'master'

dungeon chests

See merge request veloren/veloren!2342
This commit is contained in:
Justin Shipsey 2021-05-24 23:05:20 +00:00
commit 1074352ca4
21 changed files with 312 additions and 46 deletions

View File

@ -62,6 +62,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Chat tabs
- NPC's now hear certain sounds
- Renamed Animal Trainers to Beastmasters and gave them their own set of armor to wear
- Add chest to each dungeon with unique loot
### Changed

View File

@ -10,8 +10,8 @@ loot_tables: [
(1.0, false, "common.loot_tables.weapons.tier-4"),
(0.5, false, "common.loot_tables.weapons.tier-5"),
(0.05, false, "common.loot_tables.weapons.cultist"),
(0.125, false, "common.loot_tables.weapons.cave"),
(0.0625, false, "common.loot_tables.weapons.legendary"),
(0.05, false, "common.loot_tables.weapons.cave"),
(0.04, false, "common.loot_tables.weapons.legendary"),
// Armor
(20.0, true, "common.loot_tables.armor.cloth"),
(6.0, true, "common.loot_tables.armor.agile"),
@ -30,8 +30,8 @@ loot_tables: [
(0.3, true, "common.loot_tables.food.farm_ingredients"),
(0.4, true, "common.loot_tables.food.wild_ingredients"),
(0.2, true, "common.loot_tables.food.prepared"),
// TODO: Change consumables when they are split up later
(1.0, true, "common.loot_tables.consumables"),
// TODO: Change consumables and split them up
(1.0, true, "common.loot_tables.consumable.default"),
(0.5, false, "common.loot_tables.trading"),
],
// this is the amount of that good the most common item represents

View File

@ -0,0 +1,5 @@
[
(2.0, LootTable("common.loot_tables.consumable.potion")),
(0.5, LootTable("common.loot_tables.consumable.throwable")),
(1.0, LootTable("common.loot_tables.consumable.misc")),
]

View File

@ -0,0 +1,5 @@
[
// misc
(0.1, Item("common.items.utility.collar")),
(1.0, LootTable("common.loot_tables.consumable.firework")),
]

View File

@ -0,0 +1,6 @@
[
// potions
(1.0, Item("common.items.consumable.potion_minor")),
(0.5, Item("common.items.consumable.potion_med")),
(0.2, Item("common.items.consumable.potion_big")),
]

View File

@ -0,0 +1,5 @@
[
// bombs
(0.6, Item("common.items.utility.bomb")),
(0.2, Item("common.items.utility.bomb_pile")),
]

View File

@ -1,14 +0,0 @@
[
// potions
(1.0, Item("common.items.consumable.potion_minor")),
(0.5, Item("common.items.consumable.potion_med")),
(0.2, Item("common.items.consumable.potion_big")),
// bombs
(0.6, Item("common.items.utility.bomb")),
(0.2, Item("common.items.utility.bomb_pile")),
// velorite
(1.0, Item("common.items.ore.veloritefrag")),
(0.5, Item("common.items.ore.velorite")),
// misc
(0.1, Item("common.items.utility.collar")),
]

View File

@ -0,0 +1,14 @@
[
// Gear
(0.5, LootTable("common.loot_tables.weapons.tier-0")),
(0.5, LootTable("common.loot_tables.armor.cloth")),
// Currency
(2.0, ItemQuantity("common.items.utility.coins", 10, 20)),
// Consumables
(1.0, Item("common.items.consumable.potion_minor")),
// Food
(1.0, Item("common.items.food.cheese")),
(1.0, Item("common.items.food.plainsalad")),
(0.5, Item("common.items.food.apple_stick")),
(0.5, Item("common.items.food.mushroom_stick")),
]

View File

@ -1,5 +1,5 @@
[
(1.0, LootTable("common.loot_tables.armor.cloth")),
(2.0, LootTable("common.loot_tables.weapons.tier-0")),
(2.0, LootTable("common.loot_tables.consumables")),
(2.0, LootTable("common.loot_tables.consumable.potion")),
]

View File

@ -0,0 +1,17 @@
[
// Gear
// Don't put progression items until we have progression gates
// such as skill requirements or opening chest animations
// Currency
(2.0, ItemQuantity("common.items.utility.coins", 20, 50)),
// Consumables
(1.0, Item("common.items.consumable.potion_minor")),
(0.2, Item("common.items.consumable.potion_med")),
// Food
(1.0, Item("common.items.food.cheese")),
(1.0, Item("common.items.food.tomatosalad")),
(0.5, Item("common.items.food.apple_stick")),
(0.5, Item("common.items.food.mushroom_stick")),
(0.1, Item("common.items.food.sunflower_icetea")),
]

View File

@ -0,0 +1,17 @@
[
// Gear
// Don't put progression items until we have progression gates
// such as skill requirements or opening chest animations
// Currency
(2.0, ItemQuantity("common.items.utility.coins", 50, 100)),
// Consumables
(1.0, ItemQuantity("common.items.consumable.potion_minor", 1, 2)),
(0.2, Item("common.items.consumable.potion_med")),
// Food
(1.0, ItemQuantity("common.items.food.cheese", 1, 3)),
(1.0, ItemQuantity("common.items.food.tomatosalad", 1, 3)),
(0.5, ItemQuantity("common.items.food.apple_stick", 1, 2)),
(0.5, ItemQuantity("common.items.food.mushroom_stick", 1, 2)),
(0.1, Item("common.items.food.sunflower_icetea")),
]

View File

@ -0,0 +1,18 @@
[
// Gear
// Don't put progression items until we have progression gates
// such as skill requirements or opening chest animations
// Currency
(2.0, ItemQuantity("common.items.utility.coins", 100, 500)),
// Consumables
(1.0, ItemQuantity("common.items.consumable.potion_minor", 1, 3)),
(0.5, ItemQuantity("common.items.consumable.potion_minor", 1, 2)),
(0.1, Item("common.items.consumable.potion_big")),
// Food
(1.0, ItemQuantity("common.items.food.cheese", 1, 4)),
(1.0, ItemQuantity("common.items.food.tomatosalad", 1, 3)),
(0.5, ItemQuantity("common.items.food.apple_stick", 1, 2)),
(0.5, ItemQuantity("common.items.food.mushroom_stick", 1, 2)),
(0.1, Item("common.items.food.sunflower_icetea")),
]

View File

@ -0,0 +1,18 @@
[
// Gear
// Don't put progression items until we have progression gates
// such as skill requirements or opening chest animations
// Currency
(2.0, ItemQuantity("common.items.utility.coins", 200, 800)),
// Consumables
(1.0, ItemQuantity("common.items.consumable.potion_minor", 2, 4)),
(0.5, ItemQuantity("common.items.consumable.potion_minor", 1, 2)),
(0.1, Item("common.items.consumable.potion_big")),
// Food
(1.0, ItemQuantity("common.items.food.cheese", 1, 5)),
(1.0, ItemQuantity("common.items.food.tomatosalad", 1, 3)),
(0.5, ItemQuantity("common.items.food.apple_stick", 1, 2)),
(0.5, ItemQuantity("common.items.food.mushroom_stick", 1, 2)),
(0.5, Item("common.items.food.sunflower_icetea")),
]

View File

@ -0,0 +1,18 @@
[
// Gear
// Don't put progression items until we have progression gates
// such as skill requirements or opening chest animations
// Currency
(2.0, ItemQuantity("common.items.utility.coins", 200, 1000)),
// Consumables
(1.5, ItemQuantity("common.items.consumable.potion_med", 1, 2)),
(0.5, Item("common.items.consumable.potion_big")),
// Food
(1.0, ItemQuantity("common.items.food.cheese", 1, 5)),
(1.0, ItemQuantity("common.items.food.tomatosalad", 1, 3)),
(0.5, ItemQuantity("common.items.food.apple_stick", 1, 2)),
(0.5, ItemQuantity("common.items.food.mushroom_stick", 1, 2)),
(0.5, Item("common.items.food.sunflower_icetea")),
(0.5, Item("common.items.food.apple_mushroom_curry")),
]

View File

@ -14,6 +14,5 @@
(0.1, Item("common.items.glider.glider_blue")),
(0.001, Item("common.items.armor.misc.back.backpack")),
(0.1, Item("common.items.armor.misc.bag.heavy_seabag")),
(0.5, LootTable("common.loot_tables.fireworks")),
(0.5, Item("common.items.utility.bomb")),
(1.0, LootTable("common.loot_tables.consumable.default")),
]

View File

@ -5,5 +5,5 @@
(3.0, LootTable("common.loot_tables.food.wild_ingredients")),
(0.5, LootTable("common.loot_tables.food.prepared")),
// Consumables
(0.5, LootTable("common.loot_tables.consumables")),
(0.5, LootTable("common.loot_tables.consumable.default")),
]

View File

@ -671,6 +671,68 @@ Chest: Some((
wind_sway: 0.0,
)),
// Dungeon Chests
DungeonChest0: Some((
variations: [
(
model: "voxygen.voxel.sprite.chests.chest_vines",
offset: (-7.0, -5.0, -0.0),
lod_axes: (1.0, 1.0, 1.0),
),
],
wind_sway: 0.0,
)),
DungeonChest1: Some((
variations: [
(
model: "voxygen.voxel.sprite.chests.chest_skull",
offset: (-7.0, -5.0, -0.0),
lod_axes: (1.0, 1.0, 1.0),
),
],
wind_sway: 0.0,
)),
DungeonChest2: Some((
variations: [
(
model: "voxygen.voxel.sprite.chests.chest_light",
offset: (-7.0, -5.0, -0.0),
lod_axes: (1.0, 1.0, 1.0),
),
],
wind_sway: 0.0,
)),
DungeonChest3: Some((
variations: [
(
model: "voxygen.voxel.sprite.chests.chest_gold",
offset: (-7.0, -5.0, -0.0),
lod_axes: (1.0, 1.0, 1.0),
),
],
wind_sway: 0.0,
)),
DungeonChest4: Some((
variations: [
(
model: "voxygen.voxel.sprite.chests.chest_gold",
offset: (-7.0, -5.0, -0.0),
lod_axes: (1.0, 1.0, 1.0),
),
],
wind_sway: 0.0,
)),
DungeonChest5: Some((
variations: [
(
model: "voxygen.voxel.sprite.chests.chest_demon",
offset: (-7.0, -5.0, -0.0),
lod_axes: (1.0, 1.0, 1.0),
),
],
wind_sway: 0.0,
)),
// Welwitch
Welwitch: Some((
variations: [

View File

@ -703,7 +703,6 @@ impl Item {
pub fn slot_mut(&mut self, slot: usize) -> Option<&mut InvSlot> { self.slots.get_mut(slot) }
pub fn try_reclaim_from_block(block: Block) -> Option<Self> {
let chosen;
Some(Item::new_from_asset_expect(match block.get_sprite()? {
SpriteKind::Apple => "common.items.food.apple",
SpriteKind::Mushroom => "common.items.food.mushroom",
@ -721,27 +720,6 @@ impl Item {
SpriteKind::MediumGrass => "common.items.grasses.medium",
SpriteKind::ShortGrass => "common.items.grasses.short",
SpriteKind::Coconut => "common.items.food.coconut",
// Containers
// IMPORTANT: Add any new container to `SpriteKind::is_container`
SpriteKind::Chest => {
chosen = Lottery::<LootSpec>::load_expect("common.loot_tables.sprite.chest").read();
return Some(chosen.choose().to_item());
},
SpriteKind::ChestBuried => {
chosen = Lottery::<LootSpec>::load_expect("common.loot_tables.sprite.chest-buried")
.read();
return Some(chosen.choose().to_item());
},
SpriteKind::Mud => {
chosen = Lottery::<LootSpec>::load_expect("common.loot_tables.sprite.mud").read();
return Some(chosen.choose().to_item());
},
SpriteKind::Crate => {
chosen = Lottery::<LootSpec>::load_expect("common.loot_tables.sprite.crate").read();
return Some(chosen.choose().to_item());
},
SpriteKind::Beehive => "common.items.crafting_ing.honey",
SpriteKind::Stones => "common.items.crafting_ing.stones",
SpriteKind::Twigs => "common.items.crafting_ing.twigs",
@ -761,10 +739,86 @@ impl Item {
SpriteKind::EmeraldSmall => "common.items.crafting_ing.emerald",
SpriteKind::SapphireSmall => "common.items.crafting_ing.sapphire",
SpriteKind::Seashells => "common.items.crafting_ing.seashells",
// Containers
// IMPORTANT: Add any new container to `SpriteKind::is_container`
container
@
(SpriteKind::DungeonChest0
| SpriteKind::DungeonChest1
| SpriteKind::DungeonChest2
| SpriteKind::DungeonChest3
| SpriteKind::DungeonChest4
| SpriteKind::DungeonChest5
| SpriteKind::Chest
| SpriteKind::Mud
| SpriteKind::Crate
| SpriteKind::ChestBuried) => {
return Item::from_container(container);
},
_ => return None,
}))
}
fn from_container(container: SpriteKind) -> Option<Item> {
let chosen;
match container {
SpriteKind::DungeonChest0 => {
chosen =
Lottery::<LootSpec>::load_expect("common.loot_tables.dungeon.tier-0.chest")
.read();
return Some(chosen.choose().to_item());
},
SpriteKind::DungeonChest1 => {
chosen =
Lottery::<LootSpec>::load_expect("common.loot_tables.dungeon.tier-1.chest")
.read();
return Some(chosen.choose().to_item());
},
SpriteKind::DungeonChest2 => {
chosen =
Lottery::<LootSpec>::load_expect("common.loot_tables.dungeon.tier-2.chest")
.read();
return Some(chosen.choose().to_item());
},
SpriteKind::DungeonChest3 => {
chosen =
Lottery::<LootSpec>::load_expect("common.loot_tables.dungeon.tier-3.chest")
.read();
return Some(chosen.choose().to_item());
},
SpriteKind::DungeonChest4 => {
chosen =
Lottery::<LootSpec>::load_expect("common.loot_tables.dungeon.tier-4.chest")
.read();
return Some(chosen.choose().to_item());
},
SpriteKind::DungeonChest5 => {
chosen =
Lottery::<LootSpec>::load_expect("common.loot_tables.dungeon.tier-5.chest")
.read();
return Some(chosen.choose().to_item());
},
SpriteKind::Chest => {
chosen = Lottery::<LootSpec>::load_expect("common.loot_tables.sprite.chest").read();
return Some(chosen.choose().to_item());
},
SpriteKind::ChestBuried => {
chosen = Lottery::<LootSpec>::load_expect("common.loot_tables.sprite.chest-buried")
.read();
return Some(chosen.choose().to_item());
},
SpriteKind::Mud => {
chosen = Lottery::<LootSpec>::load_expect("common.loot_tables.sprite.mud").read();
return Some(chosen.choose().to_item());
},
SpriteKind::Crate => {
chosen = Lottery::<LootSpec>::load_expect("common.loot_tables.sprite.crate").read();
return Some(chosen.choose().to_item());
},
_ => None,
}
}
pub fn ability_spec(&self) -> Option<&AbilitySpec> { self.item_def.ability_spec.as_ref() }
}

View File

@ -148,6 +148,12 @@ make_case_elim!(
Cauldron = 0x79,
Anvil = 0x7A,
CookingPot = 0x7B,
DungeonChest0 = 0x7C,
DungeonChest1 = 0x7D,
DungeonChest2 = 0x7E,
DungeonChest3 = 0x7F,
DungeonChest4 = 0x80,
DungeonChest5 = 0x81,
}
);
@ -163,6 +169,12 @@ impl SpriteKind {
SpriteKind::Pumpkin => 0.81,
SpriteKind::Cabbage => 0.45,
SpriteKind::Chest => 1.09,
SpriteKind::DungeonChest0 => 1.09,
SpriteKind::DungeonChest1 => 1.09,
SpriteKind::DungeonChest2 => 1.09,
SpriteKind::DungeonChest3 => 1.09,
SpriteKind::DungeonChest4 => 1.09,
SpriteKind::DungeonChest5 => 1.09,
SpriteKind::StreetLamp => 2.65,
SpriteKind::Carrot => 0.18,
SpriteKind::Radish => 0.18,
@ -235,6 +247,12 @@ impl SpriteKind {
// SpriteKind::Velorite => true,
// SpriteKind::VeloriteFrag => true,
SpriteKind::Chest => true,
SpriteKind::DungeonChest0 => true,
SpriteKind::DungeonChest1 => true,
SpriteKind::DungeonChest2 => true,
SpriteKind::DungeonChest3 => true,
SpriteKind::DungeonChest4 => true,
SpriteKind::DungeonChest5 => true,
SpriteKind::Coconut => true,
SpriteKind::Stones => true,
SpriteKind::Twigs => true,
@ -254,7 +272,16 @@ impl SpriteKind {
pub fn is_container(&self) -> bool {
matches!(
self,
SpriteKind::Chest | SpriteKind::ChestBuried | SpriteKind::Mud | SpriteKind::Crate,
SpriteKind::DungeonChest0
| SpriteKind::DungeonChest1
| SpriteKind::DungeonChest2
| SpriteKind::DungeonChest3
| SpriteKind::DungeonChest4
| SpriteKind::DungeonChest5
| SpriteKind::Chest
| SpriteKind::ChestBuried
| SpriteKind::Mud
| SpriteKind::Crate,
)
}
@ -310,6 +337,12 @@ impl SpriteKind {
| SpriteKind::WardrobeDouble
| SpriteKind::Pot
| SpriteKind::Chest
| SpriteKind::DungeonChest0
| SpriteKind::DungeonChest1
| SpriteKind::DungeonChest2
| SpriteKind::DungeonChest3
| SpriteKind::DungeonChest4
| SpriteKind::DungeonChest5
| SpriteKind::DropGate
| SpriteKind::DropGateBottom
| SpriteKind::Door

View File

@ -996,7 +996,15 @@ impl Floor {
{
let room = &self.rooms[*room];
if RandomField::new(room.seed).chance(Vec3::from(pos), room.loot_density * 0.5) {
BlockMask::new(with_sprite(SpriteKind::Chest), 1)
match room.difficulty {
0 => BlockMask::new(with_sprite(SpriteKind::DungeonChest0), 1),
1 => BlockMask::new(with_sprite(SpriteKind::DungeonChest1), 1),
2 => BlockMask::new(with_sprite(SpriteKind::DungeonChest2), 1),
3 => BlockMask::new(with_sprite(SpriteKind::DungeonChest3), 1),
4 => BlockMask::new(with_sprite(SpriteKind::DungeonChest4), 1),
5 => BlockMask::new(with_sprite(SpriteKind::DungeonChest5), 1),
_ => BlockMask::new(with_sprite(SpriteKind::Chest), 1),
}
} else {
vacant
}