Table of Contents
A class used to create an Upgrade for a Tower
public abstract class ModUpgrade : BTD_Mod_Helper.Api.NamedModContent
Inheritance System.Object ModContent NamedModContent ModUpgrade
Derived
↳ ModHeroLevel
↳ ModParagonUpgrade
↳ ModUpgrade<T>
Path ID for the Bottom path
protected const int BOTTOM = 2;
Path ID for the Middle path
protected const int MIDDLE = 1;
Path ID for the Top path
protected const int TOP = 0;
The body text for the confirmation popup, if needed
public virtual string ConfirmationBody { get; }
The title for the confirmation popup, if needed
public virtual string ConfirmationTitle { get; }
How much the upgrade costs on Medium difficulty
public abstract int Cost { get; }
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; }
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; }
Il2CppNinjaKiwi.Common.ResourceUtils.SpriteReference
Whether this upgrade requires a confirmation popup
public virtual bool NeedsConfirmation { get; }
The upgrade path
Use TOP, MIDDLE, BOTTOM
public abstract int Path { get; }
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; }
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; }
Il2CppNinjaKiwi.Common.ResourceUtils.SpriteReference
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; }
The upgrade tier, 1 for Tier 1 Upgrades, 2 for Tier 2, etc...
public abstract int Tier { get; }
The tower that this is an upgrade for
public abstract BTD_Mod_Helper.Api.Towers.ModTower Tower { get; }
Xp Cost for the upgrade. Meaningless usually because custom heroes automatically are automatically unlocked.
public virtual int XpCost { get; }
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);
towerModel
Il2CppAssets.Scripts.Models.Towers.TowerModel
The Tower Model
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);
towerModel
Il2CppAssets.Scripts.Models.Towers.TowerModel
gameModel
Il2CppAssets.Scripts.Models.GameModel
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);
towerModel
Il2CppAssets.Scripts.Models.Towers.TowerModel
gameModes
System.Collections.Generic.IReadOnlyList<Il2CppAssets.Scripts.Models.ModModel>
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);
towerModel
Il2CppAssets.Scripts.Models.Towers.TowerModel
If you really need to override the way that the ModUpgrade makes its UpgradeModel, go ahead
public virtual UpgradeModel GetUpgradeModel();
Il2CppAssets.Scripts.Models.Towers.Upgrades.UpgradeModel
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);
towerModel
Il2CppAssets.Scripts.Models.Towers.TowerModel
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);
tower
Il2CppAssets.Scripts.Simulation.Towers.Tower