Skip to content

Commit

Permalink
Fix a Paths++ interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
doombubbles committed Oct 30, 2023
1 parent 14cb86a commit 03616a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:


- name: Upload Mod DLL
uses: actions/upload-artifact@v2.2.4
uses: actions/upload-artifact@v3
with:
name: ${{ env.PROJECT_NAME }}.dll
path: ${{ env.BLOONSTD6 }}/Mods/${{ env.PROJECT_NAME }}.dll
Expand Down
7 changes: 5 additions & 2 deletions Patches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,16 @@ internal static class UnityToSimulation_UpgradeTower_Impl
[HarmonyPostfix]
private static void Postfix(UnityToSimulation __instance, ObjectId id, int pathIndex, int inputId)
{
if (current == null) return;
if (current == null || pathIndex >= 3) return;

var towerManager = __instance.simulation.towerManager;
var tower = towerManager.GetTowerById(id);

if (!tower.HasAscendedUpgrades()) return;

var cost = towerManager.GetTowerUpgradeCost(tower, pathIndex, 5);

if (tower.HasAscendedUpgrades() && current.name.StartsWith(nameof(AscendedUpgrade)) && cost <= cash)
if (current.name.StartsWith(nameof(AscendedUpgrade)) && cost <= cash)
{
towerManager.UpgradeTower(inputId, tower, tower.rootModel.Cast<TowerModel>(), pathIndex, cost);
InGame.instance.SetCash(cash - cost);
Expand Down

0 comments on commit 03616a2

Please sign in to comment.