예제 #1
0
        public static void AbsoluteZero(TowerModel model)
        {
            var realSlow = model.GetBehavior <SlowBloonsZoneModel>();

            var totem = Game.instance.model.GetTowerFromId("NaturesWardTotem");

            var slow = totem.GetBehaviors <SlowBloonsZoneModel>().First(b => !b.name.Contains("NonMoabs")).Duplicate();

            slow.zoneRadius             = realSlow.zoneRadius;
            slow.bindRadiusToTowerRange = true;
            slow.radiusOffset           = realSlow.radiusOffset;
            slow.mutator.Cast <SlowBloonsZoneModel.Mutator>().speedScale -= .1f;


            model.AddBehavior(slow);

            var buff = new RateSupportModel("RateSupportZoneModel_AbilityChoice", 2f / 3f, true, "AbsoluteZeroRateBuff2", false, 1,
                                            new Il2CppReferenceArray <TowerFilterModel>(
                                                new TowerFilterModel[]
            {
                new FilterInBaseTowerIdModel("FilterInBaseTowerIdModel_",
                                             new Il2CppStringArray(new [] { IceMonkey }))
            }
                                                )
                                            , "", "");

            buff.showBuffIcon         = false;
            buff.appliesToOwningTower = true;
            model.AddBehavior(buff);
        }
예제 #2
0
        public static void AttackAndSupport(TowerModel model)
        {
            if (model.GetBehavior <SubmergeModel>() == null)
            {
                return;
            }

            model.targetTypes = Game.instance.model.GetTowerFromId(MonkeySub).targetTypes;

            var submergeEffect = model.GetBehavior <SubmergeEffectModel>().effectModel;
            var submerge       = model.GetBehavior <SubmergeModel>();

            if (submerge.heroXpScale > 1.0)
            {
                model.AddBehavior(new HeroXpScaleSupportModel("HeroXpScaleSupportModel_", true, submerge.heroXpScale,
                                                              null));
            }

            if (submerge.abilityCooldownSpeedScale > 1.0)
            {
                model.AddBehavior(new AbilityCooldownScaleSupportModel("AbilityCooldownScaleSupportModel_",
                                                                       true, submerge.abilityCooldownSpeedScale, true, false, null,
                                                                       submerge.buffLocsName, submerge.buffIconName, false, submerge.supportMutatorPriority));
            }

            model.RemoveBehavior <SubmergeModel>();

            foreach (var attackModel in model.GetAttackModels())
            {
                if (attackModel.name.Contains("Submerge"))
                {
                    attackModel.name = attackModel.name.Replace("Submerged", "");
                    attackModel.weapons[0].GetBehavior <EjectEffectModel>().effectModel.assetId =
                        submerge.attackDisplayPath;
                }

                attackModel.RemoveBehavior <SubmergedTargetModel>();
            }

            model.AddBehavior(new CreateEffectAfterTimeModel("CreateEffectAfterTimeModel_", submergeEffect, 0f, true));
        }
예제 #3
0
        public static void BloonAreNotPrepared(TowerModel model)
        {
            if (model.appliedUpgrades.Contains("Heart of Vengeance"))
            {
                foreach (var weaponModel in model.GetWeapons())
                {
                    var lbasm = weaponModel.GetBehavior <LifeBasedAttackSpeedModel>();
                    if (lbasm != null)
                    {
                        var bonus = lbasm.lifeCap * lbasm.ratePerLife + lbasm.baseRateIncrease;
                        weaponModel.Rate /= 1 + bonus;
                        weaponModel.RemoveBehavior <LifeBasedAttackSpeedModel>();
                    }
                }
            }

            if (model.appliedUpgrades.Contains("Druid of Wrath"))
            {
                var dbasm = model.GetBehavior <DamageBasedAttackSpeedModel>();
                if (dbasm != null)
                {
                    var bonus = dbasm.maxStacks * dbasm.increasePerThreshold;
                    foreach (var weaponModel in model.GetWeapons())
                    {
                        weaponModel.Rate /= 1 + bonus;
                    }
                }
            }

            if (model.appliedUpgrades.Contains("Avatar of Wrath"))
            {
                var dvem = model.GetBehavior <DruidVengeanceEffectModel>();
                if (dvem != null)
                {
                    var dmwm = dvem.damageModifierWrathModel;
                    dmwm.rbeThreshold         = 1;
                    dvem.epicGlowEffectStacks = -1;
                }
            }
        }
예제 #4
0
        public static void Snowstorm(TowerModel model)
        {
            var realSlow = model.GetBehavior <SlowBloonsZoneModel>();

            var totem = Game.instance.model.GetTowerFromId("NaturesWardTotem");

            var slow = totem.GetBehaviors <SlowBloonsZoneModel>().First(b => !b.name.Contains("NonMoabs")).Duplicate();

            slow.zoneRadius             = realSlow.zoneRadius;
            slow.bindRadiusToTowerRange = true;
            slow.radiusOffset           = realSlow.radiusOffset;

            model.AddBehavior(slow);
        }
예제 #5
0
        public static void RealHealthyBananas(TowerModel model)
        {
            var amount = model.tier + 1;
            var bonusLivesPerRoundModel = model.GetBehavior <BonusLivesPerRoundModel>();

            if (bonusLivesPerRoundModel == null)
            {
                model.AddBehavior(new BonusLivesPerRoundModel("BonusLivesPerRoundModel_HealthyBananas", amount, 1.25f,
                                                              "eb70b6823aec0644c81f873e94cb26cc"));
            }
            else
            {
                bonusLivesPerRoundModel.amount = amount;
            }
        }
예제 #6
0
        public static void WizardLordPhoenix(TowerModel model)
        {
            var permaBehavior = model.GetBehavior <TowerCreateTowerModel>().Duplicate();
            var lordPhoenix   = model.GetAbilites()[0].GetBehavior <AbilityCreateTowerModel>().towerModel.Duplicate();

            lordPhoenix.behaviors = lordPhoenix.behaviors.RemoveItemOfType <Model, TowerExpireModel>();
            foreach (var weaponModel in lordPhoenix.GetWeapons())
            {
                weaponModel.rate *= 3f;
            }

            permaBehavior.towerModel = lordPhoenix;

            model.AddBehavior(permaBehavior);
        }
예제 #7
0
        internal static void FinalizeTowerModel(ModTower modTower, TowerModel towerModel)
        {
            // do their base tower modifications
            try
            {
                modTower.ModifyBaseTowerModel(towerModel);
            }
            catch (Exception)
            {
                MelonLogger.Error($"Failed to modify TowerModel {towerModel.name}");
                throw;
            }

            // actually apply the upgrades
            try
            {
                foreach (var modUpgrade in modTower.upgrades.Cast <ModUpgrade>()
                         .Where(modUpgrade =>
                                modUpgrade != null && towerModel.tiers[modUpgrade.Path] >= modUpgrade.Tier)
                         .OrderByDescending(modUpgrade => modUpgrade.Priority)
                         .ThenBy(modUpgrade => modUpgrade.Tier)
                         .ThenBy(modUpgrade => modUpgrade.Path))
                {
                    try
                    {
                        modUpgrade.ApplyUpgrade(towerModel);
                    }
                    catch (Exception)
                    {
                        MelonLogger.Error(
                            $"Failed to apply ModUpgrade {modUpgrade.Name} to TowerModel {towerModel.name}");
                        throw;
                    }
                }
            }
            catch (Exception)
            {
                MelonLogger.Error($"Failed to apply upgrades for TowerModel {towerModel.name}");
                throw;
            }

            if (modTower.ShouldCreateParagon && towerModel.isParagon)
            {
                towerModel.tiers = new[] { 6, 0, 0 };
            }

            // set the tower's display model
            if (modTower.Use2DModel)
            {
                try
                {
                    var name = modTower.Get2DTexture(towerModel.tiers);
                    var guid = ModContent.GetTextureGUID(modTower.mod, name);
                    towerModel.display = guid;
                    towerModel.GetBehavior <DisplayModel>().display        = guid;
                    towerModel.GetBehavior <DisplayModel>().positionOffset = new Vector3(0, 0, 2f);
                    Tower2DScales[guid] = modTower.PixelsPerUnit;
                }
                catch (Exception)
                {
                    MelonLogger.Error($"Failed to load 2d display for TowerModel {towerModel.name}");
                    throw;
                }
            }
            else
            {
                try
                {
                    if (modTower.displays.Where(display =>
                                                display.UseForTower(towerModel.tiers) && display.ParagonDisplayIndex <= 0)
                        .OrderByDescending(display => display.Id)
                        .FirstOrDefault() is ModTowerDisplay modTowerDisplay)
                    {
                        modTowerDisplay.ApplyToTower(towerModel);
                    }
                }
                catch (Exception)
                {
                    MelonLogger.Error($"Failed to load ModTowerDisplay for TowerModel {towerModel.name}");
                    throw;
                }
            }

            // last paragon stuff
            if (modTower.ShouldCreateParagon && towerModel.isParagon)
            {
                try
                {
                    if (modTower.paragonUpgrade.RemoveAbilities)
                    {
                        towerModel.behaviors = towerModel.behaviors.RemoveItemsOfType <Model, AbilityModel>();
                    }

                    var paragonModel = modTower.paragonUpgrade.ParagonTowerModel.Duplicate();

                    for (var i = 0; i < paragonModel.displayDegreePaths.Count; i++)
                    {
                        var displayDegreePath = paragonModel.displayDegreePaths[i];
                        displayDegreePath.name = $"AssetPathModel_{modTower.paragonUpgrade.GetType().Name}Lvl1";

                        var index           = i;
                        var modTowerDisplay = modTower.displays.Where(display =>
                                                                      display.UseForTower(towerModel.tiers) && index >= display.ParagonDisplayIndex)
                                              .OrderByDescending(display => display.ParagonDisplayIndex)
                                              .FirstOrDefault();
                        if (modTowerDisplay != default)
                        {
                            displayDegreePath.assetPath = modTowerDisplay.Id;
                        }
                    }

                    towerModel.behaviors = towerModel.behaviors.AddTo(paragonModel);

                    modTower.paragonUpgrade.ApplyUpgrade(towerModel);
                }
                catch (Exception)
                {
                    MelonLogger.Error(
                        $"Failed to apply ModParagonUpgrade {modTower.paragonUpgrade.Name} to TowerModel {towerModel.name}");
                    throw;
                }
            }
        }
예제 #8
0
 /// <summary>
 /// Applies this ModDisplay to a given TowerModel
 /// </summary>
 /// <param name="towerModel"></param>
 public void Apply(TowerModel towerModel)
 {
     towerModel.display = Id;
     Apply(towerModel.GetBehavior <DisplayModel>());
 }
예제 #9
0
 /// <summary>
 /// If this TowerModel is a Hero, return the HeroModel behavior
 /// </summary>
 /// <param name="towerModel"></param>
 /// <returns></returns>
 public static HeroModel GetHeroModel(this TowerModel towerModel)
 {
     return(towerModel.GetBehavior <HeroModel>());
 }
예제 #10
0
 public static void MonkeyNomics(TowerModel model)
 {
     model.GetBehavior <BankModel>().capacity = 1000000000;
 }
예제 #11
0
 public static void IMFloan(TowerModel model)
 {
     model.GetBehavior <BankModel>().capacity += 7500;
 }