Adding different chests for each dungeon

This commit is contained in:
juliancoffee 2021-05-24 22:55:30 +03:00
parent 17e684f2a2
commit 940655dcb6
10 changed files with 227 additions and 24 deletions

View File

@ -0,0 +1,8 @@
[
(1.0, LootTable("common.loot_tables.weapons.tier-0")),
(1.0, LootTable("common.loot_tables.weapons.tier-1")),
(1.0, LootTable("common.loot_tables.armor.cloth")),
(1.0, LootTable("common.loot_tables.armor.swift")),
(0.1, LootTable("common.loot_tables.armor.plate")),
(1.0, LootTable("common.loot_tables.fallback")),
]

View File

@ -0,0 +1,8 @@
[
(1.0, LootTable("common.loot_tables.weapons.tier-0")),
(1.0, LootTable("common.loot_tables.weapons.tier-1")),
(1.0, LootTable("common.loot_tables.armor.cloth")),
(1.0, LootTable("common.loot_tables.armor.swift")),
(0.1, LootTable("common.loot_tables.armor.plate")),
(1.0, LootTable("common.loot_tables.fallback")),
]

View File

@ -0,0 +1,8 @@
[
(1.0, LootTable("common.loot_tables.weapons.tier-0")),
(1.0, LootTable("common.loot_tables.weapons.tier-1")),
(1.0, LootTable("common.loot_tables.armor.cloth")),
(1.0, LootTable("common.loot_tables.armor.swift")),
(0.1, LootTable("common.loot_tables.armor.plate")),
(1.0, LootTable("common.loot_tables.fallback")),
]

View File

@ -0,0 +1,8 @@
[
(1.0, LootTable("common.loot_tables.weapons.tier-0")),
(1.0, LootTable("common.loot_tables.weapons.tier-1")),
(1.0, LootTable("common.loot_tables.armor.cloth")),
(1.0, LootTable("common.loot_tables.armor.swift")),
(0.1, LootTable("common.loot_tables.armor.plate")),
(1.0, LootTable("common.loot_tables.fallback")),
]

View File

@ -0,0 +1,8 @@
[
(1.0, LootTable("common.loot_tables.weapons.tier-0")),
(1.0, LootTable("common.loot_tables.weapons.tier-1")),
(1.0, LootTable("common.loot_tables.armor.cloth")),
(1.0, LootTable("common.loot_tables.armor.swift")),
(0.1, LootTable("common.loot_tables.armor.plate")),
(1.0, LootTable("common.loot_tables.fallback")),
]

View File

@ -0,0 +1,8 @@
[
(1.0, LootTable("common.loot_tables.weapons.tier-0")),
(1.0, LootTable("common.loot_tables.weapons.tier-1")),
(1.0, LootTable("common.loot_tables.armor.cloth")),
(1.0, LootTable("common.loot_tables.armor.swift")),
(0.1, LootTable("common.loot_tables.armor.plate")),
(1.0, LootTable("common.loot_tables.fallback")),
]

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,84 @@ 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
}