private bool ShouldMidSplit(int currentSplitIndex) { if (splits.Length - 1 < currentSplitIndex) { return(false); } int currentRoomId; byte[] flags; byte[] enemyEncounter; long battlePtr; try { if (!gameMemory.ReadCurrentRoomId(out currentRoomId)) { return(false); } if (!gameMemory.ReadFlags(out flags)) { return(false); } if (!gameMemory.ReadEnemyEncounter(out enemyEncounter)) { return(false); } if (!gameMemory.ReadBattlePtr(out battlePtr)) { return(false); } } catch (Exception) { return(false); } if (oldEnemyEncounter == null) { oldEnemyEncounter = new byte[GameMemory.nbrBytesEnemyEncounter]; enemyEncounter.CopyTo(oldEnemyEncounter, 0); } Split split = splits[currentSplitIndex]; if (!MidSplitRoomCheck(split, currentRoomId)) { return(false); } if (!MidSplitFlagsCheck(split, flags)) { return(false); } if (!MidSplitEnemyDefeatedCheck(split, enemyEncounter, battlePtr)) { return(false); } enemyEncounter.CopyTo(oldEnemyEncounter, 0); return(true); }
private bool MidSplitRoomCheck(Split split, int currentRoomId) { return(split.requiredRoom == GameEnums.Room.UNASSIGNED || currentRoomId == (int)split.requiredRoom); }