Skip to content

Commit

Permalink
Merge pull request #3 from Jonyboylovespie/master
Browse files Browse the repository at this point in the history
Makes it so there are no duplicate towers in the selection menu.
  • Loading branch information
mend-dev authored Jul 29, 2023
2 parents 516d78e + b218787 commit e3b7848
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ModHelperData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace BTD6Rogue;

public static class ModHelperData {
public const string WorksOnVersion = "38.1";
public const string Version = "1.5.1";
public const string Version = "1.5.2";

public const string Name = "BTD6Rogue";
public const string Description =
Expand Down
11 changes: 11 additions & 0 deletions Panels/HeroChoicePanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ public void ChooseTower(string hero) {
uiPanel = null!;
Destroy(gameObject);
}

public void RerollHeros() {
BTD6Rogue.mod.rerolls--;
Create(__instance.uiRect, __instance);
Destroy(gameObject);
}

public static HeroChoicePanel Create(RectTransform menu, InGame __instance) {
BTD6Rogue.mod.uiOpen = true;
Expand All @@ -54,6 +60,11 @@ public static HeroChoicePanel Create(RectTransform menu, InGame __instance) {
towerButton.AddImage(new Info("Image") { AnchorMin = new Vector2(0, 0), AnchorMax = new Vector2(1, 1), Size = 50 }, hero.portrait.GetGUID());
}

if (heroes[0].name == heroes[1].name || heroes[1].name == heroes[2].name || heroes[2].name == heroes[0].name)
{
heroChoicePanel.RerollHeros();
}

return heroChoicePanel;
}
}
13 changes: 13 additions & 0 deletions Panels/ParagonChoicePanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ public void ChooseTower(string towerName) {
uiPanel = null!;
Destroy(gameObject);
}

public void RerollParagons() {
BTD6Rogue.mod.rerolls--;
Create(__instance.uiRect, __instance);
Destroy(gameObject);
}

public static ParagonChoicePanel Create(RectTransform menu, InGame __instance) {
BTD6Rogue.mod.uiOpen = true;
Expand All @@ -69,6 +75,13 @@ public static ParagonChoicePanel Create(RectTransform menu, InGame __instance) {
}
ModHelperText chooseText = inset.AddText(new Info("Tower Amount", 0, 400, 2000, 100), "Choose a Path", 86);
ModHelperText infoText = inset.AddText(new Info("Tower Amount", 0, 300, 2000, 100), "None of these paths will show up again, choose wisely", 56);

if (towerModels[0].name == towerModels[1].name ||
towerModels[1].name == towerModels[2].name ||
towerModels[2].name == towerModels[0].name)
{
towerChoicePanel.RerollParagons();
}

return towerChoicePanel;
}
Expand Down
7 changes: 7 additions & 0 deletions Panels/TowerChoicePanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ public static TowerChoicePanel Create(RectTransform menu, InGame __instance) {
ModHelperText towerName = rerollButton.AddText(new Info("Tower Name", 0, 0, 650, 76), "Reroll: " + BTD6Rogue.mod.rerolls, 64);
}

if (towerChoicePanel.towerModels[0].name == towerChoicePanel.towerModels[1].name ||
towerChoicePanel.towerModels[1].name == towerChoicePanel.towerModels[2].name ||
towerChoicePanel.towerModels[2].name == towerChoicePanel.towerModels[0].name)
{
towerChoicePanel.RerollTowers();
}

return towerChoicePanel;
}
}

0 comments on commit e3b7848

Please sign in to comment.