Skip to content

Commit

Permalink
Merge pull request #1286 from SolastaMods/Dev
Browse files Browse the repository at this point in the history
1.3.55.2
  • Loading branch information
ThyWoof authored May 18, 2022
2 parents d5f4c65 + 7f4a864 commit ad3e1c2
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 12 deletions.
2 changes: 1 addition & 1 deletion SolastaCommunityExpansion/Info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Id": "SolastaCommunityExpansion",
"DisplayName": "Community Expansion",
"Author": "SolastaMods",
"Version": "1.3.55.1",
"Version": "1.3.55.2",
"GameVersion": "1.3.55",
"ManagerVersion": "0.23.4",
"AssemblyName": "SolastaCommunityExpansion.dll",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ internal static void Postfix(RulesetCharacterHero __instance, RuleDefinitions.Ri
}

var spellRepertoire = __instance.SpellRepertoires
.Where(r => r.SpellCastingFeature.SpellCastingOrigin != FeatureDefinitionCastSpell.CastingOrigin.Race)
.Where(r => r.SpellCastingFeature.SpellReadyness == RuleDefinitions.SpellReadyness.AllKnown)
.FirstOrDefault(r => r.SpellCastingFeature.SpellKnowledge == RuleDefinitions.SpellKnowledge.Selection);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal static void Prefix()
[SuppressMessage("Minor Code Smell", "S101:Types should be named in PascalCase", Justification = "Patch")]
internal static class CharacterInspectionScreen_Bind
{
internal static void Postfix(
internal static void Prefix(
RulesetCharacterHero heroCharacter,
CharacterPlateDetailed ___characterPlate,
ToggleGroup ___toggleGroup)
Expand All @@ -43,7 +43,18 @@ internal static void Postfix(
[SuppressMessage("Minor Code Smell", "S101:Types should be named in PascalCase", Justification = "Patch")]
internal static class CharacterInspectionScreen_Unbind
{
internal static void Postfix()
internal static void Prefix()
{
Global.InspectedHero = null;
}
}

// reset the inspection context for MC heroes
[HarmonyPatch(typeof(CharacterInspectionScreen), "DoClose")]
[SuppressMessage("Minor Code Smell", "S101:Types should be named in PascalCase", Justification = "Patch")]
internal static class CharacterInspectionScreen_DoClose
{
internal static void Prefix()
{
Global.InspectedHero = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public static int Level(FeatureUnlockByLevel featureUnlockByLevel)
var isLevelingUp = LevelUpContext.IsLevelingUp(hero);
var selectedClass = LevelUpContext.GetSelectedClass(hero);

if (isLevelingUp && hero.ClassesAndLevels.TryGetValue(selectedClass, out var levels)
if (isLevelingUp
&& hero.ClassesAndLevels.TryGetValue(selectedClass, out var levels)
&& featureUnlockByLevel.Level <= levels + 1)
{
return int.MaxValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,20 @@ public static int Level(FeatureUnlockByLevel featureUnlockByLevel, RulesetCharac
var isLevelingUp = LevelUpContext.IsLevelingUp(hero);
var selectedClass = LevelUpContext.GetSelectedClass(hero);

if (isLevelingUp
&& hero.ClassesAndLevels.TryGetValue(selectedClass, out var levels)
&& featureUnlockByLevel.Level != (levels + 1))
if (isLevelingUp)
{
return int.MaxValue;
if (hero.ClassesAndLevels.TryGetValue(selectedClass, out var levels)
&& featureUnlockByLevel.Level != (levels + 1))
{
return int.MaxValue;
}
else
{
return featureUnlockByLevel.Level - 1;
}
}

return featureUnlockByLevel.Level - 1;
return featureUnlockByLevel.Level;
}

internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using HarmonyLib;
using SolastaCommunityExpansion.Models;

namespace SolastaCommunityExpansion.Patches.Multiclass.LevelUp
{
Expand All @@ -10,10 +11,12 @@ internal static class HigherLevelFeaturesModal_Bind
{
internal static void Prefix(ref int achievementLevel)
{
var hero = Models.Global.ActiveLevelUpHero;
var selectedClass = Models.LevelUpContext.GetSelectedClass(hero);
var hero = Global.ActiveLevelUpHero;
var isLevelingUp = LevelUpContext.IsLevelingUp(hero);
var selectedClass = LevelUpContext.GetSelectedClass(hero);

if (hero.ClassesAndLevels.TryGetValue(selectedClass, out var levels))
if (isLevelingUp
&& hero.ClassesAndLevels.TryGetValue(selectedClass, out var levels))
{
achievementLevel = levels + 1;
}
Expand Down

0 comments on commit ad3e1c2

Please sign in to comment.