Skip to content

Commit

Permalink
Start on OnObtainGhostRevek
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKnauth committed Feb 19, 2024
1 parent 725761a commit ceeff46
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
13 changes: 8 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ async fn main() {
let mut load_remover = Box::new(TimingMethodLoadRemover::new(timing_method));

next_tick().await;
let game_manager_finder = Box::new(GameManagerFinder::wait_attach(&process).await);
let mut game_manager_finder = Box::new(GameManagerFinder::wait_attach(&process).await);
let mut player_data_store = Box::new(PlayerDataStore::new());
let mut scene_data_store = Box::new(SceneDataStore::new());

#[cfg(debug_assertions)]
asr::print_message(&format!("geo: {:?}", game_manager_finder.get_geo(&process)));
Expand All @@ -70,7 +71,7 @@ async fn main() {
let mut last_timer_state = TimerState::Unknown;
let mut i = 0;
loop {
tick_action(&process, &splits, &mut last_timer_state, &mut i, auto_reset, &game_manager_finder, &mut scene_store, &mut player_data_store, &mut load_remover).await;
tick_action(&process, &splits, &mut last_timer_state, &mut i, auto_reset, &mut game_manager_finder, &mut scene_store, &mut player_data_store, &mut scene_data_store, &mut load_remover).await;

load_remover.load_removal(&process, &game_manager_finder, i);

Expand Down Expand Up @@ -114,9 +115,10 @@ async fn tick_action(
last_timer_state: &mut TimerState,
i: &mut usize,
auto_reset: bool,
game_manager_finder: &GameManagerFinder,
game_manager_finder: &mut GameManagerFinder,
scene_store: &mut SceneStore,
player_data_store: &mut PlayerDataStore,
scene_data_store: &mut SceneDataStore,
load_remover: &mut TimingMethodLoadRemover,
) {
match asr::timer::state() {
Expand Down Expand Up @@ -146,7 +148,7 @@ async fn tick_action(
let n = splits.len();
let trans_now = scene_store.transition_now(&process, &game_manager_finder);
loop {
let a = splits::splits(&splits[*i], &process, &game_manager_finder, trans_now, scene_store, player_data_store);
let a = splits::splits(&splits[*i], &process, game_manager_finder, trans_now, scene_store, player_data_store, scene_data_store);
match a {
SplitterAction::Split | SplitterAction::ManualSplit => {
splitter_action(a, i, n, load_remover);
Expand All @@ -160,7 +162,7 @@ async fn tick_action(
}
SplitterAction::Pass => {
if auto_reset {
let a0 = splits::splits(&splits[0], &process, &game_manager_finder, trans_now, scene_store, player_data_store);
let a0 = splits::splits(&splits[0], &process, game_manager_finder, trans_now, scene_store, player_data_store, scene_data_store);
match a0 {
SplitterAction::Split | SplitterAction::Reset => {
*i = 0;
Expand All @@ -177,6 +179,7 @@ async fn tick_action(
if trans_now {
if scene_store.pair().old == MENU_TITLE {
player_data_store.reset();
scene_data_store.reset();
} else {
player_data_store.clean_on_entry();
}
Expand Down
16 changes: 13 additions & 3 deletions src/splits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1586,6 +1586,10 @@ pub enum Split {
///
/// Splits when obtaining the essence from Hive Queen Vespa
OnObtainGhostVespa,
/// Dream Nail Revek (Obtain)
///
/// Splits when obtaining essence in Spirits' Glade after Revek is obtainable
OnObtainGhostRevek,
// endregion: Essence, Trees, and Ghosts

// region: Maps and Cornifer
Expand Down Expand Up @@ -3461,7 +3465,7 @@ pub fn transition_once_splits(s: &Split, p: &Pair<&str>, prc: &Process, g: &Game
}
}

pub fn continuous_splits(s: &Split, p: &Process, g: &GameManagerFinder, pds: &mut PlayerDataStore) -> SplitterAction {
pub fn continuous_splits(s: &Split, p: &Process, g: &mut GameManagerFinder, pds: &mut PlayerDataStore, sds: &mut SceneDataStore) -> SplitterAction {
match s {
Split::ManualSplit => SplitterAction::ManualSplit,
Split::RandoWake => should_split(g.disable_pause(p).is_some_and(|d| !d)
Expand Down Expand Up @@ -3877,6 +3881,12 @@ pub fn continuous_splits(s: &Split, p: &Process, g: &GameManagerFinder, pds: &mu
// make sure both PlayerDataStore methods are evaluated before the `&&` so it doesn't short-circuit
should_split(d && o && g.get_scene_name(p).is_some_and(|s| s == "Hive_05"))
}
Split::OnObtainGhostRevek => {
let d = sds.glade_ghosts_killed(p, g).is_some_and(|k| 18 <= k);
let o = pds.incremented_dream_orbs(p, g);
// make sure both SceneDataStore and PlayerDataStore methods are evaluated before the `&&` so it doesn't short-circuit
should_split(d && o && g.get_scene_name(p).is_some_and(|s| s == "RestingGrounds_08"))
}
// endregion: Essence, Trees, and Ghosts

// region: Maps and Cornifer
Expand Down Expand Up @@ -4186,10 +4196,10 @@ pub fn continuous_splits(s: &Split, p: &Process, g: &GameManagerFinder, pds: &mu
}
}

pub fn splits(s: &Split, prc: &Process, g: &GameManagerFinder, trans_now: bool, ss: &mut SceneStore, pds: &mut PlayerDataStore) -> SplitterAction {
pub fn splits(s: &Split, prc: &Process, g: &mut GameManagerFinder, trans_now: bool, ss: &mut SceneStore, pds: &mut PlayerDataStore, sds: &mut SceneDataStore) -> SplitterAction {
#[cfg(debug_assertions)]
pds.get_game_state(prc, g);
let a1 = continuous_splits(s, prc, g, pds).or_else(|| {
let a1 = continuous_splits(s, prc, g, pds, sds).or_else(|| {
let pair = ss.pair();
let a2 = if !ss.split_this_transition {
transition_once_splits(s, &pair, prc, g, pds)
Expand Down

0 comments on commit ceeff46

Please sign in to comment.