2021-01-07 19:47:29 +00:00
|
|
|
use crate::comp::{
|
2021-01-08 20:53:52 +00:00
|
|
|
item::{tool::ToolKind, Item, ItemKind},
|
|
|
|
skills::{
|
2021-01-18 19:08:13 +00:00
|
|
|
AxeSkill, BowSkill, HammerSkill, Skill, SkillGroupKind, SkillSet, StaffSkill, SwordSkill,
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
2021-01-07 19:47:29 +00:00
|
|
|
};
|
|
|
|
use tracing::warn;
|
|
|
|
|
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
pub enum SkillSetConfig {
|
2021-01-23 22:37:38 +00:00
|
|
|
Adlet,
|
|
|
|
Gnarling,
|
|
|
|
Sahagin,
|
|
|
|
Haniwa,
|
|
|
|
Myrmidon,
|
2021-01-07 19:47:29 +00:00
|
|
|
Guard,
|
|
|
|
Villager,
|
Implement /price_list (work in progress), stub for /buy and /sell
remove outdated economic simulation code
remove old values, document
add natural resources to economy
Remove NaturalResources from Place (now in Economy)
find closest site to each chunk
implement natural resources (the distance scale is wrong)
cargo fmt
working distance calculation
this collection of natural resources seem to make sense, too much Wheat though
use natural resources and controlled area to replenish goods
increase the amount of chunks controlled by one guard to 50
add new professions and goods to the list
implement multiple products per worker
remove the old code and rename the new code to the previous name
correctly determine which goods guards will give you access to
correctly estimate the amount of natural resources controlled
adapt to new server API
instrument tooltips
Now I just need to figure out how to store a (reference to) a closure
closures for tooltip content generation
pass site/cave id to the client
Add economic information to the client structure
(not yet exchanged with the server)
Send SiteId to the client, prepare messages for economy request
Make client::sites a HashMap
Specialize the Crafter into Brewer,Bladesmith and Blacksmith
working server request for economic info from within tooltip
fully operational economic tooltips
I need to fix the id clash between caves and towns though
fix overlapping ids between caves and sites
display stock amount
correctly handle invalid (cave) ids in the request
some initial balancing, turn off most info logging
less intrusive way of implementing the dynamic tool tips in map
further tooltip cleanup
further cleanup, dynamic tooltip not fully working as intended
correctly working tooltip visibility logic
cleanup, display labor value
separate economy info request in a separate translation unit
display values as well
nicer display format for economy
add last_exports and coin to the new economy
do not allocate natural resources to Dungeons (making town so much larger)
balancing attempt
print town size statistics
cargo fmt (dead code)
resource tweaks, csv debugging
output a more interesting town (and then all sites)
fix the labor value logic (now we have meaningful prices)
load professions from ron (WIP)
use assets manager in economy
loading professions works
use professions from ron file
fix Labor debug logic
count chunks per type separately
(preparing for better resource control)
better structured resource data
traders, more professions (WIP)
fix exception when starting the simulation
fix replenish function
TODO:
- use area_ratio for resource usage (chunks should be added to stock, ratio on usage?)
- fix trading
documentation clean up
fix merge artifact
Revise trader mechanic
start Coin with a reasonable default
remove the outdated economy code
preserve documentation from removed old structure
output neighboring sites (preparation)
pass list of neighbors to economy
add trade structures
trading stub
Description of purpose by zesterer on Discord
remember prices (needed for planning)
avoid growing the order vector unboundedly
into_iter doesn't clear the Vec, so clear it manually
use drain to process Vecs, avoid clone
fix the test server
implement a test stub (I need to get it faster than 30 seconds to be more useful)
enable info output in test
debug missing and extra goods
use the same logging extension as water, activate feature
update dependencies
determine good prices, good exchange goods
a working set of revisions
a cozy world which economy tests in 2s
first order planning version
fun with package version
buy according to value/priority, not missing amount
introduce min price constant, fix order priority
in depth debugging
with a correct sign the trading plans start to make sense
move the trade planning to a separate function
rename new function
reorganize code into subroutines (much cleaner)
each trading step now has its own function
cut down the number of debugging output
introduce RoadSecurity and Transportation
transport capacity bookkeeping
only plan to pay with valuable goods, you can no longer stockpile unused options
(which interestingly shows a huge impact, to be investigated)
Coin is now listed as a payment (although not used)
proper transportation estimation (although 0)
remove more left overs uncovered by viewing the code in a merge request
use the old default values, handle non-pileable stocks directly before increasing it
(as economy is based on last year's products)
don't order the missing good multiple times
also it uses coin to buy things!
fix warnings and use the transportation from stock again
cargo fmt
prepare evaluation of trade
don't count transportation multiple times
fix merge artifact
operational trade planning
trade itself is still misleading
make clippy happy
clean up
correct labor ratio of merchants (no need to multiply with amount produced)
incomplete merchant labor_value computation
correct last commit
make economy of scale more explicit
make clippy happy (and code cleaner)
more merchant tweaks (more pop=better)
beginning of real trading code
revert the update of dependencies
remove stale comments/unused code
trading implementation complete (but untested)
something is still strange ...
fix sign in trading
another sign fix
some bugfixes and plenty of debugging code
another bug fixed, more to go
fix another invariant (rounding will lead to very small negative value)
introduce Terrain and Territory
fix merge mistakes
2021-03-14 03:18:32 +00:00
|
|
|
Merchant,
|
2021-01-07 19:47:29 +00:00
|
|
|
Outcast,
|
|
|
|
Highwayman,
|
|
|
|
Bandit,
|
|
|
|
CultistNovice,
|
|
|
|
CultistAcolyte,
|
|
|
|
Warlord,
|
|
|
|
Warlock,
|
2021-01-21 19:52:07 +00:00
|
|
|
Mindflayer,
|
2021-01-07 19:47:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub struct SkillSetBuilder(SkillSet);
|
|
|
|
|
|
|
|
impl Default for SkillSetBuilder {
|
|
|
|
fn default() -> Self { Self(SkillSet::default()) }
|
|
|
|
}
|
|
|
|
|
|
|
|
impl SkillSetBuilder {
|
2021-01-08 20:53:52 +00:00
|
|
|
pub fn build_skillset(main_tool: &Option<Item>, config: Option<SkillSetConfig>) -> Self {
|
|
|
|
let active_item = main_tool.as_ref().and_then(|ic| {
|
|
|
|
if let ItemKind::Tool(tool) = &ic.kind() {
|
|
|
|
Some(tool.kind)
|
|
|
|
} else {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-01-07 19:47:29 +00:00
|
|
|
use SkillSetConfig::*;
|
|
|
|
match config {
|
2021-01-23 22:37:38 +00:00
|
|
|
Some(Adlet) => {
|
|
|
|
match active_item {
|
|
|
|
Some(ToolKind::Bow) => {
|
|
|
|
// Bow
|
|
|
|
Self::default()
|
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Bow))
|
2021-02-02 02:56:17 +00:00
|
|
|
.with_skill(Skill::Bow(BowSkill::BDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CMove), Some(1))
|
2021-01-23 22:37:38 +00:00
|
|
|
},
|
|
|
|
_ => Self::default(),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
Some(Gnarling) => {
|
|
|
|
match active_item {
|
|
|
|
Some(ToolKind::Bow) => {
|
|
|
|
// Bow
|
|
|
|
Self::default()
|
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Bow))
|
2021-02-02 02:56:17 +00:00
|
|
|
.with_skill(Skill::Bow(BowSkill::BDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CMove), Some(1))
|
2021-01-23 22:37:38 +00:00
|
|
|
},
|
|
|
|
_ => Self::default(),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
Some(Sahagin) => {
|
|
|
|
match active_item {
|
|
|
|
Some(ToolKind::Bow) => {
|
|
|
|
// Bow
|
|
|
|
Self::default()
|
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Bow))
|
2021-02-02 02:56:17 +00:00
|
|
|
.with_skill(Skill::Bow(BowSkill::BDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CMove), Some(1))
|
2021-01-23 22:37:38 +00:00
|
|
|
},
|
|
|
|
_ => Self::default(),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
Some(Haniwa) => {
|
|
|
|
match active_item {
|
|
|
|
Some(ToolKind::Bow) => {
|
|
|
|
// Bow
|
|
|
|
Self::default()
|
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Bow))
|
2021-02-02 02:56:17 +00:00
|
|
|
.with_skill(Skill::Bow(BowSkill::BDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CMove), Some(1))
|
2021-01-23 22:37:38 +00:00
|
|
|
},
|
|
|
|
_ => Self::default(),
|
|
|
|
}
|
|
|
|
},
|
|
|
|
Some(Myrmidon) => {
|
|
|
|
match active_item {
|
|
|
|
Some(ToolKind::Bow) => {
|
|
|
|
// Bow
|
|
|
|
Self::default()
|
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Bow))
|
2021-02-02 02:56:17 +00:00
|
|
|
.with_skill(Skill::Bow(BowSkill::BDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CMove), Some(1))
|
2021-01-23 22:37:38 +00:00
|
|
|
},
|
|
|
|
_ => Self::default(),
|
|
|
|
}
|
|
|
|
},
|
2021-01-08 20:53:52 +00:00
|
|
|
Some(Guard) => {
|
|
|
|
if let Some(ToolKind::Sword) = active_item {
|
|
|
|
// Sword
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Sword))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsCombo), None)
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsDamage), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsRegen), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DDamage), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DCost), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DDrain), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DScaling), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DInfinite), None)
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::UnlockSpin), None)
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SDamage), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SSpins), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SCost), Some(1))
|
2021-01-13 08:11:31 +00:00
|
|
|
} else {
|
|
|
|
Self::default()
|
2021-01-08 20:53:52 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
Some(Outcast) => {
|
|
|
|
match active_item {
|
|
|
|
Some(ToolKind::Sword) => {
|
|
|
|
// Sword
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Sword))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsCombo), None)
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DDamage), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DCost), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Axe) => {
|
|
|
|
// Axe
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Axe))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Axe(AxeSkill::DsCombo), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SInfinite), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SCost), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Hammer) => {
|
|
|
|
// Hammer
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Hammer))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CSpeed), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Bow) => {
|
|
|
|
// Bow
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Bow))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Bow(BowSkill::BDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::ProjSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CProjSpeed), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Staff) => {
|
|
|
|
// Staff
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Staff))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Staff(StaffSkill::FDamage), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FDrain), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FVelocity), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
2021-01-13 08:11:31 +00:00
|
|
|
_ => Self::default(),
|
2021-01-08 20:53:52 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
Some(Highwayman) => {
|
|
|
|
match active_item {
|
|
|
|
Some(ToolKind::Sword) => {
|
|
|
|
// Sword
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Sword))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsCombo), None)
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsDamage), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DDamage), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::UnlockSpin), None)
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SSpins), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SCost), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Axe) => {
|
|
|
|
// Axe
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Axe))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Axe(AxeSkill::DsCombo), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::DsDamage), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SInfinite), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SDamage), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SCost), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::UnlockLeap), None)
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Hammer) => {
|
|
|
|
// Hammer
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Hammer))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsDamage), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::UnlockLeap), None)
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::LKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::LRange), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Bow) => {
|
|
|
|
// Bow
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Bow))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Bow(BowSkill::BDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CMove), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::UnlockRepeater), None)
|
|
|
|
.with_skill(Skill::Bow(BowSkill::RArrows), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Staff) => {
|
|
|
|
// Staff
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Staff))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Staff(StaffSkill::BExplosion), None)
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::BRegen), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::BRadius), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FDamage), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FRange), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FVelocity), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::UnlockShockwave), None)
|
2021-01-13 08:11:31 +00:00
|
|
|
},
|
|
|
|
_ => Self::default(),
|
2021-01-08 20:53:52 +00:00
|
|
|
}
|
|
|
|
},
|
Implement /price_list (work in progress), stub for /buy and /sell
remove outdated economic simulation code
remove old values, document
add natural resources to economy
Remove NaturalResources from Place (now in Economy)
find closest site to each chunk
implement natural resources (the distance scale is wrong)
cargo fmt
working distance calculation
this collection of natural resources seem to make sense, too much Wheat though
use natural resources and controlled area to replenish goods
increase the amount of chunks controlled by one guard to 50
add new professions and goods to the list
implement multiple products per worker
remove the old code and rename the new code to the previous name
correctly determine which goods guards will give you access to
correctly estimate the amount of natural resources controlled
adapt to new server API
instrument tooltips
Now I just need to figure out how to store a (reference to) a closure
closures for tooltip content generation
pass site/cave id to the client
Add economic information to the client structure
(not yet exchanged with the server)
Send SiteId to the client, prepare messages for economy request
Make client::sites a HashMap
Specialize the Crafter into Brewer,Bladesmith and Blacksmith
working server request for economic info from within tooltip
fully operational economic tooltips
I need to fix the id clash between caves and towns though
fix overlapping ids between caves and sites
display stock amount
correctly handle invalid (cave) ids in the request
some initial balancing, turn off most info logging
less intrusive way of implementing the dynamic tool tips in map
further tooltip cleanup
further cleanup, dynamic tooltip not fully working as intended
correctly working tooltip visibility logic
cleanup, display labor value
separate economy info request in a separate translation unit
display values as well
nicer display format for economy
add last_exports and coin to the new economy
do not allocate natural resources to Dungeons (making town so much larger)
balancing attempt
print town size statistics
cargo fmt (dead code)
resource tweaks, csv debugging
output a more interesting town (and then all sites)
fix the labor value logic (now we have meaningful prices)
load professions from ron (WIP)
use assets manager in economy
loading professions works
use professions from ron file
fix Labor debug logic
count chunks per type separately
(preparing for better resource control)
better structured resource data
traders, more professions (WIP)
fix exception when starting the simulation
fix replenish function
TODO:
- use area_ratio for resource usage (chunks should be added to stock, ratio on usage?)
- fix trading
documentation clean up
fix merge artifact
Revise trader mechanic
start Coin with a reasonable default
remove the outdated economy code
preserve documentation from removed old structure
output neighboring sites (preparation)
pass list of neighbors to economy
add trade structures
trading stub
Description of purpose by zesterer on Discord
remember prices (needed for planning)
avoid growing the order vector unboundedly
into_iter doesn't clear the Vec, so clear it manually
use drain to process Vecs, avoid clone
fix the test server
implement a test stub (I need to get it faster than 30 seconds to be more useful)
enable info output in test
debug missing and extra goods
use the same logging extension as water, activate feature
update dependencies
determine good prices, good exchange goods
a working set of revisions
a cozy world which economy tests in 2s
first order planning version
fun with package version
buy according to value/priority, not missing amount
introduce min price constant, fix order priority
in depth debugging
with a correct sign the trading plans start to make sense
move the trade planning to a separate function
rename new function
reorganize code into subroutines (much cleaner)
each trading step now has its own function
cut down the number of debugging output
introduce RoadSecurity and Transportation
transport capacity bookkeeping
only plan to pay with valuable goods, you can no longer stockpile unused options
(which interestingly shows a huge impact, to be investigated)
Coin is now listed as a payment (although not used)
proper transportation estimation (although 0)
remove more left overs uncovered by viewing the code in a merge request
use the old default values, handle non-pileable stocks directly before increasing it
(as economy is based on last year's products)
don't order the missing good multiple times
also it uses coin to buy things!
fix warnings and use the transportation from stock again
cargo fmt
prepare evaluation of trade
don't count transportation multiple times
fix merge artifact
operational trade planning
trade itself is still misleading
make clippy happy
clean up
correct labor ratio of merchants (no need to multiply with amount produced)
incomplete merchant labor_value computation
correct last commit
make economy of scale more explicit
make clippy happy (and code cleaner)
more merchant tweaks (more pop=better)
beginning of real trading code
revert the update of dependencies
remove stale comments/unused code
trading implementation complete (but untested)
something is still strange ...
fix sign in trading
another sign fix
some bugfixes and plenty of debugging code
another bug fixed, more to go
fix another invariant (rounding will lead to very small negative value)
introduce Terrain and Territory
fix merge mistakes
2021-03-14 03:18:32 +00:00
|
|
|
Some(Bandit) | Some(Merchant) => {
|
2021-01-08 20:53:52 +00:00
|
|
|
match active_item {
|
|
|
|
Some(ToolKind::Sword) => {
|
|
|
|
// Sword
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Sword))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsCombo), None)
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsDamage), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DDamage), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DCost), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::UnlockSpin), None)
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SDamage), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SSpins), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SCost), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Axe) => {
|
|
|
|
// Axe
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Axe))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Axe(AxeSkill::DsCombo), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::DsSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::DsRegen), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SInfinite), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SDamage), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::UnlockLeap), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::LKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::LCost), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::LDistance), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Hammer) => {
|
|
|
|
// Hammer
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Hammer))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsDamage), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsRegen), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CDamage), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::UnlockLeap), None)
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::LDamage), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::LCost), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::LDistance), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Bow) => {
|
|
|
|
// Bow
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Bow))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Bow(BowSkill::BDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::ProjSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::BRegen), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CDrain), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::UnlockRepeater), None)
|
|
|
|
.with_skill(Skill::Bow(BowSkill::RGlide), None)
|
|
|
|
.with_skill(Skill::Bow(BowSkill::RCost), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Staff) => {
|
|
|
|
// Staff
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Staff))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Staff(StaffSkill::BExplosion), None)
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FDamage), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FRange), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FDrain), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::UnlockShockwave), None)
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::SDamage), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::SRange), Some(1))
|
2021-01-13 08:11:31 +00:00
|
|
|
},
|
|
|
|
_ => Self::default(),
|
2021-01-08 20:53:52 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
Some(CultistNovice) => {
|
|
|
|
match active_item {
|
|
|
|
Some(ToolKind::Sword) => {
|
|
|
|
// Sword
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Sword))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsCombo), None)
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsRegen), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DDamage), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DCost), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DDrain), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DScaling), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::UnlockSpin), None)
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SSpins), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SCost), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Axe) => {
|
|
|
|
// Axe
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Axe))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Axe(AxeSkill::DsCombo), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SInfinite), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SHelicopter), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SDamage), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::UnlockLeap), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::LKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::LDistance), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Hammer) => {
|
|
|
|
// Hammer
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Hammer))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsRegen), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CDamage), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CDrain), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::UnlockLeap), None)
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::LDamage), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::LKnockback), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Bow) => {
|
|
|
|
// Bow
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Bow))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Bow(BowSkill::BDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::ProjSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CProjSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CDrain), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::UnlockRepeater), None)
|
|
|
|
.with_skill(Skill::Bow(BowSkill::RDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::RGlide), None)
|
|
|
|
.with_skill(Skill::Bow(BowSkill::RArrows), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Staff) => {
|
|
|
|
// Staff
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Staff))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Staff(StaffSkill::BExplosion), None)
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::BDamage), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::BRadius), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FDamage), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FRange), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FDrain), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FVelocity), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::UnlockShockwave), None)
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::SDamage), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::SRange), Some(1))
|
2021-01-13 08:11:31 +00:00
|
|
|
},
|
|
|
|
_ => Self::default(),
|
2021-01-08 20:53:52 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
Some(CultistAcolyte) => {
|
|
|
|
match active_item {
|
|
|
|
Some(ToolKind::Sword) => {
|
|
|
|
// Sword
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Sword))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsCombo), None)
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsDamage), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DDamage), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DScaling), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::UnlockSpin), None)
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SDamage), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SSpins), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Axe) => {
|
|
|
|
// Axe
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Axe))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Axe(AxeSkill::DsCombo), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::DsDamage), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SInfinite), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SDamage), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SCost), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::UnlockLeap), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::LDamage), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::LKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::LCost), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::LDistance), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Hammer) => {
|
|
|
|
// Hammer
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Hammer))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsDamage), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsRegen), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CDamage), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CDrain), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::UnlockLeap), None)
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::LDamage), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::LRange), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Bow) => {
|
|
|
|
// Bow
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Bow))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Bow(BowSkill::BDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CProjSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CDrain), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::UnlockRepeater), None)
|
|
|
|
.with_skill(Skill::Bow(BowSkill::RDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::RGlide), None)
|
|
|
|
.with_skill(Skill::Bow(BowSkill::RArrows), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::RCost), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Staff) => {
|
|
|
|
// Staff
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Staff))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Staff(StaffSkill::BExplosion), None)
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::BDamage), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::BRadius), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FDamage), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FRange), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FVelocity), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::UnlockShockwave), None)
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::SDamage), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::SKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::SRange), Some(1))
|
2021-01-13 08:11:31 +00:00
|
|
|
},
|
|
|
|
_ => Self::default(),
|
2021-01-08 20:53:52 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
Some(Warlord) => {
|
|
|
|
match active_item {
|
|
|
|
Some(ToolKind::Sword) => {
|
|
|
|
// Sword
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Sword))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsCombo), None)
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsDamage), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsRegen), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DDamage), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DCost), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DDrain), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::UnlockSpin), None)
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SDamage), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SSpins), Some(2))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SCost), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Axe) => {
|
|
|
|
// Axe
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Axe))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Axe(AxeSkill::DsCombo), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::DsDamage), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::DsSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::DsRegen), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SInfinite), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SHelicopter), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SDamage), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::UnlockLeap), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::LDamage), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::LKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::LDistance), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Hammer) => {
|
|
|
|
// Hammer
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Hammer))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsDamage), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsRegen), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CDamage), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CDrain), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::UnlockLeap), None)
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::LDamage), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::LDistance), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::LKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::LRange), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Bow) => {
|
|
|
|
// Bow
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Bow))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Bow(BowSkill::BDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::BRegen), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CProjSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CMove), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::UnlockRepeater), None)
|
|
|
|
.with_skill(Skill::Bow(BowSkill::RDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::RGlide), None)
|
|
|
|
.with_skill(Skill::Bow(BowSkill::RArrows), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::RCost), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Staff) => {
|
|
|
|
// Staff
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Staff))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Staff(StaffSkill::BExplosion), None)
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::BDamage), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::BRegen), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::BRadius), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FDamage), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FDrain), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FVelocity), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::UnlockShockwave), None)
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::SDamage), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::SKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::SCost), Some(1))
|
2021-01-13 08:11:31 +00:00
|
|
|
},
|
|
|
|
_ => Self::default(),
|
2021-01-08 20:53:52 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
Some(Warlock) => {
|
|
|
|
match active_item {
|
|
|
|
Some(ToolKind::Sword) => {
|
|
|
|
// Sword
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Sword))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsCombo), None)
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsDamage), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsRegen), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::TsSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DDamage), Some(2))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DCost), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DDrain), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::DScaling), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::UnlockSpin), None)
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SDamage), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SSpins), Some(2))
|
|
|
|
.with_skill(Skill::Sword(SwordSkill::SCost), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Axe) => {
|
|
|
|
// Axe
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Axe))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Axe(AxeSkill::DsCombo), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::DsDamage), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::DsSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::DsRegen), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SInfinite), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SHelicopter), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SDamage), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::SCost), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::UnlockLeap), None)
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::LDamage), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::LKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::LCost), Some(1))
|
|
|
|
.with_skill(Skill::Axe(AxeSkill::LDistance), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Hammer) => {
|
|
|
|
// Hammer
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Hammer))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsDamage), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::SsRegen), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CDamage), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CDrain), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::CSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::UnlockLeap), None)
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::LDamage), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::LCost), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::LDistance), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::LKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Hammer(HammerSkill::LRange), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Bow) => {
|
|
|
|
// Bow
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Bow))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Bow(BowSkill::BDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::ProjSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::BRegen), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CProjSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CDrain), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CSpeed), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::CMove), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::UnlockRepeater), None)
|
|
|
|
.with_skill(Skill::Bow(BowSkill::RDamage), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::RGlide), None)
|
|
|
|
.with_skill(Skill::Bow(BowSkill::RArrows), Some(1))
|
|
|
|
.with_skill(Skill::Bow(BowSkill::RCost), Some(1))
|
2021-01-08 20:53:52 +00:00
|
|
|
},
|
|
|
|
Some(ToolKind::Staff) => {
|
|
|
|
// Staff
|
2021-01-13 08:11:31 +00:00
|
|
|
Self::default()
|
2021-01-18 19:08:13 +00:00
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Staff))
|
2021-01-21 19:52:07 +00:00
|
|
|
.with_skill(Skill::Staff(StaffSkill::BExplosion), None)
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::BDamage), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::BRegen), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::BRadius), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FDamage), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FRange), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FDrain), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FVelocity), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::UnlockShockwave), None)
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::SDamage), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::SKnockback), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::SRange), Some(1))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::SCost), Some(1))
|
2021-01-13 08:11:31 +00:00
|
|
|
},
|
|
|
|
_ => Self::default(),
|
2021-01-08 20:53:52 +00:00
|
|
|
}
|
2021-01-07 19:47:29 +00:00
|
|
|
},
|
2021-01-21 19:52:07 +00:00
|
|
|
Some(Mindflayer) => Self::default()
|
|
|
|
.with_skill_group(SkillGroupKind::Weapon(ToolKind::Staff))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::BExplosion), None)
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::BDamage), Some(3))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::BRegen), Some(2))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::BRadius), Some(2))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FDamage), Some(3))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FRange), Some(2))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FDrain), Some(2))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::FVelocity), Some(2))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::UnlockShockwave), None)
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::SDamage), Some(2))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::SKnockback), Some(2))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::SRange), Some(2))
|
|
|
|
.with_skill(Skill::Staff(StaffSkill::SCost), Some(2)),
|
2021-01-13 08:11:31 +00:00
|
|
|
Some(Villager) | None => Self::default(),
|
2021-01-07 19:47:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-21 19:52:07 +00:00
|
|
|
pub fn with_skill(mut self, skill: Skill, level: Option<u16>) -> Self {
|
2021-01-18 19:08:13 +00:00
|
|
|
if let Some(skill_group) = skill.skill_group_kind() {
|
2021-01-21 19:52:07 +00:00
|
|
|
for _ in 0..level.unwrap_or(1) {
|
|
|
|
self.0
|
|
|
|
.add_skill_points(skill_group, self.0.skill_cost(skill));
|
|
|
|
self.0.unlock_skill(skill);
|
|
|
|
if !self.0.has_skill(skill) {
|
|
|
|
warn!(
|
|
|
|
"Failed to add skill: {:?}. Verify that it has the appropriate skill \
|
|
|
|
group available and meets all prerequisite skills.",
|
|
|
|
skill
|
|
|
|
);
|
|
|
|
}
|
2021-01-07 19:47:29 +00:00
|
|
|
}
|
2021-01-10 01:05:13 +00:00
|
|
|
} else {
|
|
|
|
warn!(
|
|
|
|
"Tried to add skill: {:?} which does not have an associated skill group.",
|
|
|
|
skill
|
|
|
|
);
|
2021-01-07 19:47:29 +00:00
|
|
|
}
|
2021-01-10 01:05:13 +00:00
|
|
|
self
|
2021-01-07 19:47:29 +00:00
|
|
|
}
|
|
|
|
|
2021-01-21 19:52:07 +00:00
|
|
|
pub fn with_skill_group(self, skill_group: SkillGroupKind) -> Self {
|
|
|
|
self.with_skill(Skill::UnlockGroup(skill_group), None)
|
2021-01-07 19:47:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn build(self) -> SkillSet { self.0 }
|
|
|
|
}
|