localdex 0.2.44__py3-none-any.whl → 0.2.45__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/core.py +92 -18
- {localdex-0.2.44.dist-info → localdex-0.2.45.dist-info}/METADATA +1 -1
- {localdex-0.2.44.dist-info → localdex-0.2.45.dist-info}/RECORD +7 -7
- {localdex-0.2.44.dist-info → localdex-0.2.45.dist-info}/WHEEL +0 -0
- {localdex-0.2.44.dist-info → localdex-0.2.45.dist-info}/entry_points.txt +0 -0
- {localdex-0.2.44.dist-info → localdex-0.2.45.dist-info}/licenses/LICENSE +0 -0
- {localdex-0.2.44.dist-info → localdex-0.2.45.dist-info}/top_level.txt +0 -0
localdex/core.py
CHANGED
@@ -625,6 +625,10 @@ class LocalDex:
|
|
625
625
|
"""
|
626
626
|
Calculate HP EV from total HP stat using the reverse of the Pokemon HP formula.
|
627
627
|
|
628
|
+
If the target HP is impossible to achieve with any EV value, returns the EV that
|
629
|
+
produces the closest possible HP value. For impossibly high HP values, returns 252 EVs.
|
630
|
+
For impossibly low HP values, returns 0 EVs.
|
631
|
+
|
628
632
|
Args:
|
629
633
|
total_hp (int): Total HP stat value
|
630
634
|
base_hp (int): Base HP stat
|
@@ -632,13 +636,22 @@ class LocalDex:
|
|
632
636
|
level (int): Pokemon level (1-100)
|
633
637
|
|
634
638
|
Returns:
|
635
|
-
int: Required EV value (0-252)
|
639
|
+
int: Required EV value (0-252) - closest possible value if target is impossible
|
636
640
|
"""
|
637
641
|
if level <= 0:
|
638
642
|
raise ValueError("Level must be greater than 0")
|
639
643
|
|
640
|
-
#
|
641
|
-
|
644
|
+
# Calculate the minimum and maximum possible HP values
|
645
|
+
min_hp = self.calculate_hp(base_hp, iv, 0, level)
|
646
|
+
max_hp = self.calculate_hp(base_hp, iv, 252, level)
|
647
|
+
|
648
|
+
# If target HP is impossible, return the closest boundary
|
649
|
+
if total_hp <= min_hp:
|
650
|
+
return 0 # Return 0 EVs for impossibly low HP
|
651
|
+
elif total_hp >= max_hp:
|
652
|
+
return 252 # Return 252 EVs for impossibly high HP
|
653
|
+
|
654
|
+
# Find the EV that gives us the closest HP value
|
642
655
|
best_ev = 0
|
643
656
|
best_diff = float('inf')
|
644
657
|
|
@@ -659,6 +672,10 @@ class LocalDex:
|
|
659
672
|
"""
|
660
673
|
Calculate EV for other stats (Attack, Defense, Sp. Attack, Sp. Defense, Speed) using the reverse of the Pokemon stat formula.
|
661
674
|
|
675
|
+
If the target stat is impossible to achieve with any EV value, returns the EV that
|
676
|
+
produces the closest possible stat value. For impossibly high stat values, returns 252 EVs.
|
677
|
+
For impossibly low stat values, returns 0 EVs.
|
678
|
+
|
662
679
|
Args:
|
663
680
|
total_stat (int): Total stat value
|
664
681
|
base_stat (int): Base stat value
|
@@ -667,15 +684,24 @@ class LocalDex:
|
|
667
684
|
nature_modifier (float): Nature modifier (0.9 for hindering, 1.0 for neutral, 1.1 for beneficial)
|
668
685
|
|
669
686
|
Returns:
|
670
|
-
int: Required EV value (0-252)
|
687
|
+
int: Required EV value (0-252) - closest possible value if target is impossible
|
671
688
|
"""
|
672
689
|
if level <= 0:
|
673
690
|
raise ValueError("Level must be greater than 0")
|
674
691
|
if nature_modifier <= 0:
|
675
692
|
raise ValueError("Nature modifier must be greater than 0")
|
676
693
|
|
677
|
-
#
|
678
|
-
|
694
|
+
# Calculate the minimum and maximum possible stat values
|
695
|
+
min_stat = self.calculate_other_stat(base_stat, iv, 0, level, nature_modifier)
|
696
|
+
max_stat = self.calculate_other_stat(base_stat, iv, 252, level, nature_modifier)
|
697
|
+
|
698
|
+
# If target stat is impossible, return the closest boundary
|
699
|
+
if total_stat <= min_stat:
|
700
|
+
return 0 # Return 0 EVs for impossibly low stat
|
701
|
+
elif total_stat >= max_stat:
|
702
|
+
return 252 # Return 252 EVs for impossibly high stat
|
703
|
+
|
704
|
+
# Find the EV that gives us the closest stat value
|
679
705
|
best_ev = 0
|
680
706
|
best_diff = float('inf')
|
681
707
|
|
@@ -696,6 +722,10 @@ class LocalDex:
|
|
696
722
|
"""
|
697
723
|
Calculate Attack EV from total Attack stat.
|
698
724
|
|
725
|
+
If the target Attack is impossible to achieve with any EV value, returns the EV that
|
726
|
+
produces the closest possible Attack value. For impossibly high Attack values, returns 252 EVs.
|
727
|
+
For impossibly low Attack values, returns 0 EVs.
|
728
|
+
|
699
729
|
Args:
|
700
730
|
total_attack (int): Total Attack stat value
|
701
731
|
base_attack (int): Base Attack stat
|
@@ -704,7 +734,7 @@ class LocalDex:
|
|
704
734
|
nature_modifier (float): Nature modifier (0.9 for hindering, 1.0 for neutral, 1.1 for beneficial)
|
705
735
|
|
706
736
|
Returns:
|
707
|
-
int: Required EV value (0-252)
|
737
|
+
int: Required EV value (0-252) - closest possible value if target is impossible
|
708
738
|
"""
|
709
739
|
return self.calculate_other_stat_ev(total_attack, base_attack, iv, level, nature_modifier)
|
710
740
|
|
@@ -712,6 +742,10 @@ class LocalDex:
|
|
712
742
|
"""
|
713
743
|
Calculate Defense EV from total Defense stat.
|
714
744
|
|
745
|
+
If the target Defense is impossible to achieve with any EV value, returns the EV that
|
746
|
+
produces the closest possible Defense value. For impossibly high Defense values, returns 252 EVs.
|
747
|
+
For impossibly low Defense values, returns 0 EVs.
|
748
|
+
|
715
749
|
Args:
|
716
750
|
total_defense (int): Total Defense stat value
|
717
751
|
base_defense (int): Base Defense stat
|
@@ -720,7 +754,7 @@ class LocalDex:
|
|
720
754
|
nature_modifier (float): Nature modifier (0.9 for hindering, 1.0 for neutral, 1.1 for beneficial)
|
721
755
|
|
722
756
|
Returns:
|
723
|
-
int: Required EV value (0-252)
|
757
|
+
int: Required EV value (0-252) - closest possible value if target is impossible
|
724
758
|
"""
|
725
759
|
return self.calculate_other_stat_ev(total_defense, base_defense, iv, level, nature_modifier)
|
726
760
|
|
@@ -728,6 +762,10 @@ class LocalDex:
|
|
728
762
|
"""
|
729
763
|
Calculate Special Attack EV from total Special Attack stat.
|
730
764
|
|
765
|
+
If the target Special Attack is impossible to achieve with any EV value, returns the EV that
|
766
|
+
produces the closest possible Special Attack value. For impossibly high Special Attack values, returns 252 EVs.
|
767
|
+
For impossibly low Special Attack values, returns 0 EVs.
|
768
|
+
|
731
769
|
Args:
|
732
770
|
total_special_attack (int): Total Special Attack stat value
|
733
771
|
base_special_attack (int): Base Special Attack stat
|
@@ -736,7 +774,7 @@ class LocalDex:
|
|
736
774
|
nature_modifier (float): Nature modifier (0.9 for hindering, 1.0 for neutral, 1.1 for beneficial)
|
737
775
|
|
738
776
|
Returns:
|
739
|
-
int: Required EV value (0-252)
|
777
|
+
int: Required EV value (0-252) - closest possible value if target is impossible
|
740
778
|
"""
|
741
779
|
return self.calculate_other_stat_ev(total_special_attack, base_special_attack, iv, level, nature_modifier)
|
742
780
|
|
@@ -744,6 +782,10 @@ class LocalDex:
|
|
744
782
|
"""
|
745
783
|
Calculate Special Defense EV from total Special Defense stat.
|
746
784
|
|
785
|
+
If the target Special Defense is impossible to achieve with any EV value, returns the EV that
|
786
|
+
produces the closest possible Special Defense value. For impossibly high Special Defense values, returns 252 EVs.
|
787
|
+
For impossibly low Special Defense values, returns 0 EVs.
|
788
|
+
|
747
789
|
Args:
|
748
790
|
total_special_defense (int): Total Special Defense stat value
|
749
791
|
base_special_defense (int): Base Special Defense stat
|
@@ -752,7 +794,7 @@ class LocalDex:
|
|
752
794
|
nature_modifier (float): Nature modifier (0.9 for hindering, 1.0 for neutral, 1.1 for beneficial)
|
753
795
|
|
754
796
|
Returns:
|
755
|
-
int: Required EV value (0-252)
|
797
|
+
int: Required EV value (0-252) - closest possible value if target is impossible
|
756
798
|
"""
|
757
799
|
return self.calculate_other_stat_ev(total_special_defense, base_special_defense, iv, level, nature_modifier)
|
758
800
|
|
@@ -760,6 +802,10 @@ class LocalDex:
|
|
760
802
|
"""
|
761
803
|
Calculate Speed EV from total Speed stat.
|
762
804
|
|
805
|
+
If the target Speed is impossible to achieve with any EV value, returns the EV that
|
806
|
+
produces the closest possible Speed value. For impossibly high Speed values, returns 252 EVs.
|
807
|
+
For impossibly low Speed values, returns 0 EVs.
|
808
|
+
|
763
809
|
Args:
|
764
810
|
total_speed (int): Total Speed stat value
|
765
811
|
base_speed (int): Base Speed stat
|
@@ -768,7 +814,7 @@ class LocalDex:
|
|
768
814
|
nature_modifier (float): Nature modifier (0.9 for hindering, 1.0 for neutral, 1.1 for beneficial)
|
769
815
|
|
770
816
|
Returns:
|
771
|
-
int: Required EV value (0-252)
|
817
|
+
int: Required EV value (0-252) - closest possible value if target is impossible
|
772
818
|
"""
|
773
819
|
return self.calculate_other_stat_ev(total_speed, base_speed, iv, level, nature_modifier)
|
774
820
|
|
@@ -776,6 +822,10 @@ class LocalDex:
|
|
776
822
|
"""
|
777
823
|
Calculate HP EV from total HP stat using species name.
|
778
824
|
|
825
|
+
If the target HP is impossible to achieve with any EV value, returns the EV that
|
826
|
+
produces the closest possible HP value. For impossibly high HP values, returns 252 EVs.
|
827
|
+
For impossibly low HP values, returns 0 EVs.
|
828
|
+
|
779
829
|
Args:
|
780
830
|
species (str): Pokemon species name
|
781
831
|
total_hp (int): Total HP stat value
|
@@ -783,7 +833,7 @@ class LocalDex:
|
|
783
833
|
level (int): Pokemon level (1-100)
|
784
834
|
|
785
835
|
Returns:
|
786
|
-
int: Required EV value (0-252)
|
836
|
+
int: Required EV value (0-252) - closest possible value if target is impossible
|
787
837
|
"""
|
788
838
|
base_stats = self.get_base_stats_from_species(species)
|
789
839
|
return self.calculate_hp_ev(total_hp, base_stats.hp, iv, level)
|
@@ -792,6 +842,10 @@ class LocalDex:
|
|
792
842
|
"""
|
793
843
|
Calculate Attack EV from total Attack stat using species name.
|
794
844
|
|
845
|
+
If the target Attack is impossible to achieve with any EV value, returns the EV that
|
846
|
+
produces the closest possible Attack value. For impossibly high Attack values, returns 252 EVs.
|
847
|
+
For impossibly low Attack values, returns 0 EVs.
|
848
|
+
|
795
849
|
Args:
|
796
850
|
species (str): Pokemon species name
|
797
851
|
total_attack (int): Total Attack stat value
|
@@ -800,7 +854,7 @@ class LocalDex:
|
|
800
854
|
nature_modifier (float): Nature modifier (0.9 for hindering, 1.0 for neutral, 1.1 for beneficial)
|
801
855
|
|
802
856
|
Returns:
|
803
|
-
int: Required EV value (0-252)
|
857
|
+
int: Required EV value (0-252) - closest possible value if target is impossible
|
804
858
|
"""
|
805
859
|
base_stats = self.get_base_stats_from_species(species)
|
806
860
|
return self.calculate_attack_ev(total_attack, base_stats.attack, iv, level, nature_modifier)
|
@@ -809,6 +863,10 @@ class LocalDex:
|
|
809
863
|
"""
|
810
864
|
Calculate Defense EV from total Defense stat using species name.
|
811
865
|
|
866
|
+
If the target Defense is impossible to achieve with any EV value, returns the EV that
|
867
|
+
produces the closest possible Defense value. For impossibly high Defense values, returns 252 EVs.
|
868
|
+
For impossibly low Defense values, returns 0 EVs.
|
869
|
+
|
812
870
|
Args:
|
813
871
|
species (str): Pokemon species name
|
814
872
|
total_defense (int): Total Defense stat value
|
@@ -817,7 +875,7 @@ class LocalDex:
|
|
817
875
|
nature_modifier (float): Nature modifier (0.9 for hindering, 1.0 for neutral, 1.1 for beneficial)
|
818
876
|
|
819
877
|
Returns:
|
820
|
-
int: Required EV value (0-252)
|
878
|
+
int: Required EV value (0-252) - closest possible value if target is impossible
|
821
879
|
"""
|
822
880
|
base_stats = self.get_base_stats_from_species(species)
|
823
881
|
return self.calculate_defense_ev(total_defense, base_stats.defense, iv, level, nature_modifier)
|
@@ -826,6 +884,10 @@ class LocalDex:
|
|
826
884
|
"""
|
827
885
|
Calculate Special Attack EV from total Special Attack stat using species name.
|
828
886
|
|
887
|
+
If the target Special Attack is impossible to achieve with any EV value, returns the EV that
|
888
|
+
produces the closest possible Special Attack value. For impossibly high Special Attack values, returns 252 EVs.
|
889
|
+
For impossibly low Special Attack values, returns 0 EVs.
|
890
|
+
|
829
891
|
Args:
|
830
892
|
species (str): Pokemon species name
|
831
893
|
total_special_attack (int): Total Special Attack stat value
|
@@ -834,7 +896,7 @@ class LocalDex:
|
|
834
896
|
nature_modifier (float): Nature modifier (0.9 for hindering, 1.0 for neutral, 1.1 for beneficial)
|
835
897
|
|
836
898
|
Returns:
|
837
|
-
int: Required EV value (0-252)
|
899
|
+
int: Required EV value (0-252) - closest possible value if target is impossible
|
838
900
|
"""
|
839
901
|
base_stats = self.get_base_stats_from_species(species)
|
840
902
|
return self.calculate_special_attack_ev(total_special_attack, base_stats.special_attack, iv, level, nature_modifier)
|
@@ -843,6 +905,10 @@ class LocalDex:
|
|
843
905
|
"""
|
844
906
|
Calculate Special Defense EV from total Special Defense stat using species name.
|
845
907
|
|
908
|
+
If the target Special Defense is impossible to achieve with any EV value, returns the EV that
|
909
|
+
produces the closest possible Special Defense value. For impossibly high Special Defense values, returns 252 EVs.
|
910
|
+
For impossibly low Special Defense values, returns 0 EVs.
|
911
|
+
|
846
912
|
Args:
|
847
913
|
species (str): Pokemon species name
|
848
914
|
total_special_defense (int): Total Special Defense stat value
|
@@ -851,7 +917,7 @@ class LocalDex:
|
|
851
917
|
nature_modifier (float): Nature modifier (0.9 for hindering, 1.0 for neutral, 1.1 for beneficial)
|
852
918
|
|
853
919
|
Returns:
|
854
|
-
int: Required EV value (0-252)
|
920
|
+
int: Required EV value (0-252) - closest possible value if target is impossible
|
855
921
|
"""
|
856
922
|
base_stats = self.get_base_stats_from_species(species)
|
857
923
|
return self.calculate_special_defense_ev(total_special_defense, base_stats.special_defense, iv, level, nature_modifier)
|
@@ -860,6 +926,10 @@ class LocalDex:
|
|
860
926
|
"""
|
861
927
|
Calculate Speed EV from total Speed stat using species name.
|
862
928
|
|
929
|
+
If the target Speed is impossible to achieve with any EV value, returns the EV that
|
930
|
+
produces the closest possible Speed value. For impossibly high Speed values, returns 252 EVs.
|
931
|
+
For impossibly low Speed values, returns 0 EVs.
|
932
|
+
|
863
933
|
Args:
|
864
934
|
species (str): Pokemon species name
|
865
935
|
total_speed (int): Total Speed stat value
|
@@ -868,7 +938,7 @@ class LocalDex:
|
|
868
938
|
nature_modifier (float): Nature modifier (0.9 for hindering, 1.0 for neutral, 1.1 for beneficial)
|
869
939
|
|
870
940
|
Returns:
|
871
|
-
int: Required EV value (0-252)
|
941
|
+
int: Required EV value (0-252) - closest possible value if target is impossible
|
872
942
|
"""
|
873
943
|
base_stats = self.get_base_stats_from_species(species)
|
874
944
|
return self.calculate_speed_ev(total_speed, base_stats.speed, iv, level, nature_modifier)
|
@@ -877,6 +947,10 @@ class LocalDex:
|
|
877
947
|
"""
|
878
948
|
Calculate all EV values for a Pokemon using species name and target stats.
|
879
949
|
|
950
|
+
If any target stat is impossible to achieve with any EV value, returns the EV that
|
951
|
+
produces the closest possible stat value. For impossibly high stat values, returns 252 EVs.
|
952
|
+
For impossibly low stat values, returns 0 EVs.
|
953
|
+
|
880
954
|
Args:
|
881
955
|
species (str): Pokemon species name
|
882
956
|
stats (Dict[str, int]): Dictionary of target stat values with keys: 'hp', 'attack', 'defense', 'special_attack', 'special_defense', 'speed'
|
@@ -885,7 +959,7 @@ class LocalDex:
|
|
885
959
|
nature_modifier (float): Nature modifier (0.9 for hindering, 1.0 for neutral, 1.1 for beneficial)
|
886
960
|
|
887
961
|
Returns:
|
888
|
-
Dict[str, int]: Dictionary of required EV values for each stat
|
962
|
+
Dict[str, int]: Dictionary of required EV values for each stat - closest possible values if targets are impossible
|
889
963
|
"""
|
890
964
|
base_stats = self.get_base_stats_from_species(species)
|
891
965
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
localdex/__init__.py,sha256=TTeh9Eys8nLtcw7Dg2equDqnouthIUyfsqvABtzR2vA,403
|
2
2
|
localdex/cli.py,sha256=WqBCyA0akAFJNrYa8jCA3zoZgYEptDYDMGfAGkvKyZc,19317
|
3
|
-
localdex/core.py,sha256=
|
3
|
+
localdex/core.py,sha256=fXalY6GyZ94QhD_M0KW_l9tdhq-bb785O14sMmvzenI,54495
|
4
4
|
localdex/data_loader.py,sha256=hi9aSTto5Ti-OBGOgrQ-XwD5hmivsUwS1uC4rulhwQI,11366
|
5
5
|
localdex/download_data.py,sha256=T4A3OliGe2RsrRV1glyCqRcFhQIRt29KcY1K1-IqTuU,21597
|
6
6
|
localdex/exceptions.py,sha256=Z02-8Kci6jFDk2nnGdVSHZJMDDWE9vuwuASs4VM3To8,2777
|
@@ -4826,9 +4826,9 @@ localdex/models/ability.py,sha256=AQzv3XUHHl4sustMJjPDDjJOjXu2GMLTfcM3-tqQ_1w,30
|
|
4826
4826
|
localdex/models/item.py,sha256=zXao8F-jBPUGq_YLeGeYeK_dZVI7aZMXtWOPwR3qusY,4677
|
4827
4827
|
localdex/models/move.py,sha256=hfgcWI4ziz5MMvc9ddmkotxzYYdrSUqZZQ72IU5tucs,7629
|
4828
4828
|
localdex/models/pokemon.py,sha256=glnOiEhkFc25U54hJHwUkT-okUgtL2prg3269YXI3w0,5422
|
4829
|
-
localdex-0.2.
|
4830
|
-
localdex-0.2.
|
4831
|
-
localdex-0.2.
|
4832
|
-
localdex-0.2.
|
4833
|
-
localdex-0.2.
|
4834
|
-
localdex-0.2.
|
4829
|
+
localdex-0.2.45.dist-info/licenses/LICENSE,sha256=i6DyIs1YqXBAxAIiGBS6vp2iQP9tiMd47S8dvaeFmDQ,1065
|
4830
|
+
localdex-0.2.45.dist-info/METADATA,sha256=lbBlCaUAPBxN35SyxWC_Z9sIk-ScqhQEtGwT4JRJGOI,5886
|
4831
|
+
localdex-0.2.45.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
4832
|
+
localdex-0.2.45.dist-info/entry_points.txt,sha256=n5GxSeQo-MRuvrT2wVk7hOzEFFsWf6tkBjkzmGIYJe4,47
|
4833
|
+
localdex-0.2.45.dist-info/top_level.txt,sha256=vtupDMH-IaxVCoEZrmE0QzdTwhaKzngVJbTA1NkR_MY,9
|
4834
|
+
localdex-0.2.45.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|