示例#1
0
        public static void SpecialPoperations(TowerModel model)
        {
            var ability  = model.GetAbilites()[1];
            var behavior = new ActivateAbilityOnRoundStartModel("ActivateAbilityOnRoundStartModel_SpecialPoperations", ability.Duplicate());

            ability.enabled = false;
            model.AddBehavior(behavior);

            var specialPops = model.GetAbilites()[2];

            model.behaviors = model.behaviors.RemoveItem(specialPops);

            var marine = specialPops.GetBehavior <FindDeploymentLocationModel>().towerModel;

            var weapon = marine.GetAttackModels()[0].weapons[0].Duplicate();

            var airBehavior = model.GetAttackModels()[0].weapons[0].GetBehavior <FireFromAirUnitModel>();

            weapon.behaviors = new Il2CppReferenceArray <WeaponBehaviorModel>(new WeaponBehaviorModel[] { airBehavior });

            weapon.ejectX = weapon.ejectY = weapon.ejectZ = 0;

            weapon.emission = model.GetWeapon().emission.Duplicate();
            weapon.emission.Cast <EmissionWithOffsetsModel>().throwMarkerOffsetModels =
                new Il2CppReferenceArray <ThrowMarkerOffsetModel>(new[]
            {
                weapon.emission.Cast <EmissionWithOffsetsModel>().throwMarkerOffsetModels[0]
            });
            weapon.emission.Cast <EmissionWithOffsetsModel>().throwMarkerOffsetModels[0].ejectX = 0;
            weapon.emission.Cast <EmissionWithOffsetsModel>().projectileCount = 1;

            model.GetAttackModels()[0].AddWeapon(weapon);
        }
        /// <summary>
        /// (Cross-Game compatible) Recursively get every WeaponModels this TowerModel has
        /// </summary>
        public static List <WeaponModel> GetWeapons(this TowerModel towerModel)
        {
            List <AttackModel> attackModels = towerModel.GetAttackModels();

            if (attackModels is null)
            {
                return(null);
            }

            if (!attackModels.Any())
            {
                return(new List <WeaponModel>());
            }

            List <WeaponModel> weaponModels = new List <WeaponModel>();

            foreach (AttackModel attackModel in attackModels)
            {
                Il2CppReferenceArray <WeaponModel> weapons = attackModel.weapons;
                if (weapons != null)
                {
                    weaponModels.AddRange(weapons);
                }
            }

            return(weaponModels);
        }
示例#3
0
        public static void PlasmaMonkeyFanClub(TowerModel model)
        {
            model.GetWeapon().rate *= 0.03f / .475f;
            model.range += 20;
            model.GetAttackModels()[0].range += 20;

            ProjectileModel plasmaModel =
                Game.instance.model.GetTower(SuperMonkey, 2, 0, 0).GetWeapon().projectile;

            foreach (var weaponProjectile in model.GetAllProjectiles())
            {
                if (weaponProjectile.display == null)
                {
                    continue;
                }
                weaponProjectile.display = plasmaModel.display;
                weaponProjectile.GetBehavior <DisplayModel>().display = plasmaModel.display;
                weaponProjectile.GetDamageModel().damage     += 2;
                weaponProjectile.GetDamageModel().damageTypes = new Il2CppStringArray(new[] { "Plasma" });
                weaponProjectile.pierce += 5;


                weaponProjectile.GetBehavior <TravelStraitModel>().lifespan       *= 2f;
                weaponProjectile.GetBehavior <TravelStraitModel>().lifespanFrames *= 2;
            }
        }
示例#4
0
        public static void GroundZero(TowerModel model)
        {
            var ability       = model.GetAbilites()[0];
            var abilityAttack = ability.GetBehavior <ActivateAttackModel>().attacks[0].Duplicate();
            var abilityWeapon = abilityAttack.weapons[0];

            var effectModel = ability.GetBehavior <CreateEffectOnAbilityModel>().effectModel.Duplicate();

            effectModel.scale             = .5f;
            effectModel.useCenterPosition = false;

            var effectBehavior =
                new CreateEffectOnExhaustFractionModel("CreateEffectOnExhaustFractionModel_GroundZero", "", effectModel, 0, false, 1.0f, -1f, false);

            abilityWeapon.projectile.AddBehavior(effectBehavior);
            abilityWeapon.rate = 6;
            abilityWeapon.projectile.GetDamageModel().damage = 100;
            abilityWeapon.projectile.radius = 100;

            var airBehavior = model.GetAttackModels()[0].weapons[0].GetBehavior <FireFromAirUnitModel>();

            abilityWeapon.behaviors = new Il2CppReferenceArray <WeaponBehaviorModel>(new WeaponBehaviorModel[] { airBehavior });

            var sound         = ability.GetBehavior <CreateSoundOnAbilityModel>().sound;
            var soundBehavior =
                new CreateSoundOnProjectileExhaustModel("CreateSoundOnProjectileExhaustModel_GroundZero", sound, sound, sound, sound, sound);

            abilityWeapon.projectile.AddBehavior(soundBehavior);

            model.AddBehavior(abilityAttack);
        }
示例#5
0
 public static void GlueStorm(TowerModel model)
 {
     GlueStrike(model);
     model.range *= 2;
     model.GetAttackModels()[0].range *= 2;
     model.GetWeapon().rate /= 2f;
 }
示例#6
0
        public static void DigitalAmplification(TowerModel model)
        {
            model.range *= 2;

            foreach (var attackModel in model.GetAttackModels())
            {
                attackModel.range *= 2;
            }
        }
示例#7
0
        public static void TsarBomba(TowerModel model)
        {
            GroundZero(model);

            var attackModels = model.GetAttackModels();

            attackModels[attackModels.Count].weapons[0].projectile.GetDamageModel().damage = 400;
            attackModels[attackModels.Count].weapons[0].rate = 5;
            attackModels[attackModels.Count].weapons[0].projectile.GetBehavior <SlowModel>().lifespan /= 8;
        }
        // Thanks to doombubbles for creating this
        /// <summary>
        /// (Cross-Game compatible) Return every ProjectileModels this TowerModel has
        /// </summary>
        public static List <ProjectileModel> GetAllProjectiles(this TowerModel towerModel)
        {
            List <ProjectileModel> allProjectiles = new List <ProjectileModel>();

            foreach (AttackModel attackModel in towerModel.GetAttackModels())
            {
                allProjectiles.AddRange(attackModel.GetAllProjectiles());
            }

            return(allProjectiles);
        }
示例#9
0
        public static void SuperMonkeyFanClub(TowerModel model)
        {
            model.GetWeapon().rate *= 0.06f / .475f;
            model.range += 20;
            model.GetAttackModels()[0].range += 20;

            foreach (var projectileModel in model.GetAllProjectiles())
            {
                if (projectileModel.display == null)
                {
                    continue;
                }
                projectileModel.GetBehavior <TravelStraitModel>().lifespan       *= 2f;
                projectileModel.GetBehavior <TravelStraitModel>().lifespanFrames *= 2;
            }
        }
示例#10
0
        public static void XrayVision(TowerModel model)
        {
            model.ignoreBlockers = true;
            foreach (var attackModel in model.GetAttackModels())
            {
                attackModel.attackThroughWalls = true;
            }

            foreach (var projectileModel in model.GetAllProjectiles())
            {
                projectileModel.ignoreBlockers = true;
                if (projectileModel.pierce > 0)
                {
                    projectileModel.pierce += model.tier + 1;
                }
            }
        }
示例#11
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));
        }
示例#12
0
        public static void PopandAwe(TowerModel model)
        {
            var realWeapon    = model.GetWeapon();
            var ability       = model.GetAbilites()[0];
            var abilityAttack = ability.GetBehavior <ActivateAttackModel>().attacks[0].Duplicate();
            var abilityWeapon = abilityAttack.weapons[0];

            var popAndEffect = ability.GetBehavior <CreateEffectOnAbilityModel>().effectModel.Duplicate();

            popAndEffect.lifespan /= 8f;

            var newWeapon    = realWeapon.Duplicate();
            var weaponEffect = newWeapon.projectile.GetBehavior <CreateEffectOnExpireModel>();

            weaponEffect.assetId                       = "";
            weaponEffect.effectModel                   = popAndEffect;
            weaponEffect.effectModel.scale            /= 3f;
            weaponEffect.effectModel.useCenterPosition = false;
            weaponEffect.effectModel.lifespan         /= 2f;
            newWeapon.rate = 4f;

            var newProjectile = abilityWeapon.projectile;

            newProjectile.GetBehavior <AgeModel>().lifespanFrames = 1;
            newProjectile.radius = realWeapon.projectile.radius * 2;

            newProjectile.behaviors = newProjectile.behaviors.RemoveItemOfType <Model, ClearHitBloonsModel>();

            newWeapon.projectile.GetBehavior <CreateProjectileOnExhaustFractionModel>().projectile = newProjectile;
            newWeapon.projectile.behaviors = newWeapon.projectile.behaviors
                                             .RemoveItemOfType <Model, CreateEffectOnExhaustFractionModel>();

            var sound = Game.instance.model.GetTower(MortarMonkey, 5).GetWeapon().projectile
                        .GetBehavior <CreateSoundOnProjectileExhaustModel>();

            newWeapon.projectile.behaviors = newWeapon.projectile.behaviors
                                             .RemoveItemOfType <Model, CreateSoundOnProjectileExhaustModel>();
            newWeapon.projectile.AddBehavior(sound);

            model.GetAttackModels()[0].AddWeapon(newWeapon);
        }
示例#13
0
        public static void RocketStorm(TowerModel model)
        {
            var abilityAttack = model.GetAbilites()[0].GetBehavior <ActivateAttackModel>().attacks[0].Duplicate();

            var abilityWeapon = abilityAttack.weapons[0];
            var realWeapon    = model.GetWeapon();

            abilityWeapon.emission = realWeapon.emission;
            abilityWeapon.GetBehavior <EjectEffectModel>().effectModel.lifespan = .05f;
            abilityWeapon.rate /= 4;


            if (abilityWeapon.projectile.GetBehavior <CreateProjectileOnContactModel>().projectile.HasBehavior <SlowModel>())
            {
                abilityWeapon.projectile.GetBehavior <CreateProjectileOnContactModel>().projectile.GetBehavior <SlowModel>().lifespan /= 3;
                abilityWeapon.projectile.GetBehavior <CreateProjectileOnContactModel>().projectile.GetBehavior <SlowModel>()
                .dontRefreshDuration = true;
                abilityWeapon.projectile.GetBehavior <CreateProjectileOnBlockerCollideModel>().projectile.GetBehavior <SlowModel>().lifespan /= 3;
                abilityWeapon.projectile.GetBehavior <CreateProjectileOnBlockerCollideModel>().projectile.GetBehavior <SlowModel>()
                .dontRefreshDuration = true;
            }

            model.GetAttackModels()[0].AddWeapon(abilityWeapon);
        }
示例#14
0
 /// <summary>
 /// (Cross-Game compatible) Return one of the AttackModels from this TowerModel. By default will give the first AttackModel
 /// </summary>
 /// <param name="index">Index of the AttackModel you want</param>
 public static AttackModel GetAttackModel(this TowerModel towerModel, int index)
 {
     return(towerModel.GetAttackModels()[index]);
 }
示例#15
0
 /// <summary>
 /// (Cross-Game compatible) Return the first AttackModel from this TowerModel, if it has one
 /// </summary>
 public static AttackModel GetAttackModel(this TowerModel towerModel)
 {
     return(towerModel.GetAttackModels().FirstOrDefault());
 }
示例#16
0
        public static void CrystalBall(TowerModel model)
        {
            if (!model.appliedUpgrades.Contains("Guided Magic"))
            {
                return;
            }

            model.ignoreBlockers = false;

            var guidedMagic = model.GetWeapon().projectile.GetBehavior <TrackTargetModel>();

            foreach (var attackModel in model.GetAttackModels())
            {
                if (attackModel.GetBehavior <TargetFirstModel>() != null)
                {
                    attackModel.RemoveBehavior <TargetFirstModel>();
                    attackModel.AddBehavior(new TargetFirstSharedRangeModel("TargetFirstSharedRangeModel_",
                                                                            true, true, false, false));
                }

                if (attackModel.GetBehavior <TargetLastModel>() != null)
                {
                    attackModel.RemoveBehavior <TargetLastModel>();
                    attackModel.AddBehavior(new TargetLastSharedRangeModel("TargetLastSharedRangeModel_",
                                                                           true, true, false, false));
                }

                if (attackModel.GetBehavior <TargetCloseModel>() != null)
                {
                    attackModel.RemoveBehavior <TargetCloseModel>();
                    attackModel.AddBehavior(new TargetCloseSharedRangeModel("TargetCloseSharedRangeModel_",
                                                                            true, true, false, false));
                }

                if (attackModel.GetBehavior <TargetStrongModel>() != null)
                {
                    attackModel.RemoveBehavior <TargetStrongModel>();
                    attackModel.AddBehavior(new TargetStrongSharedRangeModel("TargetStrongSharedRangeModel_",
                                                                             true, true, false, false));
                }

                attackModel.attackThroughWalls = false;
            }

            foreach (var weaponModel in model.GetWeapons())
            {
                weaponModel.emission.AddBehavior(
                    new EmissionCamoIfTargetIsCamoModel("EmissionCamoIfTargetIsCamoModel_CamoEmissionBehavior"));
            }

            foreach (var projectileModel in model.GetAllProjectiles())
            {
                var travelStraitModel = projectileModel.GetBehavior <TravelStraitModel>();
                if (travelStraitModel != null)
                {
                    var newLifeSpan = travelStraitModel.Lifespan * (150 / travelStraitModel.Speed);
                    travelStraitModel.Lifespan = Math.Max(travelStraitModel.Lifespan, newLifeSpan);
                    if (projectileModel.GetBehavior <TrackTargetModel>() == null)
                    {
                        projectileModel.AddBehavior(guidedMagic.Duplicate());
                    }
                }

                projectileModel.ignoreBlockers = false;
            }
        }