weapon fix, and inability to remove cursed items

This commit is contained in:
Llywelwyn 2023-08-22 08:43:56 +01:00
parent d277384cc5
commit e403a6d845
6 changed files with 79 additions and 23 deletions

View file

@ -22,7 +22,6 @@ pub struct Name {
#[derive(Deserialize, Debug)]
pub struct Equippable {
pub slot: String,
pub flag: String,
pub damage: String,
pub to_hit: Option<i32>,

View file

@ -659,6 +659,7 @@ fn find_slot_for_equippable_item(tag: &str, raws: &RawMaster) -> EquipmentSlot {
if let Some(flags) = &item.flags {
for flag in flags {
match flag.as_str() {
"EQUIP_MELEE" => return EquipmentSlot::Melee,
"EQUIP_SHIELD" => return EquipmentSlot::Shield,
"EQUIP_BODY" => return EquipmentSlot::Body,
"EQUIP_HEAD" => return EquipmentSlot::Head,
@ -670,12 +671,6 @@ fn find_slot_for_equippable_item(tag: &str, raws: &RawMaster) -> EquipmentSlot {
}
}
}
if let Some(equip) = &item.equip {
match equip.slot.as_str() {
"EQUIP_MELEE" => return EquipmentSlot::Melee,
_ => {}
}
}
panic!("Trying to equip {}, but it has no slot tag.", tag);
}