@@ -69,9 +69,34 @@ func AbilityCommand() {
6969 }
7070 }
7171
72- capitalizedEffect := cases .Title (language .English ).String (strings .Replace (abilityName , "-" , " " , - 1 ))
73- fmt .Println (styling .StyleBold .Render (capitalizedEffect ))
74- fmt .Println ("Effect:" , englishShortEffect )
72+ // Extract English flavor_text_entries
73+ var englishFlavorEntry string
74+ for _ , entry := range abilitiesStruct .FlavorEntries {
75+ if entry .Language .Name == "en" {
76+ englishFlavorEntry = entry .FlavorText
77+ break
78+ }
79+ }
80+
81+ capitalizedAbility := cases .Title (language .English ).String (strings .Replace (abilityName , "-" , " " , - 1 ))
82+ fmt .Println (styling .StyleBold .Render (capitalizedAbility ))
83+
84+ // API is missing some data for the short_effect for abilities from Generation 9.
85+ // If short_effect is empty, fallback to the move's flavor_text_entry.
86+ if englishShortEffect == "" {
87+ fmt .Println ("Effect:" , englishFlavorEntry )
88+ } else {
89+ fmt .Println ("Effect:" , englishShortEffect )
90+ }
91+
92+ // Print the generation where the move was first introduced.
93+ generationParts := strings .Split (abilitiesStruct .Generation .Name , "-" )
94+ if len (generationParts ) > 1 {
95+ generationUpper := strings .ToUpper (generationParts [1 ])
96+ fmt .Println ("Generation:" , generationUpper )
97+ } else {
98+ fmt .Println ("Generation: Unknown" )
99+ }
75100
76101 if * pokemonFlag || * shortPokemonFlag {
77102 if err := flags .PokemonFlag (endpoint , abilityName ); err != nil {
0 commit comments