Example #1
0
        private void battleList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataGrid      dataGrid = sender as DataGrid;
            BattleWrapper battle   = (BattleWrapper)dataGrid.SelectedItem;

            characterLabel.Content = battle.Character;
            charId.Text            = battle.battle.characterId.ToString("X2");
            numBots.Text           = battle.battle.number_of_bots.ToString("X2");
            bot_1_grid.ItemsSource = battle.battle.bots[0].toDataSource();
            bot_2_grid.ItemsSource = battle.battle.bots[1].toDataSource();
            bot_3_grid.ItemsSource = battle.battle.bots[2].toDataSource();
        }
        public void fixSoftlock()
        {
            BattleWrapper odoroBattle = battles[0xA4];

            byte firstFixedPart = 0x0;

            if (odoroBattle.content.bots[0].isComplete())
            {
                odoroBattle.content.bots[0].head      = firstFixedPart;
                odoroBattle.content.bots[0].right_arm = firstFixedPart;
                odoroBattle.content.bots[0].left_arm  = firstFixedPart;
                odoroBattle.content.bots[0].legs      = firstFixedPart;
                odoroBattle.content.bots[0].medal     = IdTranslator.botMedal(firstFixedPart);
            }
            else
            {
                odoroBattle.content.bots[0].head = firstFixedPart;
            }

            byte secondFixedPart = 0x4;

            if (odoroBattle.content.bots[1].isComplete())
            {
                odoroBattle.content.bots[1].head      = secondFixedPart;
                odoroBattle.content.bots[1].right_arm = secondFixedPart;
                odoroBattle.content.bots[1].left_arm  = secondFixedPart;
                odoroBattle.content.bots[1].legs      = secondFixedPart;
                odoroBattle.content.bots[1].medal     = IdTranslator.botMedal(secondFixedPart);
            }
            else
            {
                odoroBattle.content.bots[1].right_arm = secondFixedPart;
            }

            BattleWrapper kappaBattle = battles[0x39];
            int           i           = rng.Next(0, 3);

            byte kappaFixedPart = 0x6C;

            if (kappaBattle.content.bots[i].isComplete())
            {
                kappaBattle.content.bots[i].head      = kappaFixedPart;
                kappaBattle.content.bots[i].right_arm = kappaFixedPart;
                kappaBattle.content.bots[i].left_arm  = kappaFixedPart;
                kappaBattle.content.bots[i].legs      = kappaFixedPart;
                kappaBattle.content.bots[i].medal     = IdTranslator.botMedal(kappaFixedPart);
            }
            else
            {
                kappaBattle.content.bots[i].head = kappaFixedPart;
            }
        }
Example #3
0
 public void RandomizeBattles(bool keep_team_structure, bool balanced_medal_level, float mixedchance, bool continuity)
 {
     if (keep_team_structure)
     {
         if (continuity)
         {
             Dictionary <byte, List <int> > uniques = findCharacterOccurences(battles);
             foreach (KeyValuePair <byte, List <int> > entry in uniques)
             {
                 List <byte> diffBots = new List <byte>();
                 foreach (int i in entry.Value)
                 {
                     BattleWrapper battle = battles[i];
                     for (int botIndex = 0; botIndex < battle.battle.number_of_bots; botIndex++)
                     {
                         BattleBot bot = battle.battle.bots[botIndex];
                         if (!diffBots.Contains(bot.head))
                         {
                             diffBots.Add(bot.head);
                         }
                     }
                 }
                 List <BattleBot> newBots = new List <BattleBot>();
                 foreach (byte i in diffBots)
                 {
                     newBots.Add(GenerateRandomBot(mixedchance));
                 }
                 foreach (int i in entry.Value)
                 {
                     BattleWrapper battle = battles[i];
                     for (int botIndex = 0; botIndex < battle.battle.number_of_bots; botIndex++)
                     {
                         BattleBot bot    = battle.battle.bots[botIndex];
                         BattleBot newBot = newBots[diffBots.IndexOf(bot.head)];
                         if (balanced_medal_level)
                         {
                             newBot.medal_level = bot.medal_level;
                         }
                         battle.battle.bots[botIndex] = newBot;
                     }
                 }
             }
         }
         else
         {
             foreach (BattleWrapper battle in battles)
             {
                 Dictionary <byte, List <int> > uniques = findUniques(battle.battle.bots, battle.battle.number_of_bots);
                 foreach (KeyValuePair <byte, List <int> > entry in uniques)
                 {
                     BattleBot newBot = GenerateRandomBot(mixedchance);
                     foreach (int i in entry.Value)
                     {
                         if (balanced_medal_level)
                         {
                             newBot.medal_level = battle.battle.bots[i].medal_level;
                         }
                         battle.battle.bots[i] = newBot;
                     }
                 }
             }
         }
     }
     else
     {
         foreach (BattleWrapper battle in battles)
         {
             for (int i = 0; i < battle.battle.number_of_bots; i++)
             {
                 BattleBot newBot = GenerateRandomBot(mixedchance);
                 if (balanced_medal_level)
                 {
                     newBot.medal_level = battle.battle.bots[i].medal_level;
                 }
                 battle.battle.bots[i] = newBot;
             }
         }
     }
 }