|
@ -3,7 +3,7 @@ use serde::{Serialize, Deserialize}; |
|
|
use rand::{Rng, SeedableRng};
|
|
|
use rand::{Rng, SeedableRng};
|
|
|
use rand::distributions::{WeightedIndex, Distribution};
|
|
|
use rand::distributions::{WeightedIndex, Distribution};
|
|
|
|
|
|
|
|
|
use crate::entity::item::{ItemDetail, Armor as ArmorDetail};
|
|
|
|
|
|
|
|
|
use crate::entity::item::ItemDetail;
|
|
|
use crate::entity::item::armor::{ArmorType, Armor};
|
|
|
use crate::entity::item::armor::{ArmorType, Armor};
|
|
|
use crate::ship::room::{Difficulty, Episode};
|
|
|
use crate::ship::room::{Difficulty, Episode};
|
|
|
use crate::ship::map::MapVariantType;
|
|
|
use crate::ship::map::MapVariantType;
|
|
@ -105,14 +105,12 @@ impl GenericArmorTable { |
|
|
let evp_modifier = self.dfp_modifier(&armor_type, rng);
|
|
|
let evp_modifier = self.dfp_modifier(&armor_type, rng);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Some(ItemDetail::Armor(ArmorDetail {
|
|
|
|
|
|
|
|
|
Some(ItemDetail::Armor(Armor {
|
|
|
|
|
|
armor: armor_type,
|
|
|
|
|
|
dfp: dfp_modifier as u8,
|
|
|
|
|
|
evp: evp_modifier as u8,
|
|
|
|
|
|
slots: slots as u8,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
armor: Armor {
|
|
|
|
|
|
armor: armor_type,
|
|
|
|
|
|
dfp: dfp_modifier as u8,
|
|
|
|
|
|
evp: evp_modifier as u8,
|
|
|
|
|
|
slots: slots as u8
|
|
|
|
|
|
}
|
|
|
|
|
|
}))
|
|
|
}))
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@ -126,41 +124,33 @@ mod test { |
|
|
let mut rng = rand_chacha::ChaCha20Rng::from_seed([23;32]);
|
|
|
let mut rng = rand_chacha::ChaCha20Rng::from_seed([23;32]);
|
|
|
|
|
|
|
|
|
let gat = GenericArmorTable::new(Episode::One, Difficulty::Ultimate, SectionID::Skyly);
|
|
|
let gat = GenericArmorTable::new(Episode::One, Difficulty::Ultimate, SectionID::Skyly);
|
|
|
assert!(gat.get_drop(&MapVariantType::Mines1, &mut rng) == Some(ItemDetail::Armor(ArmorDetail {
|
|
|
|
|
|
|
|
|
assert!(gat.get_drop(&MapVariantType::Mines1, &mut rng) == Some(ItemDetail::Armor(Armor {
|
|
|
|
|
|
armor: ArmorType::GeneralArmor,
|
|
|
|
|
|
dfp: 0,
|
|
|
|
|
|
evp: 0,
|
|
|
|
|
|
slots: 1,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
armor: Armor {
|
|
|
|
|
|
armor: ArmorType::GeneralArmor,
|
|
|
|
|
|
dfp: 0,
|
|
|
|
|
|
evp: 0,
|
|
|
|
|
|
slots: 1,
|
|
|
|
|
|
}
|
|
|
|
|
|
})));
|
|
|
})));
|
|
|
assert!(gat.get_drop(&MapVariantType::Caves3, &mut rng) == Some(ItemDetail::Armor(ArmorDetail {
|
|
|
|
|
|
|
|
|
assert!(gat.get_drop(&MapVariantType::Caves3, &mut rng) == Some(ItemDetail::Armor(Armor {
|
|
|
|
|
|
armor: ArmorType::AbsorbArmor,
|
|
|
|
|
|
dfp: 1,
|
|
|
|
|
|
evp: 1,
|
|
|
|
|
|
slots: 1,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
armor: Armor {
|
|
|
|
|
|
armor: ArmorType::AbsorbArmor,
|
|
|
|
|
|
dfp: 1,
|
|
|
|
|
|
evp: 1,
|
|
|
|
|
|
slots: 1,
|
|
|
|
|
|
}
|
|
|
|
|
|
})));
|
|
|
})));
|
|
|
assert!(gat.get_drop(&MapVariantType::Forest2, &mut rng) == Some(ItemDetail::Armor(ArmorDetail {
|
|
|
|
|
|
|
|
|
assert!(gat.get_drop(&MapVariantType::Forest2, &mut rng) == Some(ItemDetail::Armor(Armor {
|
|
|
|
|
|
armor: ArmorType::HyperFrame,
|
|
|
|
|
|
dfp: 0,
|
|
|
|
|
|
evp: 0,
|
|
|
|
|
|
slots: 0,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
armor: Armor {
|
|
|
|
|
|
armor: ArmorType::HyperFrame,
|
|
|
|
|
|
dfp: 0,
|
|
|
|
|
|
evp: 0,
|
|
|
|
|
|
slots: 0,
|
|
|
|
|
|
}
|
|
|
|
|
|
})));
|
|
|
})));
|
|
|
assert!(gat.get_drop(&MapVariantType::DarkFalz, &mut rng) == Some(ItemDetail::Armor(ArmorDetail {
|
|
|
|
|
|
|
|
|
assert!(gat.get_drop(&MapVariantType::DarkFalz, &mut rng) == Some(ItemDetail::Armor(Armor {
|
|
|
|
|
|
armor: ArmorType::ImperialArmor,
|
|
|
|
|
|
dfp: 2,
|
|
|
|
|
|
evp: 1,
|
|
|
|
|
|
slots: 0,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
armor: Armor {
|
|
|
|
|
|
armor: ArmorType::ImperialArmor,
|
|
|
|
|
|
dfp: 2,
|
|
|
|
|
|
evp: 1,
|
|
|
|
|
|
slots: 0,
|
|
|
|
|
|
}
|
|
|
|
|
|
})));
|
|
|
})));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|