-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.cs
151 lines (128 loc) · 4.87 KB
/
Main.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
using MelonLoader;
using BTD_Mod_Helper;
using PathsPlusPlus;
using BTD_Mod_Helper.Api.Enums;
using Il2Cpp;
using Il2CppAssets.Scripts.Models.Towers.Projectiles.Behaviors;
using Il2CppAssets.Scripts.Models.Towers;
using Il2CppSystem.IO;
using BTD_Mod_Helper.Extensions;
using Il2CppAssets.Scripts.Models.Towers.Projectiles;
using Il2CppAssets.Scripts.Unity;
using Il2CppAssets.Scripts.Models.Towers.Weapons;
[assembly: MelonInfo(typeof(FourthPath.FourthPathMod), FourthPath.ModHelperData.Name, FourthPath.ModHelperData.Version, FourthPath.ModHelperData.RepoOwner)]
[assembly: MelonGame("Ninja Kiwi", "BloonsTD6")]
namespace FourthPath;
public class FourthPathMod : BloonsTD6Mod
{
public override void OnApplicationStart()
{
ModHelper.Msg<FourthPathMod>("FourthPath loaded!");
}
}
public class FourthPath : PathPlusPlus
{
public override string Tower => "WizardMonkey";
public override int UpgradeCount => 5; // Increase this up to 5 as you create your Upgrades
}
public class RangeUpgrade : UpgradePlusPlus<FourthPath>
{
public override int Cost => 500;
public override int Tier => 1;
public override string Icon => VanillaSprites.LongRangeDartsUpgradeIcon;
public override string Description => "The Tower has more range than normal.";
public override void ApplyUpgrade(TowerModel towerModel)
{
towerModel.IncreaseRange(15);
if (IsHighestUpgrade(towerModel))
{
// apply a custom display, if you want
}
}
}
public class LeadPoppingPowerUpgrade : UpgradePlusPlus<FourthPath>
{
public override int Cost => 1000;
public override int Tier => 2;
public override string Icon => VanillaSprites.RedHotRangsUpgradeIcon;
//public override string Portrait => "700Sylveon_PSMD";
public override string Description => "The Tower's attacks can pop Lead bloons."; // and Frozen
public override void ApplyUpgrade(TowerModel towerModel)
{
foreach (var damageModel in towerModel.GetDescendants<DamageModel>().ToArray())
{
damageModel.immuneBloonProperties &= ~BloonProperties.Frozen;
damageModel.immuneBloonProperties &= ~BloonProperties.Lead;
}
if (IsHighestUpgrade(towerModel))
{
// apply a custom display, if you want
}
}
}
public class PierceAndDamageUpgrade : UpgradePlusPlus<FourthPath>
{
public override int Cost => 5000; //3000+350+
public override int Tier => 3;
public override string Icon => VanillaSprites.CrossBowUpgradeIcon;
public override string Description => "Increases pierce and damage of the Tower's attacks.";
//public override string Portrait => "700Sylveon_PSMD";
public override void ApplyUpgrade(TowerModel towerModel)
{
foreach (var damageModel in towerModel.GetDescendants<DamageModel>().ToArray())
{
damageModel.damage += 3;
}
foreach (var projectileModel in towerModel.GetDescendants<ProjectileModel>().ToArray())
{
projectileModel.pierce += 3;
}
if (IsHighestUpgrade(towerModel))
{
// apply a custom display, if you want
}
}
}
public class LaserShockUpgrade : UpgradePlusPlus<FourthPath>
{
public override int Cost => 10000; //3000+350+
public override int Tier => 4;
public override string Icon => VanillaSprites.LaserShockUpgradeIcon;
public override string Description => "Adds a Laser Shock effect to the Tower's attacks";
//public override string Portrait => "700Sylveon_PSMD";
public override void ApplyUpgrade(TowerModel towerModel)
{
TowerModel dartling = Game.instance.model.GetTowerFromId(TowerType.DartlingGunner + "-300");
AddBehaviorToBloonModel electricShock = dartling.GetDescendant<AddBehaviorToBloonModel>().Duplicate();
electricShock.filters = null;
foreach (var weaponModel in towerModel.GetDescendants<WeaponModel>().ToArray())
{
weaponModel.projectile.AddBehavior(electricShock);
weaponModel.projectile.collisionPasses = new[] { 0, 1 };
}
if (IsHighestUpgrade(towerModel))
{
// apply a custom display, if you want
}
}
}
public class AttackSpeedUpgrade : UpgradePlusPlus<FourthPath>
{
public override int Cost => 15000;
public override int Tier => 5;
public override string Icon => VanillaSprites.SemiAutomaticUpgradeIcon;
public override string Description => "Triples the Tower's attack speed.";
//public override string Portrait => "700Sylveon_PSMD";
public override void ApplyUpgrade(TowerModel towerModel)
{
foreach (var weaponModel in towerModel.GetWeapons().ToArray())
{
weaponModel.Rate /= 3;
weaponModel.rate /= 3;
}
if (IsHighestUpgrade(towerModel))
{
// apply a custom display, if you want
}
}
}