Moved materials into their own loot tables.

This commit is contained in:
Sam 2021-04-01 15:35:40 -04:00
parent cb638180f8
commit a2906168a6
10 changed files with 49 additions and 46 deletions

View File

@ -7,7 +7,6 @@ loot_tables: [
(0.1,"common.loot_tables.cave_large"), (0.1,"common.loot_tables.cave_large"),
(0.1,"common.loot_tables.consumables"), (0.1,"common.loot_tables.consumables"),
// loot_table_crafting is a rare roll on crate/mud sprite looting // loot_table_crafting is a rare roll on crate/mud sprite looting
(0.05,"common.loot_tables.crafting"),
(0.005,"common.loot_tables.cultists"), (0.005,"common.loot_tables.cultists"),
(1,"common.loot_tables.fish"), (1,"common.loot_tables.fish"),
(0.1,"common.loot_tables.humanoids"), (0.1,"common.loot_tables.humanoids"),
@ -15,7 +14,6 @@ loot_tables: [
(0.0001,"common.loot_tables.mindflayer"), (0.0001,"common.loot_tables.mindflayer"),
(0.001,"common.loot_tables.miniboss"), (0.001,"common.loot_tables.miniboss"),
// loot_table_rocks is dropped by rock monsters, but is also the only source of stones to econsim until cave_scatter information is turned into a loot table // loot_table_rocks is dropped by rock monsters, but is also the only source of stones to econsim until cave_scatter information is turned into a loot table
(0.2,"common.loot_tables.rocks"),
(1,"common.loot_tables.fallback"), (1,"common.loot_tables.fallback"),
(0.04,"common.loot_tables.saurok"), (0.04,"common.loot_tables.saurok"),
(0.05,"common.loot_tables.villager"), (0.05,"common.loot_tables.villager"),

View File

@ -1,7 +1,8 @@
[ [
// Misc // Misc
(0.25, Item("common.items.armor.misc.neck.plain_1")), (0.25, Item("common.items.armor.misc.neck.plain_1")),
(3.0, LootTable("common.loot_tables.materials.common")), (1.5, LootTable("common.loot_tables.materials.common")),
(3.5, LootTable("common.loot_tables.materials.underground")),
(0.1, Item("common.items.glider.glider_blue")), (0.1, Item("common.items.glider.glider_blue")),
(0.05, Item("common.items.glider.glider_morpho")), (0.05, Item("common.items.glider.glider_morpho")),
(0.05, Item("common.items.glider.glider_monarch")), (0.05, Item("common.items.glider.glider_monarch")),

View File

@ -1,9 +0,0 @@
[
// crafting ingredients
(0.5, Item("common.items.crafting_ing.amethyst")),
(0.5, Item("common.items.crafting_ing.topaz")),
(0.4, Item("common.items.crafting_ing.sapphire")),
(0.35, Item("common.items.crafting_ing.emerald")),
(0.25, Item("common.items.crafting_ing.ruby")),
(0.1, Item("common.items.crafting_ing.diamond")),
]

View File

@ -1,3 +0,0 @@
[
(1.0, Item("common.items.crafting_ing.stones")),
]

View File

@ -0,0 +1,8 @@
[
(3.0, Item("common.items.crafting_ing.topaz")),
(3.0, Item("common.items.crafting_ing.amethyst")),
(1.6, Item("common.items.crafting_ing.sapphire")),
(1.2, Item("common.items.crafting_ing.emerald")),
(0.8, Item("common.items.crafting_ing.ruby")),
(0.4, Item("common.items.crafting_ing.diamond")),
]

View File

@ -0,0 +1,6 @@
[
(2.0, Item("common.items.crafting_ing.stones")),
(0.5, Item("common.items.ore.veloritefrag")),
(0.25, Item("common.items.ore.velorite")),
(0.25, LootTable("common.loot_tables.materials.gems")),
]

View File

@ -1,6 +0,0 @@
[
(1.0, Item("common.items.crafting_ing.stones")),
(0.05, Item("common.items.crafting_ing.diamond")),
(0.1, Item("common.items.ore.velorite")),
(0.2, Item("common.items.ore.veloritefrag")),
]

View File

@ -624,17 +624,17 @@ impl Item {
}, },
SpriteKind::Mud => { SpriteKind::Mud => {
chosen = Lottery::<LootSpec>::load_expect(match rng.gen_range(0..5) { chosen = Lottery::<LootSpec>::load_expect(match rng.gen_range(0..5) {
0 => "common.loot_tables.crafting", 0 => "common.loot_tables.materials.common",
1 => "common.loot_tables.weapons.tier-0", 1 => "common.loot_tables.weapons.tier-0",
2 => "common.loot_tables.fallback", 2 => "common.loot_tables.materials.underground",
_ => "common.loot_tables.rocks", _ => "common.loot_tables.fallback",
}) })
.read(); .read();
return Some(chosen.choose().to_item(None)); return Some(chosen.choose().to_item(None));
}, },
SpriteKind::Crate => { SpriteKind::Crate => {
chosen = Lottery::<LootSpec>::load_expect(match rng.gen_range(0..4) { chosen = Lottery::<LootSpec>::load_expect(match rng.gen_range(0..4) {
0 => "common.loot_tables.crafting", 0 => "common.loot_tables.materials.common",
_ => "common.loot_tables.food.prepared", _ => "common.loot_tables.food.prepared",
}) })
.read(); .read();

View File

@ -351,9 +351,8 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, cause: HealthSourc
}, },
Some(common::comp::Body::QuadrupedSmall(quadruped_small)) => { Some(common::comp::Body::QuadrupedSmall(quadruped_small)) => {
match quadruped_small.species { match quadruped_small.species {
quadruped_small::Species::Dodarock => match rng.gen_range(0..6) { quadruped_small::Species::Dodarock => {
1 => "common.loot_tables.rocks", "common.loot_tables.materials.underground"
_ => "common.loot_tables.rocks",
}, },
_ => match rng.gen_range(0..4) { _ => match rng.gen_range(0..4) {
0 => "common.loot_tables.food.wild_ingredients", 0 => "common.loot_tables.food.wild_ingredients",

View File

@ -1011,13 +1011,11 @@ impl Floor {
4 => Lottery::<LootSpec>::load_expect( 4 => Lottery::<LootSpec>::load_expect(
"common.loot_tables.weapons.tier-4", "common.loot_tables.weapons.tier-4",
), ),
5 => Lottery::<LootSpec>::load_expect("common.loot_tables.husk"), 5 => Lottery::<LootSpec>::load_expect("common.loot_tables.cultist"),
_ => { _ => {
Lottery::<LootSpec>::load_expect("common.loot_tables.fallback") Lottery::<LootSpec>::load_expect("common.loot_tables.fallback")
}, },
}; };
let chosen = chosen.read();
let chosen = chosen.choose();
let entity = match room.difficulty { let entity = match room.difficulty {
0 => { 0 => {
let body = comp::Body::QuadrupedMedium( let body = comp::Body::QuadrupedMedium(
@ -1030,7 +1028,9 @@ impl Floor {
EntityInfo::at(tile_wcenter.map(|e| e as f32)) EntityInfo::at(tile_wcenter.map(|e| e as f32))
.with_body(body) .with_body(body)
.with_name("Bonerattler".to_string()) .with_name("Bonerattler".to_string())
.with_loot_drop(chosen.to_item(Some(body))), .with_loot_drop(
chosen.read().choose().to_item(Some(body)),
),
] ]
}, },
1 => { 1 => {
@ -1044,7 +1044,9 @@ impl Floor {
EntityInfo::at(tile_wcenter.map(|e| e as f32)) EntityInfo::at(tile_wcenter.map(|e| e as f32))
.with_body(body) .with_body(body)
.with_name("Bonerattler".to_string()) .with_name("Bonerattler".to_string())
.with_loot_drop(chosen.to_item(Some(body))); .with_loot_drop(
chosen.read().choose().to_item(Some(body))
);
3 3
] ]
}, },
@ -1060,7 +1062,9 @@ impl Floor {
EntityInfo::at(tile_wcenter.map(|e| e as f32)) EntityInfo::at(tile_wcenter.map(|e| e as f32))
.with_body(body) .with_body(body)
.with_name("Hakulaq".to_string()) .with_name("Hakulaq".to_string())
.with_loot_drop(chosen.to_item(Some(body))) .with_loot_drop(
chosen.read().choose().to_item(Some(body)),
)
}); });
entities entities
}, },
@ -1071,7 +1075,7 @@ impl Floor {
EntityInfo::at(tile_wcenter.map(|e| e as f32)) EntityInfo::at(tile_wcenter.map(|e| e as f32))
.with_body(body) .with_body(body)
.with_name("Animal Trainer".to_string()) .with_name("Animal Trainer".to_string())
.with_loot_drop(chosen.to_item(Some(body))) .with_loot_drop(chosen.read().choose().to_item(Some(body)))
.with_loadout_config(loadout_builder::LoadoutConfig::CultistAcolyte) .with_loadout_config(loadout_builder::LoadoutConfig::CultistAcolyte)
.with_skillset_config( .with_skillset_config(
common::skillset_builder::SkillSetConfig::CultistAcolyte common::skillset_builder::SkillSetConfig::CultistAcolyte
@ -1098,7 +1102,9 @@ impl Floor {
EntityInfo::at(tile_wcenter.map(|e| e as f32)) EntityInfo::at(tile_wcenter.map(|e| e as f32))
.with_body(body) .with_body(body)
.with_name("Tamed Darkhound".to_string()) .with_name("Tamed Darkhound".to_string())
.with_loot_drop(chosen.to_item(Some(body))) .with_loot_drop(
chosen.read().choose().to_item(Some(body)),
)
}); });
entities entities
}, },
@ -1113,23 +1119,26 @@ impl Floor {
EntityInfo::at(tile_wcenter.map(|e| e as f32)) EntityInfo::at(tile_wcenter.map(|e| e as f32))
.with_body(body) .with_body(body)
.with_name("Dullahan Guard".to_string()) .with_name("Dullahan Guard".to_string())
.with_loot_drop(chosen.to_item(Some(body))), .with_loot_drop(
chosen.read().choose().to_item(Some(body)),
),
] ]
}, },
5 => { 5 => {
let body = comp::Body::BipedSmall(
comp::biped_small::Body::random_with(
dynamic_rng,
&comp::biped_small::Species::Husk,
),
);
let mut entities = Vec::new(); let mut entities = Vec::new();
entities.resize_with(10, || { entities.resize_with(10, || {
EntityInfo::at(tile_wcenter.map(|e| e as f32)) EntityInfo::at(tile_wcenter.map(|e| e as f32))
.with_body(comp::Body::BipedSmall( .with_body(body)
comp::biped_small::Body::random_with(
dynamic_rng,
&comp::biped_small::Species::Husk,
),
))
.with_name("Cultist Husk".to_string()) .with_name("Cultist Husk".to_string())
.with_loot_drop(comp::Item::new_from_asset_expect( .with_loot_drop(
"common.items.crafting_ing.stones", chosen.read().choose().to_item(Some(body)),
)) )
.with_loadout_config( .with_loadout_config(
loadout_builder::LoadoutConfig::Husk, loadout_builder::LoadoutConfig::Husk,
) )