-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSacrificeHelperMod.cs
175 lines (149 loc) · 6.17 KB
/
SacrificeHelperMod.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
using Il2CppAssets.Scripts.Models;
using Il2CppAssets.Scripts.Simulation.Towers.Behaviors;
using BTD_Mod_Helper;
using BTD_Mod_Helper.Api.Components;
using BTD_Mod_Helper.Api.Enums;
using BTD_Mod_Helper.Api.ModOptions;
using HarmonyLib;
using MelonLoader;
using SacrificeHelper;
[assembly: MelonInfo(typeof(SacrificeHelperMod), ModHelperData.Name, ModHelperData.Version, ModHelperData.RepoOwner)]
[assembly: MelonGame("Ninja Kiwi", "BloonsTD6")]
namespace SacrificeHelper;
public class SacrificeHelperMod : BloonsTD6Mod
{
public static readonly ModSettingDouble SliderContributionPenalty = new(0.05f)
{
description = "The popup added in BTD6 v39 comes with a default 5% penalty to manually invested cash.\n" +
"Setting this to 0 would stop it, or negative would counteract it.",
stepSize = .01f,
min = -.99,
max = 1,
icon = VanillaSprites.UpgradeContainerParagonUnlocked
};
public static readonly ModSettingCategory ParagonPowerMaximums = new("Paragon Power Maximums");
public static readonly ModSettingInt MaxPowerFromPops = new(90000)
{
displayName = "Max Paragon Power From Pops\n(-1 for unlimited)",
min = -1,
max = 200000,
icon = VanillaSprites.PopIcon,
category = ParagonPowerMaximums,
};
public static readonly ModSettingInt MaxPowerFromCash = new(60000)
{
displayName = "Max Paragon Power From Cash\n(-1 for unlimited)",
min = -1,
max = 200000,
icon = VanillaSprites.CoinIcon,
category = ParagonPowerMaximums
};
public static readonly ModSettingInt MaxPowerFromNonTier5s = new(10000)
{
displayName = "Max Paragon Power From Non Tier 5s\n(-1 for unlimited)",
min = -1,
max = 200000,
icon = VanillaSprites.UpgradeContainerGrey,
modifyOption = option => option.Icon.AddText(new Info("Text", InfoPreset.FillParent), "<5", 100),
category = ParagonPowerMaximums
};
public static readonly ModSettingInt MaxPowerFromTier5s = new(50000)
{
displayName = "Max Paragon Power From Tier 5s\n(-1 for unlimited)",
min = -1,
max = 200000,
icon = VanillaSprites.UpgradeContainerTier5,
modifyOption = option => option.Icon.AddText(new Info("Text", InfoPreset.FillParent), "5", 100),
category = ParagonPowerMaximums
};
public static readonly ModSettingCategory ParagonPowerWeights = new("Paragon Power Weights");
private static readonly ModSettingInt PopsScaleFactor = new(180)
{
displayName = "Pops per Point of Paragon Power",
min = 1,
icon = VanillaSprites.PopIcon,
category = ParagonPowerWeights
};
private static readonly ModSettingInt CashScaleFactor = new(20000)
{
displayName = "Paragon Power Scale Factor for Cash",
min = 1,
icon = VanillaSprites.CoinIcon,
category = ParagonPowerWeights,
description = "As of v39, the Paragon Upgrade Price is divided by this to get the final value"
};
private static readonly ModSettingInt NonTier5ScaleFactor = new(100)
{
displayName = "Paragon Power Scale Factor for Non Tier 5s",
min = 0,
icon = VanillaSprites.UpgradeContainerGrey,
modifyOption = option => option.Icon.AddText(new Info("Text", InfoPreset.FillParent), "<5", 100),
category = ParagonPowerWeights
};
private static readonly ModSettingInt Tier5ScaleFactor = new(6000)
{
displayName = "Paragon Power Scale Factor for Tier 5s",
min = 0,
icon = VanillaSprites.UpgradeContainerTier5,
modifyOption = option => option.Icon.AddText(new Info("Text", InfoPreset.FillParent), "5", 100),
category = ParagonPowerWeights
};
public static readonly ModSettingCategory TempleAlternateCosts = new("Template Alternate Costs");
public static readonly ModSettingDouble TempleAlternateCostMod = new(.5)
{
displayName = "Alternate Sun Temple Cost",
min = 0,
max = 1,
stepSize = .01f,
icon = VanillaSprites.SunTempleUpgradeIcon,
description = "What portion the cost should be if you decide to get a Sun Temple without doing sacrifices",
category = TempleAlternateCosts
};
public static readonly ModSettingDouble GodAlternateCostMod = new(.2)
{
displayName = "Alternate True Sun God Cost",
min = 0,
max = 1,
stepSize = .01f,
icon = VanillaSprites.TrueSonGodUpgradeIcon,
description = "What portion the cost should be if you decide to get a True Sun God without doing sacrifices",
category = TempleAlternateCosts
};
public static bool templeSacrificesOff;
public override void OnNewGameModel(GameModel result)
{
var degreeData = result.paragonDegreeDataModel;
degreeData.maxPowerFromPops = MaxPowerFromPops;
if (degreeData.maxPowerFromPops < 0)
{
degreeData.maxPowerFromPops = degreeData.MaxInvestment;
}
degreeData.maxPowerFromMoneySpent = MaxPowerFromCash;
if (degreeData.maxPowerFromMoneySpent < 0)
{
degreeData.maxPowerFromMoneySpent = degreeData.MaxInvestment;
}
degreeData.maxPowerFromNonTier5Count = MaxPowerFromNonTier5s;
if (degreeData.maxPowerFromNonTier5Count < 0)
{
degreeData.maxPowerFromNonTier5Count = degreeData.MaxInvestment;
}
degreeData.maxPowerFromTier5Count = MaxPowerFromTier5s;
if (degreeData.maxPowerFromTier5Count < 0)
{
degreeData.maxPowerFromTier5Count = degreeData.MaxInvestment;
}
degreeData.popsOverX = PopsScaleFactor;
degreeData.moneySpentOverX = CashScaleFactor;
degreeData.nonTier5TowersMultByX = NonTier5ScaleFactor;
degreeData.tier5TowersMultByX = Tier5ScaleFactor;
degreeData.paidContributionPenalty = SliderContributionPenalty;
templeSacrificesOff = false;
}
[HarmonyPatch(typeof(MonkeyTemple), nameof(MonkeyTemple.StartSacrifice))]
public class MonkeyTemple_StartSacrifice
{
[HarmonyPrefix]
public static bool Prefix() => !templeSacrificesOff;
}
}