@@ -140,6 +140,7 @@ function load_progress () {
140140 asic_speed = blockSettings . readNumber ( "game_asic_speed" )
141141 asic_price = blockSettings . readNumber ( "game_asic_price" )
142142 upgrades_obtained = blockSettings . readNumberArray ( "game_upgrades_obtained" )
143+ old_difficulty = blockSettings . readNumber ( "game_old_difficulty" )
143144 difficulty_halve_time_left = blockSettings . readNumber ( "game_difficulty_halve_time_left" )
144145 difficulty_halve_max_time = blockSettings . readNumber ( "game_difficulty_halve_max_time" )
145146 difficulty_halve_chance = blockSettings . readNumber ( "game_difficulty_halve_chance" )
@@ -332,7 +333,11 @@ function buy_autoclicker_menu () {
332333spriteutils . createRenderable ( 0 , function ( screen2 ) {
333334 screen2 . fillRect ( 0 , 0 , 160 , 20 , 15 )
334335 images . print ( screen2 , "MakeCoins: " + score , 2 , 2 , 1 )
335- images . print ( screen2 , "Target: " + magic_number , 2 , 10 , 1 )
336+ if ( difficulty_halving ) {
337+ images . print ( screen2 , "Target: " + magic_number + "/" + max_height + " (" + difficulty_halve_time_left + ")" , 2 , 10 , 1 )
338+ } else {
339+ images . print ( screen2 , "Target: " + magic_number + "/" + max_height , 2 , 10 , 1 )
340+ }
336341 screen2 . drawLine ( 0 , 20 , 160 , 20 , 1 )
337342} )
338343spriteutils . createRenderable ( 0 , function ( screen2 ) {
@@ -416,6 +421,7 @@ function set_default_save () {
416421 asic_speed = 200
417422 asic_price = 100
418423 upgrades_obtained = [ ]
424+ old_difficulty = max_height
419425 difficulty_halve_time_left = 0
420426 difficulty_halve_max_time = 30
421427 difficulty_halve_chance = 1
@@ -474,6 +480,7 @@ function save_progress () {
474480 blockSettings . writeNumber ( "game_asic_speed" , asic_speed )
475481 blockSettings . writeNumber ( "game_asic_price" , asic_price )
476482 blockSettings . writeNumberArray ( "game_upgrades_obtained" , upgrades_obtained )
483+ blockSettings . writeNumber ( "game_old_difficulty" , old_difficulty )
477484 blockSettings . writeNumber ( "game_difficulty_halve_time_left" , difficulty_halve_time_left )
478485 blockSettings . writeNumber ( "game_difficulty_halve_max_time" , difficulty_halve_max_time )
479486 blockSettings . writeNumber ( "game_difficulty_halve_chance" , difficulty_halve_chance )
@@ -490,9 +497,9 @@ function enable_cursor (en: boolean) {
490497}
491498function save_bool ( name : string , value : boolean ) {
492499 if ( value ) {
493- blockSettings . writeNumber ( name , 0 )
494- } else {
495500 blockSettings . writeNumber ( name , 1 )
501+ } else {
502+ blockSettings . writeNumber ( name , 0 )
496503 }
497504}
498505function make_menu_button ( ) {
@@ -577,6 +584,7 @@ let difficulty_halving = false
577584let difficulty_halve_chance = 0
578585let difficulty_halve_max_time = 0
579586let difficulty_halve_time_left = 0
587+ let old_difficulty = 0
580588let upgrades_obtained : number [ ] = [ ]
581589let asic_price = 0
582590let asic_speed = 0
@@ -674,7 +682,7 @@ forever(function () {
674682 } )
675683} )
676684forever ( function ( ) {
677- if ( Math . floor ( average_hash_per_sec ) >= max_height ) {
685+ if ( Math . floor ( average_hash_per_sec ) >= max_height && ! ( difficulty_halving ) ) {
678686 while ( Math . floor ( average_hash_per_sec ) >= max_height ) {
679687 max_height = Math . floor ( max_height * 1.5 )
680688 score_change = Math . ceil ( score_change * 1.5 )
@@ -685,7 +693,7 @@ forever(function () {
685693 pause ( 1000 )
686694} )
687695forever ( function ( ) {
688- if ( ( Math . percentChance ( difficulty_halve_chance ) || true ) && ! ( difficulty_halving ) ) {
696+ if ( ( Math . percentChance ( difficulty_halve_chance ) || false ) && ! ( difficulty_halving ) ) {
689697 sprite_difficulty_halver = sprites . create ( assets . image `difficulty_halver` , SpriteKind . Thing )
690698 sprite_difficulty_halver . z = 30
691699 sprite_difficulty_halver . setPosition ( randint ( 0 , scene . screenWidth ( ) ) , randint ( 0 , scene . screenHeight ( ) ) )
@@ -695,14 +703,19 @@ forever(function () {
695703 pause ( 10000 )
696704 }
697705 if ( difficulty_halving && difficulty_halve_time_left == 0 ) {
698- max_height = max_height * 0.5
706+ Notification . waitForNotificationFinish ( )
707+ old_difficulty = max_height
708+ max_height = Math . round ( max_height * 0.5 )
699709 difficulty_halve_time_left = difficulty_halve_max_time
710+ timer . background ( function ( ) {
711+ Notification . notify ( "Difficulty has been halved for " + difficulty_halve_max_time + " seconds! (" + old_difficulty + " --> " + max_height + ")" , assets . image `down_arrow` )
712+ } )
700713 }
701714 if ( difficulty_halving ) {
702715 difficulty_halve_time_left += - 1
703716 }
704717 if ( difficulty_halving && difficulty_halve_time_left <= 0 ) {
705- max_height = max_height * 2
718+ max_height = old_difficulty
706719 difficulty_halving = false
707720 }
708721 pause ( 1000 )
0 commit comments