Skip to content

Commit f91949a

Browse files
committed
Kaycee's Mod compatibility
1 parent 36a5c62 commit f91949a

5 files changed

Lines changed: 14 additions & 23 deletions

File tree

Patches/AbilitiesUtil_NewAbility.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ public static bool Prefix(string abilityName, CardTriggerHandler __instance, ref
2424
}
2525
}
2626

27-
[HarmonyPatch(typeof(AbilitiesUtil), "GetAbilities",
28-
typeof(bool), typeof(bool), typeof(int), typeof(int), typeof(AbilityMetaCategory))]
29-
public class AbilitiesUtil_GetAbilities
27+
[HarmonyPatch(typeof(AbilitiesUtil), "GetLearnedAbilities",
28+
typeof(bool), typeof(int), typeof(int), typeof(AbilityMetaCategory))]
29+
public class AbilitiesUtil_GetLearnedAbilities
3030
{
3131
public static void Postfix(
32-
bool learned,
3332
bool opponentUsable,
3433
int minPower,
3534
int maxPower,
@@ -43,11 +42,7 @@ ref List<Ability> __result
4342
bool flag = !opponentUsable || info.opponentUsable;
4443
bool flag2 = info.powerLevel >= minPower && info.powerLevel <= maxPower;
4544
bool flag3 = info.metaCategories.Contains(categoryCriteria);
46-
bool flag4 = true;
47-
if (learned)
48-
{
49-
flag4 = ProgressionData.LearnedAbility(info.ability);
50-
}
45+
bool flag4 = ProgressionData.LearnedAbility(info.ability);
5146

5247
if (flag && flag2 && flag3 && flag4)
5348
{

Patches/Energy.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public class TurnManager_PlayerTurn
171171
{
172172
static IEnumerable<MethodBase> TargetMethods()
173173
{
174-
Type targetType = AccessTools.TypeByName("DiskCardGame.TurnManager+<PlayerTurn>d__73");
174+
Type targetType = AccessTools.TypeByName("DiskCardGame.TurnManager+<PlayerTurn>d__77");
175175
return AccessTools.GetDeclaredMethods(targetType).Where(m => m.Name.Equals("MoveNext"));
176176
}
177177

@@ -182,7 +182,7 @@ public static void ILManipulator(ILContext il, MethodBase original, ILLabel retL
182182
{
183183
if (Plugin.configEnergy.Value)
184184
{
185-
Type targetType = AccessTools.TypeByName("DiskCardGame.TurnManager+<PlayerTurn>d__73");
185+
Type targetType = AccessTools.TypeByName("DiskCardGame.TurnManager+<PlayerTurn>d__77");
186186
ILCursor c = new ILCursor(il);
187187
c.GotoNext(inst => inst.MatchCall(AccessTools.Method(typeof(SaveManager), "get_SaveFile")));
188188
c.RemoveRange(6);
@@ -191,7 +191,7 @@ public static void ILManipulator(ILContext il, MethodBase original, ILLabel retL
191191
c.Next.OpCode = OpCodes.Ldc_I4_1;
192192
foreach (ILLabel branch in c.IncomingLabels)
193193
{
194-
c.GotoNext(inst => inst.MatchStfld(AccessTools.Field(targetType, "<showEnergyModule>5__2")));
194+
c.GotoNext(inst => inst.MatchStfld(AccessTools.Field(targetType, "<showEnergyModule>5__1")));
195195
branch.Target = c.Next;
196196
foreach (Instruction inst in branch.Branches)
197197
{

Patches/RegionProgression_Instance.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,20 @@ public static void Prefix(ref RegionProgression ___instance)
1717
// If no custom region is defined for the default region, but custom encounters for that region exist, create one
1818
for (int t = 0; t <= 3; t++)
1919
{
20-
if (NewEncounter.encounters.Exists(encounter => (encounter.regionName == official.regions[t][0].name)))
20+
if (NewEncounter.encounters.Exists(encounter => (encounter.regionName == official.regions[t].name)))
2121
{
22-
if (!CustomRegion.regions.Exists(region => (region.tier == t && region.name == official.regions[t][0].name)))
22+
if (!CustomRegion.regions.Exists(region => (region.tier == t && region.name == official.regions[t].name)))
2323
{
24-
new CustomRegion(official.regions[t][0].name);
24+
new CustomRegion(official.regions[t].name);
2525
}
2626
}
2727
}
2828

2929
foreach (CustomRegion region in CustomRegion.regions)
3030
{
3131
bool found = false;
32-
foreach (List<RegionData> tier in official.regions)
32+
foreach (RegionData officialRegion in official.regions)
3333
{
34-
RegionData officialRegion = tier.Find((RegionData x) => x.name == region.name);
3534
if (officialRegion != null)
3635
{
3736
region.AdjustRegion(officialRegion);
@@ -65,11 +64,7 @@ public static void Prefix(ref RegionProgression ___instance)
6564

6665
foreach (NewRegion region in NewRegion.regions)
6766
{
68-
while (region.tier >= official.regions.Count)
69-
{
70-
official.regions.Add(new List<RegionData>());
71-
}
72-
official.regions[region.tier].Add(region.region);
67+
official.regions.Add(region.region);
7368

7469
List<NewEncounter> customEncounters = NewEncounter.encounters.FindAll(x => x.regionName == region.region.name);
7570
foreach (NewEncounter encounter in customEncounters)

Patches/RunState.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ public class RunState_Initialize
1010
{
1111
static void Postfix(ref RunState __instance)
1212
{
13-
__instance.regionIndex = RegionProgression.GetRandomRegionIndexForTier(0);
13+
// Random regions have been removed
14+
//__instance.regionIndex = RegionProgression.GetRandomRegionIndexForTier(0);
1415
}
1516
}
1617
}

lib/Assembly-CSharp.dll

63.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)