1414namespace TFT_Comp_Creator_2
1515{
1616
17+
1718 public partial class Form1 : Form
1819 {
1920 public static string status ;
@@ -41,12 +42,16 @@ public struct ChampionStats
4142
4243 public struct UnlockConditions
4344 {
44- public string [ ] Champions ;
45- public int minChampions ; // Field 5 Yordles or Bilgewater units + Level 7
46- public string [ ] Traits ;
47- public int [ ] TraitMinBP ;
48- public int minLevel ;
45+ public List < string > Champions ;
46+ public List < int > minChampions ; // Field 5 Yordles or Bilgewater units + Level 7
4947
48+ public List < string > Traits ;
49+ public List < int > TraitMinBP ;
50+
51+ public List < string > ChampTraitCount ;
52+ public List < int > minChampTraitCount ;
53+
54+ public int minLevel ;
5055 public bool isAnd ; // eg. unlock requires 2 champions or either one of them
5156 }
5257
@@ -71,7 +76,21 @@ public struct Champion
7176 public static Dictionary < string , Trait > TraitList = new Dictionary < string , Trait > ( ) ;
7277
7378
79+ public struct CompKey : IEquatable < CompKey >
80+ {
81+ public readonly string Key ;
82+ public readonly List < string > Comp ;
7483
84+ public CompKey ( List < string > comp )
85+ {
86+ Comp = comp ;
87+ Key = string . Join ( "," , comp ) ; // stable hash
88+ }
89+
90+ public bool Equals ( CompKey other ) => Key == other . Key ;
91+ public override bool Equals ( object obj ) => obj is CompKey other && Equals ( other ) ;
92+ public override int GetHashCode ( ) => Key . GetHashCode ( ) ;
93+ }
7594
7695
7796 public bool ForceStop = false ;
@@ -152,7 +171,8 @@ public Form1()
152171 carryCheck_unspecified ,
153172 mustMaxOutTraitLevel ,
154173 mustMaxOutTraitLevelCurrent ,
155- isSpatulaGolem
174+ isSpatulaGolem ,
175+ ignoreUnlock
156176
157177 ) ;
158178
@@ -476,14 +496,16 @@ public void n_choose_k(int size, List<string> nodes, List<string> tempIncludeTra
476496 {
477497 JObject champions_found = new JObject ( ) ;
478498
479- ConcurrentDictionary < List < string > , int > parallel_results = FindCombinations2 ( size , nodes , tempIncludeTrait , tempIncludeSpatula , current_trait , comp ) ;
499+ ConcurrentDictionary < CompKey , int > parallel_results = FindCombinations2 ( size , nodes , tempIncludeTrait , tempIncludeSpatula , current_trait , comp ) ;
480500
481- ConcurrentDictionary < List < string > , int > parallel_results_best = new ConcurrentDictionary < List < string > , int > ( ) ;
501+ ConcurrentDictionary < CompKey , int > parallel_results_best = new ConcurrentDictionary < CompKey , int > ( ) ;
482502
483503 if ( mustMaxOutTraitLevelCurrent . Checked )
484504 {
485- foreach ( List < string > compParallel in parallel_results . Keys )
505+ foreach ( var compKey in parallel_results . Keys )
486506 {
507+ List < string > compParallel = compKey . Comp ;
508+
487509 JObject JTraits = constructJTraits ( compParallel ) ;
488510 if ( ! JTraits . ContainsKey ( current_trait ) ) { continue ; }
489511
@@ -502,12 +524,12 @@ public void n_choose_k(int size, List<string> nodes, List<string> tempIncludeTra
502524 if ( maxValidBP < breakpoints . Max ( bp => ( int ) bp ) )
503525 {
504526 if ( result == maxValidBP )
505- parallel_results_best [ compParallel ] = parallel_results [ compParallel ] ;
527+ parallel_results_best [ compKey ] = parallel_results [ compKey ] ;
506528 }
507529 else
508530 {
509531 if ( result == maxValidBP )
510- parallel_results_best [ compParallel ] = parallel_results [ compParallel ] ;
532+ parallel_results_best [ compKey ] = parallel_results [ compKey ] ;
511533 }
512534 }
513535 }
@@ -525,8 +547,10 @@ public void n_choose_k(int size, List<string> nodes, List<string> tempIncludeTra
525547 emblemMaxBP = breakpoints . DefaultIfEmpty ( 0 ) . Max ( bp => ( int ) bp ) ;
526548 }
527549
528- foreach ( List < string > compParallel in parallel_results . Keys )
550+ foreach ( var compKey in parallel_results . Keys )
529551 {
552+ List < string > compParallel = compKey . Comp ;
553+
530554 JObject JTraits = constructJTraits ( compParallel ) ;
531555 if ( ! JTraits . ContainsKey ( selectedEmblemTrait ) ) { continue ; }
532556
@@ -538,7 +562,7 @@ public void n_choose_k(int size, List<string> nodes, List<string> tempIncludeTra
538562
539563 if ( result == emblemMaxBP )
540564 {
541- parallel_results_best [ compParallel ] = parallel_results [ compParallel ] ;
565+ parallel_results_best [ compKey ] = parallel_results [ compKey ] ;
542566 }
543567 }
544568 }
@@ -561,11 +585,11 @@ public void n_choose_k(int size, List<string> nodes, List<string> tempIncludeTra
561585 if ( obj . Value > Pet_SynergyBest )
562586 Pet_SynergyBest = obj . Value ;
563587
564- PrintComp ( obj . Key , obj . Value ) ;
588+ PrintComp ( obj . Key . Comp , obj . Value ) ;
565589
566590 // analysis
567591 //champions_found
568- foreach ( string champion_in_comp in obj . Key )
592+ foreach ( string champion_in_comp in obj . Key . Comp )
569593 {
570594 if ( champions_found [ champion_in_comp ] != null )
571595 {
0 commit comments