Skip to Main Content

BTD_Mod_Helper​.Api​.Towers​.ModUpgrade


BloonsTD6 Mod Helper

BTD_Mod_Helper.Api.Towers

ModUpgrade Class

A class used to create an Upgrade for a Tower

public abstract class ModUpgrade : BTD_Mod_Helper.Api.NamedModContent

Inheritance System.ObjectModContentNamedModContent  ModUpgrade

Derived
ModHeroLevel
ModParagonUpgrade
ModUpgrade<T>

Fields

ModUpgrade.BOTTOM Field

Path ID for the Bottom path

protected const int BOTTOM = 2;

Field Value

System.Int32

ModUpgrade.MIDDLE Field

Path ID for the Middle path

protected const int MIDDLE = 1;

Field Value

System.Int32

ModUpgrade.TOP Field

Path ID for the Top path

protected const int TOP = 0;

Field Value

System.Int32

Properties

ModUpgrade.ConfirmationBody Property

The body text for the confirmation popup, if needed

public virtual string ConfirmationBody { get; }

Property Value

System.String

ModUpgrade.ConfirmationTitle Property

The title for the confirmation popup, if needed

public virtual string ConfirmationTitle { get; }

Property Value

System.String

ModUpgrade.Cost Property

How much the upgrade costs on Medium difficulty

public abstract int Cost { get; }

Property Value

System.Int32

ModUpgrade.Icon Property

The file name without extension for the Icon for this upgrade


The Tower follows the default Bloons method of picking a Portrait: choose the highest tier upgrade, and if
there's a tie, choose Mid > Top > Bot (for whatever reason)


By default is the same file name as the tower followed by -Icon

public virtual string Icon { get; }

Property Value

System.String

ModUpgrade.IconReference Property

If you're not going to use a custom .png for your Icon, use this to directly control its SpriteReference

public virtual SpriteReference IconReference { get; }

Property Value

Il2CppNinjaKiwi.Common.ResourceUtils.SpriteReference

ModUpgrade.NeedsConfirmation Property

Whether this upgrade requires a confirmation popup

public virtual bool NeedsConfirmation { get; }

Property Value

System.Boolean

ModUpgrade.Path Property

The upgrade path
Use TOP, MIDDLE, BOTTOM

public abstract int Path { get; }

Property Value

System.Int32

ModUpgrade.Portrait Property

The file name without extension for the Portrait for this upgrade


By default is the same file name as the tower followed by -Portrait

public virtual string Portrait { get; }

Property Value

System.String

ModUpgrade.PortraitReference Property

If you're not going to use a custom .png for your Portrait, use this to directly control its SpriteReference

public virtual SpriteReference PortraitReference { get; }

Property Value

Il2CppNinjaKiwi.Common.ResourceUtils.SpriteReference

ModUpgrade.Priority Property

Custom priority to make this upgrade applied sooner (increased priority) or later (decreased priority)
when the TowerModel is being constructed

public virtual int Priority { get; }

Property Value

System.Int32

ModUpgrade.Tier Property

The upgrade tier, 1 for Tier 1 Upgrades, 2 for Tier 2, etc...

public abstract int Tier { get; }

Property Value

System.Int32

ModUpgrade.Tower Property

The tower that this is an upgrade for

public abstract BTD_Mod_Helper.Api.Towers.ModTower Tower { get; }

Property Value

ModTower

ModUpgrade.XpCost Property

Xp Cost for the upgrade. Meaningless usually because custom heroes automatically are automatically unlocked.

public virtual int XpCost { get; }

Property Value

System.Int32

Methods

ModUpgrade.ApplyUpgrade(TowerModel) Method

Apply the effects that this upgrade has onto a TowerModel


The TowerModel's tier(s), applied upgrades and other info will already be correct, so this is mostly about
changing the TowerModel's behavior


The default ordering of upgrade application is to do them in ascending order of tier, doing Top then Mid
then Bot at each tier. This can be changed using Priority.

public abstract void ApplyUpgrade(TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

The Tower Model

ModUpgrade.ApplyUpgradeForMatch(TowerModel, GameModel) Method

Make this upgrade apply additional effects on a towerModel when you go into a new match.
Useful for making conditional effects happen based on settings.


The normal ApplyUpgrade effects for all upgrades will have already been applied on game start,
so this will simply modify all the TowerModels for this ModTower that have this upgrade.

public virtual void ApplyUpgradeForMatch(TowerModel towerModel, GameModel gameModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

gameModel Il2CppAssets.Scripts.Models.GameModel

ModUpgrade.ApplyUpgradeForMatch(TowerModel, IReadOnlyList) Method

Make this upgrade apply additional effects on a towerModel when you go into a new match.
Useful for making conditional effects happen based on settings.


The normal ApplyUpgrade effects for all upgrades will have already been applied on game start,
so this will simply modify all the TowerModels for this ModTower that have this upgrade.

public virtual void ApplyUpgradeForMatch(TowerModel towerModel, System.Collections.Generic.IReadOnlyList<ModModel> gameModes);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

gameModes System.Collections.Generic.IReadOnlyList<Il2CppAssets.Scripts.Models.ModModel>

ModUpgrade.EarlyApplyUpgrade(TowerModel) Method

Apply effects to this Tower Model before all other ApplyUpgrade and LateApplyUpgrade effects have happened


Otherwise, usual priority / ordering rules still apply

public virtual void EarlyApplyUpgrade(TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

ModUpgrade.GetUpgradeModel() Method

If you really need to override the way that the ModUpgrade makes its UpgradeModel, go ahead

public virtual UpgradeModel GetUpgradeModel();

Returns

Il2CppAssets.Scripts.Models.Towers.Upgrades.UpgradeModel

ModUpgrade.LateApplyUpgrade(TowerModel) Method

Apply effects to this Tower Model after all the other EarlyApplyUpgrade and ApplyUpgrade effects have happened


Otherwise, usual priority / ordering rules still apply

public virtual void LateApplyUpgrade(TowerModel towerModel);

Parameters

towerModel Il2CppAssets.Scripts.Models.Towers.TowerModel

ModUpgrade.RestrictUpgrading(Tower) Method

Allows you to dynamically allow an upgrade to not be purchasable based on the InGame values of a Tower

public virtual bool RestrictUpgrading(Tower tower);

Parameters

tower Il2CppAssets.Scripts.Simulation.Towers.Tower

Returns

System.Boolean
If

To learn how to download BTD Mod Helper and install mods, click here