Skip to content

Commit ea2b46e

Browse files
committed
I forgot about ts
1 parent c1dfb3c commit ea2b46e

2 files changed

Lines changed: 48 additions & 0 deletions

File tree

Towers/ExampleMonkey-Portrait.png

255 KB
Loading

Towers/ExampleMonkey.cs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using BTD_Mod_Helper.Api.Towers;
2+
using Il2Cpp;
3+
using Il2CppAssets.Scripts.Models.Towers;
4+
using Il2CppAssets.Scripts.Models.Towers.Behaviors.Emissions;
5+
using Il2CppAssets.Scripts.Models.Towers.Filters;
6+
using Il2CppAssets.Scripts.Models.Towers.Projectiles.Behaviors;
7+
using Il2CppAssets.Scripts.Models.TowerSets;
8+
9+
namespace ExampleMod.Towers;
10+
11+
public class ExampleMonkey : ModTower
12+
{
13+
public override void ModifyBaseTowerModel(TowerModel towerModel)
14+
{
15+
var attackModel = towerModel.GetAttackModel(); // The first attack of the tower
16+
var weapon = attackModel.weapons[0]!; // towerModel.GetWeapon(): The first weapon the tower has
17+
var projectile = weapon.projectile; // The projectile the tower shoots
18+
19+
weapon.rate = 0.33f; // Attack speed in seconds, add an f at the end if non-integer number
20+
weapon.SetEmission(new ArcEmissionModel("Emission", 3, 0f, 45f, null, false, false)); // Makes the tower shoot 3 darts in a 45 degree spread
21+
22+
var damageModel = projectile.GetDescendant<DamageModel>(); // You can do projectile.GetDamageModel(), but it will error if it is not directly attached to the projectile
23+
damageModel.damage++; // 1 -> 2, ++ increments by 1, -- decrements by 1
24+
damageModel.immuneBloonProperties |= BloonProperties.Black | BloonProperties.White; // |= will make it also not able to hit that type, using just = will override it, using vertical bars after the equals will do all of those.
25+
// For example, this can't pop black bloons, white bloons, frozen bloons, or lead bloons
26+
projectile.pierce = 10; // Can hit 11 bloons
27+
projectile.AddBehavior(new SlowModel("SlowModel_low", 0.9f, 5, "Slow:ExampleMonkey_low", 999999,
28+
"", true, false, null, false, false, false, 100)); // Makes bloons 10% slower for 5 seconds
29+
30+
projectile.UpdateCollisionPassList();
31+
32+
projectile.AddBehavior(new DamageModifierForTagModel("DamageModifierForTagModel_Moabs", "Moabs", 1.5f, 0, false, true)); // Does 1.5x more damage to Moab Class Bloons, For a Moab specifically, do just "Moab" as the tag.
33+
projectile.hasDamageModifiers = true;
34+
35+
towerModel.IncreaseRange(10); // Increase towerModel.range by 10, and the range for each attackModel by 10 (towerModel.GetAttackModels().ForEach(attackModel => attackModel.range += increase));
36+
37+
towerModel.GetDescendants<FilterInvisibleModel>().ForEach(filter => filter.isActive = false); // Set this to true if you don't want it to see camo
38+
}
39+
40+
public override TowerSet TowerSet => TowerSet.Primary;
41+
public override string BaseTower => TowerType.DartMonkey;
42+
public override int Cost => 815; // 815 cash in medium mode
43+
44+
public override string Icon => Portrait; // Portrait is ClassName-Portrait (.png)
45+
46+
public override string Description => "This is an Example Monkey, woohoo!"; // The text the shown under the name of the tower in the upgrades menu.
47+
public override string DisplayName => "Example Monkey"; // If the class is called MOABMonkey for example, it'll show as M O A B Monkey in game. If you have MoabMonkey, it'll show as Moab Monkey in game. You'd use this to fix it and have it shown as "MOAB Monkey". By default, this is Name.Spaced();
48+
}

0 commit comments

Comments
 (0)