mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Normalised prices within sites
This commit is contained in:
parent
b72e454148
commit
fcc23a4427
@ -25,9 +25,9 @@ loot_tables: [
|
||||
(0.075, "common.loot_tables.armor.cultist"),
|
||||
// Materials
|
||||
(7.5, "common.loot_tables.materials.common"),
|
||||
(5.0, "common.loot_tables.materials.underground"),
|
||||
(8.0, "common.loot_tables.materials.underground"),
|
||||
// Food
|
||||
(0.5, "common.loot_tables.food.farm_ingredients"),
|
||||
(0.3, "common.loot_tables.food.farm_ingredients"),
|
||||
(0.5, "common.loot_tables.food.wild_ingredients"),
|
||||
(0.2, "common.loot_tables.food.prepared"),
|
||||
// TODO: Change consumables when they are split up later
|
||||
@ -36,10 +36,10 @@ loot_tables: [
|
||||
// this is the amount of that good the most common item represents
|
||||
// so basically this table balances the goods against each other (higher=less valuable)
|
||||
good_scaling: [
|
||||
(Potions, 0.025), // common.items.consumable.potion_minor
|
||||
(Food, 2.0), // common.items.food.mushroom
|
||||
(Coin, 25.0), // common.items.utility.coins
|
||||
(Armor, 0.1), // common.items.armor.misc.pants.worker_blue
|
||||
(Tools, 0.15), // common.items.weapons.staff.starter_staff
|
||||
(Ingredients, 0.25), // common.items.crafting_ing.leather_scraps
|
||||
(Potions, 0.0005), // common.items.consumable.potion_minor
|
||||
(Food, 1.0), // common.items.food.mushroom
|
||||
(Coin, 10.0), // common.items.utility.coins
|
||||
(Armor, 0.5), // common.items.armor.misc.pants.worker_blue
|
||||
(Tools, 0.5), // common.items.weapons.staff.starter_staff
|
||||
(Ingredients, 2.5), // common.items.crafting_ing.leather_scraps
|
||||
])
|
||||
|
@ -305,14 +305,11 @@ impl Economy {
|
||||
} else {
|
||||
add_biome(BiomeKind::Forest, 0.5 + ch.tree_density);
|
||||
add_biome(BiomeKind::Grassland, 0.5 + ch.humidity);
|
||||
add_biome(BiomeKind::Jungle, 0.5 + ch.humidity * (ch.temp * 0.5 + 0.5));
|
||||
add_biome(
|
||||
BiomeKind::Mountain,
|
||||
0.5 + ch.rockiness + (ch.alt / 4000.0).max(0.0),
|
||||
);
|
||||
add_biome(BiomeKind::Jungle, 0.5 + ch.humidity * ch.temp.max(0.0));
|
||||
add_biome(BiomeKind::Mountain, 0.5 + (ch.alt / 4000.0).max(0.0));
|
||||
add_biome(
|
||||
BiomeKind::Desert,
|
||||
0.5 + (1.0 - ch.humidity) * (ch.temp * 0.5 + 0.5),
|
||||
0.5 + (1.0 - ch.humidity) * ch.temp.max(0.0),
|
||||
);
|
||||
add_biome(BiomeKind::Snowland, 0.5 + (-ch.temp).max(0.0));
|
||||
}
|
||||
@ -330,11 +327,19 @@ impl Economy {
|
||||
|
||||
pub fn get_site_prices(&self) -> SitePrices {
|
||||
SitePrices {
|
||||
values: self
|
||||
values: {
|
||||
// Normalized values. Note: not correct, but better than nothing
|
||||
let sum = self
|
||||
.values
|
||||
.iter()
|
||||
.map(|(g, v)| (g, v.unwrap_or(Economy::MINIMUM_PRICE)))
|
||||
.collect(),
|
||||
.map(|(_, price)| (*price).unwrap_or(0.0))
|
||||
.sum::<f32>()
|
||||
.max(0.001);
|
||||
self.values
|
||||
.iter()
|
||||
.map(|(g, v)| (g, v.map(|v| v / sum).unwrap_or(Economy::MINIMUM_PRICE)))
|
||||
.collect()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user