Skip to content

Commit

Permalink
Fix for Point blank master
Browse files Browse the repository at this point in the history
  • Loading branch information
pheonix99 committed Jun 20, 2022
1 parent db9ce1e commit f9a502c
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ToggleableThrowingWeapons/Content/BaseWeapons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Kingmaker.Blueprints;
using Kingmaker.Blueprints.Items.Weapons;
using Kingmaker.Designers.Mechanics.WeaponEnchants;
using Kingmaker.Enums;
using Kingmaker.ResourceLinks;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -113,7 +114,7 @@ public static void MakeBaseWeapons()
x.m_OtherForm = BlueprintTool.GetRef<BlueprintWeaponTypeReference>("ThrownStarknife");
});


}

Main.TTWContext.Blueprints.GetDerivedMaster("ThrownStarknifeMasterId");
Expand Down
2 changes: 1 addition & 1 deletion ToggleableThrowingWeapons/Info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Id": "ToggleableThrowingWeapons",
"DisplayName": "Toggleable Throwing Weapons",
"Author": "pheonix99",
"Version": "1.1.1",
"Version": "1.2.0",
"ManagerVersion": "0.21.3",
"AssemblyName": "ToggleableThrowingWeapons.dll",
"EntryMethod": "ToggleableThrowingWeapons.Main.Load",
Expand Down
44 changes: 44 additions & 0 deletions ToggleableThrowingWeapons/Patch/PatchWeaponCategoryExtension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using HarmonyLib;
using Kingmaker.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ToggleableThrowingWeapons.Patch
{
class PatchWeaponCategoryExtension
{
[HarmonyPatch(typeof(WeaponCategoryExtension), "HasSubCategory")]
static class ApplyThrownFixToHasSubCategory
{

[HarmonyPriority(Priority.Normal)]
public static void Postfix(ref bool __result, WeaponCategory category, WeaponSubCategory subCategory)
{
if ((category == WeaponCategory.Dagger || category == WeaponCategory.Starknife) && subCategory == WeaponSubCategory.Ranged)
{
__result = true;
}
}
}

[HarmonyPatch(typeof(WeaponCategoryExtension), "GetSubCategories")]
static class ApplyThrownFixToGetSubCategories
{

[HarmonyPriority(Priority.Normal)]
public static void Postfix(ref WeaponSubCategory[] __result, WeaponCategory category)
{
if ((category == WeaponCategory.Dagger || category == WeaponCategory.Starknife) && !__result.Contains(WeaponSubCategory.Ranged))
{
__result = __result.Append(WeaponSubCategory.Ranged).ToArray();
}
}
}
}


}

2 changes: 2 additions & 0 deletions ToggleableThrowingWeapons/ToggleableThrowingWeapons.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,12 @@
<Compile Include="Content\BaseWeapons.cs" />
<Compile Include="Content\MatchHambeardWeapons.cs" />
<Compile Include="Content\ModeSwitching.cs" />
<Compile Include="Content\NewFeats.cs" />
<Compile Include="Content\PairCreation.cs" />
<Compile Include="Main.cs" />
<Compile Include="ModLogic\ModContextTTW.cs" />
<Compile Include="Patch\OverrideItemEntityBlueprintHook.cs" />
<Compile Include="Patch\PatchWeaponCategoryExtension.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\AddToRoot.cs" />
<Compile Include="UMMSettingsUI.cs" />
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ The item names don't change by mode. I'll get to this later.
Thanks to Truinto for the AddFactOnlyParty code.

#Changelog
1.2: Point Blank Master (and any other ranged-only paramaterized features added by mods) now apply to thrown daggers/starknives. Increased range to 30 feet.

1.1: Fixed dex to melee damage cutting out, fixed some graphical jank

0 comments on commit f9a502c

Please sign in to comment.