Пример #1
0
            public static void Postfix()
            {
                foreach (BloonModel bloon in Game.instance.model.bloons)
                {
                    if (bloon.name.Contains("BadFortified"))
                    {
                        // Creates a copy of a Fortified Bad
                        BloonModel boss = bloon.Clone().Cast <BloonModel>();

                        // Sets the boss display to boss.png
                        boss.display = ModContent.GetDisplayGUID <Boss>();

                        // Boss has no immunities by default. Can be changed if you'd like
                        boss.bloonProperties = BloonProperties.None;
                        boss.tags.Add("Boss");
                        foreach (DamageStateModel state in boss.damageDisplayStates)
                        {
                            // Sets all damage states to the boss
                            state.displayPath = boss.display;
                        }


                        boss.maxHealth = initialBossHealth;

                        boss.isBoss = true;

                        boss.id = "Boss";

                        boss.updateChildBloonModels = true;

                        // Removes children


                        boss.childBloonModels = new Il2CppSystem.Collections.Generic.List <BloonModel> {
                        };
                        SpawnChildrenModel spawnChildrenModel = boss.GetBehavior <SpawnChildrenModel>();
                        spawnChildrenModel.children = new string[] { };

                        // Registers the boss bloon
                        Game.instance.model.bloons = Game.instance.model.bloons.Take(0).Append(boss).Concat(Game.instance.model.bloons.Skip(0)).ToArray();
                    }
                }

                foreach (RoundSetModel round in Game.instance.model.roundSets)
                {
                    // Spawns the boss on round 3 by calling it by id
                    round.rounds[2].groups[0].bloon = "Boss";
                    round.rounds[2].groups[0].count = 1;
                }
            }