Beispiel #1
0
        public void UpdateBattle(string[] resObj)
        {
            ActivePokemon = Convert.ToInt32(resObj[7]);
            if (IsWildBattle)
            {
                WildPokemon.Update(_client.ParseArray(resObj[12]));
                WildPokemon.IsRare = _client.HasEncounteredRarePokemon;
                if (WildPokemon.Ability.Id == 23 && _client?.Team[ActivePokemon].Type1 != PokemonType.Steel &&
                    _client?.Team[ActivePokemon].Type2 != PokemonType.Steel &&
                    _client?.Team[ActivePokemon].Ability.Id != 23)
                {
                    IsTrapped = true;
                }

                if (WildPokemon.Ability.Id == 42 && _client?.Team[ActivePokemon].Type1 != PokemonType.Fire &&
                    _client?.Team[ActivePokemon].Type2 != PokemonType.Fire &&
                    _client?.Team[ActivePokemon].Ability.Id != 23 &&
                    _client?.Team[ActivePokemon].Type1 != PokemonType.Steel &&
                    _client?.Team[ActivePokemon].Type2 != PokemonType.Steel)
                {
                    IsTrapped = true;
                }

                IsAlreadyCaught = _client.PokemonCaught[WildPokemon.Id - 1] == "true";
            }

            ProcessBattleMessage(resObj[10]);
        }
Beispiel #2
0
        public void UpdateBattle(string[] resObj)
        {
            BattleHasWon  = resObj[3] == "W";
            BattleEnded   = !BattleHasWon && resObj[6] == "1";
            ActivePokemon = Convert.ToInt32(resObj[7]);

            var data   = GameClient.ParseArray(resObj[12]);
            int lastId = Convert.ToInt32(data[5]);

            if (lastId != WildPokemon.Id)
            {
                WildPokemon = new WildPokemon();
            }
            WildPokemon.Update(data);

            if (_client.HasEncounteredRarePokemon)
            {
                WildPokemon.IsRare = true;
            }

            IsTrapped |= (WildPokemon.Ability.Id == 23 && _client?.Team[ActivePokemon].Type1 != PokemonType.Steel &&
                          _client?.Team[ActivePokemon].Type2 != PokemonType.Steel &&
                          _client?.Team[ActivePokemon].Ability.Id != 23);

            IsTrapped |= (WildPokemon.Ability.Id == 42 && _client?.Team[ActivePokemon].Type1 != PokemonType.Fire &&
                          _client?.Team[ActivePokemon].Type2 != PokemonType.Fire &&
                          _client?.Team[ActivePokemon].Ability.Id != 23 &&
                          _client?.Team[ActivePokemon].Type1 != PokemonType.Steel &&
                          _client?.Team[ActivePokemon].Type2 != PokemonType.Steel);

            IsAlreadyCaught = _client.PokemonCaught[WildPokemon.Id - 1] == "true";

            var currentPPs = resObj[13].Split(',');

            for (int i = 0; i < currentPPs.Length; i++)
            {
                _client.Team[ActivePokemon].Moves[i].CurrentPoints = Convert.ToInt32(currentPPs[i]);
            }
            var maxPPs = resObj[14].Split(',');

            for (int i = 0; i < maxPPs.Length; i++)
            {
                _client.Team[ActivePokemon].Moves[i].MaxPoints = Convert.ToInt32(maxPPs[i]);
            }

            ProcessBattleMessage(resObj[10]);
        }