diff --git a/src/logic.rs b/src/logic.rs index 9cd0f30..4e08c61 100644 --- a/src/logic.rs +++ b/src/logic.rs @@ -145,6 +145,7 @@ pub enum Lock { Movement(&'static [Move]), Item(Items), Emote(Emotes), + Money(u32), SpiritHunter, Mork, EvolairTunic, diff --git a/src/logic/checks.rs b/src/logic/checks.rs index 618519e..c218512 100644 --- a/src/logic/checks.rs +++ b/src/logic/checks.rs @@ -76,11 +76,7 @@ pub const CHECKS: [Check; 255] = [ location: Locations::FirstVoid, context: Context::Overworld("Spirit_A02_RiverSpirit"), drop: Drop::Spirit(Spirits::RiverSpirit), - locks: &[Lock::Movement(&[ - no_walljump!(0, 2), - no_walljump!(2, 0), - walljump!(0, 0), - ])], + locks: &[Lock::Movement(&[no_walljump!(2, 0), walljump!(0, 0)])], }, Check { location: Locations::Crates, @@ -252,25 +248,25 @@ pub const CHECKS: [Check; 255] = [ location: Locations::ArcaneSpiritHunter, context: Context::Shop(Shop::SpiritHunter, 0, 5500), drop: Drop::Spirit(Spirits::StormCentry), - locks: &[Lock::Item(Items::SmallPouch)], + locks: &[Lock::Money(5500)], }, Check { location: Locations::ArcaneSpiritHunter, context: Context::Shop(Shop::SpiritHunter, 1, 3500), drop: Drop::Spirit(Spirits::BloodPhantom), - locks: &[Lock::Item(Items::SmallPouch)], + locks: &[Lock::Money(3500)], }, Check { location: Locations::ArcaneSpiritHunter, context: Context::Shop(Shop::SpiritHunter, 2, 4500), drop: Drop::Spirit(Spirits::FrozenSoul), - locks: &[Lock::Item(Items::SmallPouch)], + locks: &[Lock::Money(4500)], }, Check { location: Locations::ArcaneSpiritHunter, context: Context::Shop(Shop::SpiritHunter, 3, 2500), drop: Drop::Spirit(Spirits::ShadowGru), - locks: &[], + locks: &[Lock::Money(2500)], }, Check { location: Locations::ArcaneSpiritHunter, @@ -471,67 +467,67 @@ pub const CHECKS: [Check; 255] = [ location: Locations::Stoneheart, context: Context::Shop(Shop::Ari, 0, 1000), drop: Drop::Tunic(Tunics::Orange), - locks: &[], + locks: &[Lock::Money(1000)], }, Check { location: Locations::Stoneheart, context: Context::Shop(Shop::Ari, 1, 1000), drop: Drop::Tunic(Tunics::Aqua), - locks: &[], + locks: &[Lock::Money(1000)], }, Check { location: Locations::Stoneheart, context: Context::Shop(Shop::Ari, 2, 1000), drop: Drop::Tunic(Tunics::Royal), - locks: &[], + locks: &[Lock::Money(1000)], }, Check { location: Locations::Stoneheart, context: Context::Shop(Shop::Ari, 3, 1000), drop: Drop::Tunic(Tunics::Lila), - locks: &[], + locks: &[Lock::Money(1000)], }, Check { location: Locations::Stoneheart, context: Context::Shop(Shop::Ari, 4, 5000), drop: Drop::Tunic(Tunics::Rainbow), - locks: &[Lock::Item(Items::SmallPouch)], + locks: &[Lock::Money(5000)], }, Check { location: Locations::Stoneheart, context: Context::Shop(Shop::Ari, 5, 1000), drop: Drop::Tunic(Tunics::LightBlue), - locks: &[], + locks: &[Lock::Money(1000)], }, Check { location: Locations::Stoneheart, context: Context::Shop(Shop::Ari, 6, 1000), drop: Drop::Tunic(Tunics::Violet), - locks: &[], + locks: &[Lock::Money(1000)], }, Check { location: Locations::Stoneheart, context: Context::Shop(Shop::Ari, 7, 1000), drop: Drop::Tunic(Tunics::Grey), - locks: &[], + locks: &[Lock::Money(1000)], }, Check { location: Locations::Stoneheart, context: Context::Shop(Shop::Ari, 8, 1000), drop: Drop::Tunic(Tunics::Green), - locks: &[], + locks: &[Lock::Money(1000)], }, Check { location: Locations::Stoneheart, context: Context::Shop(Shop::Ari, 9, 1000), drop: Drop::Tunic(Tunics::Yellow), - locks: &[], + locks: &[Lock::Money(1000)], }, Check { location: Locations::Stoneheart, context: Context::Shop(Shop::Ari, 10, 1000), drop: Drop::Tunic(Tunics::Red), - locks: &[], + locks: &[Lock::Money(1000)], }, Check { location: Locations::Stoneheart, @@ -549,7 +545,8 @@ pub const CHECKS: [Check; 255] = [ location: Locations::Stoneheart, context: Context::Cutscene("NPC/Orip/BP_Orip_Saw/NPC_Orip_Stoneheart"), drop: Drop::Item(Items::OddRock, 1), - locks: &[], + // being in debt will not softlock you + locks: &[Lock::Money(4800)], }, Check { location: Locations::Stoneheart, @@ -592,31 +589,31 @@ pub const CHECKS: [Check; 255] = [ location: Locations::Stoneheart, context: Context::Shop(Shop::Mork, 0, 2800), drop: Drop::Spirit(Spirits::PossesedBook), - locks: &[], + locks: &[Lock::Money(2800)], }, Check { location: Locations::Stoneheart, context: Context::Shop(Shop::Mork, 1, 2500), drop: Drop::Spirit(Spirits::GoldenLust), - locks: &[], + locks: &[Lock::Money(2500)], }, Check { location: Locations::Stoneheart, context: Context::Shop(Shop::Mork, 2, 2200), drop: Drop::Spirit(Spirits::LifeSteal), - locks: &[], + locks: &[Lock::Money(2200)], }, Check { location: Locations::Stoneheart, context: Context::Shop(Shop::Mork, 3, 4000), drop: Drop::Item(Items::LargePouch, 1), - locks: &[Lock::Item(Items::SmallPouch)], + locks: &[Lock::Money(4000)], }, Check { location: Locations::Stoneheart, context: Context::Shop(Shop::Mork, 4, 1200), drop: Drop::Item(Items::RareSnow, 1), - locks: &[], + locks: &[Lock::Money(1200)], }, Check { location: Locations::Stoneheart, @@ -866,6 +863,7 @@ pub const CHECKS: [Check; 255] = [ context: Context::Cutscene("NPC/Onops/Onop_Thief/NPC_Onop_Thief"), drop: Drop::Item(Items::SmallPouch, 1), locks: &[ + Lock::Money(2000), Lock::Location(Locations::Gruh), Lock::Movement(&[walljump!(0, 0), no_walljump!(1, 0)]), ], @@ -875,6 +873,7 @@ pub const CHECKS: [Check; 255] = [ context: Context::Shop(Shop::Poi, 0, 150), drop: Drop::Item(Items::FireEssence, 1), locks: &[ + Lock::Money(150), Lock::Location(Locations::Gruh), Lock::Movement(&[walljump!(0, 0), no_walljump!(1, 0)]), ], @@ -884,6 +883,7 @@ pub const CHECKS: [Check; 255] = [ context: Context::Shop(Shop::Poi, 1, 1500), drop: Drop::Item(Items::FireEssence, 2), locks: &[ + Lock::Money(1500), Lock::Location(Locations::Gruh), Lock::Movement(&[walljump!(0, 0), no_walljump!(1, 0)]), ], @@ -959,19 +959,19 @@ pub const CHECKS: [Check; 255] = [ location: Locations::TempleGardens, context: Context::Shop(Shop::Nilo, 0, 1500), drop: Drop::Item(Items::EmeraldOre, 1), - locks: &[], + locks: &[Lock::Money(1500)], }, Check { location: Locations::TempleGardens, context: Context::Shop(Shop::Nilo, 1, 800), drop: Drop::Item(Items::SapphireOre, 1), - locks: &[], + locks: &[Lock::Money(800)], }, Check { location: Locations::TempleGardens, context: Context::Shop(Shop::Nilo, 2, 500), drop: Drop::Item(Items::RubyOre, 1), - locks: &[], + locks: &[Lock::Money(500)], }, Check { location: Locations::TempleGardens, @@ -1344,7 +1344,7 @@ pub const CHECKS: [Check; 255] = [ location: Locations::Bunny, context: Context::Cutscene("NPC/Onops/Onop_Speedo/NPC_Onop_Speedo"), drop: Drop::Ability(Abilities::Sprint), - locks: &[], + locks: &[Lock::Money(8000)], }, Check { location: Locations::Bunny, @@ -1365,7 +1365,7 @@ pub const CHECKS: [Check; 255] = [ location: Locations::Bunny, context: Context::Cutscene("NPC/Onops/Onop_Onari/NPC_Master_Onari"), drop: Drop::Tunic(Tunics::BunnySuit), - locks: &[Lock::Movement(&[no_walljump!(0, 1)])], + locks: &[Lock::Money(2000), Lock::Movement(&[no_walljump!(0, 1)])], }, Check { location: Locations::Bunny, @@ -1566,25 +1566,25 @@ pub const CHECKS: [Check; 255] = [ location: Locations::RustVillage, context: Context::Shop(Shop::Poti, 0, 3000), drop: Drop::Spirit(Spirits::OnopSiblings), - locks: &[], + locks: &[Lock::Money(3000)], }, Check { location: Locations::RustVillage, context: Context::Shop(Shop::Poti, 1, 2200), drop: Drop::Spirit(Spirits::MoiTheDreadful), - locks: &[], + locks: &[Lock::Money(2200)], }, Check { location: Locations::RustVillage, context: Context::Shop(Shop::Poti, 2, 12500), drop: Drop::Weapon(Weapons::ShadowCasters), - locks: &[], + locks: &[Lock::Money(12500)], }, Check { location: Locations::RustVillage, context: Context::Shop(Shop::Poti, 3, 8000), drop: Drop::Item(Items::ExtraLargePouch, 1), - locks: &[], + locks: &[Lock::Money(8000)], }, // Beira's Shrine Check { diff --git a/src/logic/seeding.rs b/src/logic/seeding.rs index 58ff5be..3c97c98 100644 --- a/src/logic/seeding.rs +++ b/src/logic/seeding.rs @@ -71,6 +71,29 @@ fn update( let emote = Drop::Emote(*emote); both().any(|drop| drop == &emote) } + Lock::Money(amount) => { + if amount < &3000 { + true + } else if amount < &6000 { + both().any(|drop| matches!(drop, Drop::Item(Items::SmallPouch, ..))) + } else if amount < &10000 { + both().any(|drop| { + matches!( + drop, + Drop::Item(Items::SmallPouch, ..) | Drop::Item(Items::LargePouch, ..) + ) + }) + } else { + both().any(|drop| { + matches!( + drop, + Drop::Item(Items::SmallPouch, ..) + | Drop::Item(Items::LargePouch, ..) + | Drop::Item(Items::ExtraLargePouch, ..) + ) + }) + } + } Lock::Mork => { both().fold(0, |acc, drop| { if drop == &Drop::Item(Items::Book, 1) { @@ -124,6 +147,31 @@ fn update( .iter() .position(|drop| drop == &emote) } + Lock::Money(amount) => { + if amount < &3000 { + None + } else if amount < &6000 { + possible[0..checks.len()] + .iter() + .position(|drop| matches!(drop, Drop::Item(Items::SmallPouch, ..))) + } else if amount < &10000 { + possible[0..checks.len()].iter().position(|drop| { + matches!( + drop, + Drop::Item(Items::SmallPouch, ..) | Drop::Item(Items::LargePouch, ..) + ) + }) + } else { + possible[0..checks.len()].iter().position(|drop| { + matches!( + drop, + Drop::Item(Items::SmallPouch, ..) + | Drop::Item(Items::LargePouch, ..) + | Drop::Item(Items::ExtraLargePouch, ..) + ) + }) + } + } Lock::Mork => possible[0..checks.len()] .iter() .position(|drop| drop == &Drop::Item(Items::Book, 1)), @@ -271,6 +319,16 @@ pub fn randomise(app: &crate::Rando) -> Result<(), String> { // sort descending so removing in order doesn't mess up indexes data.shop_emotes .sort_unstable_by_key(|(_, i)| std::cmp::Reverse(*i)); - std::fs::write("spoiler_log.txt", format!("{data:#?}")).unwrap_or_default(); + std::fs::write( + "spoiler_log.txt", + format!( + "{:#?}\n{:#?}\n{:#?}\n{:#?}", + data.overworld.values().flatten().collect::>(), + data.savegames, + data.cutscenes, + data.cases + ), + ) + .unwrap_or_default(); crate::writing::write(data, app).map_err(|e| e.to_string()) }