address review comments

This commit is contained in:
Hrom 2024-03-14 13:15:39 +01:00
parent 4f022d05c0
commit 4b15f7bff3
29 changed files with 67 additions and 68 deletions

View File

@ -3,7 +3,7 @@
name: Automatic,
body: RandomWith("tarasque"),
alignment: Alignment(Enemy),
loot: LootTable("common.loot_tables.creature.quad_medium.carapace"),
loot: LootTable("common.loot_tables.creature.quad_medium.tarasque"),
inventory: (
loadout: FromBody,
),

View File

@ -1,9 +1,11 @@
[
(1.2, All([
(1, All([
MultiDrop(LootTable("common.loot_tables.food.prepared"), 1, 3),
MultiDrop(LootTable("common.loot_tables.cave_large"), 2, 3),
Lottery([
(0.2, Item("common.items.glider.morpho")),
(1.8, Nothing),
]),
],
)),
(0.6, LootTable("common.loot_tables.weapons.components.tier-2")),
(0.2, Item("common.items.glider.morpho")),
)),
]

View File

@ -1,5 +1,5 @@
[
(1.2, All([
(1, All([
MultiDrop(LootTable("common.loot_tables.food.prepared"), 1, 3),
MultiDrop(LootTable("common.loot_tables.cave_large"), 2, 3),
],

View File

@ -1,9 +1,11 @@
[
(1.2, All([
(1, All([
MultiDrop(LootTable("common.loot_tables.food.prepared"), 1, 3),
MultiDrop(LootTable("common.loot_tables.cave_large"), 2, 3),
Lottery([
(0.2, Item("common.items.glider.monarch")),
(1.8, Nothing),
]),
],
)),
(0.6, LootTable("common.loot_tables.weapons.components.tier-2")),
(0.2, Item("common.items.glider.monarch")),
)),
]

View File

@ -2,7 +2,6 @@
(1, All([
MultiDrop(LootTable("common.loot_tables.food.prepared"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.hide.leather_troll"), 3, 5),
MultiDrop(LootTable("common.loot_tables.weapons.components.tier-2"), 1, 1),
MultiDrop(LootTable("common.loot_tables.cave_large"), 2, 3),
],
)),

View File

@ -1,9 +1,8 @@
[
(0.7, All([
(1, All([
MultiDrop(LootTable("common.loot_tables.food.prepared"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.animal_misc.icy_fang"), 2, 4),
MultiDrop(LootTable("common.loot_tables.cave_large"), 2, 3),
],
)),
(0.3, LootTable("common.loot_tables.weapons.components.tier-2")),
]

View File

@ -2,9 +2,9 @@
(1, All([
MultiDrop(Item("common.items.mineral.gem.topaz"), 1, 1),
MultiDrop(Item("common.items.mineral.gem.amethyst"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.animal_misc.elegant_crest"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.animal_misc.elegant_crest"), 4, 10),
MultiDrop(Item("common.items.crafting_ing.animal_misc.claw"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.hide.dragon_scale"), 2, 6),
MultiDrop(Item("common.items.crafting_ing.hide.dragon_scale"), 8, 12),
],
)),
]

View File

@ -4,7 +4,7 @@
MultiDrop(Item("common.items.mineral.gem.ruby"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.animal_misc.large_horn"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.animal_misc.sharp_fang"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.hide.dragon_scale"), 2, 6),
MultiDrop(Item("common.items.crafting_ing.hide.dragon_scale"), 8, 12),
],
)),
]

View File

@ -4,7 +4,7 @@
MultiDrop(Item("common.items.mineral.gem.diamond"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.animal_misc.large_horn"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.animal_misc.claw"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.hide.dragon_scale"), 2, 6),
MultiDrop(Item("common.items.crafting_ing.hide.dragon_scale"), 8, 12),
],
)),
]

View File

@ -4,7 +4,7 @@
MultiDrop(Item("common.items.mineral.gem.sapphire"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.animal_misc.sharp_fang"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.animal_misc.claw"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.hide.dragon_scale"), 2, 6),
MultiDrop(Item("common.items.crafting_ing.hide.dragon_scale"), 8, 12),
],
)),
]

View File

@ -2,9 +2,9 @@
(1, All([
MultiDrop(Item("common.items.mineral.gem.topaz"), 1, 1),
MultiDrop(Item("common.items.mineral.gem.emerald"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.animal_misc.elegant_crest"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.animal_misc.elegant_crest"), 3, 8),
MultiDrop(Item("common.items.crafting_ing.animal_misc.large_horn"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.hide.dragon_scale"), 2, 6),
MultiDrop(Item("common.items.crafting_ing.hide.dragon_scale"), 8, 12),
],
)),
]

View File

@ -2,7 +2,7 @@
(1, All([
MultiDrop(Item("common.items.food.meat.beast_large_raw"), 5, 8),
MultiDrop(Item("common.items.crafting_ing.hide.plate"), 6, 10),
MultiDrop(Item("common.items.crafting_ing.animal_misc.grim_eyeball"), 1, 5),
MultiDrop(Item("common.items.crafting_ing.animal_misc.grim_eyeball"), 2, 2),
],
)),
]

View File

@ -1,7 +1,7 @@
[
(1, All([
MultiDrop(Item("common.items.crafting_ing.twigs"), 2, 3),
MultiDrop(Item("common.items.log.hardwood"), 3, 4),
MultiDrop(Item("common.items.log.hardwood"), 1, 3),
MultiDrop(Item("common.items.flowers.plant_fiber"), 3, 5),
MultiDrop(Item("common.items.crafting_ing.resin"), 0, 3),
MultiDrop(Item("common.items.crafting_ing.animal_misc.grim_eyeball"), 0, 1),

View File

@ -1,6 +1,6 @@
[
(1, All([
MultiDrop(Item("common.items.crafting_ing.living_embers"), 3, 5),
MultiDrop(Item("common.items.crafting_ing.living_embers"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.hide.animal_hide"), 3, 5),
],
)),

View File

@ -1,9 +1,12 @@
[
(9.5, All([
MultiDrop(Item("common.items.crafting_ing.animal_misc.lively_vine"), 4, 8),
MultiDrop(LootTable("common.loot_tables.food.wild_ingredients"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.sentient_seed"), 3, 6),
],
(1, All([
MultiDrop(Item("common.items.crafting_ing.animal_misc.lively_vine"), 6, 10),
MultiDrop(LootTable("common.loot_tables.food.wild_ingredients"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.sentient_seed"), 3, 6),
Lottery([
(0.5, Item("common.items.armor.misc.head.bamboo_twig")),
(9.5, Nothing),
]),
],
)),
(0.5, Item("common.items.armor.misc.head.bamboo_twig")),
]

View File

@ -1,8 +1,8 @@
[
(1, All([
MultiDrop(Item("common.items.crafting_ing.resin"), 3, 6),
MultiDrop(Item("common.items.log.hardwood"), 5, 10),
MultiDrop(Item("common.items.flowers.plant_fiber""), 4, 5),
MultiDrop(Item("common.items.log.ironwood"), 5, 10),
MultiDrop(Item("common.items.flowers.plant_fiber"), 4, 5),
],
)),
]

View File

@ -1,7 +1,7 @@
[
(1, All([
MultiDrop(Item("common.items.crafting_ing.animal_misc.grim_eyeball"), 0, 1),
MultiDrop(LootTable("common.loot_tables.creature.quad_medium.generic"), 1, 5),
MultiDrop(Item("common.items.food.meat.beast_large_raw"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.hide.rugged_hide"), 2, 4),
],
)),

View File

@ -1,8 +1,8 @@
[
(1, All([
MultiDrop(Item("common.items.food.meat.beast_large_raw"), 4, 5),
MultiDrop(Item("common.items.crafting_ing.hide.animal_hide"), 5, 8),
MultiDrop(Item("common.items.crafting_ing.animal_misc.fur"), 3, 7),
MultiDrop(Item("common.items.food.meat.beast_large_raw"), 3, 5),
MultiDrop(Item("common.items.crafting_ing.hide.animal_hide"), 3, 5),
MultiDrop(Item("common.items.crafting_ing.animal_misc.fur"), 2, 6),
],
)),
]

View File

@ -2,8 +2,8 @@
(1, All([
MultiDrop(Item("common.items.food.meat.beast_small_raw"), 3, 5),
MultiDrop(Item("common.items.food.meat.beast_large_raw"), 2, 4),
MultiDrop(Item("common.items.crafting_ing.hide.rugged_hide"), 2, 4),
MultiDrop(Item("common.items.crafting_ing.animal_misc.lively_vine"), 0, 1),
MultiDrop(Item("common.items.crafting_ing.hide.rugged_hide"), 3, 6),
MultiDrop(Item("common.items.crafting_ing.animal_misc.lively_vine"), 3, 6),
],
)),
]

View File

@ -1,7 +1,8 @@
[
(1, All([
MultiDrop(Item("common.items.crafting_ing.hide.rugged_hide"), 6, 12),
MultiDrop(Item("common.items.crafting_ing.hide.rugged_hide"), 4, 6),
MultiDrop(Item("common.items.crafting_ing.animal_misc.long_tusk"), 1, 2),
MultiDrop(Item("common.items.food.meat.beast_large_raw"), 4, 6),
],
)),
]

View File

@ -3,6 +3,7 @@
MultiDrop(Item("common.items.food.meat.beast_small_raw"), 2, 4),
MultiDrop(Item("common.items.food.meat.beast_large_raw"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.hide.tough_hide"), 3, 5),
MultiDrop(Item("common.items.crafting_ing.animal_misc.large_horn"), 0, 2),
],
)),
]

View File

@ -0,0 +1,9 @@
[
(1, All([
MultiDrop(Item("common.items.food.meat.tough_raw"), 2, 4),
MultiDrop(Item("common.items.crafting_ing.animal_misc.sharp_fang"), 0, 4),
MultiDrop(Item("common.items.crafting_ing.hide.carapace"), 3, 5),
MultiDrop(Item("common.items.crafting_ing.animal_misc.large_horn"), 0, 2),
],
)),
]

View File

@ -1,6 +1,6 @@
[
(1, All([
MultiDrop(Item("common.items.food.meat.beast_large_raw"), 5, 8),
MultiDrop(Item("common.items.food.meat.beast_large_raw"), 4, 6),
MultiDrop(Item("common.items.crafting_ing.hide.tough_hide"), 6, 8),
],
)),

View File

@ -1,9 +1,12 @@
[
(1, All([
MultiDrop(Item("common.items.log.wood"), 2, 4),
MultiDrop(Item("common.items.flowers.plant_fiber"), 1, 3),
MultiDrop(Item("common.items.crafting_ing.resin"), 0, 2),
MultiDrop(Item("common.items.crafting_ing.sentient_seed"), 1, 2),
MultiDrop(Item("common.items.log.wood"), 2, 4),
MultiDrop(Item("common.items.flowers.plant_fiber"), 1, 3),
Lottery([
(0.5, Item("common.items.crafting_ing.resin")),
(0.5, Item("common.items.crafting_ing.sentient_seed")),
(0.5, Nothing),
]),
],
)),
]

View File

@ -1,6 +1,6 @@
[
(1, All([
MultiDrop(Item("common.items.food.meat.beast_large_raw"), 6, 10),
MultiDrop(Item("common.items.food.meat.beast_large_raw"), 5, 8),
MultiDrop(Item("common.items.crafting_ing.hide.plate"), 6, 10),
MultiDrop(Item("common.items.crafting_ing.animal_misc.claw"), 2, 4),
MultiDrop(Item("common.items.crafting_ing.animal_misc.large_horn"), 0, 2),

View File

@ -1,6 +1,6 @@
[
(1, All([
MultiDrop(Item("common.items.food.meat.beast_large_raw"), 6, 10),
MultiDrop(Item("common.items.food.meat.beast_large_raw"), 5, 8),
MultiDrop(Item("common.items.crafting_ing.hide.plate"), 6, 10),
MultiDrop(Item("common.items.crafting_ing.animal_misc.large_horn"), 0, 7),
],

View File

@ -1,6 +1,6 @@
[
(1, All([
MultiDrop(Item("common.items.food.meat.beast_large_raw"), 6, 10),
MultiDrop(Item("common.items.food.meat.beast_large_raw"), 5, 8),
MultiDrop(Item("common.items.crafting_ing.hide.rugged_hide"), 6, 10),
MultiDrop(Item("common.items.crafting_ing.animal_misc.long_tusk"), 1, 2),
MultiDrop(Item("common.items.crafting_ing.animal_misc.large_horn"), 0, 3),

View File

@ -1,5 +1,5 @@
[
(1.0, MultiDrop(Item("common.items.mineral.ore.veloritefrag"), 3, 4)),
(0.35, MultiDrop(Item("common.items.mineral.ore.velorite"), 3, 4)),
(0.35, MultiDrop(Item("common.items.mineral.ore.velorite"), 2, 3)),
(0.15, LootTable("common.loot_tables.materials.gems")),
]

View File

@ -1149,7 +1149,7 @@ pub fn expand_loot_table(loot_table: &str) -> Vec<(f32, ItemDefinitionIdOwned, f
#[cfg(test)]
mod tests {
use crate::{
comp::inventory::trade_pricing::{expand_loot_table, ProbabilityFile, TradePricing},
comp::inventory::trade_pricing::{ProbabilityFile, TradePricing},
lottery::LootSpec,
trade::Good,
};
@ -1164,26 +1164,6 @@ mod tests {
.unwrap_or(());
}
#[test]
fn test_loot_table() {
init();
info!("init");
let loot = expand_loot_table("common.loot_tables.creature.quad_medium.gentle");
let lootsum = loot.iter().fold(0.0, |s, i| s + i.0);
assert!((lootsum - 1.0).abs() < 1e-3);
// hierarchical
let loot2 = expand_loot_table("common.loot_tables.creature.quad_medium.catoblepas");
let lootsum2 = loot2.iter().fold(0.0, |s, i| s + i.0);
assert!((lootsum2 - 1.0).abs() < 1e-4);
// highly nested
let loot3 = expand_loot_table("common.loot_tables.creature.biped_large.wendigo");
let lootsum3 = loot3.iter().fold(0.0, |s, i| s + i.0);
//tracing::trace!("{:?} {}", loot3, lootsum3);
assert!((lootsum3 - 1.0).abs() < 1e-5);
}
#[test]
fn test_prices1() {
init();