Skip to content

Commit

Permalink
- Improved Junimo Kart checks timing
Browse files Browse the repository at this point in the history
  • Loading branch information
agilbert1412 committed Jan 27, 2023
1 parent aa1611a commit 54ba3e8
Showing 1 changed file with 21 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public static void UpdateFruitsSummary_ExtraLives_Postfix(MineCart __instance, f
{
try
{
SendJunimoKartLevelsBeatChecks(__instance);

var livesLeftField = _helper.Reflection.GetField<int>(__instance, "livesLeft");
var livesLeft = livesLeftField.GetValue();
var numberExtraLives = GetJunimoKartExtraLives();
Expand All @@ -94,20 +96,7 @@ public static bool EndCutscene_JunimoKartLevelComplete_Prefix(MineCart __instanc
{
try
{
var gamemode = _helper.Reflection.GetField<int>(__instance, "gameMode");
var levelsBeat = _helper.Reflection.GetField<int>(__instance, "levelsBeat");
if (gamemode.GetValue() != 3 || levelsBeat.GetValue() < 1)
{
return true; // run original logic
}

if (levelsBeat.GetValue() != 7)
{
_locationChecker.AddCheckedLocation(string.Format(JK_LEVEL_LOCATION, levelsBeat.GetValue()));
return true; // run original logic
}

_locationChecker.AddCheckedLocation(JK_VICTORY);
SendJunimoKartLevelsBeatChecks(__instance);
return true; // run original logic
}
catch (Exception ex)
Expand All @@ -117,6 +106,24 @@ public static bool EndCutscene_JunimoKartLevelComplete_Prefix(MineCart __instanc
}
}

private static void SendJunimoKartLevelsBeatChecks(MineCart __instance)
{
var gamemode = _helper.Reflection.GetField<int>(__instance, "gameMode");
var levelsBeat = _helper.Reflection.GetField<int>(__instance, "levelsBeat");
if (gamemode.GetValue() != 3 || levelsBeat.GetValue() < 1)
{
return;
}

if (levelsBeat.GetValue() != 7)
{
_locationChecker.AddCheckedLocation(string.Format(JK_LEVEL_LOCATION, levelsBeat.GetValue()));
return;
}

_locationChecker.AddCheckedLocation(JK_VICTORY);
}

private static int GetJunimoKartExtraLives()
{
var numberExtraLives = 6;
Expand Down

0 comments on commit 54ba3e8

Please sign in to comment.