-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Differentiate Aggressive & Beta(Skittish) battle start paths (#8)
* Beta path options Suppose you have the following spawns: aabb Where, a = aggressive, b = beta (skittish). The next 2 spawns will be beta pokemon. This step will only dismiss 2 pokemon. By ridding of aa (not ab), the next state is bbbb, resulting in a potential 4 new entities the following step. Ridding of ab or bb will result in abbb and aabb, neither of which can be 4x advanced the next step. If the next spawn is aa instead of bb, we get aaab or aaaa if we rid bb or ab, still both separate states. Both with different possibilities. Mixed behaviors is more heavily skewed towards having bbbb, b stuff will be dominant. Lots of overlap, but there are potential end states that are only reachable by trying every single action. Co-authored-by: Lusamine <[email protected]>
- Loading branch information
Showing
12 changed files
with
230 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using PKHeX.Core; | ||
|
||
namespace PermuteMMO.Lib; | ||
|
||
/// <summary> | ||
/// Fetches environment specific values necessary for spawn generation. | ||
/// </summary> | ||
public static class SaveFileParameter | ||
{ | ||
#region Public Mutable - Useful for DLL consumers | ||
|
||
public static SAV8LA SaveFile { get; set; } = GetFake(); | ||
public static PokedexSave8a Pokedex => SaveFile.PokedexSave; | ||
public static byte[] BackingArray => SaveFile.Blocks.GetBlock(0x02168706).Data; | ||
public static bool HasCharm { get; set; } = true; | ||
public static bool UseSaveFileShinyRolls { get; set; } | ||
|
||
public static byte[] GetMassOutbreakData() => SaveFile.GetMassOutbreakData(); | ||
public static byte[] GetMassiveMassOutbreakData() => SaveFile.GetMassiveMassOutbreakData(); | ||
|
||
public static byte[] GetMassOutbreakData(this SAV8LA sav) => sav.Accessor.GetBlock(0x1E0F1BA3).Data; | ||
public static byte[] GetMassiveMassOutbreakData(this SAV8LA sav) => sav.Accessor.GetBlock(0x7799EB86).Data; | ||
|
||
#endregion | ||
|
||
private static SAV8LA GetFake() | ||
{ | ||
var mainPath = AppDomain.CurrentDomain.BaseDirectory; | ||
mainPath = Path.Combine(mainPath, "main"); | ||
if (File.Exists(mainPath)) | ||
return GetFromFile(mainPath); | ||
return new SAV8LA(); | ||
} | ||
|
||
private static SAV8LA GetFromFile(string mainPath) | ||
{ | ||
var data = File.ReadAllBytes(mainPath); | ||
var sav = new SAV8LA(data); | ||
UseSaveFileShinyRolls = true; | ||
HasCharm = sav.Inventory.Any(z => z.Items.Any(i => i.Index == 632 && i.Count is not 0)); | ||
return sav; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the count of shiny rolls the player is permitted to have when rolling an <see cref="PKM.PID"/>. | ||
/// </summary> | ||
/// <param name="species">Encounter species</param> | ||
/// <param name="type">Encounter Spawn type</param> | ||
/// <returns>[1,X] iteration of PID rolls permitted</returns> | ||
public static int GetRerollCount(in int species, SpawnType type) | ||
{ | ||
if (!UseSaveFileShinyRolls) | ||
return (int)type; | ||
bool perfect = Pokedex.IsPerfect(species); | ||
bool complete = Pokedex.IsComplete(species); | ||
return 1 + (complete ? 1 : 0) + (perfect ? 2 : 0) + (HasCharm ? 3 : 0) + (int)(type - 7); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.