-
Notifications
You must be signed in to change notification settings - Fork 1
/
4thPaths.cs
265 lines (244 loc) · 11 KB
/
4thPaths.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
using System.Net;
using MelonLoader;
using BTD_Mod_Helper;
using BTD_Mod_Helper.Extensions;
using Il2CppAssets.Scripts.Models.Towers;
using Il2CppAssets.Scripts.Unity.UI_New.Popups;
using Main;
using PathsPlusPlus;
using Il2CppAssets.Scripts.Unity;
using System.Linq;
using MelonLoader.Utils;
using BTD_Mod_Helper.Api.Display;
using Il2Cpp;
using Il2CppAssets.Scripts.Models.Bloons.Behaviors;
using Il2CppAssets.Scripts.Models.Towers.Behaviors.Attack;
using Il2CppAssets.Scripts.Models.Towers.Behaviors.Emissions;
using Il2CppAssets.Scripts.Models.Towers.Projectiles;
using Il2CppAssets.Scripts.Models.Towers.Projectiles.Behaviors;
using Il2CppAssets.Scripts.Models.Towers.Weapons;
using Il2CppAssets.Scripts.Unity.Display;
using Il2CppNinjaKiwi.Common.ResourceUtils;
using Il2CppSystem.IO;
[assembly: MelonInfo(typeof(Main.Main), ModHelperData.Name, ModHelperData.Version, ModHelperData.RepoOwner)]
[assembly: MelonGame("Ninja Kiwi", "BloonsTD6")]
namespace Main;
public class Main : BloonsTD6Mod
{
public bool DependenciesRequired = false;
public override void OnApplicationLateStart()
{
if (ModHelper.HasMod("PathsPlusPlus"))
{
}
else
{
MelonLogger.Msg("Missing dependencies");
DependenciesRequired = true;
}
}
public void DownloadDependency()
{
string adress = "https://raw.githubusercontent.com/Jonyboylovespie/paths-plus-plus/main/PathsPlusPlus.dll";
string filename = MelonEnvironment.ModsDirectory + "/PathsPlusPlus.dll";
WebClient client = new WebClient();
client.DownloadFile(adress, filename);
PopupScreen.instance.ShowOkPopup("You must restart the game for changes to take place.");
}
public override void OnMainMenu()
{
if (DependenciesRequired)
{
PopupScreen.instance.ShowOkPopup("You must restart the game for changes to take place.");
}
}
public override void OnTitleScreen()
{
if (DependenciesRequired)
{
PopupScreen.instance.ShowEventPopup(PopupScreen.Placement.menuCenter, "Missing Dependencies",
"You are missing dependencies required for the mod 4thPaths. Click the download button to download the mod made by Doombubbles that is required for 4thPaths to function. After downloading, restart is required.", "Download",new System.Action(DownloadDependency), "Cancel",null,
Popup.TransitionAnim.Slide, 38);
}
}
public class SuperMonkeyFourthPath : PathPlusPlus
{
public override string Tower => TowerType.SuperMonkey;
public override int UpgradeCount => 5;
}
public class SuperUpgrade1 : UpgradePlusPlus<SuperMonkeyFourthPath>
{
public override int Cost => 4000;
public override int Tier => 1;
public override string Icon => "SuperIconT1";
public override string DisplayName => "Heated Darts";
public override string Description => "Darts become heated making them have a bit higher damage and much higher pierce. Can also hit lead and frozen bloons.";
public override void ApplyUpgrade(TowerModel towerModel)
{
foreach (var damageModel in towerModel.GetDescendants<DamageModel>().ToArray())
{
damageModel.immuneBloonProperties &= ~BloonProperties.Frozen;
damageModel.immuneBloonProperties &= ~BloonProperties.Lead;
damageModel.damage += 1;
}
foreach (var projectileModel in towerModel.GetDescendants<ProjectileModel>().ToArray())
{
projectileModel.pierce += 4;
}
}
}
public class SuperUpgrade2 : UpgradePlusPlus<SuperMonkeyFourthPath>
{
public override int Cost => 3000;
public override int Tier => 2;
public override string Icon => "SuperIconT2";
public override string DisplayName => "Lava-Coated Darts";
public override string Description => "Adds molten lava to the darts that add a DOT effect to the bloons.";
public override void ApplyUpgrade(TowerModel towerModel)
{
foreach (var projectileModel in towerModel.GetDescendants<ProjectileModel>().ToArray())
{
projectileModel.collisionPasses = new int[] { -1, 0 };
var LavaBehavior = Game.instance.model.GetTowerFromId("Alchemist").GetDescendant<AddBehaviorToBloonModel>().Duplicate();
LavaBehavior.GetBehavior<DamageOverTimeModel>().interval = 1/3f;
LavaBehavior.lifespan = 20;
LavaBehavior.lifespanFrames = 1200;
LavaBehavior.overlayType = "Fire";
//LavaBehavior.overlayType
projectileModel.AddBehavior(LavaBehavior);
}
}
}
public class SuperUpgrade3 : UpgradePlusPlus<SuperMonkeyFourthPath>
{
public override int Cost => 20000;
public override int Tier => 3;
public override string Icon => "SuperIconT3";
public override string Portrait => "SuperPortraitT3";
public override string DisplayName => "Lava Bath";
public override string Description => "The super monkey has taken a bath in a pool of lava, making his darts hotter and his attack speed faster.";
public override void ApplyUpgrade(TowerModel towerModel)
{
towerModel.ApplyDisplay<SuperDisplayT3>();
foreach (var weaponModel in towerModel.GetDescendants<WeaponModel>().ToArray())
{
weaponModel.rate /= 2;
}
foreach (var projectileModel in towerModel.GetDescendants<ProjectileModel>().ToArray())
{
projectileModel.GetBehavior<DamageModel>().damage += 1;
projectileModel.GetDescendant<DamageOverTimeModel>().damage = 10f;
projectileModel.pierce = 20f;
if (projectileModel.name == "ProjectileModel_Projectile")
{
projectileModel.display = new PrefabReference() { guidRef = "125ac5d653097974b9707f641258f71b" };
}
}
}
}
public class SuperDisplayT3 : ModDisplay
{
public override string BaseDisplay => GetDisplay(TowerType.SuperMonkey);
public override void ModifyDisplayNode(UnityDisplayNode node)
{
SetMeshTexture(node, "SuperTextureT3");
SetMeshOutlineColor(node, new UnityEngine.Color(255f/255, 0f/255, 0f/255));
}
}
public class SuperUpgrade4 : UpgradePlusPlus<SuperMonkeyFourthPath>
{
public override int Cost => 75000;
public override int Tier => 4;
public override string Icon => "SuperIconT4";
public override string Portrait => "SuperPortraitT4";
public override string DisplayName => "The Volcanic Master";
public override string Description => "Over a long time of studying with the great Monks of Mount Vesuvius, the super monkey has learned the secrets of fire, lava, and molten rock.";
public override void ApplyUpgrade(TowerModel towerModel)
{
towerModel.ApplyDisplay<SuperDisplayT4>();
towerModel.displayScale = 1.25f;
towerModel.range += 10;
foreach (var weaponModel in towerModel.GetDescendants<WeaponModel>().ToArray())
{
weaponModel.emission = new ArcEmissionModel("multishot", 5, 0, 120, null, false, false);
}
foreach (var projectileModel in towerModel.GetDescendants<ProjectileModel>().ToArray())
{
projectileModel.GetDescendant<DamageOverTimeModel>().damage = 50f;
projectileModel.pierce = 100f;
if (projectileModel.name == "ProjectileModel_Projectile")
{
projectileModel.display = new PrefabReference() { guidRef = GetDisplayGUID<SuperT4Proj>() };
}
projectileModel.AddBehavior(new TrackTargetWithinTimeModel("aimbot", 999999f, true, false, 144f, false, 99999999f, false, 3.47999978f, true));
}
foreach (var attackModel in towerModel.GetBehaviors<AttackModel>().ToArray())
{
attackModel.range += 10;
}
}
}
public class SuperDisplayT4 : ModDisplay
{
public override string BaseDisplay => GetDisplay(TowerType.NinjaMonkey,5,0,0);
public override void ModifyDisplayNode(UnityDisplayNode node)
{
foreach (var renderer in node.genericRenderers)
{
renderer.material.mainTexture = GetTexture("SuperTextureT4");
}
}
}
public class SuperT4Proj : ModDisplay
{
public override string BaseDisplay => Generic2dDisplay;
public override float Scale => 0.5f;
public override void ModifyDisplayNode(UnityDisplayNode node)
{
Set2DTexture(node, "SuperT4Proj");
}
}
public class SuperUpgrade5 : UpgradePlusPlus<SuperMonkeyFourthPath>
{
public override int Cost => 1000000;
public override int Tier => 5;
public override string Icon => "SuperIconT5";
public override string Portrait => "SuperPortraitT5";
public override string DisplayName => "THE OVERLORD OF MOUNT VESUVIUS";
public override string Description => "Kneel before him...";
public override void ApplyUpgrade(TowerModel towerModel)
{
towerModel.range += 20;
towerModel.ApplyDisplay<SuperDisplayT5>();
towerModel.displayScale = 2;
towerModel.AddBehavior(Game.instance.model.GetTowerFromId("TackShooter-500").GetBehaviors<AttackModel>().Last().Duplicate());
towerModel.GetBehaviors<AttackModel>().Last().weapons[0].emission = new ArcEmissionModel("FireBall", 10, 0, 360, null, false, false);
towerModel.GetBehaviors<AttackModel>().Last().weapons[0].rate = 3;
foreach (var weaponModel in towerModel.GetDescendants<WeaponModel>().ToArray())
{
weaponModel.emission = new ArcEmissionModel("multishot", 8, 0, 120, null, false, false);
}
foreach (var projectileModel in towerModel.GetDescendants<ProjectileModel>().ToArray())
{
projectileModel.GetBehavior<DamageModel>().damage *= 10;
projectileModel.GetDescendant<DamageOverTimeModel>().damage = 1000f;
projectileModel.pierce = 99999999999f;
}
foreach (var attackModel in towerModel.GetBehaviors<AttackModel>().ToArray())
{
attackModel.range += 20;
}
}
}
public class SuperDisplayT5 : ModDisplay
{
public override string BaseDisplay => "d84a1337513e01747ab7cb5152f466fa";
public override void ModifyDisplayNode(UnityDisplayNode node)
{
foreach (var renderer in node.genericRenderers)
{
renderer.material.mainTexture = GetTexture("SuperTextureT5");
}
}
}
}