|
@ -9,6 +9,8 @@ use rand::seq::{SliceRandom, IteratorRandom}; |
|
|
use crate::entity::character::SectionID;
|
|
|
use crate::entity::character::SectionID;
|
|
|
use crate::ship::room::Difficulty;
|
|
|
use crate::ship::room::Difficulty;
|
|
|
use crate::entity::item::weapon::{WeaponType, WeaponSpecial, Attribute, WeaponAttribute};
|
|
|
use crate::entity::item::weapon::{WeaponType, WeaponSpecial, Attribute, WeaponAttribute};
|
|
|
|
|
|
use crate::ship::shops::ShopItem;
|
|
|
|
|
|
use crate::ship::item_stats::WEAPON_STATS;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const TIER1_SPECIAL: [WeaponSpecial; 8] = [WeaponSpecial::Draw, WeaponSpecial::Heart, WeaponSpecial::Ice, WeaponSpecial::Bind,
|
|
|
const TIER1_SPECIAL: [WeaponSpecial; 8] = [WeaponSpecial::Draw, WeaponSpecial::Heart, WeaponSpecial::Ice, WeaponSpecial::Bind,
|
|
@ -26,6 +28,80 @@ pub struct ShopWeapon { |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn special_stars(special: &WeaponSpecial) -> usize {
|
|
|
|
|
|
match special {
|
|
|
|
|
|
WeaponSpecial::Draw => 1,
|
|
|
|
|
|
WeaponSpecial::Drain => 2,
|
|
|
|
|
|
WeaponSpecial::Fill => 3,
|
|
|
|
|
|
WeaponSpecial::Gush => 4,
|
|
|
|
|
|
WeaponSpecial::Heart => 1,
|
|
|
|
|
|
WeaponSpecial::Mind => 2,
|
|
|
|
|
|
WeaponSpecial::Soul => 3,
|
|
|
|
|
|
WeaponSpecial::Geist => 4,
|
|
|
|
|
|
WeaponSpecial::Masters => 2,
|
|
|
|
|
|
WeaponSpecial::Lords => 3,
|
|
|
|
|
|
WeaponSpecial::Kings => 4,
|
|
|
|
|
|
WeaponSpecial::Charge => 2,
|
|
|
|
|
|
WeaponSpecial::Spirit => 3,
|
|
|
|
|
|
WeaponSpecial::Berserk => 4,
|
|
|
|
|
|
WeaponSpecial::Ice => 1,
|
|
|
|
|
|
WeaponSpecial::Frost => 2,
|
|
|
|
|
|
WeaponSpecial::Freeze => 3,
|
|
|
|
|
|
WeaponSpecial::Blizzard => 4,
|
|
|
|
|
|
WeaponSpecial::Bind => 1,
|
|
|
|
|
|
WeaponSpecial::Hold => 2,
|
|
|
|
|
|
WeaponSpecial::Seize => 3,
|
|
|
|
|
|
WeaponSpecial::Arrest => 4,
|
|
|
|
|
|
WeaponSpecial::Heat => 1,
|
|
|
|
|
|
WeaponSpecial::Fire => 2,
|
|
|
|
|
|
WeaponSpecial::Flame => 3,
|
|
|
|
|
|
WeaponSpecial::Burning => 4,
|
|
|
|
|
|
WeaponSpecial::Shock => 1,
|
|
|
|
|
|
WeaponSpecial::Thunder => 2,
|
|
|
|
|
|
WeaponSpecial::Storm => 3,
|
|
|
|
|
|
WeaponSpecial::Tempest => 4,
|
|
|
|
|
|
WeaponSpecial::Dim => 1,
|
|
|
|
|
|
WeaponSpecial::Shadow => 2,
|
|
|
|
|
|
WeaponSpecial::Dark => 3,
|
|
|
|
|
|
WeaponSpecial::Hell => 4,
|
|
|
|
|
|
WeaponSpecial::Panic => 1,
|
|
|
|
|
|
WeaponSpecial::Riot => 2,
|
|
|
|
|
|
WeaponSpecial::Havoc => 3,
|
|
|
|
|
|
WeaponSpecial::Chaos => 4,
|
|
|
|
|
|
WeaponSpecial::Devils => 3,
|
|
|
|
|
|
WeaponSpecial::Demons => 4,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl ShopItem for ShopWeapon {
|
|
|
|
|
|
fn price(&self) -> usize {
|
|
|
|
|
|
WEAPON_STATS.get(&self.weapon)
|
|
|
|
|
|
.map(|weapon_stat| {
|
|
|
|
|
|
let mut price = weapon_stat.atp_max as f32;
|
|
|
|
|
|
price += self.grind as f32;
|
|
|
|
|
|
price = (price * (price * 3.0)) / weapon_stat.shop_multiplier;
|
|
|
|
|
|
|
|
|
|
|
|
let percent = self.attributes.iter()
|
|
|
|
|
|
.fold(0.0, |acc, attr| {
|
|
|
|
|
|
acc + attr.map(|a| a.value).unwrap_or(0) as f32
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
price = price + ((price / 300.0) * percent);
|
|
|
|
|
|
|
|
|
|
|
|
let special = self.special.map(|special| {
|
|
|
|
|
|
special_stars(&special) as f32
|
|
|
|
|
|
}).unwrap_or(0.0);
|
|
|
|
|
|
|
|
|
|
|
|
price += special * special * 1000.0;
|
|
|
|
|
|
|
|
|
|
|
|
price as usize
|
|
|
|
|
|
})
|
|
|
|
|
|
.unwrap_or(0xFFFF)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
|
#[derive(Debug, Deserialize)]
|
|
|
struct WeaponTableTierEntry {
|
|
|
struct WeaponTableTierEntry {
|
|
|
weapon: WeaponType,
|
|
|
weapon: WeaponType,
|
|
|