using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BTD_Mod_Helper; using BTD_Mod_Helper.Api; using BTD_Mod_Helper.Api.Display; using BTD_Mod_Helper.Api.ModOptions; using BTD_Mod_Helper.Api.Towers; using BTD_Mod_Helper.Extensions; using HarmonyLib; using Il2Cpp; using Il2CppAssets.Scripts.Data; using Il2CppAssets.Scripts.Models; using Il2CppAssets.Scripts.Models.Bloons; using Il2CppAssets.Scripts.Models.Effects; using Il2CppAssets.Scripts.Models.Entities; using Il2CppAssets.Scripts.Models.GenericBehaviors; using Il2CppAssets.Scripts.Models.TowerSets; using Il2CppAssets.Scripts.Models.Towers; using Il2CppAssets.Scripts.Models.Towers.Behaviors; using Il2CppAssets.Scripts.Models.Towers.Behaviors.Abilities; using Il2CppAssets.Scripts.Models.Towers.Behaviors.Abilities.Behaviors; using Il2CppAssets.Scripts.Models.Towers.Behaviors.Attack; using Il2CppAssets.Scripts.Models.Towers.Behaviors.Attack.Behaviors; using Il2CppAssets.Scripts.Models.Towers.Behaviors.Emissions; using Il2CppAssets.Scripts.Models.Towers.Behaviors.Emissions.Behaviors; using Il2CppAssets.Scripts.Models.Towers.Filters; using Il2CppAssets.Scripts.Models.Towers.Projectiles; using Il2CppAssets.Scripts.Models.Towers.Projectiles.Behaviors; using Il2CppAssets.Scripts.Models.Towers.TowerFilters; using Il2CppAssets.Scripts.Models.Towers.Weapons; using Il2CppAssets.Scripts.Models.Towers.Weapons.Behaviors; using Il2CppAssets.Scripts.Simulation.Bloons; using Il2CppAssets.Scripts.Simulation.Input; using Il2CppAssets.Scripts.Simulation.Objects; using Il2CppAssets.Scripts.Simulation.SMath; using Il2CppAssets.Scripts.Simulation.Towers.Behaviors; using Il2CppAssets.Scripts.Simulation.Towers.Behaviors.Abilities.Behaviors; using Il2CppAssets.Scripts.Simulation.Towers.Projectiles.Behaviors; using Il2CppAssets.Scripts.Unity; using Il2CppAssets.Scripts.Unity.Display; using Il2CppAssets.Scripts.Unity.UI_New.InGame; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppNinjaKiwi.Common.ResourceUtils; using MelonLoader; using Microsoft.CodeAnalysis; using PathsPlusPlus; using StarshipEnterprise; using StarshipEnterprise.Displays; using StarshipEnterprise.Displays.Ships; using StarshipEnterprise.Displays.Weapons; using StarshipEnterprise.Upgrades.Cannons; using StarshipEnterprise.Upgrades.Phasers; using StarshipEnterprise.Upgrades.Refit; using StarshipEnterprise.Upgrades.Torpedoes; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(StarshipEnterpriseMod), "Starship Enterprise", "1.0.12", "doombubbles", null)] [assembly: MelonGame("Ninja Kiwi", "BloonsTD6")] [assembly: MelonGame("Ninja Kiwi", "BloonsTD6-Epic")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("StarshipEnterprise")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+018108fdd8807448032c41a5f6cf596a0b74fccb")] [assembly: AssemblyProduct("StarshipEnterprise")] [assembly: AssemblyTitle("StarshipEnterprise")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace StarshipEnterprise { public static class ModHelperData { public const string WorksOnVersion = "55.0"; public const string Version = "1.0.12"; public const string Name = "Starship Enterprise"; public const string Description = "Adds in the Starship Enterprise to BloonsTD6 with 7 Upgrade Paths that have 6 Upgrades each.\n\nThe main 3 paths are Enterprise's weapons: Phasers, Photon Torpedoes, and Phase Cannons.\n\nThe next 3 paths are the Career Paths, letting you specialize in Tactical, Science or Engineering, with standard X/2/0 restrictions.\n\nThe final path is the refit model, taking the Enterprise from Constitution Class all the way to Odyssey Class, and always available for upgrading.\n\nRequires Paths++"; public const string RepoOwner = "doombubbles"; public const string PrevRepoName = "starship-enterprise"; public const string RepoName = "StarshipEnterprise"; public const string Icon = "StarshipEnterprise-Icon.png"; public const string Dependencies = "doombubbles/paths-plus-plus"; } public class Starfleet : ModTowerSet { public override int GetTowerStartIndex(List towerSet) { return 0; } } public class StarshipEnterprise : ModTower { public override string BaseTower => TowerType.MonkeyAce + "-004"; public override int Cost => 1701; public override int TopPathUpgrades => 5; public override int MiddlePathUpgrades => 5; public override int BottomPathUpgrades => 5; public override int ShopTowerCount => 1; public override string DisplayName => "USS Enterprise"; public override string Description => "Equipped with Phasers, Photon Torpedoes, and Phase Cannons. Upgrade weapons, refit the ship, and choose your career path. Always costs $1,701."; public override ModSettingHotkey Hotkey => StarshipEnterpriseMod.EnterpriseHotkey; public static Vector3 EjectOffset => new Vector3(0f, 20f, 5f); public static float Speed => 60f; public override bool IsValidCrosspath(params int[] tiers) { if (!((ModTower)this).IsValidCrosspath(tiers)) { return ModHelper.HasMod("UltimateCrosspathing"); } return true; } public override void ModifyBaseTowerModel(TowerModel towerModel) { //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Expected O, but got Unknown //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Expected O, but got Unknown //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Expected O, but got Unknown //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Expected O, but got Unknown //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_054f: Expected O, but got Unknown //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Expected O, but got Unknown //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Unknown result type (might be due to invalid IL or missing references) AirUnitModel obj = ModelExt.SetName(TowerModelBehaviorExt.GetBehavior(towerModel), ((ModContent)this).Name); obj.display = ModContent.CreatePrefabReference(); PathMovementModel behavior = AirUnitModelBehaviorExt.GetBehavior(obj); behavior.speed = Speed; behavior.takeOffTime = 0f; behavior.takeOffAnimTime = 0f; behavior.bankRotation = 30f; AttackAirUnitModel val = TowerModelBehaviorExt.GetBehaviors(towerModel).MinBy((AttackAirUnitModel model) => ((Model)model).name.Length); ModelExt.RemoveChildDependants((Model)(object)val, (IEnumerable)((AttackModel)val).behaviors); ((AttackModel)val).behaviors = Il2CppReferenceArray.op_Implicit((Model[])(object)new Model[3] { ((Il2CppArrayBase)(object)((AttackModel)val).behaviors)[3], ((Il2CppArrayBase)(object)((AttackModel)val).behaviors)[1], ((Il2CppArrayBase)(object)((AttackModel)val).behaviors)[2] }); ModelExt.AddChildDependants((Model)(object)val, (IEnumerable)((AttackModel)val).behaviors); foreach (FigureEightPatternModel behavior3 in AttackModelBehaviorExt.GetBehaviors((AttackModel)(object)val)) { behavior3.useTowerPosition = false; } CenterElipsePatternModel behavior2 = AttackModelBehaviorExt.GetBehavior((AttackModel)(object)val); behavior2.canSelectPoint = false; float widthRadius = (behavior2.heightRadius = 80f); behavior2.widthRadius = widthRadius; towerModel.UpdateTargetProviders(); TowerModelExt.SetDisplay(towerModel); TowerModelBehaviorExt.RemoveBehavior(towerModel); TowerModelBehaviorExt.AddBehavior(towerModel, CreateCircleFootprintModelExt.Create(new Args { radius = 12f })); TowerModel towerFromId = Game.instance.model.GetTowerFromId(TowerType.DartMonkey); TowerModelBehaviorExt.RemoveBehaviors(towerModel); TowerModelBehaviorExt.AddBehavior(towerModel, ModelExt.Duplicate(TowerModelBehaviorExt.GetBehavior(towerFromId), ((Model)towerModel).name)); AttackModelExt.RemoveWeapon((AttackModel)(object)val, ((Il2CppArrayBase)(object)((AttackModel)val).weapons)[0]); TowerModelBehaviorExt.RemoveBehavior(towerModel, TowerModelExt.GetAttackModel(towerModel, "Spectre")); AttackModel val2 = ModelExt.Duplicate(TowerModelExt.GetAttackModel(((Model)Game.instance.model.GetHeroWithNameAndLevel(TowerType.Adora, 10, false)).GetDescendant().towerModel), "Phaser"); WeaponModel obj2 = ModelExt.SetName(((Model)val2).GetChild(), "Phaser"); ProjectileModel val3 = ModelExt.SetName(obj2.projectile, "Phaser"); DamageModel damageModel = ProjectileModelExt.GetDamageModel(val3); LineProjectileEmissionModel child = ((Model)obj2).GetChild(); AttackModelBehaviorExt.RemoveBehaviors(val2); val2.targetProvider = (TargetSupplierModel)(object)CreateTargetFirstAirUnitModelExt.Create(); AttackModelBehaviorExt.AddBehavior(val2, val2.targetProvider); val2.offsetY = 0f; WeaponModelBehaviorExt.AddBehavior(obj2, CreateFireFromAirUnitModelExt.Create()); WeaponModelExt.SetEject(obj2, EjectOffset, false, false, false); obj2.Rate = 1f; child.dontUseTowerPosition = true; ModelExt.SetName(child.displayPath, "Phaser").assetPath = ModContent.CreatePrefabReference(); child.effectAtEndModel.assetId = ModContent.CreatePrefabReference(); child.displayLifetime = 0.2f; ProjectileModelBehaviorExt.RemoveBehaviors(val3); damageModel.damage = 1f; BloonProperties immuneBloonPropertiesOriginal = (BloonProperties)8; damageModel.immuneBloonProperties = (BloonProperties)8; damageModel.immuneBloonPropertiesOriginal = immuneBloonPropertiesOriginal; TowerModelBehaviorExt.AddBehavior(towerModel, val2); AttackModel val4 = ModelExt.Duplicate(TowerModelExt.GetAttackModel(((Model)Game.instance.model.GetHeroWithNameAndLevel(TowerType.Etienne, 10, false)).GetDescendant().ucavTowerModel)); Args val5 = new Args(); ((ModelArgs)val5).name = "PhotonTorpedo"; val5.weapons = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)val4.weapons); val5.range = val4.range; val5.behaviors = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)val4.behaviors); val5.targetProvider = (TargetSupplierModel)(object)CreateTargetStrongAirUnitModelExt.Create(); val5.attackThroughWalls = true; AttackModel val6 = CreateAttackModelExt.Create(val5); WeaponModel val7 = ModelExt.SetName(((Model)val6).GetChild(), "PhotonTorpedo"); ProjectileModel val8 = ModelExt.SetName(val7.projectile, "PhotonTorpedo"); ModelExt.SetName(((Model)val8).GetDescendant(), "PhotonTorpedoExplosion"); DamageModel descendant = ((Model)val8).GetDescendant(); AttackModelBehaviorExt.RemoveBehaviors(val6); AttackModelBehaviorExt.AddBehavior(val6, val6.targetProvider); WeaponModelExt.SetEject(val7, EjectOffset, false, false, false); Args val9 = new Args(); ((ModelArgs)(object)val9).name = "PhotonTorpedo"; val9.count = 1; val9.randomAngle = 90f; val9.behaviors = (EmissionBehaviorModel[])(object)new EmissionBehaviorModel[1] { (EmissionBehaviorModel)CreateEmissionRotationOffBloonDirectionModelExt.Create(new Args { useAirUnitPosition = true, dontSetAfterEmit = true }) }; WeaponModelExt.SetEmission(val7, (EmissionModel)(object)CreateRandomArcEmissionModelExt.Create(val9)); val7.Rate = 2f; ProjectileModelBehaviorExt.GetBehavior(val8).TurnRate = 180f; EffectModel effectModel = ProjectileModelBehaviorExt.GetBehavior(val8).effectModel; MiscModelExt.ApplyDisplay(effectModel); effectModel.lifespan = 0.5f; ProjectileModelBehaviorExt.GetBehavior(val8).Lifespan = 5f; ProjectileModelBehaviorExt.GetBehavior(val8).Speed = 100f; ProjectileModelExt.SetDisplay(val8, "187bc7112ccbf6445afc2ef9173b4568"); descendant.damage = 2f; immuneBloonPropertiesOriginal = (BloonProperties)8; descendant.immuneBloonProperties = (BloonProperties)8; descendant.immuneBloonPropertiesOriginal = immuneBloonPropertiesOriginal; TowerModelBehaviorExt.AddBehavior(towerModel, val6); AttackModel val10 = ModelExt.Duplicate(TowerModelExt.GetAttackModel(((Model)Game.instance.model.GetTower(TowerType.MonkeyBuccaneer, 4, 0, 0)).GetDescendant().tower), "PhaseCannon"); WeaponModel val11 = ModelExt.SetName(((Model)val10).GetChild(), "PhaseCannon"); ProjectileModel val12 = ModelExt.SetName(val11.projectile, "PhaseCannon"); DamageModel damageModel2 = ProjectileModelExt.GetDamageModel(val12); ((Model)val10).GetDescendant().fieldOfView = 90f; AttackModelBehaviorExt.RemoveBehaviors(val10); val10.targetProvider = (TargetSupplierModel)(object)CreateTargetFirstAirUnitModelExt.Create(); AttackModelBehaviorExt.AddBehavior(val10, val10.targetProvider); WeaponModelExt.SetEject(val11, EjectOffset, false, false, false); val11.Rate = 0.5f; Args val13 = new Args(); val13.count = 1; val13.behaviors = (EmissionBehaviorModel[])(object)new EmissionBehaviorModel[1] { (EmissionBehaviorModel)CreateEmissionRotationOffBloonDirectionModelExt.Create(new Args { useAirUnitPosition = true }) }; WeaponModelExt.SetEmission(val11, (EmissionModel)(object)CreateParallelEmissionModelExt.Create(val13)); WeaponModelBehaviorExt.RemoveBehaviors(val11); val12.pierce = 5f; val12.scale = 0.5f; ProjectileModelExt.SetDisplay(val12, "f54fbbae11116a04dafbcde24ff646d8"); immuneBloonPropertiesOriginal = (BloonProperties)8; damageModel2.immuneBloonProperties = (BloonProperties)8; damageModel2.immuneBloonPropertiesOriginal = immuneBloonPropertiesOriginal; TowerModelBehaviorExt.AddBehavior(towerModel, val10); Il2CppGenericIEnumerable.ForEach(((Model)towerModel).GetDescendants(), (Action)delegate(FilterInvisibleModel model) { model.isActive = true; }); } } public class StarshipEnterpriseMod : BloonsTD6Mod { [HarmonyPatch(typeof(TowerInventory), "GetTowerCost")] internal static class TowerInventory_GetTowerCost { [HarmonyPostfix] private static void Postfix(TowerModel tower, ref float __result) { if (((EntityModel)tower).baseId == ModContent.TowerID(0, 0, 0) && __result > 0f) { __result = 1701f; } } } [HarmonyPatch(typeof(TowerInventory), "IsFreeTowerAvailable")] internal static class TowerInventory_IsFreeTowerAvailable { [HarmonyPostfix] private static void Postfix(TowerModel towerModel, bool __result) { dontRoundNextValue = ((EntityModel)towerModel).baseId == ModContent.TowerID(0, 0, 0) && !__result; } } [HarmonyPatch(typeof(Math), "RoundToNearestInt")] internal static class Math_RoundToNearestInt { [HarmonyPrefix] private static bool Prefix(ref int __result, int nearestIntValue) { bool result = true; if (dontRoundNextValue && nearestIntValue == 5) { __result = 1701; result = false; } dontRoundNextValue = false; return result; } } public static readonly ModSettingHotkey EnterpriseHotkey = new ModSettingHotkey((KeyCode)101, (HotkeyModifier)1); public static readonly ModSettingDouble EnterpriseDisplayScale; private static bool dontRoundNextValue; public override void OnFixedUpdate() { dontRoundNextValue = false; } public override void OnNewGameModel(GameModel result) { foreach (TowerModel item in Il2CppGenericIEnumerable.AsIEnumerable(result.GetTowersWithBaseId(ModContent.TowerID(0, 0, 0), false))) { item.cost = 1701f; } } static StarshipEnterpriseMod() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0050: Expected O, but got Unknown ModSettingDouble val = new ModSettingDouble(1.0); ((ModSettingNumber)val).slider = true; val.stepSize = 0.01f; ((ModSettingNumber)val).min = 0.5; ((ModSettingNumber)val).max = 1.0; EnterpriseDisplayScale = val; } } } namespace StarshipEnterprise.Upgrades { public abstract class CareerPath : PathPlusPlus { public override bool ValidTiers(int[] tiers) { return PathPlusPlus.DefaultValidTiers(tiers.Skip(3).Take(3).ToArray()); } } public abstract class CareerPathUpgrade : UpgradePlusPlus where T : CareerPath { public override string Description => ((ModContent)((UpgradePlusPlus)this).Path).Name + " Officer - " + Title + "\n"; private string Title => ((UpgradePlusPlus)this).Tier switch { 1 => "Ensign", 2 => "Lieutenant", 3 => "Lt. Commander", 4 => "Commander", 5 => "Captain", 6 => "Admiral", _ => "Cadet", }; public override string Container => ((ModContent)((UpgradePlusPlus)this).Path).Name + "UpgradeContainer"; } } namespace StarshipEnterprise.Upgrades.Torpedoes { public class ChronitonTorpedoes : ModUpgrade { public override int Path => 1; public override int Tier => 4; public override int Cost => 12345; public override string Description => "Imbue Torpedoes with Chroniton particles, giving them more pierce and making them greatly slow hit Bloons."; public override string Icon => ((ModContent)this).Name; public override void Register() { ((ModUpgrade)this).Register(); GameData.Instance.bloonMutatorData.badImmunityIds = Il2CppStringArrayExt.AddTo(GameData.Instance.bloonMutatorData.badImmunityIds, ((ModContent)this).Name); } public override void ApplyUpgrade(TowerModel towerModel) { ArrayExt.ForEach(ModelExt.FindDescendants((Model)(object)towerModel, "PhotonTorpedo"), (Action)delegate(ProjectileModel proj) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Expected O, but got Unknown proj.pierce *= 1.5f; ProjectileModelBehaviorExt.AddBehavior(proj, CreateSlowModelExt.Create(new Args { multiplier = 0.25f, lifespan = 5f, mutationId = ((ModContent)this).Name, layers = 9999, isUnique = true })); Args val = new Args(); ((ModelArgs)val).name = "Moab"; val.tag = "Moab"; val.slowId = ((ModContent)this).Name; val.slowMultiplier = 1f; val.lifespanOverride = 0.5f; ProjectileModelBehaviorExt.AddBehavior(proj, CreateSlowModifierForTagModelExt.Create(val)); Args val2 = new Args(); ((ModelArgs)val2).name = "Bfb"; val2.tag = "Bfb"; val2.slowId = ((ModContent)this).Name; val2.slowMultiplier = 1f; val2.lifespanOverride = 0.3f; ProjectileModelBehaviorExt.AddBehavior(proj, CreateSlowModifierForTagModelExt.Create(val2)); Args val3 = new Args(); ((ModelArgs)val3).name = "Ddt"; val3.tag = "Ddt"; val3.slowId = ((ModContent)this).Name; val3.slowMultiplier = 1f; val3.lifespanOverride = 0.3f; ProjectileModelBehaviorExt.AddBehavior(proj, CreateSlowModifierForTagModelExt.Create(val3)); Args val4 = new Args(); ((ModelArgs)val4).name = "Zomg"; val4.tag = "Zomg"; val4.slowId = ((ModContent)this).Name; val4.slowMultiplier = 1f; val4.lifespanOverride = 0.1f; ProjectileModelBehaviorExt.AddBehavior(proj, CreateSlowModifierForTagModelExt.Create(val4)); proj.UpdateCollisionPassList(); }); } } public class FasterArming : ModUpgrade { public override int Path => 1; public override int Tier => 1; public override int Cost => 800; public override string Description => "Torpedo take less time to reload time."; public override string Icon => ((ModContent)this).Name; public override void ApplyUpgrade(TowerModel towerModel) { WeaponModel obj = ModelExt.FindDescendant((Model)(object)towerModel, "PhotonTorpedo"); obj.Rate *= 0.8f; } } public class FullSpread : ModUpgrade { public override int Path => 1; public override int Tier => 3; public override int Cost => 2300; public override string Description => "Torpedoes now fire in bursts of 3 in a wide arc."; public override string Icon => ((ModContent)this).Name; public override void ApplyUpgrade(TowerModel towerModel) { RandomArcEmissionModel obj = ModelExt.FindDescendant((Model)(object)towerModel, "PhotonTorpedo"); ((ArcEmissionModel)obj).angle = 90f; obj.randomAngle = 15f; ((ArcEmissionModel)obj).Count = 3; } } public class HighYieldWarheads : ModUpgrade { public override int Path => 1; public override int Tier => 2; public override int Cost => 1000; public override string Description => "Torpedoes deal increased damage, and bonus damage to their primary target."; public override string Icon => ((ModContent)this).Name; public override void ApplyUpgrade(TowerModel towerModel) { ProjectileModel obj = ModelExt.FindDescendant((Model)(object)towerModel, "PhotonTorpedo"); Il2CppGenericIEnumerable.ForEach(((Model)obj).GetDescendants(), (Action)delegate(DamageModel model) { model.damage *= 2f; }); ProjectileModel descendant = ((Model)obj).GetDescendant(); ProjectileModelBehaviorExt.AddBehavior(obj, ModelExt.Duplicate(ProjectileModelBehaviorExt.GetBehavior(descendant))); } } public class PhotonTorpedoPath : PathPlusPlus { public override int UpgradeCount => 6; public override int ExtendVanillaPath => 1; public override bool ValidTiers(int[] tiers) { return PathPlusPlus.DefaultValidTiers(tiers.Take(3).ToArray()); } } public class QuantumTorpedoes : ModUpgrade { public override int Path => 1; public override int Tier => 5; public override int Cost => 52000; public override string Description => "Upgrade Photon Torpedoes to powerful Quantum Torpedoes. Explosion damage, radius and pierce increased."; public override string Icon => ((ModContent)this).Name; public override void ApplyUpgrade(TowerModel towerModel) { ArrayExt.ForEach(ModelExt.FindDescendants((Model)(object)towerModel, "PhotonTorpedo"), (Action)delegate(WeaponModel weapon) { ProjectileModel projectile = weapon.projectile; ProjectileModelExt.ApplyDisplay(projectile); ProjectileModel descendant = ((Model)projectile).GetDescendant(); Il2CppGenericIEnumerable.ForEach(((Model)projectile).GetDescendants(), (Action)delegate(DamageModel model) { model.damage *= 5f; }); descendant.radius *= 1.5f; descendant.pierce *= 2f; MiscModelExt.ApplyDisplay(ProjectileModelBehaviorExt.GetBehavior(projectile).effectModel); }); } } public class TransphasicTorpedoes : UpgradePlusPlus { public override int Tier => 6; public override int Cost => 275000; public override string Description => "Torpedoes now phase through Bloon layers, dealing massive damage to all layers at the same time."; public override string Container => UpgradePlusPlus.UpgradeContainerPlatinum; public override string Icon => ((ModContent)this).Name; public override void ApplyUpgrade(TowerModel towerModel) { ArrayExt.ForEach(ModelExt.FindDescendants((Model)(object)towerModel, "PhotonTorpedo"), (Action)delegate(ProjectileModel model) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown string text = default(string); List list = default(List); foreach (IGrouping item in from bloonModel in (IEnumerable)Game.instance.model.bloons group bloonModel.layerNumber by bloonModel.baseId) { IEnumerableExt.Deconstruct(item, ref text, ref list); string text2 = text; List source = list; Args val = new Args(); ((ModelArgs)val).name = text2; val.bloonId = text2; val.damageMultiplier = source.First(); val.includeChildren = true; ProjectileModelBehaviorExt.AddBehavior(model, CreateDamageModifierForBloonTypeModelExt.Create(val)); } ProjectileModelBehaviorExt.AddBehavior(model, CreateStripChildrenModelExt.Create()); model.hasDamageModifiers = true; }); } } } namespace StarshipEnterprise.Upgrades.Tactical { public class AttackPatternAlpha : CareerPathUpgrade { public override int Cost => 1000; public override int Tier => 1; public override string Description => base.Description + "Increase the attack speed of all of Enterprise's weapons."; public override void ApplyUpgrade(TowerModel towerModel) { Il2CppGenericIEnumerable.ForEach(((Model)towerModel).GetDescendants(), (Action)delegate(WeaponModel weapon) { weapon.Rate *= 0.8f; }); } } public class AttackPatternOmega : CareerPathUpgrade { public override int Cost => 240000; public override int Tier => 6; public override string Description => base.Description + "Enterprise's attacks do bonus damage based on maximum HP of Bloons."; public override void ApplyUpgrade(TowerModel towerModel) { Il2CppGenericIEnumerable.ForEach(((Model)towerModel).GetDescendants(), (Action)delegate(ProjectileModel projectile) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0030: Expected O, but got Unknown if (ProjectileModelBehaviorExt.HasBehavior(projectile)) { ProjectileModelBehaviorExt.AddBehavior(projectile, CreateDamagePercentOfMaxModelExt.Create(new Args { percent = 0.005f, tags = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)new Il2CppStringArray(0L)) })); } }); } } public class DivertPowerWeapons : CareerPathUpgrade { public class BuffIconDivertPowerWeapons : ModBuffIcon { } [HarmonyPatch(typeof(RateMutator), "Mutate")] internal static class RateMutator_Mutate { [HarmonyPostfix] private static void Postfix(RateMutator __instance, Model model) { if (!(((BehaviorMutator)__instance).id != "DivertPowerWeapons")) { Il2CppGenericIEnumerable.ForEach(model.GetDescendants(), (Action)delegate(PathMovementModel movementModel) { movementModel.speed /= 10f; }); Il2CppGenericIEnumerable.ForEach(model.GetDescendants(), (Action)delegate(FighterMovementModel movementModel) { movementModel.maxSpeed /= 10f; }); } } } public override int Cost => 10000; public override int Tier => 4; public override string DisplayName => "Divert Power: Weapons"; public override string Description => base.Description + "Ability: Divert power from all non essential systems and give it to Weapons."; public override bool Ability => true; public override void ApplyUpgrade(TowerModel towerModel) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_012d: Expected O, but got Unknown //IL_0137: Expected O, but got Unknown BuffIconDivertPowerWeapons instance = ModContent.GetInstance(); Args val = new Args(); ((ModelArgs)(object)val).name = ((ModContent)this).Name; val.displayName = ((NamedModContent)this).DisplayName; val.description = ((NamedModContent)this).Description; val.animation = -1; val.icon = ((UpgradePlusPlus)this).IconReference; val.Cooldown = 60f; Model[] array = new Model[2]; Args val2 = new Args(); ((ModelArgs)(object)val2).name = ((ModContent)this).Name; val2.mutatorId = ((ModContent)this).Name; val2.isUnique = true; val2.rateModifier = 0.5f; val2.range = ((EntityModel)towerModel).radius; val2.maxNumTowersModified = 1f; val2.canEffectThisTower = true; val2.lifespan = 20f; val2.buffLocsName = ((ModBuffIcon)instance).BuffLocsName; val2.buffIconName = ((ModBuffIcon)instance).BuffIconName; TowerFilterModel[] array2 = new TowerFilterModel[1]; Args val3 = new Args(); val3.baseIds = new string[1] { ((UpgradePlusPlus)this).Path.Tower }; array2[0] = (TowerFilterModel)CreateFilterInBaseTowerIdModelExt.Create(val3); val2.filters = (TowerFilterModel[])(object)array2; array[0] = (Model)CreateActivateRateSupportZoneModelExt.Create(val2); array[1] = (Model)CreateCreateSoundOnAbilityModelExt.Create(new Args { sound = CreateSoundModelExt.Create(new Args { assetId = new AudioClipReference { guidRef = "c72781a0643d41c4b976110d1516fabc" } }) }); val.behaviors = (Model[])(object)array; val.addedViaUpgrade = ((ModContent)this).Id; TowerModelBehaviorExt.AddBehavior(towerModel, CreateAbilityModelExt.Create(val)); } } public class ResistanceIsFutile : CareerPathUpgrade { public override int Cost => 42000; public override int Tier => 5; public override string Description => base.Description + "Enterprise's attacks do bonus damage to Moab-Class Bloons."; public override void ApplyUpgrade(TowerModel towerModel) { Il2CppGenericIEnumerable.ForEach(((Model)towerModel).GetDescendants(), (Action)delegate(ProjectileModel model) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown if (ProjectileModelBehaviorExt.HasBehavior(model)) { Args val = new Args(); ((ModelArgs)val).name = "Moabs"; val.tag = "Moabs"; val.damageMultiplier = 1.2f; val.damageAddative = 2f; val.applyOverMaxDamage = true; ProjectileModelBehaviorExt.AddBehavior(model, CreateDamageModifierForTagModelExt.Create(val)); model.hasDamageModifiers = true; } }); } } public class Tactical : CareerPath { public override int UpgradeCount => 6; protected override int Order => 1; } public class TacticalInitiative : CareerPathUpgrade { public override int Cost => 1700; public override int Tier => 2; public override string Description => base.Description + "Increase the pierce of all of Enterprise's weapons."; public override void ApplyUpgrade(TowerModel towerModel) { Il2CppGenericIEnumerable.ForEach(((Model)towerModel).GetDescendants(), (Action)delegate(ProjectileModel proj) { if (ProjectileModelBehaviorExt.HasBehavior(proj)) { proj.pierce += (float)(int)Math.Ceiling((double)proj.pierce * 0.2); } }); } } public class TargetShields : CareerPathUpgrade { public override int Cost => 2700; public override int Tier => 3; public override string Description => base.Description + "Enterpise's attacks do bonus damage to Ceramic and Fortified Bloons"; public override void ApplyUpgrade(TowerModel towerModel) { Il2CppGenericIEnumerable.ForEach(((Model)towerModel).GetDescendants(), (Action)delegate(ProjectileModel model) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown if (ProjectileModelBehaviorExt.HasBehavior(model)) { Args val = new Args(); ((ModelArgs)val).name = "Fortified"; val.tag = "Fortified"; val.damageMultiplier = 1.2f; val.damageAddative = 2f; val.applyOverMaxDamage = true; ProjectileModelBehaviorExt.AddBehavior(model, CreateDamageModifierForTagModelExt.Create(val)); Args val2 = new Args(); ((ModelArgs)val2).name = "Ceramic"; val2.tag = "Ceramic"; val2.damageMultiplier = 1.2f; val2.damageAddative = 2f; val2.applyOverMaxDamage = true; ProjectileModelBehaviorExt.AddBehavior(model, CreateDamageModifierForTagModelExt.Create(val2)); model.hasDamageModifiers = true; } }); } } } namespace StarshipEnterprise.Upgrades.Science { public class ModulateFrequencies : CareerPathUpgrade { public override int Cost => 700; public override int Tier => 1; public override string Description => base.Description + "All of Enterprise's attacks can pop Purple Bloons."; public override string Icon => ((ModContent)this).Name; public override void ApplyUpgrade(TowerModel towerModel) { Il2CppGenericIEnumerable.ForEach(((Model)towerModel).GetDescendants(), (Action)delegate(DamageModel model) { model.immuneBloonProperties = (BloonProperties)0; }); } } public class RefuseThePrimeDirective : CareerPathUpgrade { public class BuffIconRefuseThePrimeDirective : ModBuffIcon { } [HarmonyPatch(typeof(RateMutator), "Mutate")] internal static class RateMutator_Mutate { [HarmonyPostfix] private static void Postfix(RateSupportMutator __instance, Model model, ref bool __result) { TowerModel val = default(TowerModel); if (!(((BehaviorMutator)__instance).id != "RefuseThePrimeDirective") && Il2CppSystemObjectExt.Is((Il2CppObjectBase)(object)model, ref val)) { __result = Science.PrimeDirectiveTech(val, Math.Clamp(val.tier, 0, 4)); } } } public override int Cost => 17770; public override int Tier => 4; public override bool Ability => true; public override string Description => base.Description + "Ability: Grant all Monkeys temporary access to advanced Starfleet technology."; public override void ApplyUpgrade(TowerModel towerModel, int tier) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_0135: Expected O, but got Unknown //IL_013f: Expected O, but got Unknown BuffIconRefuseThePrimeDirective instance = ModContent.GetInstance(); Args val = new Args(); ((ModelArgs)(object)val).name = ((ModContent)this).Name; val.displayName = ((NamedModContent)this).DisplayName; val.description = ((NamedModContent)this).Description; val.animation = -1; val.icon = ((UpgradePlusPlus)this).IconReference; val.Cooldown = 60f; Model[] array = new Model[2]; Args val2 = new Args(); val2.mutatorId = ((ModContent)this).Name; val2.isUnique = true; val2.rateModifier = 1f; val2.range = 99999f; val2.maxNumTowersModified = 99999f; val2.lifespan = 20f; val2.displayModel = CreateDisplayModelExt.Create(new Args { display = ModContent.CreatePrefabReference(), category = (DisplayCategory)64 }); val2.buffLocsName = ((ModBuffIcon)instance).BuffLocsName; val2.buffIconName = ((ModBuffIcon)instance).BuffIconName; val2.filters = (TowerFilterModel[])(object)new TowerFilterModel[1] { (TowerFilterModel)CreateFilterInBaseTowerIdModelExt.Create(new Args { baseIds = Science.PrimeDirectiveModes.Keys.ToArray() }) }; array[0] = (Model)CreateActivateRateSupportZoneModelExt.Create(val2); array[1] = (Model)CreateCreateSoundOnAbilityModelExt.Create(new Args { sound = CreateSoundModelExt.Create(new Args { assetId = new AudioClipReference { guidRef = "8c509ff34947707469192054a463f6b7" } }) }); val.behaviors = (Model[])(object)array; val.addedViaUpgrade = ((ModContent)this).Id; TowerModelBehaviorExt.AddBehavior(towerModel, CreateAbilityModelExt.Create(val)); } } public class RepealThePrimeDirective : CareerPathUpgrade { public class BuffIconRepealThePrimeDirective : ModBuffIcon { } [HarmonyPatch(typeof(RateMutator), "Mutate")] internal static class RateMutator_Mutate { [HarmonyPostfix] private static bool Prefix(RateSupportMutator __instance, Model model, ref bool __result) { TowerModel val = default(TowerModel); if (((BehaviorMutator)__instance).id != "RepealThePrimeDirective" || !Il2CppSystemObjectExt.Is((Il2CppObjectBase)(object)model, ref val)) { return true; } __result = Science.PrimeDirectiveTech(val, 5); ArrayExt.ForEach(ModelExt.FindDescendants((Model)(object)val, "Phaser"), (Action)delegate(WeaponModel w) { w.Rate *= 0.75f; }); ArrayExt.ForEach(ModelExt.FindDescendants((Model)(object)val, "PhotonTorpedo"), (Action)delegate(WeaponModel w) { w.Rate *= 0.75f; }); ArrayExt.ForEach(ModelExt.FindDescendants((Model)(object)val, "PhaseCannon"), (Action)delegate(WeaponModel w) { w.Rate *= 0.75f; }); return false; } } [HarmonyPatch(typeof(RateSupportMutator), "Mutate")] internal static class RateSupportMutator_Mutate { [HarmonyPostfix] private static void Postfix(RateSupportMutator __instance, Model model, ref bool __result) { TowerModel towerModel = default(TowerModel); if (!(((BehaviorMutator)__instance).id != "RepealThePrimeDirective") && Il2CppSystemObjectExt.Is((Il2CppObjectBase)(object)model, ref towerModel)) { __result = Science.PrimeDirectiveTech(towerModel, 5); } } } public override int Cost => 71770; public override int Tier => 5; public override string Description => base.Description + "Monkeys have permanent access to even more advanced Starfleet technology. Ability now increases its attack speed."; public override void ApplyUpgrade(TowerModel towerModel, int tier) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown if (tier < 6) { AbilityModelBehaviorExt.GetBehavior(ModelExt.SetName(ModelExt.FindDescendant((Model)(object)towerModel, "RefuseThePrimeDirective"), ((ModContent)this).Name)).mutatorId = ((ModContent)this).Name; BuffIconRepealThePrimeDirective instance = ModContent.GetInstance(); Args val = new Args(); ((ModelArgs)val).name = ((ModContent)this).Name; val.multiplier = 1f; val.isUnique = true; val.mutatorId = ((ModContent)this).Name; val.isGlobal = true; val.priority = -1; val.buffLocsName = ((ModBuffIcon)instance).BuffLocsName; val.buffIconName = ((ModBuffIcon)instance).BuffIconName; TowerModelBehaviorExt.AddBehavior(towerModel, CreateRateSupportModelExt.Create(val)); } } } public class ReverseThePrimeDirective : CareerPathUpgrade { public class BuffIconReverseThePrimeDirective : ModBuffIcon { } [HarmonyPatch(typeof(RateMutator), "Mutate")] internal static class RateMutator_Mutate { [HarmonyPostfix] private static bool Prefix(RateSupportMutator __instance, Model model, ref bool __result) { TowerModel val = default(TowerModel); if (((BehaviorMutator)__instance).id != "ReverseThePrimeDirective" || !Il2CppSystemObjectExt.Is((Il2CppObjectBase)(object)model, ref val)) { return true; } __result = Science.PrimeDirectiveTech(val, 6); ArrayExt.ForEach(ModelExt.FindDescendants((Model)(object)val, "Phaser"), (Action)delegate(WeaponModel w) { w.Rate *= 0.5f; }); ArrayExt.ForEach(ModelExt.FindDescendants((Model)(object)val, "PhotonTorpedo"), (Action)delegate(WeaponModel w) { w.Rate *= 0.5f; }); ArrayExt.ForEach(ModelExt.FindDescendants((Model)(object)val, "PhaseCannon"), (Action)delegate(WeaponModel w) { w.Rate *= 0.5f; }); __result = true; return false; } } [HarmonyPatch(typeof(RateSupportMutator), "Mutate")] internal static class RateSupportMutator_Mutate { [HarmonyPostfix] private static void Postfix(RateSupportMutator __instance, Model model, ref bool __result) { TowerModel towerModel = default(TowerModel); if (!(((BehaviorMutator)__instance).id != "ReverseThePrimeDirective") && Il2CppSystemObjectExt.Is((Il2CppObjectBase)(object)model, ref towerModel)) { __result = Science.PrimeDirectiveTech(towerModel, 6); } } } public override int Cost => 171170; public override int Tier => 6; public override string Description => base.Description + "Give all Monkeys the most advanced Starfleet technology possible."; public override void ApplyUpgrade(TowerModel towerModel) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown ActivateRateSupportZoneModel behavior = AbilityModelBehaviorExt.GetBehavior(ModelExt.SetName(ModelExt.FindDescendant((Model)(object)towerModel, "RefuseThePrimeDirective"), ((ModContent)this).Name)); behavior.mutatorId = ((ModContent)this).Name; behavior.rateModifier = 0.5f; BuffIconReverseThePrimeDirective instance = ModContent.GetInstance(); Args val = new Args(); ((ModelArgs)val).name = ((ModContent)this).Name; val.multiplier = 1f; val.isUnique = true; val.mutatorId = ((ModContent)this).Name; val.isGlobal = true; val.priority = -1; val.buffLocsName = ((ModBuffIcon)instance).BuffLocsName; val.buffIconName = ((ModBuffIcon)instance).BuffIconName; TowerModelBehaviorExt.AddBehavior(towerModel, CreateRateSupportModelExt.Create(val)); } } public class ScanForLifeForms : CareerPathUpgrade { public override int Cost => 1700; public override int Tier => 2; public override string Description => base.Description + "Allows Enterprise to see and pop Camo Bloons."; public override void ApplyUpgrade(TowerModel towerModel) { Il2CppGenericIEnumerable.ForEach(((Model)towerModel).GetDescendants(), (Action)delegate(FilterInvisibleModel model) { model.isActive = false; }); } } public class Science : CareerPath { public enum PrimeDirectiveMode { Phaser, PhaserDrones, PhotonTorpedo, PhotonTorpedoOnSelf, PhotonTorpedoOnPoint, PhotonTorpedoOnTarget, PhaseCannon, PhaseCannonSpread } [HarmonyPatch(typeof(Support), "IsInZone")] internal static class Support_IsInZone { [HarmonyPrefix] private static bool Prefix(Support __instance) { return !((RootBehavior)__instance).model.name.Contains("PrimeDirective"); } } public static readonly Dictionary PrimeDirectiveModes = new Dictionary { { TowerType.DartMonkey, PrimeDirectiveMode.PhaseCannonSpread }, { TowerType.BoomerangMonkey, PrimeDirectiveMode.Phaser }, { TowerType.TackShooter, PrimeDirectiveMode.PhaseCannonSpread }, { TowerType.BombShooter, PrimeDirectiveMode.PhotonTorpedo }, { TowerType.GlueGunner, PrimeDirectiveMode.PhaseCannon }, { TowerType.IceMonkey, PrimeDirectiveMode.PhotonTorpedoOnSelf }, { TowerType.SniperMonkey, PrimeDirectiveMode.Phaser }, { TowerType.DartlingGunner, PrimeDirectiveMode.PhaseCannonSpread }, { TowerType.MonkeySub, PrimeDirectiveMode.Phaser }, { TowerType.MonkeyBuccaneer, PrimeDirectiveMode.PhotonTorpedo }, { TowerType.MortarMonkey, PrimeDirectiveMode.PhotonTorpedoOnPoint }, { TowerType.MonkeyAce, PrimeDirectiveMode.Phaser }, { TowerType.HeliPilot, PrimeDirectiveMode.PhaseCannon }, { TowerType.NinjaMonkey, PrimeDirectiveMode.PhaseCannonSpread }, { TowerType.WizardMonkey, PrimeDirectiveMode.Phaser }, { TowerType.SuperMonkey, PrimeDirectiveMode.PhaseCannonSpread }, { TowerType.Druid, PrimeDirectiveMode.PhaseCannonSpread }, { TowerType.Alchemist, PrimeDirectiveMode.PhotonTorpedo }, { TowerType.EngineerMonkey, PrimeDirectiveMode.Phaser }, { TowerType.BeastHandler, PrimeDirectiveMode.Phaser }, { TowerType.Quincy, PrimeDirectiveMode.Phaser }, { TowerType.Gwendolin, PrimeDirectiveMode.PhaseCannon }, { TowerType.StrikerJones, PrimeDirectiveMode.PhotonTorpedo }, { TowerType.ObynGreenfoot, PrimeDirectiveMode.PhotonTorpedo }, { TowerType.CaptainChurchill, PrimeDirectiveMode.PhaseCannon }, { TowerType.Ezili, PrimeDirectiveMode.Phaser }, { TowerType.PatFusty, PrimeDirectiveMode.PhotonTorpedoOnTarget }, { TowerType.Adora, PrimeDirectiveMode.Phaser }, { TowerType.AdmiralBrickell, PrimeDirectiveMode.Phaser }, { TowerType.Etienne, PrimeDirectiveMode.PhaserDrones }, { TowerType.Sauda, PrimeDirectiveMode.PhotonTorpedoOnTarget }, { TowerType.Psi, PrimeDirectiveMode.Phaser }, { TowerType.Geraldo, PrimeDirectiveMode.Phaser }, { TowerType.SunAvatarMini, PrimeDirectiveMode.PhaseCannonSpread }, { TowerType.TrueSunAvatarMini, PrimeDirectiveMode.PhaseCannonSpread }, { TowerType.Sentry, PrimeDirectiveMode.Phaser }, { TowerType.SentryBoom, PrimeDirectiveMode.PhotonTorpedo }, { TowerType.SentryCold, PrimeDirectiveMode.Phaser }, { TowerType.SentryEnergy, PrimeDirectiveMode.PhaseCannon }, { TowerType.SentryCrushing, PrimeDirectiveMode.PhaseCannon }, { TowerType.SentryParagon, PrimeDirectiveMode.PhaseCannon } }; public override int UpgradeCount => 6; protected override int Order => 3; public static bool PrimeDirectiveTech(TowerModel towerModel, int tier) { //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Expected O, but got Unknown //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Expected O, but got Unknown //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Expected O, but got Unknown //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Expected O, but got Unknown //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Expected O, but got Unknown //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Expected O, but got Unknown if (!PrimeDirectiveModes.TryGetValue(((EntityModel)towerModel).baseId, out var value)) { return false; } TowerModel val = (TowerModel)((value != PrimeDirectiveMode.PhaserDrones) ? ((object)towerModel) : ((object)TowerModelBehaviorExt.GetBehavior(towerModel).droneModel)); TowerModel val2 = val; AttackModel val3; switch (value) { default: val3 = ModelExt.Duplicate(ModelExt.FindDescendant((Model)(object)GetEnterprise(tier, 0, 0), "Phaser")); if (tier >= 3) { WeaponModel child2 = ((Model)val3).GetChild(); child2.Rate /= 3f; } break; case PrimeDirectiveMode.PhotonTorpedo: case PrimeDirectiveMode.PhotonTorpedoOnSelf: case PrimeDirectiveMode.PhotonTorpedoOnPoint: case PrimeDirectiveMode.PhotonTorpedoOnTarget: { val3 = ModelExt.Duplicate(ModelExt.FindDescendant((Model)(object)GetEnterprise(0, tier, 0), "PhotonTorpedo")); RandomArcEmissionModel descendant2 = ((Model)val3).GetDescendant(); EmissionModelBehaviorExt.RemoveBehavior((EmissionModel)(object)descendant2); if (!ModelExt.HasDescendant((Model)(object)val2)) { WeaponModelExt.SetEmission(((Model)val3).GetChild(), (EmissionModel)(object)CreateSingleEmissionModelExt.Create()); if (tier >= 3) { WeaponModel child = ((Model)val3).GetChild(); child.Rate /= 3f; } } else { descendant2.randomAngle = 0f; } break; } case PrimeDirectiveMode.PhaseCannon: case PrimeDirectiveMode.PhaseCannonSpread: { val3 = ModelExt.Duplicate(ModelExt.FindDescendant((Model)(object)GetEnterprise(0, 0, tier), "PhaseCannon")); AttackModelExt.RemoveFilter(val3); ParallelEmissionModel descendant = ((Model)val3).GetDescendant(); if (!TowerModelBehaviorExt.HasBehavior(val2)) { EmissionModelBehaviorExt.RemoveBehavior((EmissionModel)(object)descendant); } if (!TowerModelBehaviorExt.HasBehavior(val2)) { descendant.spreadLength /= 2f; MiscModelExt.UpdateOffset(descendant); } break; } } Il2CppGenericIEnumerable.ForEach(((Model)val3).GetDescendants(), (Action)delegate(FilterInvisibleModel model) { model.isActive = false; }); Il2CppGenericIEnumerable.ForEach(((Model)val3).GetDescendants(), (Action)delegate(DamageModel model) { model.immuneBloonProperties = (BloonProperties)0; }); if (Il2CppGenericIEnumerable.Any(((Model)val2).GetDescendants(), (Func)((TargetSupplierModel model) => model.GetName() == "Close" || Il2CppSystemObjectExt.Is((Il2CppObjectBase)(object)model)))) { AttackModelBehaviorExt.RemoveBehavior(val3); val3.targetProvider = null; } WeaponModel child3 = ((Model)val3).GetChild(); if (!val2.isGlobalRange && !TowerModelBehaviorExt.HasBehavior(towerModel)) { val3.range = towerModel.range; } FilterInvisibleModel descendant3 = ((Model)towerModel).GetDescendant(); bool camo = descendant3 != null && descendant3.isActive; Il2CppGenericIEnumerable.ForEach(((Model)val3).GetDescendants(), (Action)delegate(FilterInvisibleModel camoModel) { camoModel.isActive = camo; }); Vector3 eject = WeaponModelExt.GetEject(((Model)val2).GetDescendant()); if (((EntityModel)val2).baseId == TowerType.AdmiralBrickell) { eject = WeaponModelExt.GetEject(ModelExt.FindDescendants((Model)(object)val2).Skip(1).First()); } eject.y -= 1f; foreach (WeaponModel item in (Il2CppArrayBase)(object)val3.weapons) { if (!TowerModelBehaviorExt.HasBehavior(val2)) { WeaponModelBehaviorExt.RemoveBehavior(item); } WeaponModelExt.SetEject(item, eject, false, false, false); } RotateToTargetModel val4 = default(RotateToTargetModel); if (AttackModelBehaviorExt.HasBehavior(TowerModelExt.GetAttackModel(val2), ref val4)) { AttackModelBehaviorExt.AddBehavior(val3, ModelExt.Duplicate(((Model)val2).GetDescendant())); EmissionModel val5 = default(EmissionModel); if (val4.additionalRotation != 0 && ModelExt.HasDescendant((Model)(object)val3, ref val5)) { if (Il2CppSystemObjectExt.Is((Il2CppObjectBase)(object)val5)) { EmissionModelBehaviorExt.AddBehavior(val5, CreateEmissionArcRotationOffTowerDirectionModelExt.Create(new Args { offsetRotation = -val4.additionalRotation })); } else { EmissionModelBehaviorExt.AddBehavior(val5, CreateEmissionRotationOffTowerDirectionModelExt.Create(new Args { offsetRotation = -val4.additionalRotation })); } } } switch (value) { case PrimeDirectiveMode.PhotonTorpedoOnSelf: { ProjectileModel descendant4 = ((Model)child3.projectile).GetDescendant(); EffectModel effectModel = ((Model)child3).GetDescendant().effectModel; WeaponModelExt.SetProjectile(child3, descendant4); WeaponModelBehaviorExt.AddBehavior(child3, CreateEjectEffectModelExt.Create(new Args { effectModel = effectModel, lifespan = effectModel.lifespan, fullscreen = effectModel.fullscreen })); break; } case PrimeDirectiveMode.PhotonTorpedoOnPoint: WeaponModelExt.SetEmission(child3, (EmissionModel)(object)ModelExt.Duplicate(((Model)val2).GetDescendant())); ProjectileModelBehaviorExt.AddBehavior(child3.projectile, CreateInstantModelExt.Create(new Args { destroyIfInvalid = true })); ProjectileModelBehaviorExt.AddBehavior(child3.projectile, CreateAgeModelExt.Create(new Args { lifespan = 0.1f })); ProjectileModelBehaviorExt.RemoveBehavior(child3.projectile); ProjectileModelBehaviorExt.RemoveBehavior(child3.projectile); AttackModelExt.AddWeapon(TowerModelExt.GetAttackModel(val2), child3); return true; case PrimeDirectiveMode.PhotonTorpedoOnTarget: WeaponModelExt.SetEmission(((Model)val3).GetChild(), (EmissionModel)(object)CreateInstantDamageEmissionModelExt.Create()); ProjectileModelBehaviorExt.AddBehavior(child3.projectile, CreateInstantModelExt.Create(new Args { destroyIfInvalid = true })); ProjectileModelBehaviorExt.RemoveBehavior(child3.projectile); break; case PrimeDirectiveMode.PhaseCannonSpread: { int num = ((Model)child3).GetChild().count; EmissionWithOffsetsModel val6 = default(EmissionWithOffsetsModel); if (ModelExt.HasDescendant((Model)(object)TowerModelExt.GetAttackModel(val2), ref val6)) { EmissionWithOffsetsModel val7 = ModelExt.Duplicate(val6); val7.projectileCount = num; WeaponModelExt.SetEmission(child3, (EmissionModel)(object)val7); } ArcEmissionModel val8 = default(ArcEmissionModel); if (ModelExt.HasDescendant((Model)(object)TowerModelExt.GetAttackModel(val2), ref val8)) { ArcEmissionModel val9 = ModelExt.Duplicate(val8); num = ((Model)child3).GetChild().count; if (val9.angle >= 360f) { num *= 4; } val9.count = num; WeaponModelExt.SetEmission(child3, (EmissionModel)(object)val9); ((Model)child3).GetDescendant().Lifespan = ((Model)val2).GetDescendant().Lifespan; } RandomEmissionModel val10 = default(RandomEmissionModel); if (ModelExt.HasDescendant((Model)(object)TowerModelExt.GetAttackModel(val2), ref val10)) { RandomEmissionModel val11 = ModelExt.Duplicate(val10); val11.count = num; WeaponModelExt.SetEmission(child3, (EmissionModel)(object)val11); ((Model)child3).GetDescendant().Lifespan = ((Model)val2).GetDescendant().Lifespan; } if (((EntityModel)val2).baseId == TowerType.DartlingGunner) { val3.fireWithoutTarget = true; } break; } } TowerModelBehaviorExt.AddBehavior(val2, val3); return true; } private static TowerModel GetEnterprise(int t1, int t2, int t3) { TowerModel val = ModContent.GetTowerModel(Math.Clamp(t1, 0, 5), Math.Clamp(t2, 0, 5), Math.Clamp(t3, 0, 5)); if (t1 >= 6 || t2 >= 6 || t3 >= 6) { val = ModelExt.Duplicate(val); } foreach (UpgradePlusPlus item in ((PathPlusPlus)ModContent.GetInstance()).Upgrades.Values.Where((UpgradePlusPlus u) => u.Tier <= t1)) { item.ApplyUpgrade(val); item.ApplyUpgrade(val, t1); } foreach (UpgradePlusPlus item2 in ((PathPlusPlus)ModContent.GetInstance()).Upgrades.Values.Where((UpgradePlusPlus u) => u.Tier <= t2)) { item2.ApplyUpgrade(val); item2.ApplyUpgrade(val, t2); } foreach (UpgradePlusPlus item3 in ((PathPlusPlus)ModContent.GetInstance()).Upgrades.Values.Where((UpgradePlusPlus u) => u.Tier <= t3)) { item3.ApplyUpgrade(val); item3.ApplyUpgrade(val, t3); } return val; } } public class SurgicalStrikes : CareerPathUpgrade { public override int Cost => 7000; public override int Tier => 3; public override string Description => base.Description + "Enterprise's attacks remove Regrow, Camo and Fortified properties from Bloons."; public override void ApplyUpgrade(TowerModel towerModel) { Il2CppGenericIEnumerable.ForEach(((Model)towerModel).GetDescendants(), (Action)delegate(ProjectileModel projectile) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0053: Expected O, but got Unknown if (ProjectileModelBehaviorExt.HasBehavior(projectile)) { ProjectileModelBehaviorExt.AddBehavior(projectile, CreateRemoveBloonModifiersModelExt.Create(new Args { cleanseRegen = true, cleanseCamo = true, cleanseFortified = true, cleanseOnlyIfDamaged = true, bloonTagExcludeList = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)new Il2CppStringArray(0L)), bloonTagExplicitList = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)new Il2CppStringArray(0L)) })); projectile.UpdateCollisionPassList(); } }); } } } namespace StarshipEnterprise.Upgrades.Refit { public class AmbassadorClass : RefitUpgrade { public override int Tier => 3; public override int Cost => 7010; public override string Description => "Upgrade to the Enterprise-C, an Ambassador class starship.\n" + base.Description; public override float BuffFactor => 0.3f; public override float Speed => 40f; } public class ConstitutionRefit : RefitUpgrade { public override int Tier => 1; public override int Cost => 1170; public override string Description => "Upgrade to the Enterprise-A, a Constitution-II class starship.\n" + base.Description; public override float BuffFactor => 0.1f; } public class ExcelsiorClass : RefitUpgrade { public override int Tier => 2; public override int Cost => 2700; public override string Description => "Upgrade to the Enterprise-B, an Excelsior class starship.\n" + base.Description; public override float BuffFactor => 0.2f; public override Vector3 EjectOffset => new Vector3(0f, 30f, 5f); public override float Speed => 50f; } public class GalaxyClass : RefitUpgrade { public override int Tier => 4; public override int Cost => 17010; public override string Description => "Upgrade to the Enterprise-D, a Galaxy class starship.\n" + base.Description; public override float BuffFactor => 0.4f; public override float Speed => 30f; } public class OdysseyClass : RefitUpgrade { public override int Tier => 6; public override int Cost => 97000; public override string Description => "Upgrade to the Enterprise-F, an Odyssey class starship.\n" + base.Description; public override float BuffFactor => 1f; public override string Container => UpgradePlusPlus.UpgradeContainerPlatinum; public override Vector3 EjectOffset => new Vector3(0f, 40f, 5f); public override float Speed => 30f; } public class RefitPath : PathPlusPlus { public override int UpgradeCount => 6; protected override int Order => 4; public override int Priority => 100; public override bool ValidTiers(int[] tiers) { return true; } } public abstract class RefitUpgrade : UpgradePlusPlus { public override string Description => "Increased pierce and damage for all weapons."; public override string Portrait => ((ModContent)this).Name + "-Portrait"; public abstract float BuffFactor { get; } public virtual Vector3 EjectOffset => StarshipEnterprise.EjectOffset; public virtual float Speed => StarshipEnterprise.Speed; public abstract PrefabReference Display { get; } public override void ApplyUpgrade(TowerModel towerModel, int tier) { if (((UpgradePlusPlus)this).Tier == tier) { TowerModelBehaviorExt.GetBehavior(towerModel).display = Display; ((Model)towerModel).GetDescendant().speed = Speed; Il2CppGenericIEnumerable.ForEach(((Model)towerModel).GetDescendants(), (Action)delegate(WeaponModel weapon) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) WeaponModelExt.SetEject(weapon, EjectOffset, true, false, false); }); towerModel.portrait = ((UpgradePlusPlus)this).PortraitReference; } Il2CppGenericIEnumerable.ForEach(((Model)towerModel).GetDescendants(), (Action)delegate(ProjectileModel projectile) { projectile.pierce += (float)(int)Math.Ceiling(projectile.pierce * BuffFactor); }); Il2CppGenericIEnumerable.ForEach(((Model)towerModel).GetDescendants(), (Action)delegate(DamageModel damage) { damage.damage += (float)(int)Math.Ceiling(damage.damage * BuffFactor); }); Il2CppGenericIEnumerable.ForEach(((Model)towerModel).GetDescendants(), (Action)delegate(CritMultiplierModel crit) { crit.damage += (float)(int)Math.Ceiling(crit.damage * BuffFactor); }); } } public abstract class RefitUpgrade : RefitUpgrade where T : ModDisplay { public override PrefabReference Display => ModContent.CreatePrefabReference(); } public class SovereignClass : RefitUpgrade { public override int Tier => 5; public override int Cost => 47000; public override string Description => "Upgrade to the Enterprise-E, a Sovereign class starship.\n" + base.Description; public override float BuffFactor => 0.5f; public override float Speed => 40f; } } namespace StarshipEnterprise.Upgrades.Phasers { public class AntiprotonBeams : UpgradePlusPlus { public override int Tier => 6; public override int Cost => 200000; public override string Description => "Phasers become devastating powerful Antiproton beams, with crits strong enough to one-shot many Bloons."; public override string Container => UpgradePlusPlus.UpgradeContainerPlatinum; public override string Icon => ((ModContent)this).Name; public override void ApplyUpgrade(TowerModel towerModel) { LineProjectileEmissionModel[] array = ModelExt.FindDescendants((Model)(object)towerModel); foreach (LineProjectileEmissionModel obj in array) { MiscModelExt.ApplyDisplay(obj.displayPath); MiscModelExt.ApplyDisplay(obj.effectAtEndModel); MiscModelExt.ApplyDisplay(ProjectileModelBehaviorExt.GetBehavior(obj.projectileInitialHitModel).effectModel); } ArrayExt.ForEach(ModelExt.FindDescendants((Model)(object)towerModel, "Phaser"), (Action)delegate(ProjectileModel projectile) { DamageModel val = default(DamageModel); if (ProjectileModelBehaviorExt.HasBehavior(projectile, ref val)) { DamageModel obj2 = val; obj2.damage *= 10f; } projectile.pierce *= 10f; }); Il2CppGenericIEnumerable.ForEach(((Model)towerModel).GetDescendants(), (Action)delegate(CritMultiplierModel crit) { crit.damage *= 100f; }); } } public class BeamOverload : ModUpgrade { public override int Path => 0; public override int Tier => 4; public override int Cost => 8000; public override string Icon => ((ModContent)this).Name; public override string Description => "Phaser Beams create a burst of energy on contact with Bloons, also damaging other Bloons nearby."; public override void ApplyUpgrade(TowerModel towerModel) { Il2CppGenericIEnumerable.ForEach(((Model)towerModel).GetDescendants(), (Action)delegate(LineProjectileEmissionModel emission) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown FilterModel[] filters = (FilterModel[])(object)new FilterModel[1] { (FilterModel)CreateFilterInvisibleModelExt.Create(new Args { isActive = true }) }; Args val = new Args(); val.id = "PhaserBlast"; val.radius = 10f; val.pierce = 25f; Model[] array = new Model[5]; Args val2 = new Args(); ((ModelArgs)val2).name = "PhaserBlast"; val2.category = (DisplayCategory)16; array[0] = (Model)CreateDisplayModelExt.Create(val2); Args val3 = new Args(); ((ModelArgs)val3).name = "PhaserBlast"; val3.lifespan = 0.2f; array[1] = (Model)CreateAgeModelExt.Create(val3); Args val4 = new Args(); ((ModelArgs)val4).name = "PhaserBlast"; val4.filters = filters; array[2] = (Model)CreateProjectileFilterModelExt.Create(val4); Args val5 = new Args(); ((ModelArgs)val5).name = "PhaserBlast"; val5.damage = 2f; val5.immuneBloonProperties = (BloonProperties)8; val5.immuneBloonPropertiesOriginal = (BloonProperties)8; array[3] = (Model)CreateDamageModelExt.Create(val5); Args val6 = new Args(); ((ModelArgs)val6).name = "PhaserBlast"; val6.effectModel = CreateEffectModelExt.Create(new Args { assetId = ModContent.CreatePrefabReference(), lifespan = 0.2f }); val6.lifespan = 0.2f; val6.durationFraction = 1f; val6.randomRotation = true; array[4] = (Model)CreateCreateEffectOnExhaustFractionModelExt.Create(val6); val.behaviors = (Model[])(object)array; val.filters = filters; ProjectileModel val7 = (emission.projectileInitialHitModel = CreateProjectileModelExt.Create(val)); ((Model)emission).AddChildDependant(val7); emission.endProjectileSharesPierce = true; emission.emissionAtEndModel = (EmissionModel)(object)CreateSingleEmissionModelExt.Create(); ((Model)emission).AddChildDependant(emission.emissionAtEndModel); }); foreach (DamageModel item in ModelExt.FindDescendants((Model)(object)towerModel, "Phaser").SelectMany((ProjectileModel model) => ModelExt.FindDescendants((Model)(object)model))) { float damage = item.damage; item.damage = damage + 1f; } } } public class FireAtWill : ModUpgrade { public override int Path => 0; public override int Tier => 3; public override int Cost => 3000; public override string Icon => ((ModContent)this).Name; public override string Description => "Adds additional Phasers that fire at Strong and Close Bloons."; public override void ApplyUpgrade(TowerModel towerModel) { AttackModel obj = ModelExt.FindDescendant((Model)(object)towerModel, "Phaser"); AttackModel val = ModelExt.Duplicate(obj, "PhaserStrong"); AttackModelBehaviorExt.RemoveBehaviors(val); ((Model)val).RemoveChildDependant(val.targetProvider); val.targetProvider = (TargetSupplierModel)(object)CreateTargetStrongAirUnitModelExt.Create(); AttackModelBehaviorExt.AddBehavior(val, val.targetProvider); ((Model)val).GetChild().ejectX = -10f; WeaponModel child = ((Model)val).GetChild(); child.Rate *= 1.41f; TowerModelBehaviorExt.AddBehavior(towerModel, val); AttackModel val2 = ModelExt.Duplicate(obj, "PhaserClose"); AttackModelBehaviorExt.RemoveBehaviors(val2); ((Model)val2).RemoveChildDependant(val2.targetProvider); val2.targetProvider = (TargetSupplierModel)(object)CreateTargetCloseAirUnitModelExt.Create(); AttackModelBehaviorExt.AddBehavior(val2, val2.targetProvider); ((Model)val2).GetChild().ejectX = 10f; ((Model)val2).GetChild().Rate = 1.73f; TowerModelBehaviorExt.AddBehavior(towerModel, val2); } } public class PhaserPath : PathPlusPlus { public override int UpgradeCount => 6; public override int ExtendVanillaPath => 0; public override bool ValidTiers(int[] tiers) { return PathPlusPlus.DefaultValidTiers(tiers.Take(3).ToArray()); } } public class PhasersToMaximum : ModUpgrade { public override int Path => 0; public override int Tier => 5; public override int Cost => 40000; public override string Icon => ((ModContent)this).Name; public override string Description => "Sets Phasers to their maximum power setting, dealing immense damage and crits."; public override void ApplyUpgrade(TowerModel towerModel) { foreach (DamageModel item in ModelExt.FindDescendants((Model)(object)towerModel, "Phaser").SelectMany((ProjectileModel model) => ModelExt.FindDescendants((Model)(object)model))) { item.damage *= 4f; } Il2CppGenericIEnumerable.ForEach(((Model)towerModel).GetDescendants(), (Action)delegate(CritMultiplierModel model) { model.damage *= 4f; }); } } public class PhaseVariance : ModUpgrade { [HarmonyPatch(typeof(ShowTextOnHit), "Collide")] internal static class ShowTextOnHit_Collide { [HarmonyPrefix] private static bool Prefix(ShowTextOnHit __instance, Bloon bloon) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) ShowTextOnHitModel showTextOnHitModel = __instance.showTextOnHitModel; if (!((Model)showTextOnHitModel).name.Contains("Phaser") || string.IsNullOrEmpty(showTextOnHitModel.text)) { return true; } ((RootObject)__instance).Sim.CreateTextEffect(Vector3Boxed.op_Implicit(((CommonBehaviorProxy)(object)bloon).Position), showTextOnHitModel.assetId, showTextOnHitModel.lifespan, showTextOnHitModel.text, false, (DisplayCategory)1); return false; } } public override int Path => 0; public override int Tier => 1; public override int Cost => 700; public override string Icon => ((ModContent)this).Name; public override string Description => "Phaser shots can critically strike Bloons for 10 damage."; public override void ApplyUpgrade(TowerModel towerModel) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown WeaponModelBehaviorExt.AddBehavior(ModelExt.FindDescendant((Model)(object)towerModel, "Phaser"), CreateCritMultiplierModelExt.Create(new Args { damage = 10f, lower = 10, upper = 10, displayModel = CreateDisplayModelExt.Create(new Args { category = (DisplayCategory)16 }), distributeToChildren = true })); ProjectileModel obj = ModelExt.FindDescendant((Model)(object)towerModel, "Phaser"); Args val = new Args(); ((ModelArgs)val).name = "Phaser"; val.assetId = ModContent.CreatePrefabReference("6eaf39977c73cf340b1ce55689e7a4e2"); val.lifespan = 1f; ProjectileModelBehaviorExt.AddBehavior(obj, CreateShowTextOnHitModelExt.Create(val)); } } public class RepulsorBeams : ModUpgrade { public override int Path => 0; public override int Tier => 2; public override int Cost => 1300; public override string Icon => ((ModContent)this).Name; public override string Description => "Phaser Beams deal more damage, and will push back Bloons."; public override void ApplyUpgrade(TowerModel towerModel) { } public override void LateApplyUpgrade(TowerModel towerModel) { KnockbackModel knockback = ((Model)Game.instance.model.GetTower(TowerType.SuperMonkey, 0, 0, Math.Clamp(towerModel.tier, 0, 5))).GetDescendant(); ArrayExt.ForEach(ModelExt.FindDescendants((Model)(object)towerModel, "Phaser"), (Action)delegate(ProjectileModel projectile) { DamageModel damageModel = ProjectileModelExt.GetDamageModel(projectile); float damage = damageModel.damage; damageModel.damage = damage + 1f; ProjectileModelBehaviorExt.AddBehavior(projectile, ModelExt.Duplicate(knockback)); projectile.UpdateCollisionPassList(); }); } } } namespace StarshipEnterprise.Upgrades.Engineering { public class AuxiliaryPower : CareerPathUpgrade { public override int Cost => 1000; public override int Tier => 2; public override string Description => base.Description + "Boost the power of Enterprise's least upgraded weapon."; public override void ApplyUpgrade(TowerModel towerModel) { int min = ((IEnumerable)towerModel.tiers).Min(); float factor = 1f / (float)((IEnumerable)towerModel.tiers).Count((int t) => t == min); if (((Il2CppArrayBase)(object)towerModel.tiers)[0] == min) { Apply(towerModel, "Phaser", factor); } if (((Il2CppArrayBase)(object)towerModel.tiers)[1] == min) { Apply(towerModel, "Torpedo", factor); } if (((Il2CppArrayBase)(object)towerModel.tiers)[2] == min) { Apply(towerModel, "Cannon", factor); } } private static void Apply(TowerModel towerModel, string nameContains, float factor) { ArrayExt.ForEach(ModelExt.FindDescendants((Model)(object)towerModel, nameContains), (Action)delegate(WeaponModel weapon) { weapon.Rate /= 1f + factor; Il2CppGenericIEnumerable.ForEach(((Model)weapon).GetDescendants(), (Action)delegate(ProjectileModel projectile) { projectile.pierce += (float)(int)Math.Ceiling(projectile.pierce * factor); }); Il2CppGenericIEnumerable.ForEach(((Model)weapon).GetDescendants(), (Action)delegate(DamageModel damage) { damage.damage += (float)(int)Math.Ceiling(damage.damage * factor); }); }); } } public class DeployRunabouts : CareerPathUpgrade { public override int Cost => 4000; public override int Tier => 3; public override string Description => base.Description + "Upgrades deployed Shuttles to stronger Danube-class Runabouts."; public override void ApplyUpgrade(TowerModel towerModel, int tier) { if (tier < 5) { Engineering.AddShuttles(towerModel, 2, 5f); } } } public class DeployShuttlecraft : CareerPathUpgrade { public override int Cost => 800; public override int Tier => 1; public override string Description => base.Description + "Deploy 2 small Shuttles with slower copies of Enterprise's most upgraded weapon."; public override void ApplyUpgrade(TowerModel towerModel, int tier) { if (tier < 3) { Engineering.AddShuttles(towerModel, 2, 10f); } } } public class EjectTheWarpCore : CareerPathUpgrade { public override int Cost => 30000; public override int Tier => 4; public override bool Ability => true; public override string Description => base.Description + "Ability: Eject the Warp Core, creating an Explosion that deals immense damage to all Bloons on Screen."; public override void ApplyUpgrade(TowerModel towerModel) { AbilityModel val = ModelExt.Duplicate(TowerModelExt.GetAbility(Game.instance.model.GetTower(TowerType.MonkeyAce, 0, 5, 0)), ((ModContent)this).Name); ((Model)val).name = ((ModContent)this).Name; val.displayName = ((NamedModContent)this).DisplayName; val.description = ((NamedModContent)this).Description; val.icon = ((UpgradePlusPlus)this).IconReference; val.resetCooldownOnTierUpgrade = false; MiscModelExt.ApplyDisplay(((Model)val).GetDescendant().effectModel); AbilityModelBehaviorExt.RemoveBehavior(val); ProjectileModel descendant = ((Model)val).GetDescendant(); descendant.pierce = 9999999f; ProjectileModelBehaviorExt.RemoveBehavior(descendant); TowerModelBehaviorExt.AddBehavior(towerModel, val); } } public class Engineering : CareerPath { [HarmonyPatch(typeof(FighterMovement), "Process")] internal static class FighterMovement_Process { [HarmonyPrefix] private static void Prefix(FighterMovement __instance) { if (__instance.currentPathSupplier == null) { ((RootBehavior)__instance).Attatched(); } } } public override int UpgradeCount => 6; protected override int Order => 2; public static TowerModel GetBaseShuttle(string name, PrefabReference display, TargetSupplierModel targetProvider) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown TowerModel val = ModelExt.Duplicate(((Model)Game.instance.model.GetTower(TowerType.MonkeyBuccaneer, 4, 0, 0)).GetDescendant(), name); ((EntityModel)val).baseId = name; val.towerSet = ModContent.GetTowerSet(); val.isGlobalRange = true; TowerModelBehaviorExt.RemoveBehaviors(val); TowerModelBehaviorExt.RemoveBehavior(val); TowerModelBehaviorExt.GetBehavior(val).display = display; FighterMovementModel descendant = ((Model)val).GetDescendant(); descendant.rollChancePerSecondPassed = 1E-08f; descendant.rollTimeBeforeNext = 1E+09f; descendant.bankAngleMax = 30f; Args val2 = new Args(); val2.range = 2000f; val2.attackThroughWalls = true; val2.targetProvider = targetProvider; val2.behaviors = (Model[])(object)new Model[1] { (Model)targetProvider }; TowerModelBehaviorExt.AddBehavior(val, CreateAttackModelExt.Create(val2)); val.UpdateTargetProviders(); return val; } public static void AddShuttles(TowerModel towerModel, int howMany, float factor) where T : ModDisplay { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Expected O, but got Unknown //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Expected O, but got Unknown List list = TowerModelExt.GetAttackModels(towerModel); int num = ((IEnumerable)towerModel.tiers).Max(); if (((Il2CppArrayBase)(object)towerModel.tiers)[0] == num) { list = list.Where((AttackModel model) => ((Model)model).name.Contains("Phaser")).ToList(); } else if (((Il2CppArrayBase)(object)towerModel.tiers)[1] == num) { list = list.Where((AttackModel model) => ((Model)model).name.Contains("PhotonTorpedo")).ToList(); } else if (((Il2CppArrayBase)(object)towerModel.tiers)[2] == num) { list = list.Where((AttackModel model) => ((Model)model).name.Contains("PhaseCannon")).ToList(); } TargetSupplierModel[] array = (TargetSupplierModel[])(object)new TargetSupplierModel[4] { (TargetSupplierModel)CreateFighterPilotPatternFirstModelExt.Create(new Args { offsetDistance = 40f, isOnSubTower = true }), (TargetSupplierModel)CreateFighterPilotPatternStrongModelExt.Create(new Args { offsetDistance = 40f, isOnSubTower = true }), (TargetSupplierModel)CreateFighterPilotPatternLastModelExt.Create(new Args { offsetDistance = 40f, isOnSubTower = true }), (TargetSupplierModel)CreateFighterPilotPatternCloseModelExt.Create(new Args { offsetDistance = 40f, isOnSubTower = true }) }; for (int num2 = 0; num2 < howMany; num2++) { string name = "Shuttle" + num2; TargetSupplierModel targetProvider = ModelExt.Duplicate(array[num2 % array.Length]); TowerModel baseShuttle = GetBaseShuttle(name, ModContent.CreatePrefabReference(), targetProvider); foreach (AttackModel item in list) { AttackModel val = ModelExt.Duplicate(item); WeaponModel child = ((Model)val).GetChild(); child.Rate *= factor + (float)num2 * 0.1f; WeaponModelExt.SetEject(child, new Vector3(0f, 10f, 5f), false, false, false); TowerModelBehaviorExt.AddBehavior(baseShuttle, val); } FighterMovementModel descendant = ((Model)baseShuttle).GetDescendant(); descendant.maxSpeed += (float)num2; Args val2 = new Args(); ((ModelArgs)val2).name = name; val2.towerModel = baseShuttle; val2.isAirBasedTower = true; TowerModelBehaviorExt.AddBehavior(towerModel, CreateTowerCreateTowerModelExt.Create(val2)); } towerModel.UpdateTargetProviders(); } } public class FleetMuseum : CareerPathUpgrade { public override int Cost => 300000; public override int Tier => 6; public override string Description => base.Description + "Instead of deploying Shuttles, calls in all previous Enterprises from retirement."; public override void ApplyUpgrade(TowerModel towerModel) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0049: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) ProjectileModelBehaviorExt.AddBehavior(((Model)ModelExt.FindDescendant((Model)(object)towerModel, "EjectTheWarpCore")).GetDescendant(), CreateDamagePercentOfMaxModelExt.Create(new Args { percent = 0.5f, tags = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)new Il2CppStringArray(0L)) })); RefitUpgrade[] array = (from upgrade in ModContent.GetContent() where ((Il2CppArrayBase)(object)towerModel.appliedUpgrades).Contains(((ModContent)upgrade).Id) orderby ((UpgradePlusPlus)upgrade).Tier descending select upgrade).ToArray(); if (!ArrayExt.Any(array)) { return; } float num = 1f + array.First().BuffFactor; foreach (RefitUpgrade item in array.Skip(1)) { AddShuttle(towerModel, item.Display, num, item.EjectOffset, item.Speed); num *= 1f + item.BuffFactor; } AddShuttle(towerModel, ModContent.CreatePrefabReference(), num, StarshipEnterprise.EjectOffset, StarshipEnterprise.Speed); } private static void AddShuttle(TowerModel towerModel, PrefabReference display, float buffReductionFactor, Vector3 eject, float speed) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown string name = display.guidRef.Replace("StarshipEnterprise-", "").Replace("Display", ""); TowerModel baseShuttle = Engineering.GetBaseShuttle(name, display, (TargetSupplierModel)(object)CreateFighterPilotPatternFirstModelExt.Create(new Args { offsetDistance = 40f, isOnSubTower = true })); foreach (AttackModel item in TowerModelExt.GetAttackModels(towerModel).Skip(1)) { TowerModelBehaviorExt.AddBehavior(baseShuttle, ModelExt.Duplicate(item)); } TowerModelBehaviorExt.GetBehavior(baseShuttle).display = display; ((Model)baseShuttle).GetDescendant().maxSpeed = speed; FighterMovementModel descendant = ((Model)baseShuttle).GetDescendant(); descendant.loopRadius += buffReductionFactor; Il2CppGenericIEnumerable.ForEach(((Model)baseShuttle).GetDescendants(), (Action)delegate(WeaponModel weapon) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) WeaponModelExt.SetEject(weapon, eject, true, false, false); weapon.Rate *= buffReductionFactor; }); Args val = new Args(); ((ModelArgs)val).name = name; val.towerModel = baseShuttle; val.isAirBasedTower = true; TowerModelBehaviorExt.AddBehavior(towerModel, CreateTowerCreateTowerModelExt.Create(val)); } } public class ShuttleSquadron : CareerPathUpgrade { public override int Cost => 50000; public override int Tier => 5; public override string Description => base.Description + "Now deploys 5 total Shuttles."; public override void ApplyUpgrade(TowerModel towerModel, int tier) { if (tier < 6) { Engineering.AddShuttles(towerModel, 5, 5f); } } } } namespace StarshipEnterprise.Upgrades.Cannons { public class DualCannons : ModUpgrade { public override int Path => 2; public override int Tier => 2; public override int Cost => 1200; public override string Icon => ((ModContent)this).Name; public override string Description => "Phase Cannons fire 2 at a time for 2 damage each."; public override void ApplyUpgrade(TowerModel towerModel) { ParallelEmissionModel descendant = ((Model)TowerModelExt.GetAttackModel(towerModel, "PhaseCannon")).GetDescendant(); descendant.count = 2; descendant.spreadLength = 10f; MiscModelExt.UpdateOffset(descendant); ProjectileModelExt.GetDamageModel(ModelExt.FindDescendant((Model)(object)towerModel, "PhaseCannon")).damage = 2f; } } public class HeavyCannons : ModUpgrade { public override int Path => 2; public override int Tier => 5; public override int Cost => 45000; public override string Icon => ((ModContent)this).Name; public override string Description => "Phase Cannon shots are bigger, deal more damage, and have more pierce."; public override void ApplyUpgrade(TowerModel towerModel) { ProjectileModel obj = ModelExt.FindDescendant((Model)(object)towerModel, "PhaseCannon"); DamageModel damageModel = ProjectileModelExt.GetDamageModel(obj); damageModel.damage *= 2f; obj.pierce *= 5f; obj.radius *= 2f; obj.scale *= 2f; ParallelEmissionModel descendant = ((Model)TowerModelExt.GetAttackModel(towerModel, "PhaseCannon")).GetDescendant(); descendant.spreadLength = 25f; MiscModelExt.UpdateOffset(descendant); } } public class PhaseCannonPath : PathPlusPlus { public override int UpgradeCount => 6; public override int ExtendVanillaPath => 2; public override bool ValidTiers(int[] tiers) { return PathPlusPlus.DefaultValidTiers(tiers.Take(3).ToArray()); } } public class PhaseTurret : ModUpgrade { public override int Path => 2; public override int Tier => 3; public override int Cost => 3600; public override string Icon => ((ModContent)this).Name; public override string Description => "Phase Cannons fire much faster and with a 360 degree attack angle."; public override void ApplyUpgrade(TowerModel towerModel) { AttackModel attackModel = TowerModelExt.GetAttackModel(towerModel, "PhaseCannon"); ((Model)attackModel).GetDescendant().fieldOfView = 360f; WeaponModel child = ((Model)attackModel).GetChild(); child.Rate /= 3f; } } public class PolaronCannons : UpgradePlusPlus { public override int Cost => 160000; public override int Tier => 6; public override string Icon => ((ModContent)this).Name; public override string Description => "Upgrade to Polaron Cannons, dealing massive damage with unlimited pierce."; public override string Container => UpgradePlusPlus.UpgradeContainerPlatinum; public override void ApplyUpgrade(TowerModel towerModel) { ArrayExt.ForEach(ModelExt.FindDescendants((Model)(object)towerModel, "PhaseCannon"), (Action)delegate(ProjectileModel projectile) { ProjectileModelExt.ApplyDisplay(projectile); projectile.ignorePierceExhaustion = true; DamageModel val = default(DamageModel); if (ProjectileModelBehaviorExt.HasBehavior(projectile, ref val)) { DamageModel obj = val; obj.damage *= 6f; } }); } } public class QuadCannons : ModUpgrade { public override int Path => 2; public override int Tier => 4; public override int Cost => 14000; public override string Icon => ((ModContent)this).Name; public override string Description => "Phase Cannons fire 4 at a time for 4 damage each."; public override void ApplyUpgrade(TowerModel towerModel) { ParallelEmissionModel descendant = ((Model)TowerModelExt.GetAttackModel(towerModel, "PhaseCannon")).GetDescendant(); descendant.count = 4; descendant.spreadLength = 20f; MiscModelExt.UpdateOffset(descendant); ProjectileModelExt.GetDamageModel(ModelExt.FindDescendant((Model)(object)towerModel, "PhaseCannon")).damage = 4f; } } public class WideArc : ModUpgrade { public override int Path => 2; public override int Tier => 1; public override int Cost => 180; public override string Icon => ((ModContent)this).Name; public override string Description => "Phase Cannon attack angle increased from 90 degrees to 180."; public override void ApplyUpgrade(TowerModel towerModel) { ((Model)TowerModelExt.GetAttackModel(towerModel, "PhaseCannon")).GetDescendant().fieldOfView = 180f; } } } namespace StarshipEnterprise.Displays { public class PrimeDirectiveBuff : ModDisplay { private static readonly int TintColor = Shader.PropertyToID("_TintColor"); public override string BaseDisplay => "900108af532d9bb41a0b48e891789fa1"; public override void ModifyDisplayNode(UnityDisplayNode node) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) foreach (ParticleSystemRenderer componentsInChild in ((Component)node).GetComponentsInChildren()) { ((Renderer)componentsInChild).material.SetColor(TintColor, new Color(0f, 0.5f, 1f, 1f)); } } } public class StarfleetBase : ModDisplay { public override string BaseDisplay => "43873ddc40185ac438cb0da6e60e327f"; public override void ModifyDisplayNode(UnityDisplayNode node) { ((ModDisplay)this).SetMeshTexture(node, ((ModContent)this).Name); ((Component)((Component)node).gameObject.transform.Find("Sparks")).gameObject.SetActive(false); } } } namespace StarshipEnterprise.Displays.Weapons { public class AntiprotonBeam : ModDisplay { private static readonly int Color1 = Shader.PropertyToID("_Color1"); private static readonly int Color1Power = Shader.PropertyToID("_Color1Power"); private static readonly int Color2 = Shader.PropertyToID("_Color2"); private static readonly int BeamPower = Shader.PropertyToID("_BeamPower"); public override string BaseDisplay => "b740dac7b6bc850438df2a7a10b01bfb"; public override void ModifyDisplayNode(UnityDisplayNode node) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) Material material = UnityDisplayNodeExt.GetMeshRenderer(node, 0, true).material; material.SetColor(Color1, new Color(0f, 0f, 0f)); material.SetFloat(Color1Power, 1f); material.SetColor(Color2, new Color(1f, 0f, 0f)); material.SetFloat(BeamPower, 3.3f); } } public class AntiprotonBlast : PhaserBlast { } public class AntiProtonParticles : ModDisplay { private static readonly int TintColor = Shader.PropertyToID("_TintColor"); public override string BaseDisplay => "3c445c563b7fc3f44aacf5cb2a79e424"; public override void ModifyDisplayNode(UnityDisplayNode node) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) foreach (Renderer item in (Il2CppArrayBase)(object)node.genericRenderers) { item.material.SetColor(TintColor, new Color(0f, 0f, 0f)); } } } public class PhaserBeam : ModDisplay { private static readonly int Color1 = Shader.PropertyToID("_Color1"); private static readonly int Color1Power = Shader.PropertyToID("_Color1Power"); private static readonly int Color2 = Shader.PropertyToID("_Color2"); private static readonly int BeamPower = Shader.PropertyToID("_BeamPower"); public override string BaseDisplay => "b740dac7b6bc850438df2a7a10b01bfb"; public override void ModifyDisplayNode(UnityDisplayNode node) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) Material material = UnityDisplayNodeExt.GetMeshRenderer(node, 0, true).material; material.SetColor(Color1, new Color(1f, 0.5f, 0.2f)); material.SetFloat(Color1Power, 1f); material.SetColor(Color2, new Color(1f, 0.5f, 0.2f)); material.SetFloat(BeamPower, 4f); } } public class PhaserBlast : ModDisplay { public override string BaseDisplay => "95e1b845816b6f748af84449fe6b7a59"; public override void ModifyDisplayNode(UnityDisplayNode node) { UnityDisplayNodeExt.GetRenderers(node, true).ForEach(delegate(SpriteRenderer renderer) { if ((Object)(object)renderer.sprite != (Object)null) { renderer.sprite = ((ModContent)this).GetSprite(((ModContent)this).Name, 10f); } }); } } public class PhaserParticles : ModDisplay { private static readonly int TintColor = Shader.PropertyToID("_TintColor"); public override string BaseDisplay => "3c445c563b7fc3f44aacf5cb2a79e424"; public override void ModifyDisplayNode(UnityDisplayNode node) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) foreach (Renderer item in (Il2CppArrayBase)(object)node.genericRenderers) { item.material.SetColor(TintColor, new Color(1f, 0.1f, 0f)); } } } public class PhotonTorpedoExplosion : ModDisplay { public override string BaseDisplay => "21f659bbb9e1d9441adf3239a773e224"; public override float Scale => 0.2f; public override void ModifyDisplayNode(UnityDisplayNode node) { ((Component)((Component)node).transform.GetChild(2)).gameObject.SetActive(false); } } public class PolaronBolt : ModDisplay { public override string BaseDisplay => "f54fbbae11116a04dafbcde24ff646d8"; public override void ModifyDisplayNode(UnityDisplayNode node) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) ((ModDisplay)this).Set2DTexture(node, ((ModContent)this).Name); UnityDisplayNodeExt.GetRenderer(node, true).startColor = new Color(0.63f, 0f, 1f, 1f); UnityDisplayNodeExt.GetRenderer(node, true).endColor = new Color(0.63f, 0f, 1f, 0f); } } public class QuantumTorpedo : ModDisplay { public override string BaseDisplay => "187bc7112ccbf6445afc2ef9173b4568"; public override void ModifyDisplayNode(UnityDisplayNode node) { ((ModDisplay)this).Set2DTexture(node, ((ModContent)this).Name); } } public class QuantumTorpedoExplosion : PhotonTorpedoExplosion { private static readonly int TintColor = Shader.PropertyToID("_TintColor"); public override float Scale => 0.25f; public override void ModifyDisplayNode(UnityDisplayNode node) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) base.ModifyDisplayNode(node); foreach (Renderer item in (Il2CppArrayBase)(object)node.genericRenderers) { item.material.SetColor(TintColor, Color.cyan); } } } public class TransphasicTorpedo : ModDisplay { public override string BaseDisplay => "187bc7112ccbf6445afc2ef9173b4568"; public override void ModifyDisplayNode(UnityDisplayNode node) { ((ModDisplay)this).Set2DTexture(node, ((ModContent)this).Name); } } public class TransphasicTorpedoExplosion : PhotonTorpedoExplosion { private static readonly int TintColor = Shader.PropertyToID("_TintColor"); public override float Scale => 0.3f; public override void ModifyDisplayNode(UnityDisplayNode node) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) base.ModifyDisplayNode(node); foreach (Renderer item in (Il2CppArrayBase)(object)node.genericRenderers) { item.material.SetColor(TintColor, Color.yellow); } } } public class WarpCoreExplosion : ModDisplay { private static readonly int TintColor = Shader.PropertyToID("_TintColor"); public override string BaseDisplay => "6f4aa8eecdb528144b69efee775c64f2"; public override void ModifyDisplayNode(UnityDisplayNode node) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) ((Component)((Component)node).transform.Find("BombAnimContainer/Bomb")).gameObject.SetActive(false); foreach (ParticleSystemRenderer componentsInChild in ((Component)node).GetComponentsInChildren()) { ((Renderer)componentsInChild).material.SetColor(TintColor, Color.cyan); } } } } namespace StarshipEnterprise.Displays.Ships { public class AmbassadorDisplay : ModCustomDisplay { public override string AssetBundleName => "assets"; public override string PrefabName => "AmbassadorClass"; public override float Scale => ModSettingDouble.op_Implicit(StarshipEnterpriseMod.EnterpriseDisplayScale); public override void ModifyDisplayNode(UnityDisplayNode node) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) Renderer meshRenderer = UnityDisplayNodeExt.GetMeshRenderer(node, 0, true); RendererExt.ApplyOutlineShader(meshRenderer); RendererExt.SetOutlineColor(meshRenderer, new Color(0.25f, 0.25f, 0.25f, 1f)); } } public class ConstitutionDisplay : ModCustomDisplay { public override string AssetBundleName => "assets"; public override string PrefabName => "ConstitutionClass"; public override float Scale => ModSettingDouble.op_Implicit(StarshipEnterpriseMod.EnterpriseDisplayScale); public override void ModifyDisplayNode(UnityDisplayNode node) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) Renderer meshRenderer = UnityDisplayNodeExt.GetMeshRenderer(node, 0, true); RendererExt.ApplyOutlineShader(meshRenderer); RendererExt.SetOutlineColor(meshRenderer, new Color(0.25f, 0.25f, 0.25f, 1f)); } } public class ConstitutionIIDisplay : ModCustomDisplay { public override string AssetBundleName => "assets"; public override string PrefabName => "RefitConstitutionClass"; public override float Scale => ModSettingDouble.op_Implicit(StarshipEnterpriseMod.EnterpriseDisplayScale); public override void ModifyDisplayNode(UnityDisplayNode node) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) Renderer meshRenderer = UnityDisplayNodeExt.GetMeshRenderer(node, 0, true); RendererExt.ApplyOutlineShader(meshRenderer); RendererExt.SetOutlineColor(meshRenderer, new Color(0.25f, 0.25f, 0.25f, 1f)); } } public class ExcelsiorDisplay : ModCustomDisplay { public override string AssetBundleName => "assets"; public override string PrefabName => "ExcelsiorClass"; public override float Scale => ModSettingDouble.op_Implicit(StarshipEnterpriseMod.EnterpriseDisplayScale); public override void ModifyDisplayNode(UnityDisplayNode node) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) Renderer meshRenderer = UnityDisplayNodeExt.GetMeshRenderer(node, 0, true); RendererExt.ApplyOutlineShader(meshRenderer); RendererExt.SetOutlineColor(meshRenderer, new Color(0.25f, 0.25f, 0.25f, 1f)); } } public class GalaxyDisplay : ModCustomDisplay { public override string AssetBundleName => "assets"; public override string PrefabName => "GalaxyClass"; public override float Scale => ModSettingDouble.op_Implicit(StarshipEnterpriseMod.EnterpriseDisplayScale); public override void ModifyDisplayNode(UnityDisplayNode node) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) Renderer meshRenderer = UnityDisplayNodeExt.GetMeshRenderer(node, 0, true); RendererExt.ApplyOutlineShader(meshRenderer); RendererExt.SetOutlineColor(meshRenderer, new Color(0.25f, 0.25f, 0.25f, 1f)); } } public class OdysseyDisplay : ModCustomDisplay { public override string AssetBundleName => "assets"; public override string PrefabName => "OdysseyClass"; public override float Scale => ModSettingDouble.op_Implicit(StarshipEnterpriseMod.EnterpriseDisplayScale); public override void ModifyDisplayNode(UnityDisplayNode node) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) Renderer meshRenderer = UnityDisplayNodeExt.GetMeshRenderer(node, 0, true); RendererExt.ApplyOutlineShader(meshRenderer); RendererExt.SetOutlineColor(meshRenderer, new Color(0.25f, 0.25f, 0.25f, 1f)); } } public class RunaboutDisplay : ModCustomDisplay { public override string AssetBundleName => "assets"; public override string PrefabName => "Runabout"; public override float Scale => ModSettingDouble.op_Implicit(StarshipEnterpriseMod.EnterpriseDisplayScale); public override void ModifyDisplayNode(UnityDisplayNode node) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) Renderer meshRenderer = UnityDisplayNodeExt.GetMeshRenderer(node, 0, true); RendererExt.ApplyOutlineShader(meshRenderer); RendererExt.SetOutlineColor(meshRenderer, new Color(0.25f, 0.25f, 0.25f, 1f)); } } public class ShuttleDisplay : ModCustomDisplay { public override string AssetBundleName => "assets"; public override string PrefabName => "Shuttle"; public override float Scale => ModSettingDouble.op_Implicit(StarshipEnterpriseMod.EnterpriseDisplayScale); public override void ModifyDisplayNode(UnityDisplayNode node) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) Renderer meshRenderer = UnityDisplayNodeExt.GetMeshRenderer(node, 0, true); RendererExt.ApplyOutlineShader(meshRenderer); RendererExt.SetOutlineColor(meshRenderer, new Color(0.25f, 0.25f, 0.25f, 1f)); } } public class SovereignDisplay : ModCustomDisplay { public override string AssetBundleName => "assets"; public override string PrefabName => "SovereignClass"; public override float Scale => ModSettingDouble.op_Implicit(StarshipEnterpriseMod.EnterpriseDisplayScale); public override void ModifyDisplayNode(UnityDisplayNode node) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) Renderer meshRenderer = UnityDisplayNodeExt.GetMeshRenderer(node, 0, true); RendererExt.ApplyOutlineShader(meshRenderer); RendererExt.SetOutlineColor(meshRenderer, new Color(0.25f, 0.25f, 0.25f, 1f)); } } }