明日方舟 · 攒抽计算器

想知道到某天时你在明日方舟还可以攒到多少抽?用这个小工具!
代码:

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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>明日方舟 · 攒抽计算器</title>
<!-- 农历库 -->
<script src="https://cdn.jsdelivr.net/npm/lunar-javascript@1.7.0/lunar.js"></script>
<!-- Excel 库 -->
<script src="https://cdn.sheetjs.com/xlsx-0.20.1/package/dist/xlsx.full.min.js"></script>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
background: #0b0e14;
font-family: 'Segoe UI', 'PingFang SC', Roboto, sans-serif;
display: flex;
justify-content: center;
padding: 30px 20px;
color: #e2e8f0;
}
.container {
max-width: 820px;
width: 100%;
background: #161c26;
border-radius: 28px;
padding: 30px 28px;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
border: 1px solid #2a3340;
}
h1 {
font-size: 26px;
font-weight: 600;
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 6px;
}
.subhead {
color: #8896a8;
font-size: 14px;
border-left: 3px solid #f7931e;
padding-left: 14px;
margin-bottom: 28px;
background: #1e2632;
border-radius: 10px;
padding: 12px 16px;
}
.grid-2 {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px 20px;
}
.grid-3 {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 16px 20px;
}
.field {
display: flex;
flex-direction: column;
gap: 5px;
}
.field.full { grid-column: 1 / -1; }
label {
font-size: 13px;
font-weight: 500;
color: #a4b3c9;
display: flex;
align-items: center;
gap: 6px;
}
label .badge {
background: #2a3a4a;
font-size: 10px;
padding: 0 8px;
border-radius: 30px;
color: #bcc9db;
}
input, select {
background: #0f151e;
border: 1px solid #2a3442;
border-radius: 12px;
padding: 12px 14px;
font-size: 15px;
color: #edf2f7;
transition: 0.2s;
width: 100%;
outline: none;
}
input:focus, select:focus {
border-color: #f7931e;
box-shadow: 0 0 0 3px rgba(247, 147, 30, 0.15);
}
input[type="date"]::-webkit-calendar-picker-indicator {
filter: invert(0.7);
cursor: pointer;
}
input[type="number"] { appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
-webkit-appearance: none;
}
.checkbox-group {
display: flex;
align-items: center;
gap: 12px;
background: #0f151e;
padding: 10px 16px;
border-radius: 14px;
border: 1px solid #2a3442;
}
.checkbox-group input[type="checkbox"] {
width: 18px;
height: 18px;
accent-color: #f7931e;
cursor: pointer;
}
.btn {
background: #f7931e;
border: none;
border-radius: 40px;
padding: 16px 24px;
font-weight: 700;
font-size: 18px;
color: #0b0e14;
cursor: pointer;
transition: 0.2s;
width: 100%;
margin-top: 10px;
letter-spacing: 0.5px;
}
.btn:hover {
background: #ffa739;
transform: scale(1.01);
box-shadow: 0 8px 20px rgba(247, 147, 30, 0.25);
}
.btn:active { transform: scale(0.97); }
.result-box {
margin-top: 30px;
background: #0f151e;
border-radius: 20px;
padding: 24px 22px;
border: 1px solid #26303e;
}
.result-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
gap: 16px;
margin-top: 6px;
}
.stat {
background: #1a222e;
border-radius: 16px;
padding: 14px 12px;
text-align: center;
}
.stat .num {
font-size: 28px;
font-weight: 700;
color: #f7c948;
}
.stat .num.green { color: #6fcf97; }
.stat .num.blue { color: #6bb8f7; }
.stat .num.purple { color: #c084fc; }
.stat .label {
font-size: 12px;
color: #8f9eb2;
margin-top: 4px;
}
.stat .sub {
font-size: 12px;
color: #6b7d93;
margin-top: 2px;
}
.divider {
border: none;
border-top: 1px solid #26303e;
margin: 20px 0 16px 0;
}
.log-area {
background: #0a0f16;
border-radius: 14px;
padding: 14px 16px;
font-size: 13px;
max-height: 200px;
overflow-y: auto;
font-family: 'Consolas', monospace;
color: #b9c7db;
border: 1px solid #1f2937;
white-space: pre-wrap;
word-break: break-all;
line-height: 1.6;
}
@media (max-width: 640px) {
.grid-2, .grid-3 { grid-template-columns: 1fr; }
.container { padding: 20px 16px; }
}
.log-area::-webkit-scrollbar {
width: 5px;
}
.log-area::-webkit-scrollbar-track {
background: #0f151e;
}
.log-area::-webkit-scrollbar-thumb {
background: #3a4a5e;
border-radius: 12px;
}
.hint {
font-size: 11px;
color: #5a6d82;
margin-top: 2px;
}
.flex-row {
display: flex;
gap: 12px;
flex-wrap: wrap;
}
.flex-row .field {
flex: 1;
min-width: 120px;
}
</style>
</head>
<body>

<div class="container">
<h1>
<span>🧮 明日方舟 · 攒抽计算器</span>
</h1>

<!-- 输入区 -->
<div class="grid-2">
<div class="field">
<label>📅 起始日期 <span class="badge">默认今天</span></label>
<input type="date" id="startDate">
</div>
<div class="field">
<label>🎯 截止日期</label>
<input type="date" id="endDate">
</div>

<div class="field">
<label>💎 当前合成玉</label>
<input type="number" id="currentJade" value="0" min="0" step="100">
</div>
<div class="field">
<label>🪨 当前源石</label>
<input type="number" id="currentOriginium" value="0" min="0" step="1">
</div>

<div class="field">
<label>🎫 当前寻访凭证</label>
<input type="number" id="currentTickets" value="0" min="0" step="1">
</div>
<div class="field">
<label style="visibility: hidden;">占位</label>
<div class="checkbox-group" style="min-height: 42.5px;">
<input type="checkbox" id="free24">
<label for="free24" style="cursor:pointer;">🎫 计入限定寻访免费24寻访凭证</label>
<span style="color:#6a7f99; font-size:14px;">+24寻访凭证</span>
</div>
</div>

<div class="field full">
<div class="checkbox-group">
<input type="checkbox" id="hasMonthly">
<label for="hasMonthly" style="cursor:pointer;">🌙 开启月卡</label>
<span style="color:#6a7f99; font-size:14px;">+200玉/天</span>
</div>
</div>

<div class="field" id="monthlyDaysGroup" style="display:none;">
<label>📆 月卡剩余天数</label>
<input type="number" id="monthlyDays" value="30" min="1" max="365">
</div>
</div>

<!-- 灵活控制区 -->
<div style="margin: 18px 0 10px 0; padding: 16px; background: #111a22; border-radius: 16px; border: 1px solid #1f2937;">
<div style="font-weight:600; color:#b2c4dd; margin-bottom:12px; font-size:15px;">⚙️ 灵活控制</div>
<div class="flex-row">
<div class="field">
<label>📌 周常刷新日</label>
<select id="weekTaskDay">
<option value="1">周一</option>
<option value="2">周二</option>
<option value="3">周三</option>
<option value="4">周四</option>
<option value="5">周五</option>
<option value="6">周六</option>
<option value="0" selected>周日</option>
</select>
<div class="hint">每周哪天发周常任务</div>
</div>
<div class="field">
<label>📌 歼灭刷新日</label>
<select id="annihilationDay">
<option value="1">周一</option>
<option value="2">周二</option>
<option value="3">周三</option>
<option value="4">周四</option>
<option value="5">周五</option>
<option value="6">周六</option>
<option value="0" selected>周日</option>
</select>
<div class="hint">每周哪天发剿灭</div>
</div>
<div class="field">
<label>🧱 幸运墙获取数</label>
<select id="luckilyJades">
<option value="200">200</option>
<option value="300">300</option>
<option value="400" selected>400</option>
<option value="500">500</option>
<option value="800">800</option>
</select>
<div class="hint">幸运墙每天给多少玉</div>
</div>
</div>
<div class="flex-row">
<div class="field">
<label>📦 歼灭满额</label>
<input type="number" id="annihilationCap" value="1800" min="0" max="1800" step="100">
<div class="hint">默认 1800,未满可改</div>
</div>
<div class="field">
<label>✅ 本周歼灭已领</label>
<input type="number" id="annihilationClaimed" value="0" min="0" max="1800" step="100">
<div class="hint">本周已领取的合成玉数</div>
</div>
</div>
<div class="flex-row" style="margin-top:12px;">
<div class="field">
<div class="checkbox-group">
<input type="checkbox" id="dailyDone">
<label for="dailyDone" style="cursor:pointer;">✅ 本日日常已完成</label>
</div>
<div class="hint">勾选后今天不+100玉</div>
</div>
<div class="field">
<div class="checkbox-group">
<input type="checkbox" id="weeklyDone">
<label for="weeklyDone" style="cursor:pointer;">✅ 本周周常已完成</label>
</div>
<div class="hint">勾选后本周不+500玉</div>
</div>
</div>
<div class="flex-row" style="margin-top:12px;">
<div class="field">
<div class="checkbox-group">
<input type="checkbox" id="helpDone">
<label for="helpDone" style="cursor:pointer;">✅ 本日游戏内补给/月卡已领取</label>
</div>
<div class="hint">勾选后今天不+200玉(月卡),+1寻访凭证(如满足)</div>
</div>
<div class="field">
<div class="checkbox-group">
<input type="checkbox" id="luckilyDone">
<label for="luckilyDone" style="cursor:pointer;">✅ 本日幸运墙已抽取</label>
</div>
<div class="hint">勾选后今天不+400玉(如满足)</div>
</div>
</div>
<div class="flex-row" style="margin-top:12px;">
<div class="field">
<div class="checkbox-group">
<input type="checkbox" id="sklandDone">
<label for="sklandDone" style="cursor:pointer;">✅ 本日森空岛签到已领取</label>
</div>
<div class="hint">勾选后今天不+80/100/120玉(如满足)</div>
</div>
<div class="field">
<div class="checkbox-group">
<input type="checkbox" id="activityDone">
<label for="activityDone" style="cursor:pointer;">✅ 本日活动签到已领取</label>
</div>
<div class="hint">勾选后今天不领取活动签到(如满足)</div>
</div>
</div>
<div class="flex-row">
<div class="field">
<label>🗓️ 森空岛签到缺席天数</label>
<input type="number" id="sklandNoClaimDays" value="0" min="0" max="31" step="1">
<div class="hint">本月森空岛缺席未领多少天</div>
</div>
<div class="field">
<label>🗓️ 游戏内补给缺席天数</label>
<input type="number" id="helpNoClaimDays" value="0" min="0" max="31" step="1">
<div class="hint">本月游戏内补给缺席未领多少天</div>
</div>
<div class="field">
<label>🗓️ 活动签到缺席天数</label>
<input type="number" id="activityNoClaimDays" value="0" min="0" max="31" step="1">
<div class="hint">本月活动签到缺席未领多少天</div>
</div>
</div>
<div class="flex-row" style="margin-top:12px;">
<div class="field">
<div class="checkbox-group">
<input type="checkbox" id="noSkland">
<label for="noSkland" style="cursor:pointer;">❌ 不计算森空岛签到</label>
</div>
<div class="hint">勾选后不计算森空岛签到</div>
</div>
</div>
</div>

<button class="btn" id="calcBtn">📊 开始计算</button>
<button class="btn" id="downloadBtn" hidden>⏬ 下载结果</button>

<!-- 结果 -->
<div class="result-box" id="resultBox" style="display:none;">
<div class="result-grid" id="resultStats"></div>
<hr class="divider">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; flex-wrap:wrap; gap:8px;">
<span style="font-weight:500; color:#b2c4dd;">📋 每日收入明细</span>
<span style="font-size:12px; color:#5f748e;">共 <span id="logDaysCount">0</span> 天</span>
</div>
<div class="log-area" id="logArea"></div>
</div>
</div>

<script>
(function() {
// ---- 硬编码 ----
/*
月/日 - 普通公历日期
N月/日 - 普通农历日期
N-月/日 - 去年的农历日期(如除夕)
*/
const CHECKIN = [
{ // 新年
'start': 'N-12/29',
'end': 'N1/13',
'rewards': {
500: [
'N-12/29',
'N1/1',
'N1/5',
'N1/8'
]
}
},
{ // 周年庆
'start': '5/1',
'end': '5/28',
'rewards': {
200: [
'5/5',
'5/8',
'5/10'
]
}
},
{ // 端午节
'start': 'N5/3',
'end': 'N5/12',
'rewards': {
200: [
'N5/4'
]
}
},
{ // 夏日嘉年华
'start': '8/1',
'end': '8/15',
'rewards': {
200: [
'8/2',
'8/6',
'8/9'
]
}
},
{ // 中秋节
'start': 'N8/13',
'end': 'N8/19',
'rewards': {
200: [
'N8/17'
]
}
},
{ // 感谢庆典
'start': '11/1',
'end': '11/15',
'rewards': {
200: [
'11/2',
'11/10'
]
}
}
];
const WISH_WALLS = [
{ start: 'N-12/23', end: 'N1/8' }, // 新年
{ start: '5/1', end: '5/14' }, // 周年庆
{ start: '8/1', end: '8/14' }, // 夏活
{ start: '11/1', end: '11/14' }, // 感谢庆典
];
const ORIGINIUM_RANGE = { start: '10/26', end: '10/31', amount: 1 }; // 感谢庆典
const GAME_SIGN_DAY = 17; // 游戏内补给
const SKLAND_SIGN = { 4: 80, 12: 100, 20: 120 }; // 森空岛签到

// ---- 工具 ----
function parseDate(str, forceYear) {
if (str.startsWith('N')) {
const parts = str.slice(1).split('/').map(Number).map((v) => Math.abs(v));
const year = forceYear - str.startsWith('N-');
const solar = Lunar.fromYmd(year, parts[0], parts[1]).getSolar();
return new Date(solar.getYear(), solar.getMonth() - 1, solar.getDay());
}
const p = str.split('/').map(Number);
let y = forceYear;
const now = new Date();
const d = new Date(y, p[0]-1, p[1]);
if (d < now && p[0] < now.getMonth()+1) y++;
return new Date(y, p[0]-1, p[1]);
}

function formatDate(d) {
const y = d.getFullYear();
const m = String(d.getMonth()+1).padStart(2,'0');
const day = String(d.getDate()).padStart(2,'0');
return `${y}-${m}-${day}`;
}

function isDateInRange(date, startStr, endStr, addDays = 0) {
const s = parseDate(startStr, date.getFullYear()), e = parseDate(endStr, date.getFullYear());
s.setDate(s.getDate() + addDays); e.setDate(e.getDate() + addDays);
const t = new Date(date); t.setHours(0,0,0,0);
s.setHours(0,0,0,0); e.setHours(0,0,0,0);
return t >= s && t <= e;
}

function isWishWallDay(date) {
for (let w of WISH_WALLS) {
if (isDateInRange(date, w.start, w.end)) return true;
}
return false;
}
function isOriginiumDay(date, start) {
let noClaimDays = parseInt(document.getElementById('activityNoClaimDays').value);
if (date.getYear() !== start.getYear()) noClaimDays = 0;

return isDateInRange(date, ORIGINIUM_RANGE.start, ORIGINIUM_RANGE.end, noClaimDays);
}
function getCheckIn(date, isFirstActivity) {
let haveActivity = false;

for (const activity of CHECKIN) {
if (isDateInRange(date, activity.start, activity.end)) {
haveActivity = true;
let noClaimDays = parseInt(document.getElementById('activityNoClaimDays').value);
if (!isFirstActivity) noClaimDays = 0;

for (const [amount, dates] of Object.entries(activity.rewards)) {
for (raw of dates) {
const ciDate = parseDate(raw, date.getFullYear());
ciDate.setDate(ciDate.getDate() + noClaimDays)

if (ciDate.getTime() === date.getTime()) {
return Number(amount);
}
}
}
}
}

return haveActivity;
}

function getSkland(date, start) {
let noClaimDays = parseInt(document.getElementById('sklandNoClaimDays').value);
if (date.getYear() !== start.getYear() || date.getMonth() !== start.getMonth()) noClaimDays = 0;

let tempSklandSign = {};
if (noClaimDays === 0) tempSklandSign = SKLAND_SIGN;
else {
for (const [sign, value] of Object.entries(SKLAND_SIGN)) {
tempSklandSign[Number(sign) + noClaimDays] = value
}
}

return tempSklandSign[date.getDate()] || 0;
}
function getGameSign(date, start) {
let noClaimDays = parseInt(document.getElementById('helpNoClaimDays').value);
if (date.getYear() !== start.getYear() || date.getMonth() !== start.getMonth()) noClaimDays = 0;

return date.getDate() === (GAME_SIGN_DAY + noClaimDays) ? 1 : 0;
}

// ---- 主计算 ----
function calculate() {
const startInput = document.getElementById('startDate').value;
const endInput = document.getElementById('endDate').value;
let startDate = startInput ? new Date(startInput) : new Date();
let endDate = endInput ? new Date(endInput) : new Date();
startDate.setHours(0,0,0,0);
endDate.setHours(0,0,0,0);
if (startDate > endDate) {
alert('⚠️ 起始日期不能晚于截止日期!');
return;
}

const currentJade = parseInt(document.getElementById('currentJade').value) || 0;
const currentOriginium = parseInt(document.getElementById('currentOriginium').value) || 0;
const currentTickets = (parseInt(document.getElementById('currentTickets').value) || 0) + document.getElementById('free24').checked * 24;
const hasMonthly = document.getElementById('hasMonthly').checked;
const monthlyDays = parseInt(document.getElementById('monthlyDays').value) || 0;

const weekTaskDay = parseInt(document.getElementById('weekTaskDay').value);
const annihilationDay = parseInt(document.getElementById('annihilationDay').value);
const luckilyJades = parseInt(document.getElementById('luckilyJades').value);
const annihilationCap = parseInt(document.getElementById('annihilationCap').value) || 1800;
const annihilationClaimed = parseInt(document.getElementById('annihilationClaimed').value) || 0;
let dailyDone = document.getElementById('dailyDone').checked;
let weeklyDone = document.getElementById('weeklyDone').checked;
let helpDone = document.getElementById('helpDone').checked;
const firstDayHelpDone = helpDone;
let luckilyDone = document.getElementById('luckilyDone').checked;
let sklandDone = document.getElementById('sklandDone').checked;
let activityDone = document.getElementById('activityDone').checked;
const noSkland = document.getElementById('noSkland').checked;
let isThisWeek = true;
let isFirstActivity = true;

// 今天的日期(用于判断月卡剩余天数、本周是否已领等)
const today = new Date();
today.setHours(0,0,0,0);

let totalJade = currentJade;
let totalOriginium = currentOriginium;
let totalTickets = currentTickets;
let dailyLog = [];

const start = new Date(startDate);
let current = startDate;
let dayCount = 0;

while (current <= endDate) {
const dateStr = formatDate(current);
let dayJade = 0;
let dayOriginium = 0;
let dayTickets = 0;
let parts = [];

// ---- 每日任务 ----
if (!dailyDone) {
dayJade += 100;
parts.push('日常+100');
}

// ---- 月卡:从今天开始算剩余天数 ----
const daysSinceToday = Math.floor((current - today) / (1000 * 60 * 60 * 24)) - firstDayHelpDone;
if (!helpDone && hasMonthly && daysSinceToday >= 0 && daysSinceToday < monthlyDays) {
dayJade += 200;
parts.push('月卡+200');
}

// ---- 周常:只在周常刷新日发,且每周只发一次 ----
if (current.getDay() === weekTaskDay) {
if (!weeklyDone) {
dayJade += 500;
parts.push('周常+500');
}
weeklyDone = false;
}

// ---- 剿灭:只在歼灭刷新日发,且每周只发一次 ----
if (current.getDay() === annihilationDay) {
let weekAnnihilation = annihilationCap;
if (annihilationDay < current.getDay() && !(annihilationDay === 0)) {
isThisWeek = false;
}
if (isThisWeek) {
weekAnnihilation = Math.max(0, annihilationCap - annihilationClaimed);
}
if (weekAnnihilation > 0) {
dayJade += weekAnnihilation;
parts.push(`剿灭+${weekAnnihilation}`);
}
isThisWeek = false;
}

if (!activityDone) {
// ---- 签到 ----
const CheckIn = getCheckIn(current, isFirstActivity);
if (typeof CheckIn === 'number') { dayJade += CheckIn; parts.push(`签到+${CheckIn}`); }
else if (!CheckIn) isFirstActivity = false;

// ---- 源石签到 ----
if (isOriginiumDay(current, start)) { dayOriginium += 1; parts.push('源石+1'); }
}

// ---- 森空岛 ----
const skland = getSkland(current, start);
if (!noSkland && skland > 0 && !sklandDone) { dayJade += skland; parts.push(`森空岛+${skland}`); }

// ---- 游戏内签到(17号) ----
const gameSign = getGameSign(current, start);
if (gameSign > 0 && !helpDone) { dayTickets += gameSign; parts.push('补给+1抽'); }

// ---- 幸运墙 ----
if (isWishWallDay(current) && !luckilyDone) { dayJade += luckilyJades; parts.push(`幸运墙+${luckilyJades}`); }

// ---- 记录 ----
if (dayJade > 0 || dayOriginium > 0 || dayTickets > 0) {
dailyLog.push({ date: dateStr, jade: dayJade, originium: dayOriginium, tickets: dayTickets, detail: parts.join(' · ') });
}

totalJade += dayJade;
totalOriginium += dayOriginium;
totalTickets += dayTickets;

dailyDone = false;
helpDone = false;
luckilyDone = false;
sklandDone = false;
activityDone = false;

dayCount++;
current.setDate(current.getDate() + 1);
}

// ---- 汇总 ----
const totalJadeFromOriginium = totalOriginium * 180;
const totalJadeAll = totalJade + totalJadeFromOriginium;
const totalPulls = Math.floor(totalJadeAll / 600) + totalTickets;
const leftoverJade = totalJadeAll % 600;

const resultBox = document.getElementById('resultBox');
resultBox.style.display = 'block';
document.getElementById('resultStats').innerHTML = `
<div class="stat"><div class="num" id="result-jade">${totalJade}</div><div class="label">合成玉 (不含源石)</div></div>
<div class="stat"><div class="num green" id="result-originium">${totalOriginium}</div><div class="label">源石</div><div class="sub">= ${totalJadeFromOriginium} 玉</div></div>
<div class="stat"><div class="num blue" id="result-ticket">${totalTickets}</div><div class="label">寻访凭证</div></div>
<div class="stat"><div class="num purple" id="result">${totalPulls}</div><div class="label">总抽数</div><div class="sub" id="result-more">余 ${leftoverJade} 玉</div></div>
`;

const logArea = document.getElementById('logArea');
if (dailyLog.length === 0) {
logArea.textContent = '(无任何稳定收入日期)';
document.getElementById('downloadBtn').hidden = true;
} else {
logArea.textContent = dailyLog.map(e => `${e.date} | ${e.detail}`).join('\n');
document.getElementById('logDaysCount').textContent = dailyLog.length;
document.getElementById('downloadBtn').hidden = false;
}
resultBox.scrollIntoView({ behavior: 'smooth', block: 'start' });
}

function download() {
const logTexts = document.getElementById('logArea').textContent.split('\n');
const infos = [
{
'总抽数': document.getElementById('result').textContent,
'余下玉': document.getElementById('result-more').textContent.match(/\d+/g)[0],
'合成玉': document.getElementById('result-jade').textContent,
'源石': document.getElementById('result-originium').textContent,
'寻访凭证': document.getElementById('result-ticket').textContent,
}
];
let datas = []
let maxDataLength = 0;

for (const logText of logTexts) {
const logTextSplit = logText.split(' | ');
const date = logTextSplit[0];
const texts = logTextSplit[1];
const logs = texts.split(' · ');

if (logs.length > maxDataLength) maxDataLength = logs.length;

let tempData = {
'日期': date
};
for (const [i, log] of logs.entries()) {
tempData['项目 ' + (i + 1).toString()] = log;
}
datas.push(tempData);
}

const wb = XLSX.utils.book_new();
const ws_info = XLSX.utils.json_to_sheet(infos);
const ws_data = XLSX.utils.json_to_sheet(datas);

ws_data['!cols'] = [
{wch: 15}
];

for (let _ = 0; _ < maxDataLength; _++) {
ws_data['!cols'].push({wch: 18});
}

XLSX.utils.book_append_sheet(wb, ws_info, '攒抽结果');
XLSX.utils.book_append_sheet(wb, ws_data, '攒抽详情');

XLSX.writeFile(wb, '攒抽结果.xlsx');
}

// ---- 绑定 ----
document.getElementById('calcBtn').addEventListener('click', calculate);
document.getElementById('downloadBtn').addEventListener('click', download);
document.getElementById('hasMonthly').addEventListener('change', function() {
document.getElementById('monthlyDaysGroup').style.display = this.checked ? 'block' : 'none';
});

const today = new Date();
document.getElementById('startDate').value = formatDate(today);
const future = new Date(today);
future.setDate(future.getDate() + 30);
document.getElementById('endDate').value = formatDate(future);
})();
</script>

</body>
</html>


明日方舟 · 攒抽计算器
https://qiufengcute.github.io/Blog/posts/明日方舟攒抽计算器/
作者
Qiufeng
发布于
2026年8月28日
许可协议