Пример #1
0
 def test_appraisal_filter_vaporeon_none(self):
     calculator = IvCalculator()
     result = calculator.get_ivs_across_powerups(
         pokemon_name='Vaporeon',
         powerup_stats=[(2212, 192, 4500, True)],
         appraisal=[3, 3, False, True, False])
     self._compare_result_lists([], result)
Пример #2
0
 def test_appraisal_filter_vaporeon_max(self):
     calculator = IvCalculator()
     result = calculator.get_ivs_across_powerups(
         pokemon_name='Vaporeon',
         powerup_stats=[(2074, 176, 3500, True)],
         appraisal=[3, 3, True, True, True])
     self._compare_result_lists(self.vaporeon_data_t1, result)
Пример #3
0
 def test_get_ivs_slowbro_across_powerups(self):
     calculator = IvCalculator()
     actual = calculator.get_ivs_across_powerups(
         pokemon_name='Slowbro',
         powerup_stats=[(653, 81, 1000, True), (690, 83, 1000, True)]
     )
     self._compare_result_lists(self.slowbro_data_t2, actual)
Пример #4
0
def main():
    parser = ArgumentParser(
        description=
        'Calculate possible IVs for your Pokemon.{line}Example Usage:{line}\t{cmd}'
        .format(
            line=linesep,
            cmd=
            "pogoiv --dust-cost 3000 3000 --combat-power 1528 1564 --hp 125 126 --powered True True --pokemon Slowbro"
        ))
    parser.add_argument(
        '--d',
        '--dust-cost',
        type=int,
        nargs='+',
        required=True,
        help=
        'Space delimited list of dust cost integers with one entry for each data point from the Pokemon\'s history.'
    )
    parser.add_argument(
        '--cp',
        '--combat-power',
        type=int,
        nargs='+',
        required=True,
        help=
        'Space delimited list of combat power integers with one entry for each data point from the Pokemon\'s history.'
    )
    parser.add_argument(
        '--hp',
        '--hitpoints',
        type=int,
        nargs='+',
        required=True,
        help=
        'Space delimited list of hit point integers with one entry for each data point from the Pokemon\'s history.'
    )
    parser.add_argument(
        '--powered',
        nargs="+",
        choices=["True", "False"],
        required=True,
        help='For this data point, has the Pokemon ever been powered?')
    parser.add_argument('-p',
                        '--pokemon',
                        required=True,
                        help='Name of the Pokemon')

    args = parser.parse_args()

    calculator = IvCalculator()
    try:
        possible_ivs = calculator.get_ivs_across_powerups(
            args.pokemon,
            collate_args(args.cp, args.hp, args.d,
                         [str2bool(bool_str) for bool_str in args.powered]))
        pretty_possible_ivs = get_pretty_table(possible_ivs)
        print(pretty_possible_ivs)
    except PokeDataError as pde:
        print(pde)
Пример #5
0
 def test_get_ivs_slowbro_across_powerups(self):
     calculator = IvCalculator()
     actual = calculator.get_ivs_across_powerups(pokemon_name='Slowbro',
                                                 powerup_stats=[
                                                     (653, 81, 1000, True),
                                                     (690, 83, 1000, True)
                                                 ])
     self._compare_result_lists(self.slowbro_data_t2, actual)
Пример #6
0
 def test_get_ivs_slowbro(self):
     calculator = IvCalculator()
     actual = calculator.get_ivs(pokemon_name='Slowbro',
                                 current_cp=1528,
                                 current_health=125,
                                 dust_to_upgrade=3000,
                                 powered=True)
     self._compare_result_lists(self.slowbro_data_t1, actual)
Пример #7
0
 def test_get_ivs_bulbasaur_edge_case(self):
     calculator = IvCalculator()
     actual = calculator.get_ivs(pokemon_name='Bulbasaur',
                                 current_cp=321,
                                 current_health=45,
                                 dust_to_upgrade=1000,
                                 powered=True)
     self._compare_result_lists(self.bulba_data_t1, actual)
Пример #8
0
 def test_appraisal_filter_vaporeon_max(self):
     calculator = IvCalculator()
     result = calculator.get_ivs_across_powerups(
         pokemon_name = 'Vaporeon',
         powerup_stats = [(2074, 176, 3500, True)],
         appraisal = [3, 3, True, True, True]
     )
     self._compare_result_lists(self.vaporeon_data_t1, result)
Пример #9
0
 def test_appraisal_filter_vaporeon_none(self):
     calculator = IvCalculator()
     result = calculator.get_ivs_across_powerups(
         pokemon_name = 'Vaporeon',
         powerup_stats = [(2212, 192, 4500, True)],
         appraisal = [3, 3, False, True, False]
     )
     self._compare_result_lists([], result)
Пример #10
0
 def test_get_ivs_bulbasaur_edge_case(self):
     calculator = IvCalculator()
     actual = calculator.get_ivs(
         pokemon_name='Bulbasaur',
         current_cp=321,
         current_health=45,
         dust_to_upgrade=1000,
         powered=True
     )
     self._compare_result_lists(self.bulba_data_t1, actual)
Пример #11
0
 def test_get_ivs_slowbro(self):
     calculator = IvCalculator()
     actual = calculator.get_ivs(
         pokemon_name='Slowbro',
         current_cp=1528,
         current_health=125,
         dust_to_upgrade=3000,
         powered=True
     )
     self._compare_result_lists(self.slowbro_data_t1, actual)
Пример #12
0
 def test_calculate_iv_eevee(self):
     calculator = IvCalculator()
     result = calculator.get_ivs(
         pokemon_name='Eevee',
         current_cp=320,
         current_health=49,
         dust_to_upgrade=1300,
         powered=False
     )
     self.assertEquals([{'atk_iv': 15, 'def_iv': 15, 'stam_iv': 2, 'level': 11.0, 'perfection': 71.1}], result)
Пример #13
0
 def test_calculate_iv_eevee(self):
     calculator = IvCalculator()
     result = calculator.get_ivs(pokemon_name='Eevee',
                                 current_cp=320,
                                 current_health=49,
                                 dust_to_upgrade=1300,
                                 powered=False)
     self.assertEquals([{
         'atk_iv': 15,
         'def_iv': 15,
         'stam_iv': 2,
         'level': 11.0,
         'perfection': 71.1
     }], result)
Пример #14
0
    def test_calculate_iv_eevee(self):
        calculator = IvCalculator()
        result = calculator.get_ivs(pokemon_name='Eevee',
                                    current_cp=389,
                                    current_health=63,
                                    dust_to_upgrade=1600,
                                    powered=True)

        self.assertEquals([{
            'atk_iv': 12,
            'def_iv': 14,
            'stam_iv': 15,
            'perfection': 91.1,
            'level': 14.5
        }, {
            'atk_iv': 12,
            'def_iv': 15,
            'stam_iv': 14,
            'perfection': 91.1,
            'level': 14.5
        }, {
            'atk_iv': 14,
            'def_iv': 9,
            'stam_iv': 15,
            'perfection': 84.4,
            'level': 14.5
        }, {
            'atk_iv': 14,
            'def_iv': 10,
            'stam_iv': 14,
            'perfection': 84.4,
            'level': 14.5
        }, {
            'atk_iv': 15,
            'def_iv': 7,
            'stam_iv': 15,
            'perfection': 82.2,
            'level': 14.5
        }, {
            'atk_iv': 15,
            'def_iv': 8,
            'stam_iv': 14,
            'perfection': 82.2,
            'level': 14.5
        }], result)
Пример #15
0
    def test_calculate_iv_eevee(self):
        calculator = IvCalculator()
        result = calculator.get_ivs(
            pokemon_name='Eevee',
            current_cp=389,
            current_health=63,
            dust_to_upgrade=1600,
            powered=True
        )

        self.assertEquals([
            {'atk_iv': 12, 'def_iv': 14, 'stam_iv': 15, 'perfection': 91.1, 'level': 14.5},
            {'atk_iv': 12, 'def_iv': 15, 'stam_iv': 14, 'perfection': 91.1, 'level': 14.5},
            {'atk_iv': 14, 'def_iv': 9, 'stam_iv': 15, 'perfection': 84.4, 'level': 14.5},
            {'atk_iv': 14, 'def_iv': 10, 'stam_iv': 14, 'perfection': 84.4, 'level': 14.5},
            {'atk_iv': 15, 'def_iv': 7, 'stam_iv': 15, 'perfection': 82.2, 'level': 14.5},
            {'atk_iv': 15, 'def_iv': 8, 'stam_iv': 14, 'perfection': 82.2, 'level': 14.5}
        ], result)
Пример #16
0
def get_all_iv_range(message):
    numbers = message.split(' ')
    pokename = str(numbers[1])
    pokecp = int(numbers[2])
    pokehp = int(numbers[3])
    pokepwcost = int(numbers[4])
    pokepowered = bool(numbers[5])
    calculator = IvCalculator()
    all_ivs = calculator.get_ivs_across_powerups(pokemon_name=pokename,
                                                 powerup_stats=[
                                                     (pokecp, pokehp,
                                                      pokepwcost, pokepowered)
                                                 ])
    if all_ivs:
        return all_ivs
    else:
        return [
            'Check your values are correct and in the right order: name, cp, hp, powerup cost, True/False if powered'
        ]
Пример #17
0
def main():
    parser = ArgumentParser(description='Calculate possible IVs for your Pokemon.{line}Example Usage:{line}\t{cmd}'.format(
        line=linesep,
        cmd="pogoiv --dust-cost 3000 3000 --combat-power 1528 1564 --hp 125 126 --powered True True --pokemon Slowbro"
    ))
    parser.add_argument(
        '--d', '--dust-cost',
        type=int,
        nargs='+',
        required=True,
        help='Space delimited list of dust cost integers with one entry for each data point from the Pokemon\'s history.'
    )
    parser.add_argument(
        '--cp', '--combat-power',
        type=int,
        nargs='+',
        required=True,
        help='Space delimited list of combat power integers with one entry for each data point from the Pokemon\'s history.'
    )
    parser.add_argument(
        '--hp', '--hitpoints',
        type=int,
        nargs='+',
        required=True,
        help='Space delimited list of hit point integers with one entry for each data point from the Pokemon\'s history.'
    )
    parser.add_argument('--powered', nargs="+", choices=["True", "False"], required=True, help='For this data point, has the Pokemon ever been powered?')
    parser.add_argument('-p', '--pokemon', required=True, help='Name of the Pokemon')

    parser.add_argument(
        '--ao', '--appraisal-overall',
        type=int,
        required=False,
        help='Integer from 0 to 3 indicating the global appraisal phrase. 0 the lowest, 3 the highest.'
    )
    parser.add_argument(
        '--ap', '--appraisal-stats',
        type=int,
        required=False,
        help='Integer from 0 to 3 indicating the best stat appraisal phrase. 0 the lowest, 3 the highest.'
    )
    parser.add_argument('--at', choices=["True", "False"], required=False, help='Is attack the best stat?')
    parser.add_argument('--de', choices=["True", "False"], required=False, help='Is defense the best stat?')
    parser.add_argument('--st', choices=["True", "False"], required=False, help='Is stamina the best stat?')

    args = parser.parse_args()

    appraisal = []
    if not (args.ao == None or args.ap == None or args.at == None or args.de == None or args.st == None):
        appraisal.append(args.ao)
        appraisal.append(args.ap)
        appraisal.append(str2bool(args.at))
        appraisal.append(str2bool(args.de))
        appraisal.append(str2bool(args.st))

    calculator = IvCalculator()
    try:
        possible_ivs = calculator.get_ivs_across_powerups(
            args.pokemon,
            collate_args(args.cp, args.hp, args.d, [str2bool(bool_str) for bool_str in args.powered]),
            appraisal
        )
        pretty_possible_ivs = get_pretty_table(possible_ivs)
        print(pretty_possible_ivs)
    except PokeDataError as pde:
        print(pde)