localdex 0.2.55__py3-none-any.whl → 0.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
localdex/__init__.py CHANGED
@@ -2,6 +2,8 @@
2
2
  from .core import LocalDex
3
3
  from .models import Pokemon, Move, Ability, Item, BaseStats
4
4
  from .exceptions import PokemonNotFoundError, MoveNotFoundError, AbilityNotFoundError, ItemNotFoundError
5
+ from .stat_guesser import BattleStatGuesser, PokemonSet, battle_stat_optimizer
6
+ from .stat_calculator import StatCalculator
5
7
 
6
8
  __all__ = [
7
9
  "LocalDex",
@@ -14,4 +16,8 @@ __all__ = [
14
16
  "MoveNotFoundError",
15
17
  "AbilityNotFoundError",
16
18
  "ItemNotFoundError",
19
+ "BattleStatGuesser",
20
+ "PokemonSet",
21
+ "battle_stat_optimizer",
22
+ "StatCalculator",
17
23
  ]
localdex/core.py CHANGED
@@ -20,6 +20,7 @@ from .exceptions import (
20
20
  )
21
21
  from .data_loader import DataLoader
22
22
  from .name_normalizer import PokemonNameNormalizer
23
+ from .stat_guesser import BattleStatGuesser, PokemonSet, battle_stat_optimizer
23
24
 
24
25
 
25
26
  class LocalDex:
@@ -72,9 +73,10 @@ class LocalDex:
72
73
  for pokemon in all_pokemon:
73
74
  # Index by type
74
75
  for pokemon_type in pokemon.types:
75
- if pokemon_type not in self._pokemon_by_type:
76
- self._pokemon_by_type[pokemon_type] = set()
77
- self._pokemon_by_type[pokemon_type].add(pokemon.name.lower())
76
+ type_key = pokemon_type.lower()
77
+ if type_key not in self._pokemon_by_type:
78
+ self._pokemon_by_type[type_key] = set()
79
+ self._pokemon_by_type[type_key].add(pokemon.name.lower())
78
80
 
79
81
  # Index by generation
80
82
  if pokemon.generation:
@@ -513,7 +515,7 @@ class LocalDex:
513
515
  name=data.get("name", ""),
514
516
  description=data.get("description", data.get("desc", "")),
515
517
  short_description=data.get("shortDesc"),
516
- generation=data.get("gen"),
518
+ generation=data.get("generation", data.get("gen")),
517
519
  num=data.get("num"),
518
520
  spritenum=data.get("spritenum"),
519
521
  fling=data.get("fling"),
@@ -555,3 +557,42 @@ class LocalDex:
555
557
  """Access to stat calculation functionality."""
556
558
  from .stat_calculator import StatCalculator
557
559
  return StatCalculator(self)
560
+
561
+ def create_stat_guesser(self, format_id: str) -> BattleStatGuesser:
562
+ """
563
+ Create a BattleStatGuesser instance for the specified format.
564
+
565
+ Args:
566
+ format_id: The format ID (e.g., "gen9ou", "gen8ou", etc.)
567
+
568
+ Returns:
569
+ BattleStatGuesser instance configured for the format
570
+ """
571
+ return BattleStatGuesser(format_id, self)
572
+
573
+ def guess_pokemon_stats(self, pokemon_set: PokemonSet, format_id: str = "gen9ou") -> Dict[str, Any]:
574
+ """
575
+ Guess the role and EV spread for a Pokemon set.
576
+
577
+ Args:
578
+ pokemon_set: The Pokemon set to analyze
579
+ format_id: The format ID (default: "gen9ou")
580
+
581
+ Returns:
582
+ Dictionary containing role, EVs, plus/minus stats, and move information
583
+ """
584
+ guesser = self.create_stat_guesser(format_id)
585
+ return guesser.guess(pokemon_set)
586
+
587
+ def optimize_pokemon_stats(self, pokemon_set: PokemonSet, format_id: str = "gen9ou") -> Optional[Dict[str, Any]]:
588
+ """
589
+ Optimize a Pokemon's EV spread and nature.
590
+
591
+ Args:
592
+ pokemon_set: The Pokemon set to optimize
593
+ format_id: The format ID (default: "gen9ou")
594
+
595
+ Returns:
596
+ Optimized spread or None if no optimization is possible
597
+ """
598
+ return battle_stat_optimizer(pokemon_set, format_id, self)
@@ -0,0 +1,3 @@
1
+ {
2
+ "name": "crystal-cluster"
3
+ }