-
Notifications
You must be signed in to change notification settings - Fork 10
/
ui_fruit.js
1608 lines (1405 loc) · 69.7 KB
/
ui_fruit.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Ethereal Farm
Copyright (C) 2020-2024 Lode Vandevenne
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
var fruitScrollFlex = undefined;
var busyChoosingTargetSlot = undefined; // for "move to slot" button
var busyChoosingTargetSlot_shift = false;
function getFruitAbilityName(ability, opt_abbreviation) {
if(opt_abbreviation) {
switch(ability) {
case FRUIT_NONE: return '/';
case FRUIT_BERRYBOOST: return 'BB';
case FRUIT_MUSHBOOST: return 'MB';
case FRUIT_MUSHEFF: return 'ME';
case FRUIT_FLOWERBOOST: return 'FB';
case FRUIT_GROWSPEED: return 'G';
case FRUIT_WEATHER: return 'WB';
case FRUIT_BRASSICA: return 'BC';
case FRUIT_NETTLEBOOST: return 'NB';
// S from "season", the actual season is known due to the fruit's name which includes the season in it
case FRUIT_SPRING: return getSeason() == 0 ? 'S' : 's';
case FRUIT_SUMMER: return getSeason() == 1 ? 'S' : 's';
case FRUIT_AUTUMN: return getSeason() == 2 ? 'S' : 's';
case FRUIT_WINTER: return getSeason() == 3 ? 'S' : 's';
case FRUIT_SPRING_SUMMER: return ((getSeason() == 0 || getSeason() == 1) && haveFruitMix(1)) ? 'S' : 's';
case FRUIT_SUMMER_AUTUMN: return ((getSeason() == 1 || getSeason() == 2) && haveFruitMix(1)) ? 'S' : 's';
case FRUIT_AUTUMN_WINTER: return ((getSeason() == 2 || getSeason() == 3) && haveFruitMix(1)) ? 'S' : 's';
case FRUIT_WINTER_SPRING: return ((getSeason() == 3 || getSeason() == 0) && haveFruitMix(1)) ? 'S' : 's';
case FRUIT_ALL_SEASON: return haveFruitMix(2) ? 'S' : 's';
case FRUIT_ALL_SEASON2: return haveFruitMix(3) ? 'S' : 's';
case FRUIT_RESINBOOST: return 'RS';
case FRUIT_TWIGSBOOST: return 'TW';
case FRUIT_RESIN_TWIGS: return 'RT';
case FRUIT_NUTBOOST: return 'NU';
case FRUIT_BEEBOOST: return 'BE';
case FRUIT_MIX: return 'X';
case FRUIT_TREELEVEL: return 'T';
case FRUIT_SEED_OVERLOAD: return 'O';
case FRUIT_SPORES_OVERLOAD: return 'MO'; // mo = mushroom overload
}
return '?';
}
switch(ability) {
case FRUIT_NONE: return 'none';
case FRUIT_BERRYBOOST: return 'berry boost';
case FRUIT_MUSHBOOST: return 'mushroom boost';
case FRUIT_MUSHEFF: return 'mushroom economy';
case FRUIT_FLOWERBOOST: return 'flower boost';
case FRUIT_GROWSPEED: return 'growing speed';
case FRUIT_WEATHER: return 'weather boost';
case FRUIT_BRASSICA: return 'brassica copying';
case FRUIT_NETTLEBOOST: return 'nettle boost';
case FRUIT_SPRING: return 'spring boost';
case FRUIT_SUMMER: return 'summer boost';
case FRUIT_AUTUMN: return 'autumn boost';
case FRUIT_WINTER: return 'winter boost';
case FRUIT_SPRING_SUMMER: return 'spring and summer boost';
case FRUIT_SUMMER_AUTUMN: return 'summer and autumn boost';
case FRUIT_AUTUMN_WINTER: return 'autumn and winter boost';
case FRUIT_WINTER_SPRING: return 'winter and spring boost';
case FRUIT_ALL_SEASON: return '4-seasons boost';
case FRUIT_ALL_SEASON2: return 'ultra seasons boost';
case FRUIT_RESINBOOST: return 'resin boost';
case FRUIT_TWIGSBOOST: return 'twigs boost';
case FRUIT_RESIN_TWIGS: return 'resin and twigs boost';
case FRUIT_NUTBOOST: return 'nuts boost';
case FRUIT_BEEBOOST: return 'bee boost';
case FRUIT_MIX: return 'mix nettle/brass/bee';
case FRUIT_TREELEVEL: return 'treelevel prod boost';
case FRUIT_SEED_OVERLOAD: return 'seeds overload';
case FRUIT_SPORES_OVERLOAD: return 'spores overload';
}
return 'unknown';
}
function getFruitAbilityDescription(ability) {
switch(ability) {
case FRUIT_NONE: return 'none, fuse fruits to fill this slot';
case FRUIT_BERRYBOOST: return 'boosts berry production';
case FRUIT_MUSHBOOST: return 'boosts mushroom production but also consumption';
case FRUIT_MUSHEFF: return 'reduces mushroom consumption (with a soft cap)';
case FRUIT_FLOWERBOOST: return 'boosts flowers effect';
case FRUIT_GROWSPEED: return 'reduces crop grow time (Before any other reductions. A soft cap applies.)';
case FRUIT_WEATHER: return 'increases the weather effect abilities';
case FRUIT_BRASSICA: return 'increases the copy effect of brassica (such as watercress)';
case FRUIT_NETTLEBOOST: return 'boosts the nettle effect';
case FRUIT_SPRING: return 'boosts the spring flower boost, only during the spring season';
case FRUIT_SUMMER: return 'boosts the summer berry boost, only during the summer season';
case FRUIT_AUTUMN: return 'boosts the autumn mushroom boost, only during the autumn season';
case FRUIT_WINTER: return 'boosts the winter tree warmth effect, only during the winter season';
case FRUIT_SPRING_SUMMER: return 'boosts the spring flower boost and the summer berry boost, only during the respective seasons';
case FRUIT_SUMMER_AUTUMN: return 'boosts the summer berry boost and the autumn mushroom boost, only during the respective seasons';
case FRUIT_AUTUMN_WINTER: return 'boosts the autumn mushroom boost and the winter tree warmth effect, only during the respective seasons';
case FRUIT_WINTER_SPRING: return 'boosts the winter tree warmth effect and the spring flower boost, only during the respective seasons';
case FRUIT_ALL_SEASON: return 'boosts the special effect of each of the 4 seasons, when the applicable season is active: flower boost in spring, berry boost in summer, mushroom boost in autumn, tree warmth boost in winter';
case FRUIT_ALL_SEASON2: return 'boosts the special effect of each of the 4 seasons, even more for dragon fruit, when the applicable season is active: flower boost in spring, berry boost in summer, mushroom boost in autumn, tree warmth boost in winter';
// "taking into account the time this fruit was active" now means: it takes into account how many spores were produced while any fruit with resin boost (respectively twigs boost) was active, vs while other fruits were active. The more spores produced while such fruit active, the more of the boost is given.
case FRUIT_RESINBOOST: return 'boost resin income (with a soft cap), based on spores produced while this fruit was active. In addition slightly boosts the unspent resin production bonus.';
case FRUIT_TWIGSBOOST: return 'boost twigs income (with a soft cap), based on spores produced while this this fruit was active. In addition slightly boosts the unspent twigs production bonus.';
case FRUIT_RESIN_TWIGS: return 'boost resin and twigs income (with a soft cap), based on spores produced while this this fruit was active. In addition slightly boosts the unspent resin and twigs production bonus.';
case FRUIT_NUTBOOST: return 'boosts nuts production (with a soft cap)';
case FRUIT_BEEBOOST: return 'boosts the beehive bonus';
case FRUIT_MIX: return 'divides given boost over nettle, brassica and bee, balanced differently for spores and seeds, but only additively if corresponding non-mix abilities are present';
case FRUIT_TREELEVEL: return 'boosts the production boost that is given by the tree level, the shown target multiplier is reached when reaching tree level where next fruit tier could drop.'; // that is, targeted to get close at tree levels 20 levels above where this tier of fruit drops
case FRUIT_SEED_OVERLOAD: return 'boosts seeds, but increases mushroom seed consumption by the same amount';
case FRUIT_SPORES_OVERLOAD: return 'boosts spores, but the additional spores require much higher seeds consumption';
}
return 'unknown';
}
var lastTouchedFruit = null; // for some visual indication only
var lastTouchedFruit2 = null; // similar but only used in fruit fusing dialog
function createFruitHelp(opt_fusing_only) {
var dialog = createDialog({title:'Fruit help', scrollable:true});
var text = '';
if(!opt_fusing_only) {
text += 'Fruits drop when the tree reaches certain levels. Fruits have one or more abilities from a random set. At higher tree levels, higher tier fruits with more and stronger abilities can drop.';
text += '<br/><br/>';
text += 'You can move fruits between the stored and sacrificial slots with the buttons in the fruit dialog. You can choose the active fruit with the arrows. You can only have one active fruit and only the abilities of the active fruit have an effect. You can switch the active fruit at any time. You can also select no fruit at all by toggling the arrow above an active one.';
text += '<br/><br/>';
text += 'Fruit essence can be used to level up abilities, increasing their effect. If the fruit has mutliple abilities, click the ability you want to upgrade first.';
text += '<br/><br/>';
text += 'All fruit essence is available for all fruits, leveling up an ability in one fruit does not consume any fruit essence for other fruits. Example: if you have 50 fruit essence and 3 fruits, then you can use 50 essence in fruit 1, you can also use 50 essence in fruit 2, and you can also use 50 essence in fruit 3, and in any future fruits as well. If you now sacrifice a fruit that gives 10 essence, you have 10 more essence available for all the others.';
text += '<br/><br/>';
text += 'Leveling up abilities permanently affects this fruit, you cannot undo it. This only matters if this fruit has more than one ability so that you have to choose which ones to level up. And if unhappy with this fruit, you can always wait for a next one and sacrifice this one.';
text += '<br/><br/>';
text += 'To get more fruit essence, sacrifice fruits by putting them in the sacrificial pool and transcending (available at high enough tree level). The amount of fruit essence of sacrificed fruits depends on their tier (zinc, bronze, ...), the ability levels or how much essence you\'ve used to level them up don\'t matter for this.';
text += '<br/><br/>';
text += 'The active and stored fruits do not get sacrificed and stay after transcension.';
text += '<br/><br/>';
text += 'Higher tier fruits may have more abilities, and abilities provide more boost.';
text += '<br/><br/>';
text += 'You can rename fruits with the rename button. Named fruits will also have their name show up in the fruit tab when active. You can also mark fruits as favorite: click the fruit logo in the fruit dialog to alter border color (visual effect only).';
text += '<br/><br/>';
text += '<b>Fruit related hotkeys</b>';
text += '<br/><br/>';
text += 'Note: on mac, ctrl means command instead.';
text += '<br/>';
text += ' • <b>ctrl + click fruit</b>: move fruit between sacrificial and storage slots, if possible.';
text += '<br/>';
text += ' • <b>shift + click fruit</b>: same as ctrl + click fruit.';
text += '<br/>';
text += ' • <b>drag & drop</b>: drag fruits between slots, re-order slots.';
text += '<br/>';
text += ' • <b>shift + click fruit ability upgrade</b>: buy multiple abilities up to 25% of currently available essence';
text += '<br/>';
text += ' • <b>], } or )</b>: select next active fruit';
text += '<br/>';
text += ' • <b>[, { or (</b>: select previous active fruit';
text += '<br/><br/>';
}
text += '<b>Fusing Fruits</b>';
text += '<br/><br/>';
text += 'Fruits of the same tier (bronze and up) can be fused together to allow transferring abilities to create the fruit with the combination you want, when the random drops aren\'t giving it. Fusing does not increase strength of stats, it\'s only about allowing control of the combination.';
text += '<br/><br/>';
text += 'Fusing fruits destroys the two original fruits and creates a new one with a new set of abilities. The rules are as follows:';
text += '<br/>';
text += ' • The two input fruits, called the "from" and the "into" fruits, create one new fruit the "result" fruit';
text += '<br/>';
text += ' • The result fruit will initially have the same abilities as the "into" fruit, but some may be pushed out if transferring occurs';
text += '<br/>';
text += ' • Any abilities in the "from" fruit that match the "into" fruit, will charge up the matching ability: it becomes charged (marked [*]), or transferable (marked [**]) if already charged';
text += '<br/>';
text += ' • Any abilities in the "from" fruit that are transferable [**] will be transferred to the result fruit and push out the last ability of the result fruit. The fuse dialog also gives the option to disable some of them from being transferred, if they are undesired.';
text += '<br/>';
text += ' • Any other abilities of the "from" fruit disappear and don\'t matter, the only abilities of the "from" fruit that matter are: abilities that match the "into" fruit (to charge them up), and transferable abilities (to replace abilities).';
text += '<br/>';
text += ' • The order of abilities of the input fruits matters (to determine which get pushed out), but you can freely reorder abilities: either in the regular fruit dialog (where abilities can be moved up or down), or using the priority checkboxes in the fuse dialog.';
text += '<br/>';
text += ' • The seasonal abilities of some fruit types (pineapple, ...) do not participate in fusing. The resulting fruit will be an apple if the two original fruits are of a different type, or will be seasonal if both original fruits are the same seasonal type (e.g. both pineapple). Some later upgrades in the game change this.';
text += '<br/>';
text += ' • After fusing, abilities will be auto-leveled up (using the usual amount of fruit essence), based on what levels they had before, and leaving some essence unused if a new unupgraded ability is added. You may need to do a few more upgrades manually again anyway. No essence is lost in this process.';
text += '<br/><br/>';
text += 'Summary of the rules: getting 3 fruits with the same ability allows, with at least two fuse actions, to create a transferable ability that you can transfer to any fruit of choice with a third fuse action, replacing an unwanted ability of choice.';
text += '<br/>';
text += 'Example: if you desire a silver fruit with flower boost and berry boost, one way you could reach it is:'
text += '<br/>';
text += ' • collect 3 silver fruits that have flower boost in any slot, fruits A, B and C';
text += '<br/>';
text += ' • fuse A with B, resulting in a fruit AB with charged flower boost, marked [*]';
text += '<br/>';
text += ' • fuse AB with C, resulting in a fruit ABC with transferable flower boost, marked [**]';
text += '<br/>';
text += ' • collect a fruit D that has berry boost, and if necessary, move berry boost to the first slot';
text += '<br/>';
text += ' • fuse ABC into D, resulting in the desired fruit with flower boost and berry boost. Don\'t forget to level up its abilities, since they\'ll all be set to level 1.';
if(haveFruitMix(1)) {
text += '<br/><br/>';
text += '<b>Seasonal fruit mixing</b>';
text += '<br/><br/>';
text += 'You unlocked the squirrel upgrade for seasonal fruit mixing! This works when fuxing certain combinations of two different seasonal fruits together.';
text += '<br/><br/>';
text += 'The combinations are:';
text += '<br><br>';
text += '• Apricot + Pineapple = Mango (spring + summer)';
text += '<br>';
text += '• Pineapple + Pear = Plum (summer + autumn)';
text += '<br>';
text += '• Pear + Medlar = Quince (autumn + winter)';
text += '<br>';
text += '• Medlar + Apricot = Kumquat (winter + spring)';
text += '<br/><br/>';
text += 'If you also have the second fruit mixing upgrade purchased, then in addition you can create the all-season star fruit. This one is harder to fuse, since the fruits must also have the same set of abilities:';
text += '<br><br>';
text += '• Mango + Quince = Star Fruit (4 seasons)';
text += '<br>';
text += '• Plum + Kumquat = Star Fruit (4 seasons)';
text += '<br/><br/>';
text += 'If you also have the third fruit mixing upgrade purchased, then in addition you can create the dragon fruit. It\'s like the star fruit, but gives more season bonus. It\'s created by fusing star fruit and apple, and they must have the same set of abilities again.';
text += '<br><br>';
text += '• Star Fruit + Apple = Dragon Fruit (stronger 4 seasons boost)';
text += '<br><br>';
text += '<br/>';
}
dialog.content.div.innerHTML = text;
}
function createFruitFuseDialog(f, parentdialogrecreatefun) {
var oldLastTouchedFruit = lastTouchedFruit;
lastTouchedFruit = null;
lastTouchedFruit2 = null;
busyChoosingTargetSlot = undefined; // just in case this was somehow still active
var selected = undefined;
var swapped = false;
var transfer_choices = [];
var keep_choices = [];
var dialog = createDialog({undefined,
functions:function() {
if(selected) {
if(swapped) {
addAction({type:ACTION_FRUIT_FUSE, a:selected, b:f, transfer_choices:transfer_choices, keep_choices:keep_choices});
} else {
addAction({type:ACTION_FRUIT_FUSE, a:f, b:selected, transfer_choices:transfer_choices, keep_choices:keep_choices});
}
}
update();
if(parentdialogrecreatefun) parentdialogrecreatefun(lastTouchedFruit);
},
names:'fuse',
scrollable_canchange:true,
title:'Fuse fruits',
help:bind(createFruitHelp, true),
onclose:function() {
lastTouchedFruit = oldLastTouchedFruit;
lastTouchedFruit2 = null;
}
});
var n = getNumFruitAbilities(f.tier); // abilities excluding the fixed seasonal one
var resetChoices = function() {
for(var i = 0; i < n; i++) {
transfer_choices[i] = true;
keep_choices[i] = false;
}
};
resetChoices();
var make = function() {
var scrollFlex = dialog.content;
var scrollPos = scrollFlex.div.scrollTop;
scrollFlex.clear();
var fruits = [];
var fruits_index_sacr = -1; // index in fruits array where the fruits come from sacrificial pool rather than storage pool, or -1 if there's no switch (either all or stored or all are sacr)
for(var i = 0; i < state.fruit_stored.length + state.fruit_sacr.length; i++) {
var f2 = (i < state.fruit_stored.length) ? state.fruit_stored[i] : (state.fruit_sacr[i - state.fruit_stored.length]);
if(f2 == f) continue;
if(f2.tier != f.tier) continue;
//if(f2.type != f.type) continue;
if(fruits_index_sacr == -1 && f2.slot >= 100) fruits_index_sacr = fruits.length;
fruits.push(f2);
}
if(fruits_index_sacr == 0) fruits_index_sacr = -1;
var s = 0.1; // relative width and height of a chip
var x = 0;
var y = 0.03;
var addTitle = function(text, opt_x, opt_y) {
var y2 = opt_y || y;
var x2 = opt_x || 0;
var flex = new Flex(scrollFlex, [0.01, 0, x2], [0, 0, y2], 1, [0, 0, y2 + s]);
flex.div.innerText = text;
if(opt_y == undefined) y += s * 0.5;
};
addTitle('Fusing exists to gradually choose a set of abilities from the random drops, it doesn\'t make fruits stronger. Only abilities marked [**] can be transferred to other fruits. The [*] then [**] marks can be created by fusing the same abilities. No fruit essence is lost from fusing.');
y += s;
y += s * 0.5;
addTitle('Choose other fruit to fuse:');
for(var i = 0; i < fruits.length; i++) {
//if(i == fruits_index_sacr) x += s; // a horizontal gap to indicate we switch to the sacrificial fruits
if(i != 0 && i == fruits_index_sacr) {
x = 0;
y += s;
y += s * 0.1;
addTitle('Sacrificial:');
y -= s * 0.1;
}
if(x > s * 9.5) {
x = 0;
y += s;
//if(i == fruits_index_sacr) y += s * 0.1; // a vertical gap to indicate we switch to the sacrificial fruits
}
var flex = new Flex(scrollFlex, [0.01, 0, x], [0, 0, y], [0.01, 0, x + s], [0, 0, y + s]);
x += s;
var f2 = fruits[i]
makeFruitChip(flex, f2, 0, undefined, true, undefined, true);
styleButton0(flex.div);
addButtonAction(flex.div, bind(function(f) {
selected = f;
lastTouchedFruit2 = f;
resetChoices();
make();
}, f2), 'select ' + getFruitAriaLabel(f2));
}
if(fruits.length == 0) {
var flex = new Flex(scrollFlex, 0.01, [0, 0, y], 0.9, [0, 0, y + s]);
flex.div.innerText = '[ No fruit to fuse, must have at least 1 other fruit of the same tier ]';
}
y += s;
y += s * 0.5;
var y0t = y; // temporary y position for result title
addTitle('From:');
addTitle('Into:', 0.2, y0t);
var fruits2 = [f, selected];
var y0c = y; // temporary y position for result chip
x = 0;
for(var i = 0; i < 3; i++) {
var flex = new Flex(scrollFlex, [0.01, 0, x], [0, 0, y], [0.01, 0, x + s], [0, 0, y + s]);
x += s;
var f2 = f;
if(swapped != (i == 0)) f2 = selected;
if(i == 1) {
var canvas = createCanvas('0%', '0%', '100%', '100%', flex.div);
renderImage(image_swap, canvas);
styleButton0(flex.div, true);
addButtonAction(flex.div, bind(function(f, e) {
if(e.shiftKey) {
if(!selected) return;
var temp = f;
f = selected;
selected = temp;
make();
} else {
swapped = !swapped;
make();
}
}, f), 'swap fuse order');
registerTooltip(flex.div, 'Swap the fuse order of the two input fruits');
} else {
if(f2) {
var text = (i == 0) ? 'First selected fuse fruit: the "from" fruit' : 'Second selected fuse fruit: the "into" fruit';
makeFruitChip(flex, f2, 0, undefined, true, text, true);
} else {
flex.div.style.backgroundColor = '#ccc';
flex.div.style.border = '1px solid black';
registerTooltip(flex.div, 'Empty fuse fruit slot, select a fruit above to fuse');
}
styleButton0(flex.div);
var fruitname = (i == 0) ? 'From fruit' : 'Into fruit';
addButtonAction(flex.div, bind(function(f, i) {
if(f) {
createFruitInfoDialog(f, fruitname + ' stats');
} else {
showMessage(fruitname + ' empty, select one from the list above first', C_INVALID);
}
}, f2, i), fruitname + ': see stats' + (f2 ? ('. ' + getFruitAriaLabel(f2)) : '. Empty.'));
}
}
y += s;
var result_x = 0.4;
addTitle('Fused result:', result_x, y0t);
y += s * 0.5;
addTitle('Result stats:');
var fruitmix = 0;
// due to gated squirrel upgrades, it's always ensured if you have a next one, you also have the previous one
if(haveFruitMix(1)) fruitmix = 2;
if(haveFruitMix(2)) fruitmix = 4;
if(haveFruitMix(3)) fruitmix = 5;
var message = [undefined];
var intofruit = swapped ? selected : f;
var fromfruit = swapped ? f : selected;
var fuse = fuseFruit(intofruit, fromfruit, fruitmix, transfer_choices, keep_choices, message);
x = 0;
var flex = new Flex(scrollFlex, [0.01, 0, x + result_x], [0, 0, y0c], [0.01, 0, x + s + result_x], [0, 0, y0c + s]);
x += s;
if(fuse) {
makeFruitChip(flex, fuse, 0, undefined, true, 'fused fruit result', true);
styleButton0(flex.div);
addButtonAction(flex.div, bind(function(f) {
createFruitInfoDialog(f, 'Fuse result fruit stats');
}, fuse), 'Fused result: see stats' + (f2 ? ('. ' + getFruitAriaLabel(f2)) : ''));
} else {
flex.div.style.backgroundColor = '#ccc';
flex.div.style.border = '1px solid black';
registerTooltip(flex.div, 'Fused fruit appears here when successful');
addButtonAction(flex.div, bind(function(f) {
showMessage(fruitname + ' empty, select one from the list above first', C_INVALID);
}, fuse), 'Fused result: see stats. Empty');
}
//y += s;
if(message[0]) {
y += s * 0.25;
x = 0;
var flex = new Flex(scrollFlex, [0.01, 0, 0], [0, 0, y], [0.99, 0, 0], [0, 0, y + s]);
x += s;
flex.div.innerHTML = message[0] + '<br><br><br><br> '; // the br are to maintain scroll position if you were scrolled down in a fuse with more text
flex.div.style.color = message[1] ? '#f00' : '#0a0' ;
y += s * 1.1;
}
if(fuse) {
var h = s * 0.35;
var fuseFlex = new Flex(scrollFlex, [0.01, 0, 0], [0, 0, y], 1, [0, 0, y + 1]);
for(var i = -1; i < fuse.abilities.length; i++) {
var flex = new Flex(fuseFlex, 0, 'a', 1, 'a');
flex.div.style.marginBottom = '1.4em';
if(i == -1) {
flex.div.innerText = upper(fuse.toString()) + ', fused ' + fuse.fuses + ' times';
} else {
var text = '';
var other = swapped ? selected : f;
var highlight = false;
if(i < other.abilities.length && other.abilities[i] == fuse.abilities[i] && fuse.charge[i] > other.charge[i]) highlight = true;
text += 'ability: ' + fuse.abilityToString(i, false, false, highlight);
if(i < other.abilities.length) {
text += ' (was: ' + other.abilityToString(i) + ')';
} else {
text += ' (was: none)';
}
flex.div.innerHTML = text;
}
}
var num_transfer = 0;
for(var i = 0; i < fromfruit.abilities.length; i++) {
if(fromfruit.charge[i] == 2) {
num_transfer++;
}
}
if(num_transfer == 0) {
y += h;
//addTitle('When the "from" fruit has two-star [**] abilities, you can transfer them to the "to" fruit. To get [**] abilities, fuse two fruits with the same ability to get [*], then one more fuse to get [**].');
new Flex(flex, 0, 'a', 1, 'a').div.innerText = '\nWhen the "from" fruit has two-star [**] abilities, you can transfer them to the "to" fruit. To get [**] abilities, fuse two fruits with the same ability to get [*], then one more fuse to get [**].\n\n';
} else {
y += h;
//addTitle('Two-star [**] abilities below are transferred from the "from" fruit into the "to" fruit. Optionally you can use the checkboxes below to prevent some abilities from transferring, or to prioritize which original abilities get kept and pushed out:');
new Flex(flex, 0, 'a', 1, 'a').div.innerText = '\nTwo-star [**] abilities below are transferred from the "from" fruit into the "to" fruit. Optionally you can use the checkboxes below to prevent some abilities from transferring, or to prioritize which original abilities get kept and pushed out:\n\n';
y += h * 5;
var ability_type_seen = [];
for(var i = 0; i < fromfruit.abilities.length; i++) {
if(fromfruit.charge[i] == 2) {
//var flex = new Flex(scrollFlex, [0.01, 0, 0], [0, 0, y], 1, [0, 0, y + h]);
var flex = new Flex(fuseFlex, 0, 'a', 1, [0, 0, h]);
flex.div.style.marginBottom = '0.1em';
var text = '';
var flex0 = new Flex(flex, 0, 0, [0, 1], 1);
var flex1 = new Flex(flex, [0, 1.2], 0, 1, 1);
var canvas = createCanvas('0%', '0%', '100%', '100%', flex0.div);
renderImage(transfer_choices[i] ? image_checkbox_on : image_checkbox_off, canvas);
ability_type_seen[fromfruit.abilities[i]] = true;
styleButton0(flex0.div);
addButtonAction(flex0.div, bind(function(i) {
transfer_choices[i] = !transfer_choices[i];
make();
}, i), 'Checkbox to transfer ' + fromfruit.abilityToString(i) + ': ' + (transfer_choices[i] ? 'checked' : 'unchecked'));
text += fromfruit.abilityToString(i);
text += '\n';
flex1.div.innerText = text;
y += h * 1.2;
}
}
// Commented out: internally this works as 2 groups of checkboxes (transfer_choices and keep_choices), but there's no reason to show it as two separate lists in the UI, it can be seen as just a single list of abilities to choose prioritized ones from
//y += h;
//addTitle('Original abilities from the "into" fruit. Optionally, using the checkboxes, you can prioritize some abilities, to affect which ones get kept or get pushed out by the transferred abilities:');
//y += h * 2;
for(var i = 0; i < n; i++) {
if(ability_type_seen[intofruit.abilities[i]]) continue;
//var flex = new Flex(scrollFlex, [0.01, 0, 0], [0, 0, y], 1, [0, 0, y + h]);
var flex = new Flex(fuseFlex, 0, 'a', 1, [0, 0, h]);
flex.div.style.marginBottom = '0.1em';
//flex.div.style.border = '1px solid red';
var text = '';
var flex0 = new Flex(flex, 0, 0, [0, 1], 1);
var flex1 = new Flex(flex, [0, 1.2], 0, 1, 1);
var canvas = createCanvas('0%', '0%', '100%', '100%', flex0.div);
renderImage(keep_choices[i] ? image_checkbox_on : image_checkbox_off, canvas);
styleButton0(flex0.div);
addButtonAction(flex0.div, bind(function(i) {
keep_choices[i] = !keep_choices[i];
make();
}, i), 'Checkbox to prioritize ' + intofruit.abilityToString(i) + ': ' + (keep_choices[i] ? 'checked' : 'unchecked'));
text += intofruit.abilityToString(i);
text += '\n';
flex1.div.innerText = text;
y += h * 1.2;
}
}
}
scrollFlex.div.scrollTop = scrollPos;
};
make();
}
function showFruitMarkColorDialog(f, opt_onclose) {
//var fruitmarkcolors = ['#000', '#f00', '#dc0', '#4c4', '#66f', '#fff', '#f80', '#840', '#b0f'];
//var fruitmarkcolornames = ['none', 'red', 'yellow', 'green', 'blue', 'white', 'orange', 'brown', 'purple'];
var dialog = createDialog({
onclose:opt_onclose,
title:'Mark fruit border color',
bgstyle:'efDialogTranslucent',
icon:image_palette
});
var num = fruitmarkcolors.length;
for(var i = 0; i < num; i++) {
var button = new Flex(dialog.content, 0.25, (i + 0.05) / num , 0.8, (i + 0.75) / num).div;
styleButton(button);
button.textEl.innerText = fruitmarkcolornames[i];
button.style.color = util.farthestColor(fruitmarkcolors[i]);
button.style.backgroundColor = fruitmarkcolors[i];
addButtonAction(button, bind(function(i) {
f.mark = i;
closeTopDialog();
}, i));
}
}
function fillFruitDialog(dialog, f, opt_selected) {
dialog.content.clear();
dialog.icon.clear();
if(lastTouchedFruit != f) {
lastTouchedFruit = f;
//updateFruitUI(); // to update lastTouchedFruit style --> commented out: this is slow on mobile browsers, and the dialog's onclose also already redraws fruits (which is of course as slow but at least only twice as often)
}
var recreate = function(opt_f) {
if(opt_f) f = opt_f;
fillFruitDialog(dialog, f, selected);
};
var canvasFlex = new Flex(dialog.icon, 0.05, 0.05, 0.95, 0.95);
var canvas = createCanvas('0%', '0%', '100%', '100%', canvasFlex.div);
renderImage(images_fruittypes[f.type][f.tier], canvas);
styleFruitChip(canvasFlex, f);
var margin = 0.1;
var topFlex = new Flex(dialog.content, margin, 0.01, 1 - margin, 0.15);
var text = upper(f.toString());
var essence_available = state.res.essence.sub(f.essence);
text += '<br>';
text += 'Tier ' + toRomanUpTo(f.tier) + ': ' + tierNames[f.tier] + ', type: ' + f.typeName();
text += '<br><br>';
text += 'Fruit essence available: ' + essence_available.toString() + ' of ' + state.res.essence.toString() + ', ' + f.essence.toString() + ' used.';
text += '<br>';
if(essence_available.ltr(0)) {
text += 'Note: negative essence: re-earn it to upgrade abilities further.';
text += '<br>';
}
text += 'Get on sacrifice: ' + getFruitSacrifice(f).toString();
if(f.fuses) {
text += '<br>';
text += 'Fuses done: ' + f.fuses;
}
text += '<br><br>';
text += 'Click ability to view or level up: ';
topFlex.div.innerHTML = text;
var selected = (opt_selected == undefined) ? -1 : opt_selected; // the selected ability for details and upgrade button
var flexes = [];
var y = 0.26;
var h = 0.05;
for(var i = 0; i < f.abilities.length; i++) {
var flex = new Flex(dialog.content, margin, y, 1 - margin, y + h);
y += h * 1.1;
var a = f.abilities[i];
var level = f.levels[i];
text = upper(f.abilityToString(i));
text += ' (' + getFruitBoost(a, level, f.tier).toPercentString() + ')';
centerText2(flex.div);
flex.div.textEl.innerHTML = text;
flexes[i] = flex;
flex.div.style.backgroundColor = '#fff'; // temporary, to make styleButton0 use the filter instead of backgroundColor
styleButton0(flex.div);
addButtonAction(flex.div, bind(function(i) {
selected = (i == selected) ? -1 : i;
updateSelected();
}, i));
}
y += 0.02;
var y0 = y;
h = 0.05;
var margin2 = margin * 1.05;
if(f.slot < 100) {
var moveButton2 = new Flex(dialog.content, margin2, y, 1 - margin2, y + h).div;
y += h * 1.1;
styleButton(moveButton2);
moveButton2.textEl.innerText = 'to sacrificial pool';
addButtonAction(moveButton2, function() {
addAction({type:ACTION_FRUIT_SLOT, f:f, slottype:1});
update();
//recreate();
closeAllDialogs();
});
} else {
var moveButton1 = new Flex(dialog.content, margin2, y, 1 - margin2, y + h).div;
y += h * 1.1;
styleButton(moveButton1);
moveButton1.textEl.innerText = 'to storage slot';
if(state.fruit_stored.length >= state.fruit_slots) moveButton1.className = 'efButtonCantAfford';
addButtonAction(moveButton1, function() {
addAction({type:ACTION_FRUIT_SLOT, f:f, slottype:0});
update();
//recreate();
closeAllDialogs();
});
}
var moveToButton = new Flex(dialog.content, margin2, y, 1 - margin2, y + h).div;
y += h * 1.1;
styleButton(moveToButton);
moveToButton.textEl.innerText = 'move to slot (click target...)';
registerAction(moveToButton, function(shift, ctrl) {
showMessage('Click target slot to move this fruit into');
busyChoosingTargetSlot = f;
busyChoosingTargetSlot_shift = shift;
closeAllDialogs();
}, 'move fruit to slot (click target...)', {
label_shift:'swap fruit with slot (click target...)',
tooltip:'after clicking this button, click any fruit slot in the fruit tab to move this fruit to',
});
if(f.slot < 100) {
var moveButton3 = new Flex(dialog.content, margin2, y, 1 - margin2, y + h).div;
y += h * 1.1;
styleButton(moveButton3);
moveButton3.textEl.innerText = 'make active';
if(f.slot == state.fruit_active) moveButton3.className = 'efButtonCantAfford';
addButtonAction(moveButton3, function() {
if(f.slot >= MAXFRUITARROWS) {
// The UI only allows to make the top 10 (MAXFRUITARROWS) active. So the "make active" button of further ones
// must move this one to the top row.
// We could instead not have this button at all, but then the issue is that the only way to make this fruit active is to
// drag it to a top slot, so if dragging isn't available on the device it couldn't be made active at all.
// So swap it with the active one, that even allows choosing its destination spot
swapFruit(f.slot, state.fruit_active);
}
state.fruit_active = f.slot;
updateFruitUI();
update();
//recreate();
closeAllDialogs();
});
}
// can't do fusing on fruits that only have 1 ability
if(f.tier > 0) {
var fuseButton = new Flex(dialog.content, margin2, y, 1 - margin2, y + h).div;
y += h * 1.1;
styleButton(fuseButton);
fuseButton.textEl.innerText = 'fuse';
//if(fruitReachedFuseMax(f)) fuseButton.className = 'efButtonCantAfford';
addButtonAction(fuseButton, function() {
createFruitFuseDialog(f, recreate);
});
}
var renameButton = new Flex(dialog.content, margin2, y, 1 - margin2, y + h).div;
y += h * 1.1;
styleButton(renameButton);
renameButton.textEl.innerText = 'rename';
addButtonAction(renameButton, function() {
makeTextInput('Rename fruit', 'Enter new fruit name, or empty for default', function(name) {
f.name = sanitizeName(name);
updateFruitUI();
if(dialog_level) recreate();
}, f.name);
});
var markColorButton = new Flex(dialog.content, margin2, y, 1 - margin2, y + h).div;
y += h * 1.1;
styleButton(markColorButton);
markColorButton.textEl.innerText = 'mark border color';
addButtonAction(markColorButton, function() {
showFruitMarkColorDialog(f, function() {
updateFruitUI();
recreate();
});
});
/*styleButton0(canvas, true);
addButtonAction(canvas, function() {
f.mark = ((f.mark || 0) + 1) % 9;
updateFruitUI();
recreate();
}, 'fruit icon: ' + getFruitAriaLabel(f) + '. Click to mark favorite');
registerTooltip(canvas, 'click to mark as favorite and toggle color style. This is a visual effect only.');*/
y = y0;
h = 0.35;
var bottomflex = new Flex(dialog.content, margin, y, 1 - margin, y + h);
bottomflex.div.className = 'efFruitAbilityBox';
bottomflex.div.style.visibility = 'hidden';
y += h;
var textFlex = new Flex(bottomflex, 0.01, 0.0, 0.9, 0.5);
var downButton = new Flex(bottomflex, 0.01, 0.7, 0.15, 0.95).div;
styleButton(downButton);
var upButton = new Flex(bottomflex, 0.16, 0.7, 0.3, 0.95).div;
styleButton(upButton);
var levelManyButton = new Flex(bottomflex, 0.31, 0.7, 0.645, 0.95).div;
styleButton(levelManyButton);
var levelButton = new Flex(bottomflex, 0.655, 0.7, 0.99, 0.95).div;
styleButton(levelButton);
var closeButton = new Flex(bottomflex, 0.92, [0, 0.01], 0.99, [0, 0.08]).div;
renderImage(image_close, createCanvas('0%', '0%', '100%', '100%', closeButton));
styleButton0(closeButton);
//bottomflex.div.style.border = '1px solid black';
var updateSelected = function() {
for(var i = 0; i < flexes.length; i++) {
// TODO: integrate ALL THIS with dark/light theming system and the CSS stylesheet
if(i == selected) {
flexes[i].div.style.boxShadow = '0px 0px 5px #000';
flexes[i].div.style.border = '';
flexes[i].div.style.backgroundColor = '#8f8';
} else {
flexes[i].div.style.boxShadow = '';
flexes[i].div.style.border = '1px solid #000';
flexes[i].div.style.backgroundColor = '#6d6';
}
var cost = getFruitAbilityCost(f.abilities[i], f.levels[i], f.tier);
var afford = cost.essence.lte(state.res.essence.sub(f.essence));
var inherent = isInherentAbility(f.abilities[i]);
if(inherent) {
flexes[i].div.style.color = '#0008';
flexes[i].div.style.textShadow = '2px 0 #fff8, 0 2px #fff8';
} else {
flexes[i].div.style.color = afford ? '#000' : '#797';
flexes[i].div.style.textShadow = '';
}
}
var a = f.abilities[selected];
var level = f.levels[selected];
if(selected < 0 || isInherentAbility(a)) {
textFlex.div.innerHTML = 'click ability to view or level up';
bottomflex.div.style.visibility = 'hidden';
if(selected < 0) return;
} else {
bottomflex.div.style.visibility = '';
}
y += h;
text = upper(getFruitAbilityName(a));
if(!isInherentAbility(a)) text += ' ' + toRomanUpTo(level);
text += '<br>';
//text += 'Cost to level: ????';
text += upper(getFruitAbilityDescription(a));
text += '<br>';
if(isInherentAbility(a)) {
text += 'Boost: ' + getFruitBoost(a, level, f.tier).toPercentString();
text += '<br>';
text += '<br>';
text += 'This is an inherent fruit ability. It doesn\'t take up a regular ability slot for this fruit tier. It cannot be upgraded nor moved.';
} else {
var cost = getFruitAbilityCost(a, level, f.tier);
text += 'Current level: ' + getFruitBoost(a, level, f.tier).toPercentString();
if(a == FRUIT_TREELEVEL) text += ' (target: ' + getFruitBoost(a, level, f.tier, undefined, 1).toPercentString() + ')';
text += '<br>';
text += 'Next level: ' + getFruitBoost(a, level + 1, f.tier).toPercentString()
if(a == FRUIT_TREELEVEL) text += ' (target: ' + getFruitBoost(a, level + 1, f.tier, undefined, 1).toPercentString() + ')';
text += ', cost: ' + cost.toString();
levelButton.textEl.innerText = 'Buy 1';
var available = state.res.essence.sub(f.essence);
if(available.lt(cost.essence)) {
levelButton.className = 'efButtonCantAfford';
} else {
levelButton.className = 'efButton';
}
registerAction(levelButton, function(e) {
addAction({type:ACTION_FRUIT_LEVEL, f:f, index:selected, shift:false});
update();
recreate();
}, 'Buy 1', {tooltip:('Levels up this ability. Does not permanently use up essence, only for this fruit: all essence can be used in all fruits.')});
levelManyButton.textEl.innerText = 'Buy many';
var available = state.res.essence.sub(f.essence);
if(available.mulr(0.25).lt(cost.essence)) {
levelManyButton.className = 'efButtonCantAfford';
} else {
levelManyButton.className = 'efButton';
}
registerAction(levelManyButton, function(e) {
addAction({type:ACTION_FRUIT_LEVEL, f:f, index:selected, shift:true});
update();
recreate();
}, 'Buy many', {tooltip:('Levels up this ability multiple times, using up to 25% of the available essence. Does not permanently use up essence, only for this fruit: all essence can be used in all fruits.')});
upButton.textEl.innerText = '^';
if(selected <= 0) {
upButton.className = 'efButtonCantAfford';
} else {
upButton.className = 'efButton';
}
registerAction(upButton, function(e) {
if(selected <= 0) return;
addAction({type:ACTION_FRUIT_REORDER, f:f, index:selected, up:true});
selected--;
update();
recreate();
}, 'Move ability up', {tooltip:('Moves up this ability in the order. This has no effect on ability strength, but can affect fusing of fruits')});
downButton.textEl.innerText = 'v';
if(selected + 1 >= getNumFruitAbilities(f.tier)) {
downButton.className = 'efButtonCantAfford';
} else {
downButton.className = 'efButton';
}
registerAction(downButton, function(e) {
if(selected + 1 >= getNumFruitAbilities(f.tier)) return;
addAction({type:ACTION_FRUIT_REORDER, f:f, index:selected, up:false});
selected++;
update();
recreate();
}, 'Move ability down', {tooltip:('Moves down this ability in the order. This has no effect on ability strength, but can affect fusing of fruits')});
registerAction(closeButton, function(e) {
selected = -1;
recreate();
}, 'Close fruit ability popup', {tooltip:('Close fruit ability popup')});
}
textFlex.div.innerHTML = text;
};
updateSelected();
}
function createFruitDialog(f, opt_selected) {
var dialog = createDialog({
onclose:function() {
// onclose function: updates the relevant fruit chip with new upgrade levels. TODO: it's inefficient to redraw all fruit chips for this
updateFruitUI();
},
help:bind(createFruitHelp, false),
title:'Configure fruit',
bgstyle:'efDialogTranslucent',
/*functions:[''],
names:['edit'],*/
});
fillFruitDialog(dialog, f, opt_selected);
}
function createFruitInfoDialog(f, opt_label) {
var dialog = createDialog({
title:(opt_label || 'Fruit info')
});
var scrollFlex = dialog.content;
var y = 0;
var s = 0.1;
for(var i = -1; i < f.abilities.length; i++) {
var flex = new Flex(scrollFlex, [0.01, 0, 0], [0, 0, y], 1, [0, 0, y + s]);
flex.div.innerText = (i == -1) ? (f.toString() + ', fused ' + f.fuses + ' times') : ('ability: ' + f.abilityToString(i));
y += s * 0.5;
}
}
var showing_fruit_dialog = false;
function showStorageFruitSourceDialog() {
showing_fruit_dialog = true; // for achievement
var dialog = createDialog({
title:'Fruit storage slot sources',
scrollable:true,
icon:images_apple[3],
onclose:function() {
showing_fruit_dialog = false;
}
});
var text = '';
text += 'You have ' + state.fruit_slots + ' fruit storage slots available. Here\'s where they came from:';
text += '<br/><br/>';
text += ' • 3: initial amount';
text += '<br/>';
if(state.seen_seasonal_fruit != 0) {
text += ' • 1: for having seen at least 1 seasonal fruit';
text += '<br/>';
}
if((state.seen_seasonal_fruit & 15) == 15) {
text += ' • 1: for having seen all 4 types of seasonal fruit';
text += '<br/>';
}
if((state.seen_seasonal_fruit & 240) == 240) {
text += ' • 1: for having seen all 4 types of 2-seasonal fruit';
text += '<br/>';
}
if((state.seen_seasonal_fruit & 256) == 256) {
text += ' • 1: for having seen a star fruit';
text += '<br/>';
}
if((state.seen_seasonal_fruit & 512) == 512) {
text += ' • 1: for having seen a dragon fruit';
text += '<br/>';
}
var num_ethereal_upgrades = 0;
if(state.upgrades2[upgrade2_extra_fruit_slot].count) num_ethereal_upgrades++;
if(state.upgrades2[upgrade2_extra_fruit_slot2].count) num_ethereal_upgrades++;
if(state.upgrades2[upgrade2_extra_fruit_slot3].count) num_ethereal_upgrades++;
if(state.upgrades2[upgrade2_extra_fruit_slot4].count) num_ethereal_upgrades++;
if(state.upgrades2[upgrade2_extra_fruit_slot5].count) num_ethereal_upgrades++;
if(state.upgrades2[upgrade2_extra_fruit_slot6].count) num_ethereal_upgrades++;
if(state.upgrades2[upgrade2_extra_fruit_slot7].count) num_ethereal_upgrades++;
if(num_ethereal_upgrades > 0) {