| | 137 | =head2 sane_encounters |
| | 138 | |
| | 139 | Returns the following data structure representing this Pokemon's wild |
| | 140 | encounters: |
| | 141 | |
| | 142 | [ |
| | 143 | { |
| | 144 | location => $location_obj, |
| | 145 | section => $section, |
| | 146 | methods => { |
| | 147 | grass => [ |
| | 148 | { |
| | 149 | levels => [ 5, 7 ], |
| | 150 | rarity => 100, |
| | 151 | }, ... |
| | 152 | ], ... |
| | 153 | } |
| | 154 | }, ... |
| | 155 | ] |
| | 156 | |
| | 157 | =cut |
| | 158 | |
| | 159 | sub sane_encounters { |
| | 160 | my ($self) = @_; |
| | 161 | |
| | 162 | my @encounter_sets; |
| | 163 | |
| | 164 | my $sections_rs = $self->encounters_rs( undef, { |
| | 165 | group_by => 'location_id, section', |
| | 166 | } ); |
| | 167 | |
| | 168 | while (my $section = $sections_rs->next) { |
| | 169 | my $encounters_rs = $section->location->encounters_rs( { |
| | 170 | version => 'diamond', |
| | 171 | section => $section->section, |
| | 172 | } ); |
| | 173 | |
| | 174 | push @encounter_sets, Vee::Dex::EncounterSet->new($encounters_rs, $self); |
| | 175 | } |
| | 176 | |
| | 177 | return @encounter_sets; |
| | 178 | } |
| | 179 | |