|
|
@ -5,7 +5,7 @@ use rand::{Rng, SeedableRng}; |
|
|
|
use rand::distributions::{WeightedIndex, Distribution};
|
|
|
|
use rand::seq::SliceRandom;
|
|
|
|
|
|
|
|
use crate::entity::item::{ItemDetail, Weapon as WeaponDetail};
|
|
|
|
use crate::entity::item::{ItemDetail};
|
|
|
|
use crate::entity::item::weapon::{Weapon, WeaponType, Attribute, WeaponAttribute, WeaponSpecial};
|
|
|
|
use crate::ship::monster::MonsterType;
|
|
|
|
use crate::ship::room::{Difficulty, Episode};
|
|
|
@ -487,15 +487,13 @@ impl GenericWeaponTable { |
|
|
|
let weapon_special = self.special_table.get_special(map_area, rng);
|
|
|
|
let actual_weapon = self.actual_weapon(&weapon_type, weapon_rank);
|
|
|
|
|
|
|
|
Some(ItemDetail::Weapon(WeaponDetail {
|
|
|
|
Some(ItemDetail::Weapon(Weapon {
|
|
|
|
weapon: actual_weapon,
|
|
|
|
special: weapon_special,
|
|
|
|
grind: weapon_grind as u8,
|
|
|
|
attrs: weapon_attributes,
|
|
|
|
equipped: false,
|
|
|
|
tekked: weapon_special.is_none(),
|
|
|
|
weapon: Weapon {
|
|
|
|
weapon: actual_weapon,
|
|
|
|
special: weapon_special,
|
|
|
|
grind: weapon_grind as u8,
|
|
|
|
attrs: weapon_attributes,
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -510,51 +508,43 @@ mod test { |
|
|
|
let mut rng = rand_chacha::ChaCha20Rng::from_seed([23;32]);
|
|
|
|
|
|
|
|
let gwt = GenericWeaponTable::new(Episode::One, Difficulty::Normal, SectionID::Skyly);
|
|
|
|
assert!(gwt.get_drop(&MapVariantType::Forest1, &mut rng) == Some(ItemDetail::Weapon(WeaponDetail {
|
|
|
|
assert!(gwt.get_drop(&MapVariantType::Forest1, &mut rng) == Some(ItemDetail::Weapon(Weapon {
|
|
|
|
weapon: WeaponType::Cane,
|
|
|
|
special: None,
|
|
|
|
grind: 0,
|
|
|
|
attrs: [None, None, None],
|
|
|
|
equipped: false,
|
|
|
|
tekked: true,
|
|
|
|
weapon: Weapon {
|
|
|
|
weapon: WeaponType::Cane,
|
|
|
|
special: None,
|
|
|
|
grind: 0,
|
|
|
|
attrs: [None, None, None]
|
|
|
|
}
|
|
|
|
})));
|
|
|
|
|
|
|
|
let gwt = GenericWeaponTable::new(Episode::One, Difficulty::Hard, SectionID::Skyly);
|
|
|
|
assert!(gwt.get_drop(&MapVariantType::Caves2, &mut rng) == Some(ItemDetail::Weapon(WeaponDetail {
|
|
|
|
assert!(gwt.get_drop(&MapVariantType::Caves2, &mut rng) == Some(ItemDetail::Weapon(Weapon {
|
|
|
|
weapon: WeaponType::Sniper,
|
|
|
|
special: None,
|
|
|
|
grind: 2,
|
|
|
|
attrs: [None, None, None],
|
|
|
|
equipped: false,
|
|
|
|
tekked: true,
|
|
|
|
weapon: Weapon {
|
|
|
|
weapon: WeaponType::Sniper,
|
|
|
|
special: None,
|
|
|
|
grind: 2,
|
|
|
|
attrs: [None, None, None]
|
|
|
|
}
|
|
|
|
})));
|
|
|
|
|
|
|
|
let gwt = GenericWeaponTable::new(Episode::One, Difficulty::VeryHard, SectionID::Skyly);
|
|
|
|
assert!(gwt.get_drop(&MapVariantType::Mines1, &mut rng) == Some(ItemDetail::Weapon(WeaponDetail {
|
|
|
|
assert!(gwt.get_drop(&MapVariantType::Mines1, &mut rng) == Some(ItemDetail::Weapon(Weapon {
|
|
|
|
weapon: WeaponType::Club,
|
|
|
|
special: Some(WeaponSpecial::Berserk),
|
|
|
|
grind: 0,
|
|
|
|
attrs: [None, None, None],
|
|
|
|
equipped: false,
|
|
|
|
tekked: false,
|
|
|
|
weapon: Weapon {
|
|
|
|
weapon: WeaponType::Club,
|
|
|
|
special: Some(WeaponSpecial::Berserk),
|
|
|
|
grind: 0,
|
|
|
|
attrs: [None, None, None]
|
|
|
|
}
|
|
|
|
})));
|
|
|
|
|
|
|
|
let gwt = GenericWeaponTable::new(Episode::One, Difficulty::Ultimate, SectionID::Skyly);
|
|
|
|
assert!(gwt.get_drop(&MapVariantType::DarkFalz, &mut rng) == Some(ItemDetail::Weapon(WeaponDetail {
|
|
|
|
assert!(gwt.get_drop(&MapVariantType::DarkFalz, &mut rng) == Some(ItemDetail::Weapon(Weapon {
|
|
|
|
weapon: WeaponType::Vulcan,
|
|
|
|
special: None,
|
|
|
|
grind: 0,
|
|
|
|
attrs: [Some(WeaponAttribute {attr: Attribute::ABeast, value: 30}), Some(WeaponAttribute {attr: Attribute::Dark, value: 30}), None],
|
|
|
|
equipped: false,
|
|
|
|
tekked: true,
|
|
|
|
weapon: Weapon {
|
|
|
|
weapon: WeaponType::Vulcan,
|
|
|
|
special: None,
|
|
|
|
grind: 0,
|
|
|
|
attrs: [Some(WeaponAttribute {attr: Attribute::ABeast, value: 30}), Some(WeaponAttribute {attr: Attribute::Dark, value: 30}), None]
|
|
|
|
}
|
|
|
|
})));
|
|
|
|
}
|
|
|
|
}
|