Beispiel #1
0
        public static BloonModel GetNextStrongest(this BloonModel bloonModel, bool allowCamo = false, bool allowFortified = false, bool allowRegrow = false)
        {
            var allBloonTypes = Game.instance.GetAllBloonModels();

            int        max             = allBloonTypes.Count - 1; // subtract 1 more here to avoid test bloon
            int        currentBloonNum = bloonModel.GetBloonIdNum();
            BloonModel nextBloonModel  = null;

            if (allowCamo || allowFortified || allowRegrow)
            {
                nextBloonModel = _BloonModel.RemoveBloonStatus(allBloonTypes[currentBloonNum + 1].name, !allowCamo, !allowFortified, !allowRegrow);
            }
            else
            {
                string baseBloon = bloonModel.id.Replace("Camo", "").Replace("Fortified", "").Replace("Regrow", "");
                for (int a = bloonModel.GetBloonIdNum(); a < max; a++)
                {
                    if (allBloonTypes[a].name.Contains(baseBloon))
                    {
                        continue;
                    }

                    nextBloonModel = _BloonModel.RemoveBloonStatus(allBloonTypes[a].name, true, true, true);
                    break;
                }
            }

            return(nextBloonModel);
        }
Beispiel #2
0
        private int GetRandomBloonNum(BloonModel currentBloon)
        {
            var allBloonTypes = Game.instance.GetAllBloonModels();
            int maxBloonNum   = allBloonTypes.Count - 2; //subtracting 2 to avoid test bloon
            int maxRand       = (settings.maxRandomChange > 0) ? settings.maxRandomChange : 0;
            var randNum       = rand.Next(0, maxRand);

            var currentBloonNum      = currentBloon.GetBloonIdNum();
            var nextPossibleBloonNum = currentBloonNum + randNum;
            var nextBloonNum         = (nextPossibleBloonNum <= maxBloonNum) ? nextPossibleBloonNum : maxBloonNum;

            return(nextBloonNum);
        }