@@ -286,9 +286,23 @@ private void DoCalculateBreedingScoresAndDisplayPairs()
286286 bool considerMutationLimit = nudBPMutationLimit . Value >= 0 ;
287287
288288 bool creaturesMutationsFilteredOut = false ;
289+
290+ // only consider creatures with top stats if breeding for that
291+ Creature [ ] females , males ;
292+ if ( _breedingMode == BreedingMode . BestNextGen )
293+ {
294+ females = _females ;
295+ males = _males ;
296+ }
297+ else
298+ {
299+ females = _females . Where ( c => c . topStatsCountBP > 0 ) . ToArray ( ) ;
300+ males = _males ? . Where ( c => c . topStatsCountBP > 0 ) . ToArray ( ) ;
301+ }
302+
289303 // filter by tags
290- int crCountF = _females . Length ;
291- int crCountM = _males ? . Length ?? 0 ;
304+ int crCountF = females . Length ;
305+ int crCountM = males ? . Length ?? 0 ;
292306 IEnumerable < Creature > selectFemales ;
293307 IEnumerable < Creature > selectMales = null ;
294308 if ( considerChosenCreature && ( _chosenCreature . sex == Sex . Female || _currentSpecies . noGender ) )
@@ -297,25 +311,25 @@ private void DoCalculateBreedingScoresAndDisplayPairs()
297311 }
298312 else if ( ! cbBPMutationLimitOnlyOnePartner . Checked && considerMutationLimit )
299313 {
300- selectFemales = FilterByTags ( _females . Where ( c => c . Mutations <= nudBPMutationLimit . Value ) ) ;
301- creaturesMutationsFilteredOut = _females . Any ( c => c . Mutations > nudBPMutationLimit . Value ) ;
314+ selectFemales = FilterByTags ( females . Where ( c => c . Mutations <= nudBPMutationLimit . Value ) ) ;
315+ creaturesMutationsFilteredOut = females . Any ( c => c . Mutations > nudBPMutationLimit . Value ) ;
302316 }
303- else selectFemales = FilterByTags ( _females ) ;
317+ else selectFemales = FilterByTags ( females ) ;
304318
305319 if ( considerChosenCreature && ! _currentSpecies . noGender && _chosenCreature . sex == Sex . Male )
306320 {
307321 selectMales = new List < Creature > ( ) ; // the specific creature is added after the filtering
308322 }
309323 else if ( ! cbBPMutationLimitOnlyOnePartner . Checked && considerMutationLimit )
310324 {
311- if ( _males != null )
325+ if ( males != null )
312326 {
313- selectMales = FilterByTags ( _males . Where ( c => c . Mutations <= nudBPMutationLimit . Value ) ) ;
327+ selectMales = FilterByTags ( males . Where ( c => c . Mutations <= nudBPMutationLimit . Value ) ) ;
314328 creaturesMutationsFilteredOut = creaturesMutationsFilteredOut ||
315- _males . Any ( c => c . Mutations > nudBPMutationLimit . Value ) ;
329+ males . Any ( c => c . Mutations > nudBPMutationLimit . Value ) ;
316330 }
317331 }
318- else selectMales = FilterByTags ( _males ) ;
332+ else selectMales = FilterByTags ( males ) ;
319333
320334 // filter by servers
321335 if ( cbServerFilterLibrary . Checked && ( Settings . Default . FilterHideServers ? . Any ( ) ?? false ) )
@@ -401,18 +415,16 @@ private void DoCalculateBreedingScoresAndDisplayPairs()
401415 ref creaturesMutationsFilteredOut , levelLimitWithOutDomLevels , CbDontSuggestOverLimitOffspring . Checked ,
402416 cbBPOnlyOneSuggestionForFemales . Checked , _statOddEvens ) ;
403417
404- //double minScore = _breedingPairs.LastOrDefault()?.BreedingScore ?? 0;
405- //if (minScore < 0)
406- //{
407- // foreach (BreedingPair bp in _breedingPairs)
408- // bp.BreedingScore -= minScore;
409- //}
418+ double minScore = _breedingPairs . LastOrDefault ( ) ? . BreedingScore . OneNumber ?? 0 ;
419+ var displayScoreOffset = ( minScore < 0 ? - minScore : 0 ) + .5 ; // don't display negative scores, could be confusing
420+
421+ _breedingPairs = _breedingPairs . Take ( CreatureCollection . maxBreedingSuggestions ) . ToList ( ) ;
410422
411423 var sb = new StringBuilder ( ) ;
412424 // draw best parents
413425 using ( var brush = new SolidBrush ( Color . Black ) )
414426 {
415- for ( int i = 0 ; i < _breedingPairs . Count && i < CreatureCollection . maxBreedingSuggestions ; i ++ )
427+ for ( int i = 0 ; i < _breedingPairs . Count ; i ++ )
416428 {
417429 PedigreeCreature pc ;
418430 if ( 2 * i < _pcs . Count )
@@ -486,7 +498,7 @@ private void DoCalculateBreedingScoresAndDisplayPairs()
486498 sb . AppendLine ( _breedingPairs [ i ] . Father + " can produce a mutation." ) ;
487499 }
488500
489- var colorPercent = ( int ) ( _breedingPairs [ i ] . BreedingScore . OneNumber * 12.5 ) ;
501+ var colorPercent = ( int ) ( ( _breedingPairs [ i ] . BreedingScore . OneNumber + displayScoreOffset ) * 12.5 ) ;
490502 // outline
491503 brush . Color = Utils . GetColorFromPercent ( colorPercent , - .2 ) ;
492504 g . FillRectangle ( brush , 0 , 15 , 87 , 5 ) ;
@@ -504,7 +516,7 @@ private void DoCalculateBreedingScoresAndDisplayPairs()
504516 }
505517 // breeding score text
506518 brush . Color = Color . Black ;
507- g . DrawString ( _breedingPairs [ i ] . BreedingScore . ToString ( "N4" ) ,
519+ g . DrawString ( ( _breedingPairs [ i ] . BreedingScore . Primary + displayScoreOffset ) . ToString ( "N4" ) ,
508520 new Font ( "Microsoft Sans Serif" , 8.25f ) , brush , 24 , 12 ) ;
509521 pb . Image = bm ;
510522 }
0 commit comments