tool shop pricing
This commit is contained in:
parent
1e18d5729b
commit
b94dcb62d0
56
data/item_stats/tech_stats.toml
Normal file
56
data/item_stats/tech_stats.toml
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
[Foie]
|
||||||
|
price = 100
|
||||||
|
|
||||||
|
[Gifoie]
|
||||||
|
price = 300
|
||||||
|
|
||||||
|
[Rafoie]
|
||||||
|
price = 450
|
||||||
|
|
||||||
|
[Zonde]
|
||||||
|
price = 100
|
||||||
|
|
||||||
|
[Gizonde]
|
||||||
|
price = 300
|
||||||
|
|
||||||
|
[Razonde]
|
||||||
|
price = 450
|
||||||
|
|
||||||
|
[Barta]
|
||||||
|
price = 100
|
||||||
|
|
||||||
|
[Gibarta]
|
||||||
|
price = 300
|
||||||
|
|
||||||
|
[Rabarta]
|
||||||
|
price = 450
|
||||||
|
|
||||||
|
[Grants]
|
||||||
|
price = 500
|
||||||
|
|
||||||
|
[Deband]
|
||||||
|
price = 100
|
||||||
|
|
||||||
|
[Jellen]
|
||||||
|
price = 100
|
||||||
|
|
||||||
|
[Zalure]
|
||||||
|
price = 100
|
||||||
|
|
||||||
|
[Shifta]
|
||||||
|
price = 100
|
||||||
|
|
||||||
|
[Ryuker]
|
||||||
|
price = 5000
|
||||||
|
|
||||||
|
[Resta]
|
||||||
|
price = 300
|
||||||
|
|
||||||
|
[Anti]
|
||||||
|
price = 100
|
||||||
|
|
||||||
|
[Reverser]
|
||||||
|
price = 5000
|
||||||
|
|
||||||
|
[Megid]
|
||||||
|
price = 500
|
92
data/item_stats/tool_stats.toml
Normal file
92
data/item_stats/tool_stats.toml
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
[Monomate]
|
||||||
|
price = 50
|
||||||
|
|
||||||
|
[Dimate]
|
||||||
|
price = 300
|
||||||
|
|
||||||
|
[Trimate]
|
||||||
|
price = 2000
|
||||||
|
|
||||||
|
[Monofluid]
|
||||||
|
price = 100
|
||||||
|
|
||||||
|
[Difluid]
|
||||||
|
price = 500
|
||||||
|
|
||||||
|
[Trifluid]
|
||||||
|
price = 3600
|
||||||
|
|
||||||
|
[SolAtomizer]
|
||||||
|
price = 300
|
||||||
|
|
||||||
|
[MoonAtomizer]
|
||||||
|
price = 500
|
||||||
|
|
||||||
|
[StarAtomizer]
|
||||||
|
price = 5000
|
||||||
|
|
||||||
|
[Antidote]
|
||||||
|
price = 60
|
||||||
|
|
||||||
|
[Antiparalysis]
|
||||||
|
price = 60
|
||||||
|
|
||||||
|
[Telepipe]
|
||||||
|
price = 350
|
||||||
|
|
||||||
|
[TrapVision]
|
||||||
|
price = 100
|
||||||
|
|
||||||
|
[ScapeDoll]
|
||||||
|
price = 10000
|
||||||
|
|
||||||
|
[Monogrinder]
|
||||||
|
price = 5000
|
||||||
|
|
||||||
|
[Digrinder]
|
||||||
|
price = 10000
|
||||||
|
|
||||||
|
[Trigrinder]
|
||||||
|
price = 15000
|
||||||
|
|
||||||
|
[PowerMaterial]
|
||||||
|
price = 2400
|
||||||
|
|
||||||
|
[MindMaterial]
|
||||||
|
price = 2400
|
||||||
|
|
||||||
|
[EvadeMaterial]
|
||||||
|
price = 2400
|
||||||
|
|
||||||
|
[HpMaterial]
|
||||||
|
price = 2400
|
||||||
|
|
||||||
|
[TpMaterial]
|
||||||
|
price = 2400
|
||||||
|
|
||||||
|
[DefMaterial]
|
||||||
|
price = 2400
|
||||||
|
|
||||||
|
[LuckMaterial]
|
||||||
|
price = 2400
|
||||||
|
|
||||||
|
[PhotonDrop]
|
||||||
|
price = 8000
|
||||||
|
|
||||||
|
[PhotonSphere]
|
||||||
|
price = 16000
|
||||||
|
|
||||||
|
[PhotonCrystal]
|
||||||
|
price = 24000
|
||||||
|
|
||||||
|
[TeamPoints500]
|
||||||
|
price = 500
|
||||||
|
|
||||||
|
[TeamPoints1000]
|
||||||
|
price = 1000
|
||||||
|
|
||||||
|
[TeamPoints5000]
|
||||||
|
price = 5000
|
||||||
|
|
||||||
|
[TeamPoints10000]
|
||||||
|
price = 10000
|
@ -10,6 +10,7 @@ use crate::entity::item::shield::ShieldType;
|
|||||||
use crate::entity::item::unit::UnitType;
|
use crate::entity::item::unit::UnitType;
|
||||||
use crate::entity::item::mag::MagType;
|
use crate::entity::item::mag::MagType;
|
||||||
use crate::entity::item::tool::ToolType;
|
use crate::entity::item::tool::ToolType;
|
||||||
|
use crate::entity::item::tech::Technique;
|
||||||
|
|
||||||
|
|
||||||
lazy_static::lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
@ -17,6 +18,8 @@ lazy_static::lazy_static! {
|
|||||||
pub static ref ARMOR_STATS: HashMap<ArmorType, ArmorStats> = armor_stats();
|
pub static ref ARMOR_STATS: HashMap<ArmorType, ArmorStats> = armor_stats();
|
||||||
pub static ref SHIELD_STATS: HashMap<ShieldType, ShieldStats> = shield_stats();
|
pub static ref SHIELD_STATS: HashMap<ShieldType, ShieldStats> = shield_stats();
|
||||||
pub static ref UNIT_STATS: BTreeMap<UnitType, UnitStats> = unit_stats();
|
pub static ref UNIT_STATS: BTreeMap<UnitType, UnitStats> = unit_stats();
|
||||||
|
pub static ref TOOL_STATS: HashMap<ToolType, ToolStats> = tool_stats();
|
||||||
|
pub static ref TECH_STATS: HashMap<Technique, TechStats> = tech_stats();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -78,6 +81,17 @@ pub struct UnitStats {
|
|||||||
pub modifier: u32,
|
pub modifier: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct ToolStats {
|
||||||
|
pub price: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct TechStats {
|
||||||
|
pub price: usize,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
|
||||||
pub struct MagStats {
|
pub struct MagStats {
|
||||||
pub feed_table: u32,
|
pub feed_table: u32,
|
||||||
@ -102,7 +116,6 @@ pub struct MagFeedTables(Vec<MagFeedTable>);
|
|||||||
pub fn weapon_stats() -> HashMap<WeaponType, WeaponStats> {
|
pub fn weapon_stats() -> HashMap<WeaponType, WeaponStats> {
|
||||||
let weapon_stats: HashMap<String, WeaponStats> = load_data_file("data/item_stats/weapon_stats.toml");
|
let weapon_stats: HashMap<String, WeaponStats> = load_data_file("data/item_stats/weapon_stats.toml");
|
||||||
weapon_stats.iter()
|
weapon_stats.iter()
|
||||||
.inspect(|k| println!("{:?}", k))
|
|
||||||
.map(|(name, stats)| {
|
.map(|(name, stats)| {
|
||||||
(name.parse().unwrap(), *stats)
|
(name.parse().unwrap(), *stats)
|
||||||
}).collect()
|
}).collect()
|
||||||
@ -132,6 +145,22 @@ pub fn unit_stats() -> BTreeMap<UnitType, UnitStats> {
|
|||||||
}).collect()
|
}).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn tool_stats() -> HashMap<ToolType, ToolStats> {
|
||||||
|
let tool_stats: HashMap<String, ToolStats> = load_data_file("data/item_stats/tool_stats.toml");
|
||||||
|
tool_stats.iter()
|
||||||
|
.map(|(name, stats)| {
|
||||||
|
(name.parse().unwrap(), *stats)
|
||||||
|
}).collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn tech_stats() -> HashMap<Technique, TechStats> {
|
||||||
|
let tech_stats: HashMap<String, TechStats> = load_data_file("data/item_stats/tech_stats.toml");
|
||||||
|
tech_stats.iter()
|
||||||
|
.map(|(name, stats)| {
|
||||||
|
(name.parse().unwrap(), *stats)
|
||||||
|
}).collect()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn mag_stats() -> HashMap<MagType, MagStats> {
|
pub fn mag_stats() -> HashMap<MagType, MagStats> {
|
||||||
let mag_stats: BTreeMap<String, MagStats> = load_data_file("data/item_stats/mag_stats.toml");
|
let mag_stats: BTreeMap<String, MagStats> = load_data_file("data/item_stats/mag_stats.toml");
|
||||||
mag_stats.iter()
|
mag_stats.iter()
|
||||||
@ -181,6 +210,18 @@ mod test {
|
|||||||
assert!(ustat.get(&UnitType::ElfArm).unwrap().stars == 5);
|
assert!(ustat.get(&UnitType::ElfArm).unwrap().stars == 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_tool_stats() {
|
||||||
|
let tstat = tool_stats();
|
||||||
|
assert!(tstat.get(&ToolType::Monomate).unwrap().price == 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_tech_stats() {
|
||||||
|
let tstat = tech_stats();
|
||||||
|
assert!(tstat.get(&Technique::Reverser).unwrap().price == 5000);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_mag_stats() {
|
fn test_mag_stats() {
|
||||||
let mstats = mag_stats();
|
let mstats = mag_stats();
|
||||||
|
@ -10,6 +10,8 @@ use crate::entity::character::SectionID;
|
|||||||
use crate::ship::room::Difficulty;
|
use crate::ship::room::Difficulty;
|
||||||
use crate::entity::item::tool::{Tool, ToolType};
|
use crate::entity::item::tool::{Tool, ToolType};
|
||||||
use crate::entity::item::tech::{Technique, TechniqueDisk};
|
use crate::entity::item::tech::{Technique, TechniqueDisk};
|
||||||
|
use crate::ship::shops::ShopItem;
|
||||||
|
use crate::ship::item_stats::{TOOL_STATS, TECH_STATS};
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
@ -48,6 +50,28 @@ impl PartialOrd for ShopTool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ShopItem for ShopTool {
|
||||||
|
fn price(&self) -> usize {
|
||||||
|
match self {
|
||||||
|
ShopTool::Tool(tool) => {
|
||||||
|
TOOL_STATS.get(&tool)
|
||||||
|
.map(|tool_stats| {
|
||||||
|
tool_stats.price
|
||||||
|
})
|
||||||
|
.unwrap_or(0xFFFF)
|
||||||
|
},
|
||||||
|
ShopTool::Tech(tech) => {
|
||||||
|
TECH_STATS.get(&tech.tech)
|
||||||
|
.map(|tech_stats| {
|
||||||
|
tech_stats.price * tech.level as usize
|
||||||
|
})
|
||||||
|
.unwrap_or(0xFFFF)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
struct ToolTable(Vec<ToolType>);
|
struct ToolTable(Vec<ToolType>);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user