-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBananaFarmParagon.cs
227 lines (212 loc) · 10.6 KB
/
BananaFarmParagon.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
using Il2CppAssets.Scripts.Models.Towers;
using Il2CppAssets.Scripts.Models.Towers.Behaviors;
using Il2CppAssets.Scripts.Models.Towers.Projectiles.Behaviors;
using Il2CppAssets.Scripts.Models.Towers.Weapons.Behaviors;
using Il2CppAssets.Scripts.Unity;
using Il2CppAssets.Scripts.Unity.Display;
using BTD_Mod_Helper;
using BTD_Mod_Helper.Api;
using BTD_Mod_Helper.Api.Display;
using BTD_Mod_Helper.Api.Towers;
using BTD_Mod_Helper.Extensions;
using MelonLoader;
using ModHelperData = BananaFarmParagon.ModHelperData;
using BTD_Mod_Helper.Api.ModOptions;
using Il2CppAssets.Scripts.Unity.UI_New.Popups;
using BananaFarmParagon.bananafarmfake;
using Il2CppAssets.Scripts.Models.Towers.Behaviors.Attack.Behaviors;
using Il2CppAssets.Scripts.Models.Towers.Behaviors.Attack;
using weapondisplays;
using BTD_Mod_Helper.Api.Data;
using Il2CppAssets.Scripts.Models;
using BTD_Mod_Helper.Api.Helpers;
using Il2CppAssets.Scripts.Models.TowerSets;
using Il2CppNinjaKiwi.Common.ResourceUtils;
[assembly: MelonInfo(typeof(BananaFarmParagon.Main), ModHelperData.Name, ModHelperData.Version, ModHelperData.RepoOwner)]
[assembly: MelonGame("Ninja Kiwi", "BloonsTD6")]
namespace weapondisplays
{
public class BananaDisplay : ModDisplay
{
public override string BaseDisplay => Generic2dDisplay;
public override void ModifyDisplayNode(UnityDisplayNode node)
{
Set2DTexture(node, "BananaDisplay");
}
}
}
namespace BananaFarmParagon
{
public class Main : BloonsTD6Mod
{
public override void OnNewGameModel(GameModel gameModel, Il2CppSystem.Collections.Generic.List<ModModel> mods)
{
gameModel.GetParagonUpgradeForTowerId("BananaFarm").cost = CostHelper.CostForDifficulty(Settings.ParagonCost, mods);
foreach (var towerModel in gameModel.towers)
{
if (towerModel.appliedUpgrades.Contains(ModContent.UpgradeID<Paragon.BananaFarmParagonUpgrade>()))
{
if (Settings.ParagonTowerOp == true)
{
var attackModel = towerModel.GetAttackModel();
var projectile = attackModel.weapons[0].projectile;
var weapon = attackModel.weapons[0];
projectile.GetBehavior<CashModel>().minimum = 18446744073709551615;
projectile.GetBehavior<CashModel>().maximum = 18446744073709551615;
projectile.GetBehavior<CashModel>().salvage = 18446744073709551615;
weapon.GetBehavior<EmissionsPerRoundFilterModel>().count = 100000;
}
else
{
var attackModel = towerModel.GetAttackModel();
var projectile = attackModel.weapons[0].projectile;
var weapon = attackModel.weapons[0];
projectile.GetBehavior<CashModel>().minimum = 100000;
projectile.GetBehavior<CashModel>().maximum = 100000;
projectile.GetBehavior<CashModel>().salvage = 1;
weapon.GetBehavior<EmissionsPerRoundFilterModel>().count = 10;
}
}
}
}
public override void OnMainMenu()
{
base.OnMainMenu();
//Op melon msg
if (Settings.ParagonTowerOp == false)
{
MelonLogger.Msg(System.ConsoleColor.Yellow, "The balanced version of the banana farm paragon has been loaded.");
if (Settings.TogglePopup == true)
{
PopupScreen.instance.ShowOkPopup("The balanced version of the banana farm paragon has been loaded.");
}
}
else
{
MelonLogger.Msg(System.ConsoleColor.Yellow, "The OP version of the banana farm paragon has been loaded.");
if (Settings.TogglePopup == true)
{
PopupScreen.instance.ShowOkPopup("The OP version of the banana farm paragon has been loaded.");
}
}
}
public override void OnApplicationStart()
{
MelonLogger.Msg(System.ConsoleColor.Yellow, "The great one... Is ready...");
}
}
public class Settings : ModSettings
{
public static readonly ModSettingBool ParagonTowerOp = new(false)
{
displayName = "OP Mode of Banana Farm Paragon",
description = "Toggles the OP mode of the banana farm paragon",
button = true
};
public static readonly ModSettingBool TogglePopup = new(true)
{
displayName = "Toggle Popup",
description = "Toggles the popup on main menu that tells you what version of the banana farm paragon you are on",
button = true
};
public static readonly ModSettingInt ParagonCost = new(1000000)
{
displayName = "Banana Farm Paragon Cost",
min = 0
};
}
public class Paragon
{
public class Display : ModTowerDisplay<BananaFarmParagon>
{
public override string BaseDisplay => GetDisplay(TowerType.BananaFarm, 4, 0, 0);
public override bool UseForTower(int[] tiers)
{ return IsParagon(tiers); }
public override void ModifyDisplayNode(UnityDisplayNode node)
{
SetMeshTexture(node, "texture1");
}
}
public class BananaFarmParagon : ModVanillaParagon
{
public override string BaseTower => "BananaFarm-500";
}
public class BananaFarmParagonUpgrade : ModParagonUpgrade<BananaFarmParagon>
{
public override int Cost => 1000000;
public override string Description => "The banana's are too strong...not even the monkeys can control the power...";
public override string DisplayName => "The Pinacle Of Banana Production";
public override string Icon => "BananaFarmParagon-Icon";
public override string Portrait => "BananaFarmParagon-Portrait";
public override void ApplyUpgrade(TowerModel towerModel)
{
towerModel.range += 99999999999999;
var attackModel = towerModel.GetAttackModel();
attackModel.range += 99999999999999;
var projectile = attackModel.weapons[0].projectile;
var weapon = attackModel.weapons[0];
towerModel.RemoveBehavior<BananaCentralBuffModel>();
projectile.GetBehavior<CashModel>().minimum = 100000;
projectile.GetBehavior<CashModel>().maximum = 100000;
projectile.GetBehavior<CashModel>().salvage = 1;
weapon.GetBehavior<EmissionsPerRoundFilterModel>().count = 10;
towerModel.AddBehavior(Game.instance.model.GetTowerFromId("MonkeyVillage-004").GetBehavior<MonkeyCityIncomeSupportModel>().Duplicate());
towerModel.GetBehavior<MonkeyCityIncomeSupportModel>().incomeModifier = 10;
towerModel.GetBehavior<MonkeyCityIncomeSupportModel>().buffIconName = "";
towerModel.GetBehavior<MonkeyCityIncomeSupportModel>().onlyShowBuffIfMutated = false;
towerModel.GetBehavior<MonkeyCityIncomeSupportModel>().showBuffIcon = true;
towerModel.GetBehavior<MonkeyCityIncomeSupportModel>().isGlobal = true;
projectile.GetBehavior<AgeModel>().Lifespan = 0;
projectile.GetBehavior<AgeModel>().rounds = 9999999;
var farm = Game.instance.model.GetTowerFromId("EngineerMonkey-200").GetAttackModel().Duplicate();
farm.range = towerModel.range;
farm.name = "Farm_Weapon";
farm.weapons[0].Rate = 100f;
farm.weapons[0].projectile.RemoveBehavior<CreateTowerModel>();
farm.weapons[0].projectile.ApplyDisplay<BananaDisplay>();
farm.weapons[0].projectile.AddBehavior(new CreateTowerModel("BananaFarm000place", GetTowerModel<BananaFarmer>().Duplicate(), 0f, true, true, false, true, true));
towerModel.AddBehavior(farm);
farm.RemoveBehavior<RotateToTargetModel>();
}
public class BananaFarmParagonDisplay : ModTowerDisplay<BananaFarmParagon>
{
public override string BaseDisplay => GetDisplay(TowerType.BananaFarm, 4, 0, 0);
public override bool UseForTower(int[] tiers)
{ return IsParagon(tiers); }
public override void ModifyDisplayNode(UnityDisplayNode node)
{
SetMeshTexture(node, "texture1");
}
}
}
}
namespace bananafarmfake
{
public class BananaFarmer : ModTower
{
public override string Portrait => "BananaCostumeFarmerPortrait";
public override string Name => "Banan";
public override TowerSet TowerSet => TowerSet.Support;
public override string BaseTower => TowerType.DartMonkey;
public override bool DontAddToShop => true;
public override int Cost => 0;
public override int TopPathUpgrades => 0;
public override int MiddlePathUpgrades => 0;
public override int BottomPathUpgrades => 0;
public override string DisplayName => "Banan";
public override string Description => "";
public override void ModifyBaseTowerModel(TowerModel towerModel)
{
towerModel.RemoveBehaviors<AttackModel>();
towerModel.isSubTower = true;
towerModel.AddBehavior(new TowerExpireModel("ExpireModel", 45f, 3, false, false));
towerModel.display = new PrefabReference { guidRef = "cd01e5de10343944ea24e6a6b3690b3a" };
towerModel.range += 0;
towerModel.AddBehavior(Game.instance.model.GetTowerFromId("BananaFarm-005").GetBehavior<CollectCashZoneModel>().Duplicate());
towerModel.GetBehavior<CollectCashZoneModel>().collectRange = 1;
towerModel.GetBehavior<CollectCashZoneModel>().attractRange = 9999999;
towerModel.GetBehavior<CollectCashZoneModel>().speed = 1;
}
}
}
}