Skip to content

Commit

Permalink
Further updates for v40.0
Browse files Browse the repository at this point in the history
  • Loading branch information
doombubbles committed Dec 5, 2023
1 parent 2fb1ee0 commit 9d31ea4
Show file tree
Hide file tree
Showing 14 changed files with 1,431 additions and 42 deletions.
2 changes: 1 addition & 1 deletion BloonsTD6 Mod Helper/Api/Display/ModDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ protected string GetDisplay(string tower, int top = 0, int mid = 0, int bot = 0)

/// <summary>
/// Gets the Display for a given bloon
/// <summary>
/// </summary>
/// <param name="bloon"> The bloon base id</param>
/// <returns>The display GUID</returns>
protected string GetBloonDisplay(string bloon) =>
Expand Down
4 changes: 2 additions & 2 deletions BloonsTD6 Mod Helper/Api/Display/ModTowerDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public override void Register()
/// </summary>
/// <param name="tiers">The potential tiers of the tower</param>
/// <returns>If the Tower should have this display</returns>
public abstract bool UseForTower(int[] tiers);
public abstract bool UseForTower(params int[] tiers);

/// <summary>
/// Applies this ModTowerDisplay to the towerModel. Override to change how this applies, i.e. making it
Expand Down Expand Up @@ -92,7 +92,7 @@ public override void ModifyDisplayNode(UnityDisplayNode node)
/// </summary>
/// <param name="tiers"></param>
/// <returns></returns>
protected bool IsParagon(int[] tiers) => tiers[0] == 6;
protected bool IsParagon(params int[] tiers) => tiers[0] == 6;
}

/// <summary>
Expand Down
38 changes: 38 additions & 0 deletions BloonsTD6 Mod Helper/Api/Enums/UpgradeType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,25 @@ public static class UpgradeType
public const string GeraldoUpgrade18 = "Geraldo Upgrade 18";
public const string GeraldoUpgrade19 = "Geraldo Upgrade 19";
public const string GeraldoUpgrade20 = "Geraldo Upgrade 20";
public const string CorvusUpgrade2 = "Corvus Upgrade 2";
public const string CorvusUpgrade3 = "Corvus Upgrade 3";
public const string CorvusUpgrade4 = "Corvus Upgrade 4";
public const string CorvusUpgrade5 = "Corvus Upgrade 5";
public const string CorvusUpgrade6 = "Corvus Upgrade 6";
public const string CorvusUpgrade7 = "Corvus Upgrade 7";
public const string CorvusUpgrade8 = "Corvus Upgrade 8";
public const string CorvusUpgrade9 = "Corvus Upgrade 9";
public const string CorvusUpgrade10 = "Corvus Upgrade 10";
public const string CorvusUpgrade11 = "Corvus Upgrade 11";
public const string CorvusUpgrade12 = "Corvus Upgrade 12";
public const string CorvusUpgrade13 = "Corvus Upgrade 13";
public const string CorvusUpgrade14 = "Corvus Upgrade 14";
public const string CorvusUpgrade15 = "Corvus Upgrade 15";
public const string CorvusUpgrade16 = "Corvus Upgrade 16";
public const string CorvusUpgrade17 = "Corvus Upgrade 17";
public const string CorvusUpgrade18 = "Corvus Upgrade 18";
public const string CorvusUpgrade19 = "Corvus Upgrade 19";
public const string CorvusUpgrade20 = "Corvus Upgrade 20";
public static readonly Dictionary<string, string> ByName = new()
{
{ "SharpShots", SharpShots },
Expand Down Expand Up @@ -1242,5 +1261,24 @@ public static class UpgradeType
{ "GeraldoUpgrade18", GeraldoUpgrade18 },
{ "GeraldoUpgrade19", GeraldoUpgrade19 },
{ "GeraldoUpgrade20", GeraldoUpgrade20 },
{ "CorvusUpgrade2", CorvusUpgrade2 },
{ "CorvusUpgrade3", CorvusUpgrade3 },
{ "CorvusUpgrade4", CorvusUpgrade4 },
{ "CorvusUpgrade5", CorvusUpgrade5 },
{ "CorvusUpgrade6", CorvusUpgrade6 },
{ "CorvusUpgrade7", CorvusUpgrade7 },
{ "CorvusUpgrade8", CorvusUpgrade8 },
{ "CorvusUpgrade9", CorvusUpgrade9 },
{ "CorvusUpgrade10", CorvusUpgrade10 },
{ "CorvusUpgrade11", CorvusUpgrade11 },
{ "CorvusUpgrade12", CorvusUpgrade12 },
{ "CorvusUpgrade13", CorvusUpgrade13 },
{ "CorvusUpgrade14", CorvusUpgrade14 },
{ "CorvusUpgrade15", CorvusUpgrade15 },
{ "CorvusUpgrade16", CorvusUpgrade16 },
{ "CorvusUpgrade17", CorvusUpgrade17 },
{ "CorvusUpgrade18", CorvusUpgrade18 },
{ "CorvusUpgrade19", CorvusUpgrade19 },
{ "CorvusUpgrade20", CorvusUpgrade20 },
};
}
1,386 changes: 1,368 additions & 18 deletions BloonsTD6 Mod Helper/Api/Enums/VanillaSprites.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion BloonsTD6 Mod Helper/Api/ModContent.Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ public static AudioSourceReference GetAudioSourceReference<T>(string name) where
/// <returns>The tower name/id</returns>
public static string TowerID<T>(int top = 0, int mid = 0, int bot = 0) where T : ModTower
{
return GetInstance<T>().TowerId(new[] {top, mid, bot});
return GetInstance<T>().TowerId(top, mid, bot);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion BloonsTD6 Mod Helper/Api/Towers/ModHero.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ internal override TowerModel GetDefaultTowerModel(int[] tiers = null)
return baseTowerModel;
}

internal override string TowerId(int[] tiers)
internal override string TowerId(params int[] tiers)
{
var id = Id;
if (tiers[0] > 0)
Expand Down
14 changes: 7 additions & 7 deletions BloonsTD6 Mod Helper/Api/Towers/ModTower.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,14 @@ public virtual void ModifyTowerModelForMatch(TowerModel towerModel, GameModel ga
{
}

internal List<ModUpgrade> GetUpgradesForTiers(int[] tiers) => AllUpgrades
internal List<ModUpgrade> GetUpgradesForTiers(params int[] tiers) => AllUpgrades
.Where(modUpgrade => tiers[modUpgrade.Path] >= modUpgrade.Tier)
.OrderByDescending(modUpgrade => modUpgrade.Priority)
.ThenBy(modUpgrade => modUpgrade.Tier)
.ThenBy(modUpgrade => modUpgrade.Path)
.ToList();

internal virtual string TowerId(int[] tiers)
internal virtual string TowerId(params int[] tiers)
{
var id = Id;
if (tiers.Sum() > 0)
Expand Down Expand Up @@ -253,7 +253,7 @@ public virtual IEnumerable<int[]> TowerTiers()
/// <br />
/// Used in the default implementation of <see cref="TowerTiers()" />
/// </summary>
public virtual bool IsValidCrosspath(int[] tiers)
public virtual bool IsValidCrosspath(params int[] tiers)
{
var sorted = tiers.OrderByDescending(num => num).ToArray();
return sorted[0] <= 5 && sorted[1] <= 2 && sorted[2] == 0;
Expand All @@ -267,7 +267,7 @@ public virtual bool IsValidCrosspath(int[] tiers)
/// <seealso cref="Use2DModel" />
/// <see cref="Get2DScale" />
/// </summary>
public virtual string Get2DTexture(int[] tiers)
public virtual string Get2DTexture(params int[] tiers)
{
var name = $"{Name}-{tiers.Printed()}";
if (TextureExists(name))
Expand Down Expand Up @@ -306,7 +306,7 @@ public virtual string Get2DTexture(int[] tiers)
/// <seealso cref="Use2DModel" />
/// <seealso cref="Get2DTexture(int[])" />
/// </summary>
public virtual float Get2DScale(int[] tiers) => 1f;
public virtual float Get2DScale(params int[] tiers) => 1f;

/// <summary>
/// Gets the portrait reference this tower should use for the given tiers
Expand All @@ -316,7 +316,7 @@ public virtual string Get2DTexture(int[] tiers)
/// falling back to the tower's own base <see cref="PortraitReference" /> by default.
/// </summary>
/// <param name="tiers"></param>
public SpriteReference GetPortraitReferenceForTiers(int[] tiers) => AllUpgrades
public SpriteReference GetPortraitReferenceForTiers(params int[] tiers) => AllUpgrades
.Where(modUpgrade => tiers[modUpgrade.Path] >= modUpgrade.Tier && modUpgrade.PortraitReference is not null)
.OrderByDescending(modUpgrade => modUpgrade.Tier)
.ThenByDescending(modUpgrade => modUpgrade.Path % 2)
Expand Down Expand Up @@ -482,7 +482,7 @@ public virtual UpgradePathModel GetUpgradePathModel(ModUpgrade modUpgrade, int[]
/// </summary>
/// <param name="tiers">Length 3 array of Top/Mid/Bot tiers</param>
/// <returns>The base TowerModel to use</returns>
public virtual TowerModel GetBaseTowerModel(int[] tiers) => !string.IsNullOrEmpty(BaseTower)
public virtual TowerModel GetBaseTowerModel(params int[] tiers) => !string.IsNullOrEmpty(BaseTower)
? BaseTowerModel.MakeCopy(Id)
: new TowerModel(Id, Id, TowerSet, CreatePrefabReference(""));
}
Expand Down
2 changes: 1 addition & 1 deletion BloonsTD6 Mod Helper/Api/Towers/ModVanillaParagon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public sealed override void ModifyBaseTowerModel(TowerModel towerModel)
{
}

internal override string TowerId(int[] tiers) => BaseTowerModel.baseId + "-Paragon";
internal override string TowerId(params int[] tiers) => BaseTowerModel.baseId + "-Paragon";

/// <summary>
/// Doesn't generate any of the tower on its own
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@ public static void AddBehavior(this TowerModel model, ModelHelper behavior)
}

/// <summary>
/// Remove all Behaviors of type T
/// Remove all Behaviors
/// </summary>
/// <typeparam name="T">The Behavior you want to remove</typeparam>
/// <param name="model"></param>
public static void RemoveBehaviors(this TowerModel model)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static void AddFilter(this AttackModel attack, FilterModel filter)
}

/// <summary>
/// Adds a new filter to this projectile model
/// Removes a specific filter from this attack model
/// </summary>
public static void RemoveFilter(this AttackModel attack, FilterModel filter)
{
Expand All @@ -122,7 +122,7 @@ public static void RemoveFilter(this AttackModel attack, FilterModel filter)
}

/// <summary>
/// Adds a new filter to this projectile model
/// Removes the first filter of a given type from this attack model
/// </summary>
public static void RemoveFilter<T>(this AttackModel attack) where T : FilterModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static void AddFilter(this ProjectileModel projectile, FilterModel filter
}

/// <summary>
/// Adds a new filter to this projectile model
/// Removes a specific filter from this projectile model
/// </summary>
public static void RemoveFilter(this ProjectileModel projectile, FilterModel filter)
{
Expand All @@ -124,7 +124,7 @@ public static void RemoveFilter(this ProjectileModel projectile, FilterModel fil
}

/// <summary>
/// Adds a new filter to this projectile model
/// Removes the first filter of the given type from this projectile model
/// </summary>
public static void RemoveFilter<T>(this ProjectileModel projectile) where T : FilterModel
{
Expand Down
6 changes: 5 additions & 1 deletion BloonsTD6 Mod Helper/LATEST.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
- Preliminary fixes for v40.0 (thanks @KosmicShovel!)
- Updates for v40.0 UpgradeTypes, VanillaSprites, etc
- The `TopPathUpgrades`, `MiddlePathUpgrades` and `BottomPathUpgrades` properties no longer need to be manually specified for `ModTower`s, they will be inferred
- Same goes for `MaxLevel` in `ModHero`
- Added a `Model.RemoveBehaviors()` extension (no type argument) that simply clears all behaviors
- Fixed a possible visual error with ModSettingFile and ModSettingFolder
- Fixed a possible visual error with ModSettingFile and ModSettingFolder
- Let a number of api methods use params arguments
- Added GetBloonDisplay method to ModDisplay.cs (thanks @DarkTerraYT!)
4 changes: 1 addition & 3 deletions BloonsTD6 Mod Helper/ModHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
using System.Reflection;
using BTD_Mod_Helper.Api;
using BTD_Mod_Helper.Api.Data;
using BTD_Mod_Helper.Api.Helpers;
using BTD_Mod_Helper.Api.Internal;
using BTD_Mod_Helper.UI.BTD6;
using MelonLoader.InternalUtils;
using MelonLoader.Utils;
namespace BTD_Mod_Helper;
Expand All @@ -18,7 +16,7 @@ namespace BTD_Mod_Helper;
public static class ModHelper
{
internal const string Name = "BloonsTD6 Mod Helper";
internal const string Version = "3.1.15";
internal const string Version = "3.1.16";
internal const string RepoOwner = "gurrenm3";
internal const string RepoName = "BTD-Mod-Helper";
internal const string Description =
Expand Down
2 changes: 1 addition & 1 deletion Website/src/lib/mod-helper-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const ModHelperRepoName = "BTD-Mod-Helper";
export const ModHelperRepoBranch = "master";

export const StoppedWorkingVersion = 34;
export const LatestVersion = 38;
export const LatestVersion = 40;

export type ModHelperData = {
// Serialized
Expand Down

0 comments on commit 9d31ea4

Please sign in to comment.