@@ -165,6 +165,7 @@ impl IntoParameters for CopilotParams {
165165 let ignore_requirements =
166166 self . ignore_requirements || default. get_or ( "ignore_requirements" , false ) ;
167167
168+ let copilot_files_count = copilot_files. len ( ) ;
168169 let mut stage_list = Vec :: new ( ) ;
169170 for ( _, file, value) in copilot_files {
170171 let copilot_task = value. map ( Ok ) . unwrap_or_else ( || json_from_file ( & file) ) ?;
@@ -206,19 +207,30 @@ impl IntoParameters for CopilotParams {
206207 }
207208 }
208209
209- // We also want all other parameters from overlay
210210 let mut params = default;
211+
211212 insert ! ( params,
212213 "formation" => formation,
213214 "use_sanity_potion" => use_sanity_potion,
214215 "add_trust" => add_trust,
215216 "ignore_requirements" => ignore_requirements,
216- "copilot_list" => stage_list?,
217217 "formation_index" =>? self . formation_index,
218218 "support_unit_usage" =>? self . support_unit_usage,
219219 "support_unit_name" =>? self . support_unit_name
220220 ) ;
221221
222+ // Use single file mode when there's only one task and raid mode is not 2
223+ if copilot_files_count == 1 && self . raid != 2 {
224+ let stage_opt = stage_list. into_iter ( ) . next ( ) . unwrap ( ) ;
225+ insert ! ( params,
226+ "filename" => stage_opt. filename. to_string_lossy( ) . to_string( )
227+ ) ;
228+ } else {
229+ insert ! ( params,
230+ "copilot_list" => stage_list?
231+ ) ;
232+ }
233+
222234 Ok ( params)
223235 }
224236}
@@ -717,11 +729,7 @@ found"}"#,
717729 assert_eq ! (
718730 params,
719731 object!(
720- "copilot_list" => [ object!(
721- "filename" => path_from_cache_dir( "40051.json" ) ,
722- "stage_name" => "AS-EX-1" ,
723- "is_raid" => false ,
724- ) ] ,
732+ "filename" => path_from_cache_dir( "40051.json" ) ,
725733 "formation" => false ,
726734 "use_sanity_potion" => false ,
727735 "add_trust" => false ,
@@ -757,11 +765,7 @@ found"}"#,
757765 assert_eq ! (
758766 params,
759767 object!(
760- "copilot_list" => [ object!(
761- "filename" => path_from_cache_dir( "40051.json" ) ,
762- "stage_name" => "AS-EX-1" ,
763- "is_raid" => true ,
764- ) ] ,
768+ "filename" => path_from_cache_dir( "40051.json" ) ,
765769 "formation" => true ,
766770 "use_sanity_potion" => true ,
767771 "add_trust" => true ,
@@ -787,11 +791,7 @@ found"}"#,
787791 assert_eq ! (
788792 params,
789793 object!(
790- "copilot_list" => [ object!(
791- "filename" => path_from_cache_dir( "40051.json" ) ,
792- "stage_name" => "AS-EX-1" ,
793- "is_raid" => false ,
794- ) ] ,
794+ "filename" => path_from_cache_dir( "40051.json" ) ,
795795 "formation" => false ,
796796 "use_sanity_potion" => false ,
797797 "add_trust" => false ,
@@ -915,11 +915,7 @@ found"}"#,
915915 assert_eq ! (
916916 params,
917917 object!(
918- "copilot_list" => [ object!(
919- "filename" => path_from_cache_dir( "40051.json" ) ,
920- "stage_name" => "AS-EX-1" ,
921- "is_raid" => false ,
922- ) ] ,
918+ "filename" => path_from_cache_dir( "40051.json" ) ,
923919 "formation" => true ,
924920 "use_sanity_potion" => false ,
925921 "add_trust" => false ,
@@ -944,11 +940,7 @@ found"}"#,
944940 assert_eq ! (
945941 params,
946942 object!(
947- "copilot_list" => [ object!(
948- "filename" => path_from_cache_dir( "40051.json" ) ,
949- "stage_name" => "AS-EX-1" ,
950- "is_raid" => false ,
951- ) ] ,
943+ "filename" => path_from_cache_dir( "40051.json" ) ,
952944 "formation" => false ,
953945 "use_sanity_potion" => true ,
954946 "add_trust" => false ,
@@ -973,11 +965,7 @@ found"}"#,
973965 assert_eq ! (
974966 params,
975967 object!(
976- "copilot_list" => [ object!(
977- "filename" => path_from_cache_dir( "40051.json" ) ,
978- "stage_name" => "AS-EX-1" ,
979- "is_raid" => false ,
980- ) ] ,
968+ "filename" => path_from_cache_dir( "40051.json" ) ,
981969 "formation" => false ,
982970 "use_sanity_potion" => false ,
983971 "add_trust" => true ,
@@ -1002,11 +990,7 @@ found"}"#,
1002990 assert_eq ! (
1003991 params,
1004992 object!(
1005- "copilot_list" => [ object!(
1006- "filename" => path_from_cache_dir( "40051.json" ) ,
1007- "stage_name" => "AS-EX-1" ,
1008- "is_raid" => false ,
1009- ) ] ,
993+ "filename" => path_from_cache_dir( "40051.json" ) ,
1010994 "formation" => false ,
1011995 "use_sanity_potion" => false ,
1012996 "add_trust" => false ,
@@ -1038,11 +1022,7 @@ found"}"#,
10381022 assert_eq ! (
10391023 params,
10401024 object!(
1041- "copilot_list" => [ object!(
1042- "filename" => path_from_cache_dir( "40051.json" ) ,
1043- "stage_name" => "AS-EX-1" ,
1044- "is_raid" => false ,
1045- ) ] ,
1025+ "filename" => path_from_cache_dir( "40051.json" ) ,
10461026 "formation" => true ,
10471027 "use_sanity_potion" => true ,
10481028 "add_trust" => false ,
0 commit comments