Skip to content

Commit

Permalink
money logic + don't require early dd
Browse files Browse the repository at this point in the history
  • Loading branch information
bananaturtlesandwich committed Apr 16, 2023
1 parent 26b9360 commit d962d96
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 36 deletions.
1 change: 1 addition & 0 deletions src/logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ pub enum Lock {
Movement(&'static [Move]),
Item(Items),
Emote(Emotes),
Money(u32),
SpiritHunter,
Mork,
EvolairTunic,
Expand Down
70 changes: 35 additions & 35 deletions src/logic/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)]),
],
Expand All @@ -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)]),
],
Expand All @@ -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)]),
],
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down
60 changes: 59 additions & 1 deletion src/logic/seeding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)),
Expand Down Expand Up @@ -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::<Vec<_>>(),
data.savegames,
data.cutscenes,
data.cases
),
)
.unwrap_or_default();
crate::writing::write(data, app).map_err(|e| e.to_string())
}

0 comments on commit d962d96

Please sign in to comment.