@@ -378,7 +378,7 @@ function updateScenario(value, updateUI)
378
378
else
379
379
Global .setVar (" scenarioCard" , getObjectFromGUID (scenarios [value ]))
380
380
Global .setVar (" useRandomScenario" , false )
381
- checkToDisableRandomDifficulty ( )
381
+ checkRandomDifficulty ( false )
382
382
end
383
383
updateDifficulty ()
384
384
@@ -406,7 +406,7 @@ function updateLeadingAdversary(value, updateUI)
406
406
else
407
407
Global .setVar (" adversaryCard" , getObjectFromGUID (adversaries [value ]))
408
408
Global .setVar (" useRandomAdversary" , false )
409
- checkToDisableRandomDifficulty ( )
409
+ checkRandomDifficulty ( false )
410
410
end
411
411
if value == " None" or value == " Random" then
412
412
updateLeadingLevel (0 , updateUI )
@@ -440,7 +440,7 @@ function updateSupportingAdversary(value, updateUI)
440
440
else
441
441
Global .setVar (" adversaryCard2" , getObjectFromGUID (adversaries [value ]))
442
442
Global .setVar (" useSecondAdversary" , false )
443
- checkToDisableRandomDifficulty ( )
443
+ checkRandomDifficulty ( false )
444
444
end
445
445
if value == " None" or value == " Random" then
446
446
updateSupportingLevel (0 , updateUI )
@@ -580,7 +580,7 @@ function updateBoardLayout(value, updateUI)
580
580
else
581
581
Global .setVar (" useRandomBoard" , false )
582
582
Global .setVar (" includeThematic" , false )
583
- checkToDisableRandomDifficulty ( )
583
+ checkRandomDifficulty ( false )
584
584
end
585
585
Global .setVar (" boardLayout" , value )
586
586
updateDifficulty ()
@@ -830,10 +830,7 @@ function toggleSimpleMode()
830
830
self .UI .setAttribute (" leadingText" , " text" , " Adversary" )
831
831
self .UI .setAttribute (" supportingHeader" , " visibility" , " Invisible" )
832
832
self .UI .setAttribute (" supportingRow" , " visibility" , " Invisible" )
833
- self .UI .setAttribute (" minTextRow" , " visibility" , " Invisible" )
834
- self .UI .setAttribute (" minRow" , " visibility" , " Invisible" )
835
- self .UI .setAttribute (" maxTextRow" , " visibility" , " Invisible" )
836
- self .UI .setAttribute (" maxRow" , " visibility" , " Invisible" )
833
+ checkRandomDifficulty (false )
837
834
self .UI .setAttribute (" blightCardRow" , " visibility" , " " )
838
835
self .UI .setAttribute (" optionalCell" , " visibility" , " Invisible" )
839
836
self .UI .setAttribute (" toggles" , " visibility" , " Invisible" )
@@ -848,10 +845,7 @@ function toggleSimpleMode()
848
845
self .UI .setAttribute (" leadingText" , " text" , " Leading Adversary" )
849
846
self .UI .setAttribute (" supportingHeader" , " visibility" , " " )
850
847
self .UI .setAttribute (" supportingRow" , " visibility" , " " )
851
- self .UI .setAttribute (" minTextRow" , " visibility" , " " )
852
- self .UI .setAttribute (" minRow" , " visibility" , " " )
853
- self .UI .setAttribute (" maxTextRow" , " visibility" , " " )
854
- self .UI .setAttribute (" maxRow" , " visibility" , " " )
848
+ checkRandomDifficulty (true )
855
849
self .UI .setAttribute (" blightCardRow" , " visibility" , " Invisible" )
856
850
self .UI .setAttribute (" optionalCell" , " visibility" , " " )
857
851
self .UI .setAttribute (" toggles" , " visibility" , " " )
@@ -916,15 +910,20 @@ function enableRandomDifficulty()
916
910
self .UI .setAttribute (" maxTextRow" , " visibility" , " " )
917
911
self .UI .setAttribute (" maxRow" , " visibility" , " " )
918
912
end
919
- function checkToDisableRandomDifficulty ()
920
- if not Global .getVar (" useRandomAdversary" )
921
- and not Global .getVar (" useSecondAdversary" )
922
- and not Global .getVar (" useRandomBoard" )
923
- and not Global .getVar (" useRandomScenario" ) then
924
- self .UI .setAttribute (" minTextRow" , " visibility" , " Invisible" )
925
- self .UI .setAttribute (" minRow" , " visibility" , " Invisible" )
926
- self .UI .setAttribute (" maxTextRow" , " visibility" , " Invisible" )
927
- self .UI .setAttribute (" maxRow" , " visibility" , " Invisible" )
913
+ function checkRandomDifficulty (enable )
914
+ local visibility = " "
915
+ if not enable then
916
+ visibility = " Invisible"
917
+ end
918
+ local random = Global .getVar (" useRandomAdversary" )
919
+ or Global .getVar (" useSecondAdversary" )
920
+ or Global .getVar (" useRandomBoard" )
921
+ or Global .getVar (" useRandomScenario" )
922
+ if random == enable then
923
+ self .UI .setAttribute (" minTextRow" , " visibility" , visibility )
924
+ self .UI .setAttribute (" minRow" , " visibility" , visibility )
925
+ self .UI .setAttribute (" maxTextRow" , " visibility" , visibility )
926
+ self .UI .setAttribute (" maxRow" , " visibility" , visibility )
928
927
end
929
928
end
930
929
0 commit comments