@@ -286,9 +286,23 @@ private void DoCalculateBreedingScoresAndDisplayPairs()
286
286
bool considerMutationLimit = nudBPMutationLimit . Value >= 0 ;
287
287
288
288
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
+
289
303
// 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 ;
292
306
IEnumerable < Creature > selectFemales ;
293
307
IEnumerable < Creature > selectMales = null ;
294
308
if ( considerChosenCreature && ( _chosenCreature . sex == Sex . Female || _currentSpecies . noGender ) )
@@ -297,25 +311,25 @@ private void DoCalculateBreedingScoresAndDisplayPairs()
297
311
}
298
312
else if ( ! cbBPMutationLimitOnlyOnePartner . Checked && considerMutationLimit )
299
313
{
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 ) ;
302
316
}
303
- else selectFemales = FilterByTags ( _females ) ;
317
+ else selectFemales = FilterByTags ( females ) ;
304
318
305
319
if ( considerChosenCreature && ! _currentSpecies . noGender && _chosenCreature . sex == Sex . Male )
306
320
{
307
321
selectMales = new List < Creature > ( ) ; // the specific creature is added after the filtering
308
322
}
309
323
else if ( ! cbBPMutationLimitOnlyOnePartner . Checked && considerMutationLimit )
310
324
{
311
- if ( _males != null )
325
+ if ( males != null )
312
326
{
313
- selectMales = FilterByTags ( _males . Where ( c => c . Mutations <= nudBPMutationLimit . Value ) ) ;
327
+ selectMales = FilterByTags ( males . Where ( c => c . Mutations <= nudBPMutationLimit . Value ) ) ;
314
328
creaturesMutationsFilteredOut = creaturesMutationsFilteredOut ||
315
- _males . Any ( c => c . Mutations > nudBPMutationLimit . Value ) ;
329
+ males . Any ( c => c . Mutations > nudBPMutationLimit . Value ) ;
316
330
}
317
331
}
318
- else selectMales = FilterByTags ( _males ) ;
332
+ else selectMales = FilterByTags ( males ) ;
319
333
320
334
// filter by servers
321
335
if ( cbServerFilterLibrary . Checked && ( Settings . Default . FilterHideServers ? . Any ( ) ?? false ) )
@@ -401,18 +415,16 @@ private void DoCalculateBreedingScoresAndDisplayPairs()
401
415
ref creaturesMutationsFilteredOut , levelLimitWithOutDomLevels , CbDontSuggestOverLimitOffspring . Checked ,
402
416
cbBPOnlyOneSuggestionForFemales . Checked , _statOddEvens ) ;
403
417
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 ( ) ;
410
422
411
423
var sb = new StringBuilder ( ) ;
412
424
// draw best parents
413
425
using ( var brush = new SolidBrush ( Color . Black ) )
414
426
{
415
- for ( int i = 0 ; i < _breedingPairs . Count && i < CreatureCollection . maxBreedingSuggestions ; i ++ )
427
+ for ( int i = 0 ; i < _breedingPairs . Count ; i ++ )
416
428
{
417
429
PedigreeCreature pc ;
418
430
if ( 2 * i < _pcs . Count )
@@ -486,7 +498,7 @@ private void DoCalculateBreedingScoresAndDisplayPairs()
486
498
sb . AppendLine ( _breedingPairs [ i ] . Father + " can produce a mutation." ) ;
487
499
}
488
500
489
- var colorPercent = ( int ) ( _breedingPairs [ i ] . BreedingScore . OneNumber * 12.5 ) ;
501
+ var colorPercent = ( int ) ( ( _breedingPairs [ i ] . BreedingScore . OneNumber + displayScoreOffset ) * 12.5 ) ;
490
502
// outline
491
503
brush . Color = Utils . GetColorFromPercent ( colorPercent , - .2 ) ;
492
504
g . FillRectangle ( brush , 0 , 15 , 87 , 5 ) ;
@@ -504,7 +516,7 @@ private void DoCalculateBreedingScoresAndDisplayPairs()
504
516
}
505
517
// breeding score text
506
518
brush . Color = Color . Black ;
507
- g . DrawString ( _breedingPairs [ i ] . BreedingScore . ToString ( "N4" ) ,
519
+ g . DrawString ( ( _breedingPairs [ i ] . BreedingScore . Primary + displayScoreOffset ) . ToString ( "N4" ) ,
508
520
new Font ( "Microsoft Sans Serif" , 8.25f ) , brush , 24 , 12 ) ;
509
521
pb . Image = bm ;
510
522
}
0 commit comments