-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
174 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using HarmonyLib; | ||
using Kingmaker.Designers.Mechanics.Buffs; | ||
using Kingmaker.EntitySystem; | ||
using Kingmaker.Enums; | ||
using Kingmaker.UnitLogic.Buffs; | ||
using Kingmaker.UnitLogic.Parts; | ||
using Kingmaker.Utility; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace LevelableAivu | ||
{ | ||
[HarmonyPatch(typeof(UnitPartSizeModifier), "UpdateSize")] | ||
|
||
static class AivuSizeFix | ||
{ | ||
[HarmonyPriority(Priority.Normal)] | ||
static bool Prefix(UnitPartSizeModifier __instance) | ||
{ | ||
|
||
var variableSize = __instance.Owner.Facts.m_Facts.SelectMany(x => x.Components).Select(x => x.SourceBlueprintComponent).OfType<VariableBaseSize>(); | ||
if (variableSize.Count() == 0) | ||
{ | ||
|
||
return true; | ||
} | ||
else | ||
{ | ||
|
||
Size ogSize = __instance.Owner.OriginalSize + variableSize.Select(x => x.Shift).Sum(); | ||
Size finalSize = ogSize; | ||
EntityFact entityFact = __instance.m_SizeChangeFacts.LastItem<EntityFact>(); | ||
if (entityFact != null) | ||
{ | ||
foreach (EntityFactComponent entityFactComponent in entityFact.Components) | ||
{ | ||
Polymorph polymorph = entityFactComponent.SourceBlueprintComponent as Polymorph; | ||
ChangeUnitSize changeUnitSize = entityFactComponent.SourceBlueprintComponent as ChangeUnitSize; | ||
if (polymorph != null) | ||
{ | ||
Size? polySize = polymorph.GetUnitSize(entityFactComponent); | ||
if (polySize != null) | ||
finalSize = polySize.Value; | ||
|
||
} | ||
else if (changeUnitSize != null) | ||
{ | ||
if (changeUnitSize.IsTypeDelta) | ||
{ | ||
finalSize = ogSize + changeUnitSize.SizeDelta; | ||
//Main.Log($"Size Adjust: Size set to :{finalSize}"); | ||
} | ||
else if (changeUnitSize.IsTypeValue) | ||
{ | ||
finalSize = changeUnitSize.Size; | ||
//Main.Log($"Size Set: Size set to :{finalSize}"); | ||
} | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
__instance.Owner.Remove<UnitPartSizeModifier>(); | ||
} | ||
Main.Log($"Final Size Setto :{finalSize}"); | ||
__instance.Owner.State.Size = finalSize; | ||
return false; | ||
} | ||
|
||
|
||
} | ||
} | ||
|
||
static class AfterTheFactAivuSizeFix | ||
{ | ||
|
||
} | ||
} |
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,24 @@ | ||
using Kingmaker.Blueprints; | ||
using Kingmaker.Designers.Mechanics.Buffs; | ||
using Kingmaker.EntitySystem.Entities; | ||
using Kingmaker.UnitLogic; | ||
using Kingmaker.UnitLogic.Mechanics.Properties; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace LevelableAivu | ||
{ | ||
|
||
class VariableBaseSize : UnitFactComponentDelegate | ||
{ | ||
public override void OnActivate() | ||
{ | ||
|
||
} | ||
|
||
public int Shift; | ||
} | ||
} |