-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.js
More file actions
7161 lines (6087 loc) · 278 KB
/
Copy pathgame.js
File metadata and controls
7161 lines (6087 loc) · 278 KB
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
// ==================== 游戏状态管理 ====================
const GameState = {
// 玩家信息
playerName: '', // 玩家名字
gameTitle: '模拟器研究者', // 游戏标题(可能被彩蛋修改)
// 基础资源
inventory: 1000000,
money: 5000,
reputation: 50,
day: 1,
totalSold: 0,
// 成本系统
costPrice: 1.5, // 模拟器成本价(每个)
// 无尽模式
endlessMode: false,
contractSigned: false, // 是否与生产基地签约
contractDay: 0, // 签约天数
nextDeliveryDay: 0, // 下次送达天数
stockoutDays: 0, // 缺货天数累计
todayPurchase: 0, // 今日已授权数量
// 销售相关
currentPrice: 3,
promotions: {
bogo: false, // 买一送一
discount: false, // 限时折扣
bundle: false // 捆绑销售
},
// 营销效果
activeMarketing: [],
// 店铺
ownedShops: [],
// 赛事
completedEvents: [],
// 天气
weather: 'sunny',
// 特殊状态
specialEffects: {
qualityLabel: false, // 优质模拟器标签
newRecipe: false, // 新菜品解锁
competitorDebuff: 0 // 对拍模拟器贩子发起负面宣传剩余天数
},
// 今日销售数据(改为支持多次销售)
todaySales: {
session1: { quantity: 0, revenue: 0, hasSold: false },
session2: { quantity: 0, revenue: 0, hasSold: false },
currentSession: 0 // 当前是第几次销售(0=未开始, 1=第一次, 2=第二次)
},
// 销售倒计时
salesTimer: {
isWaiting: false,
timeLeft: 0,
timerId: null
},
// 游戏状态
isGameOver: false,
gameWon: false,
// 兑换码系统
codeRedeemed: false, // 是否已兑换过代码
// 升级系统
restaurantLevel: 0, // 0=普通, 1=餐馆, 2=工厂, 3=实验室
canUpgradeToRestaurant: false, // 是否可以升级为餐馆(售卖15天后)
cannedProduction: {
enabled: false, // 是否启用产品包生产
dailyInput: 1000, // 每日投入模拟器数量
simulatorsPerCan: 1, // 每个产品包的模拟器数量(0.1-10)
pricePerCan: 5 // 每个产品包售价
},
// 实验室系统
labProduction: {
enabled: false, // 是否启用实验室
experimentAmount: 1000, // 每次实验投入模拟器数(1000-100000,步长1000)
cultureAmount: 1000, // 批量复制数量(1000-100000,步长1000)
experimentLevel: 0, // 实验等级(影响销量提升)
lastCultureDay: 0 // 上次使用批量复制的天数
},
// 研究点系统
techPoints: 0, // 研究点数总数
researchUpgrades: [], // 已购买的升级 ID 列表
// 模拟器学术研究院系统
academy: {
unlocked: false, // 是否已解锁学术研究院
divinePoints: 0, // 学术积分数量
sacrificeAmount: 10000, // 每次投入模拟器作学术样本数量(10000-1000000,步长10000)
salesBonus: 0 // 永久销量加成
},
// 股票市场系统
stockMarket: {
unlocked: false, // 是否已解锁股票市场
totalAssets: 0, // 股票总资产
todayProfit: 0, // 今日收益
holdings: {}, // 持股信息 {companyId: quantity}
selectedStock: null // 当前选中的股票ID
},
// 自定义比赛系统
customEvent: null, // 当前进行中的自定义比赛
// 成就系统
achievements: {
unlocked: [], // 已解锁的成就ID列表
lastCheckDay: 0 // 上次检查成就的天数
},
// 收集要素系统
collections: {
letters: [], // 特殊客户信件
trophies: [], // 比赛奖杯
souvenirs: [] // 限时活动纪念品
},
// 皮肤/主题系统
currentSkin: 'default', // 当前使用的皮肤
unlockedSkins: ['default'], // 已解锁的皮肤列表
// 客户系统
customers: {
relationships: {}, // 客户关系 {customerType: level}
todaySpecialCustomer: null, // 今日特殊客户
wordOfMouthBonus: 0 // 口碑传播带来的销量加成
},
// 社区论坛系统
community: null // 在initCommunityForum中初始化
};
// ==================== 配置常量 ====================
const CONFIG = {
MAX_DAYS: 90,
TARGET_SALES: 1000000,
INITIAL_INVENTORY: 1000000,
INITIAL_MONEY: 5000,
INITIAL_REPUTATION: 50,
// 无尽模式配置
CONTRACT_DELIVERY: 100000, // 每7天送达模拟器数量
CONTRACT_INTERVAL: 7, // 合约周期(天)
CONTRACT_COST: 50000, // 签约费用
WHOLESALE_PRICE: 10, // 无尽模式批发价/个
WHOLESALE_MAX_DAILY: 100000, // 每天最多授权数量
STOCKOUT_LIMIT: 2, // 连续缺货天数上限
BANKRUPTCY_LIMIT: -100000, // 资金链断裂阈值
// 升级系统配置
RESTAURANT_UPGRADE_COST: 1000000, // 升级为餐馆的费用
RESTAURANT_UPGRADE_DAY: 15, // 售卖15天后可升级
RESTAURANT_COST_PRICE: 10, // 餐馆成本价
RESTAURANT_MAX_PRICE: 100, // 餐馆最高定价
FACTORY_UPGRADE_COST: 9000000, // 升级为模拟器研发中心的费用(降低10%)
CANNED_MIN_CABBAGES: 0.1, // 产品包最少模拟器数量
CANNED_MAX_CABBAGES: 10, // 产品包最多模拟器数量
// 实验室配置
LAB_UPGRADE_COST: 50000000, // 升级为高等模拟器实验室的费用(降低至50%)
LAB_EXPERIMENT_MAX: 100000, // 实验投入模拟器上限
LAB_EXPERIMENT_STEP: 1000, // 实验滑块步长
LAB_CULTURE_MAX: 100000, // 批量复制上限
LAB_CULTURE_STEP: 1000, // 批量复制滑块步长
// 价格配置
MIN_PRICE: 2,
MAX_PRICE: 15,
BASE_PRICE: 3,
COST_PRICE: 1.5, // 成本价
SALES_SESSIONS_PER_DAY: 2, // 每天销售次数
SALES_WAIT_TIME: 5, // 销售等待时间(秒)
// 营销配置(所有加成缩减到原来的10%)
MARKETING_OPTIONS: {
// 基础营销(立即可用)
flyer: { cost: 200, salesBonus: 0.015, reputationBonus: 0, duration: 3, name: '私信推广', unlockDay: 0, icon: '📄' },
social: { cost: 500, salesBonus: 0.03, reputationBonus: 0.5, duration: 5, name: '算法群群发', unlockDay: 0, icon: '📱' },
radio: { cost: 1000, salesBonus: 0.05, reputationBonus: 1, duration: 7, name: '技术周刊', unlockDay: 0, icon: '📻' },
tv: { cost: 3000, salesBonus: 0.1, reputationBonus: 2, duration: 10, name: '热门博客', unlockDay: 0, icon: '📺' },
// 高级营销(每5天解锁1个)
newspaper: { cost: 1500, salesBonus: 0.06, reputationBonus: 1.5, duration: 8, name: '题解平台', unlockDay: 5, icon: '📰' },
billboard: { cost: 2500, salesBonus: 0.08, reputationBonus: 1.2, duration: 12, name: '线上冬令营展位', unlockDay: 10, icon: '🪧' },
influencer: { cost: 4000, salesBonus: 0.12, reputationBonus: 3, duration: 6, name: '开箱测评', unlockDay: 15, icon: '⭐' },
livestream: { cost: 5000, salesBonus: 0.15, reputationBonus: 2.5, duration: 5, name: '模拟器技术直播', unlockDay: 20, icon: '🎥' },
festival: { cost: 8000, salesBonus: 0.2, reputationBonus: 5, duration: 15, name: '算法嘉年华', unlockDay: 25, icon: '🎉' },
celebrity: { cost: 15000, salesBonus: 0.25, reputationBonus: 8, duration: 20, name: '国家队选手力荐', unlockDay: 30, icon: '🌟' },
documentary: { cost: 25000, salesBonus: 0.3, reputationBonus: 10, duration: 30, name: '《模拟器的诞生》纪录短片', unlockDay: 35, icon: '🎬' },
international: { cost: 50000, salesBonus: 0.4, reputationBonus: 15, duration: 45, name: '国际信奥合作', unlockDay: 40, icon: '🌍' }
},
// 店铺配置
SHOPS: [
{ id: 'stall', name: '个人技术博客售卖', icon: '🏪', unlockAt: 5000, cost: 1000, dailyCost: 50, salesBonus: 0.30, baseSales: 100 },
{ id: 'market', name: '模拟器技术小店', icon: '🏬', unlockAt: 15000, cost: 3000, dailyCost: 150, salesBonus: 0.60, baseSales: 200, wholesaleBonus: 0.10 },
{ id: 'community', name: '模拟器实操教学直播', icon: '🏠', unlockAt: 30000, cost: 8000, dailyCost: 300, salesBonus: 1.0, baseSales: 300 },
{ id: 'supermarket', name: '竞赛团队批量授权', icon: '🛒', unlockAt: 60000, cost: 15000, dailyCost: 500, salesBonus: 1.50, baseSales: 500 },
{ id: 'online', name: '模拟器网上商城', icon: '💻', unlockAt: 80000, cost: 10000, dailyCost: 200, salesBonus: 0.80, baseSales: 250, weatherImmune: true }
],
// 赛事配置
EVENTS: {
15: { type: 'quality', name: '模拟器性能赛', icon: '🏆', cost: 800 },
30: { type: 'cooking', name: '模拟器扩展功能创意赛', icon: '👨🍳', cost: 1200 },
45: { type: 'quality', name: '模拟器性能赛', icon: '🏆', cost: 800 },
60: { type: 'cooking', name: '模拟器扩展功能创意赛', icon: '👨🍳', cost: 1200 },
75: { type: 'championship', name: '省级模拟器设计赛', icon: '🥈', cost: 2000 },
90: { type: 'final', name: '全国模拟器设计大赛', icon: '👑', cost: 0 }
},
// 天气配置
WEATHER: {
sunny: { name: '学术热点期', icon: '☀️', salesMultiplier: 1.0 },
cloudy: { name: '社区讨论期', icon: '⛅', salesMultiplier: 0.9 },
rainy: { name: '竞品冲击', icon: '🌧️', salesMultiplier: 0.7 },
stormy: { name: '学术风波', icon: '⛈️', salesMultiplier: 0.4 },
snowy: { name: '社区低活跃', icon: '❄️', salesMultiplier: 0.6 }
},
// 客户类型配置
CUSTOMERS: {
normal: { probability: 0.60, icon: '👤', name: '普通选手', minDemand: 1, maxDemand: 5 },
restaurant: { probability: 0.20, icon: '🍽️', name: '教练团队', minDemand: 50, maxDemand: 200 },
wholesaler: { probability: 0.10, icon: '🚚', name: '学校竞赛组', minDemand: 500, maxDemand: 2000 },
blogger: { probability: 0.05, icon: '📸', name: '技术测评博主', minDemand: 10, maxDemand: 30 },
competitor: { probability: 0.05, icon: '😈', name: '对拍模拟器贩子', minDemand: 0, maxDemand: 0 }
},
// 股票市场配置
STOCK_COMPANIES: [
{ id: 'oi_restart', name: 'OI重开模拟器', icon: '🔄', basePrice: 100, price: 100, history: [], changePercent: 0, link: 'https://www.luogu.com.cn/article/9d4wr427' },
{ id: 'oi_coach', name: 'OI教练模拟器', icon: '👨🏫', basePrice: 150, price: 150, history: [], changePercent: 0, link: 'https://www.luogu.com.cn/article/1s9wdoal' },
{ id: 'oi_association', name: 'OI 协会模拟器', icon: '🏛️', basePrice: 200, price: 200, history: [], changePercent: 0, link: 'https://www.luogu.com.cn/article/w9cahexa' },
{ id: 'oj_operation', name: 'OJ 运维模拟器', icon: '⚙️', basePrice: 180, price: 180, history: [], changePercent: 0, link: 'https://www.luogu.com.cn/article/dcqcee1r' },
{ id: 'whk_teacher', name: 'whk 班主任模拟器', icon: '👔', basePrice: 250, price: 250, history: [], changePercent: 0, link: 'https://www.luogu.com.cn/article/44li54py' },
{ id: 'bj8z', name: '北京八中模拟器', icon: '🏫', basePrice: 300, price: 300, history: [], changePercent: 0, link: 'https://www.luogu.com.cn/article/7xmewwtx' }
],
STOCK_UNLOCK_COST: 100000, // 解锁股票市场费用(10万)
STOCK_LIMIT_UP: 0.10, // 涨停幅度 10%
STOCK_LIMIT_DOWN: -0.10, // 跌停幅度 -10%
// 研究升级配置 (35项)
RESEARCH_UPGRADES: [
// 第 1-10 项:销量加成类
{ id: 'sales_boost_1', name: '营销技巧 I', description: '销量 +5%', cost: 1, effect: { type: 'sales_multiplier', value: 0.05 } },
{ id: 'sales_boost_2', name: '营销技巧 II', description: '销量 +8%', cost: 3, effect: { type: 'sales_multiplier', value: 0.08 } },
{ id: 'sales_boost_3', name: '营销技巧 III', description: '销量 +12%', cost: 6, effect: { type: 'sales_multiplier', value: 0.12 } },
{ id: 'sales_boost_4', name: '品牌效应 I', description: '销量 +15%', cost: 10, effect: { type: 'sales_multiplier', value: 0.15 } },
{ id: 'sales_boost_5', name: '品牌效应 II', description: '销量 +20%', cost: 15, effect: { type: 'sales_multiplier', value: 0.20 } },
{ id: 'sales_boost_6', name: '客户忠诚 I', description: '销量 +25%', cost: 22, effect: { type: 'sales_multiplier', value: 0.25 } },
{ id: 'sales_boost_7', name: '客户忠诚 II', description: '销量 +30%', cost: 30, effect: { type: 'sales_multiplier', value: 0.30 } },
{ id: 'sales_boost_8', name: '市场扩张 I', description: '销量 +35%', cost: 40, effect: { type: 'sales_multiplier', value: 0.35 } },
{ id: 'sales_boost_9', name: '市场扩张 II', description: '销量 +40%', cost: 50, effect: { type: 'sales_multiplier', value: 0.40 } },
{ id: 'sales_boost_10', name: '全球知名', description: '销量 +50%', cost: 65, effect: { type: 'sales_multiplier', value: 0.50 } },
// 第 11-18 项:模拟器获取翻倍类
{ id: 'weekly_simulator_1', name: '信息补贴 I', description: '每周免费模拟器 ×1.5', cost: 5, effect: { type: 'weekly_simulator_multiplier', value: 1.5 } },
{ id: 'weekly_simulator_2', name: '信息补贴 II', description: '每周免费模拟器 ×2', cost: 12, effect: { type: 'weekly_simulator_multiplier', value: 2.0 } },
{ id: 'weekly_simulator_3', name: '算法合作 I', description: '每周免费模拟器 ×2.5', cost: 20, effect: { type: 'weekly_simulator_multiplier', value: 2.5 } },
{ id: 'weekly_simulator_4', name: '算法合作 II', description: '每周免费模拟器 ×3', cost: 30, effect: { type: 'weekly_simulator_multiplier', value: 3.0 } },
{ id: 'weekly_simulator_5', name: '算法优化 I', description: '每周免费模拟器 ×4', cost: 45, effect: { type: 'weekly_simulator_multiplier', value: 4.0 } },
{ id: 'weekly_simulator_6', name: '算法优化 II', description: '每周免费模拟器 ×5', cost: 60, effect: { type: 'weekly_simulator_multiplier', value: 5.0 } },
{ id: 'weekly_simulator_7', name: '层级架构', description: '每周免费模拟器 ×6', cost: 80, effect: { type: 'weekly_simulator_multiplier', value: 6.0 } },
{ id: 'weekly_simulator_8', name: '云端部署', description: '每周免费模拟器 ×8', cost: 100, effect: { type: 'weekly_simulator_multiplier', value: 8.0 } },
// 第 19-26 项:实验室效率类
{ id: 'lab_efficiency_1', name: '实验加速 I', description: '技术研究成本 -10%', cost: 8, effect: { type: 'experiment_cost_reduction', value: 0.10 } },
{ id: 'lab_efficiency_2', name: '实验加速 II', description: '技术研究成本 -20%', cost: 18, effect: { type: 'experiment_cost_reduction', value: 0.20 } },
{ id: 'lab_efficiency_3', name: '批量复制 I', description: '批量复制冷却时间 -2 天', cost: 25, effect: { type: 'culture_cooldown_reduction', value: 2 } },
{ id: 'lab_efficiency_4', name: '批量复制 II', description: '批量复制冷却时间 -4 天', cost: 40, effect: { type: 'culture_cooldown_reduction', value: 4 } },
{ id: 'lab_efficiency_5', name: '复制技术 I', description: '批量复制产量 +50%', cost: 55, effect: { type: 'culture_yield_bonus', value: 0.50 } },
{ id: 'lab_efficiency_6', name: '复制技术 II', description: '批量复制产量 +100%', cost: 75, effect: { type: 'culture_yield_bonus', value: 1.0 } },
{ id: 'lab_efficiency_7', name: '自动化实验', description: '实验等级获取 ×2', cost: 90, effect: { type: 'experiment_level_multiplier', value: 2.0 } },
{ id: 'lab_efficiency_8', name: '量子计算', description: '所有实验室效果 +25%', cost: 110, effect: { type: 'lab_global_bonus', value: 0.25 } },
// 第 27-35 项:其他效果类
{ id: 'passive_sales_1', name: '自动出售 I', description: '被动销售频率 +20%', cost: 15, effect: { type: 'passive_sales_frequency', value: 0.20 } },
{ id: 'passive_sales_2', name: '自动出售 II', description: '被动销售频率 +40%', cost: 35, effect: { type: 'passive_sales_frequency', value: 0.40 } },
{ id: 'marketing_boost_1', name: '广告优化 I', description: '营销效果 +15%', cost: 20, effect: { type: 'marketing_effectiveness', value: 0.15 } },
{ id: 'marketing_boost_2', name: '广告优化 II', description: '营销效果 +30%', cost: 45, effect: { type: 'marketing_effectiveness', value: 0.30 } },
{ id: 'price_premium_1', name: '奢侈品定位', description: '可定价上限 +¥20', cost: 50, effect: { type: 'max_price_increase', value: 20 } },
{ id: 'reputation_boost', name: '声誉加速器', description: '声誉获取 +50%', cost: 60, effect: { type: 'reputation_gain', value: 0.50 } },
{ id: 'cost_reduction', name: '供应链优化', description: '成本价 -¥2', cost: 70, effect: { type: 'cost_price_reduction', value: 2 } },
{ id: 'shop_bonus', name: '连锁经营', description: '店铺收益 +30%', cost: 85, effect: { type: 'shop_revenue_bonus', value: 0.30 } },
{ id: 'ultimate_tech', name: '终极科技', description: '所有效果 +10%', cost: 120, effect: { type: 'global_bonus', value: 0.10 } }
],
// 学术研究院配置
ACADEMY_UNLOCK_COST: 2000000000, // 模拟器学术研究院解锁费用(降低至20%)
ACADEMY_SACRIFICE_MIN: 10000, // 最小供奉数量
ACADEMY_SACRIFICE_MAX: 1000000, // 最大供奉数量
ACADEMY_SACRIFICE_STEP: 10000, // 供奉步长
// 无尽模式赛事配置(每75天一个周期)
ENDLESS_EVENTS: [
{ day: 105, type: 'quality', name: '模拟器性能赛', icon: '🏆', cost: 800 },
{ day: 120, type: 'cooking', name: '模拟器扩展功能创意赛', icon: '👨🍳', cost: 1200 },
{ day: 135, type: 'quality', name: '模拟器性能赛', icon: '🏆', cost: 800 },
{ day: 150, type: 'cooking', name: '模拟器扩展功能创意赛', icon: '👨🍳', cost: 1200 },
{ day: 165, type: 'championship', name: '省级模拟器设计赛', icon: '🥈', cost: 2000 },
{ day: 180, type: 'final', name: '全国模拟器设计大赛', icon: '👑', cost: 0 }
],
// 成就系统配置
ACHIEVEMENTS: [
// 销售类成就
{ id: 'first_sale', name: '初入模拟', description: '完成第一次销售', icon: '💰', condition: (gs) => gs.totalSold > 0 },
{ id: 'sell_1000', name: '小有名气', description: '累计授权1000个模拟器', icon: '📦', condition: (gs) => gs.totalSold >= 1000 },
{ id: 'sell_10000', name: '供不应求', description: '累计授权10000个模拟器', icon: '📈', condition: (gs) => gs.totalSold >= 10000 },
{ id: 'sell_100000', name: '产业巨头', description: '累计授权100000个模拟器', icon: '👑', condition: (gs) => gs.totalSold >= 100000 },
{ id: 'sell_1m', name: '模拟传奇', description: '累计授权1000000个模拟器', icon: '⭐', condition: (gs) => gs.totalSold >= 1000000 },
// 库存类成就
{ id: 'stock_10000', name: '小仓库', description: '库存达到10000个', icon: '🏪', condition: (gs) => gs.inventory >= 10000 },
{ id: 'stock_100000', name: '大仓库', description: '库存达到100000个', icon: '🏭', condition: (gs) => gs.inventory >= 100000 },
{ id: 'stock_1m', name: '仓鼠型研究者', description: '库存达到1000000个', icon: '📦', condition: (gs) => gs.inventory >= 1000000 },
// 资金类成就
{ id: 'money_10000', name: '万元户', description: '拥有10000元资金', icon: '💵', condition: (gs) => gs.money >= 10000 },
{ id: 'money_100000', name: '风投青睐', description: '拥有100000元资金', icon: '💰', condition: (gs) => gs.money >= 100000 },
{ id: 'money_1m', name: '资本雄厚', description: '拥有1000000元资金', icon: '💎', condition: (gs) => gs.money >= 1000000 },
{ id: 'money_10m', name: '研究可期', description: '拥有10000000元资金', icon: '👑', condition: (gs) => gs.money >= 10000000 },
// 店铺类成就
{ id: 'shop_1', name: '生态初成', description: '解锁第一个店铺', icon: '🏬', condition: (gs) => gs.ownedShops.length >= 1 },
{ id: 'shop_all', name: '模拟器学术王国', description: '解锁全部店铺', icon: '🌟', condition: (gs) => gs.ownedShops.length >= SHOP_TYPES.length },
// 特殊成就
{ id: 'double_sellout', name: '供不应求', description: '一天内两次售罄', icon: '🔥', condition: (gs) => gs.todaySales.session1.hasSold && gs.todaySales.session2.hasSold && gs.day > 1 },
{ id: 'endless_mode', name: '永无止境', description: '进入无尽模式', icon: '♾️', condition: (gs) => gs.endlessMode },
{ id: 'academy_unlock', name: '学术研究院成立', description: '解锁模拟器学术研究院', icon: '🎓', condition: (gs) => gs.academy.unlocked },
{ id: 'lab_unlock', name: '科技前沿', description: '解锁高等模拟器实验室', icon: '🧪', condition: (gs) => gs.restaurantLevel >= 3 },
{ id: 'stock_market', name: '操盘手', description: '解锁股票市场', icon: '📊', condition: (gs) => gs.stockMarket.unlocked },
// 收集类成就
{ id: 'collect_5_letters', name: '通信达人', description: '收集5封特殊信件', icon: '✉️', condition: (gs) => gs.collections.letters.length >= 5 },
{ id: 'collect_5_trophies', name: '冠军收藏家', description: '获得5个比赛奖杯', icon: '🏆', condition: (gs) => gs.collections.trophies.length >= 5 },
{ id: 'collect_10_souvenirs', name: '纪念品专家', description: '收集10个活动纪念品', icon: '🎁', condition: (gs) => gs.collections.souvenirs.length >= 10 }
],
// 皮肤配置
SKINS: {
default: { name: '默认主题', description: '经典蓝色主题', unlockCondition: null, cssClass: '' },
academic: { name: '学术蓝主题', description: '经典学术配色,专注模拟器研发', unlockCondition: (gs) => gs.totalSold >= 20000, cssClass: 'theme-academic' },
dark: { name: '暗黑主题', description: '深邃的暗色界面', unlockCondition: (gs) => gs.money >= 1000000, cssClass: 'theme-dark' },
retro: { name: '复古主题', description: '怀旧复古风格', unlockCondition: (gs) => gs.totalSold >= 50000, cssClass: 'theme-retro' },
pixel: { name: '像素主题', description: '8位像素艺术风', unlockCondition: (gs) => gs.day >= 50, cssClass: 'theme-pixel' },
gold: { name: '黄金主题', description: '奢华金色外观', unlockCondition: (gs) => gs.money >= 10000000, cssClass: 'theme-gold' },
nature: { name: '自然主题', description: '清新绿色风格', unlockCondition: (gs) => gs.achievements.unlocked.length >= 10, cssClass: 'theme-nature' }
},
// 客户系统配置
CUSTOMER_TYPES: {
normal: {
id: 'normal',
name: '普通选手',
icon: '👤',
description: '日常购买模拟器进行算法训练的学生,需求稳定。',
basePurchaseMin: 50,
basePurchaseMax: 500,
priceSensitivity: 1.0,
relationshipBonus: 0.05
},
blogger: {
id: 'blogger',
name: '技术测评博主',
icon: '📹',
description: '购买后会发布详尽测评,可能带来大量关注或引发争议。',
basePurchaseMin: 20,
basePurchaseMax: 200,
positiveReviewChance: 0.6, // 60%概率正面评价
heatBonus: 15, // 正面评价增加15热度
heatPenalty: -10, // 负面评价减少10热度
reputationBonus: 10, // 正面评价增加10声誉
relationshipBonus: 0.15
},
distributor: {
id: 'distributor',
name: '学校竞赛组',
icon: '🚚',
description: '以学校为单位大宗采购,但会要求可观折扣。',
basePurchaseMin: 1000,
basePurchaseMax: 5000,
priceDiscount: 0.2, // 要求20%折扣
relationshipBonus: 0.12
},
student: {
id: 'student',
name: '学生群体',
icon: '🎓',
description: '单次购买少,但概率触发"口碑传播",增加次日基础销量。',
basePurchaseMin: 10,
basePurchaseMax: 100,
priceSensitivity: 1.5, // 对价格敏感
wordOfMouthChance: 0.3, // 30%概率触发口碑传播
wordOfMouthBonus: 1.2, // 口碑传播带来20%销量提升
relationshipBonus: 0.1 // 每次交易增加0.1关系值
},
government: {
id: 'government',
name: '省级竞赛组委会',
icon: '🏛️',
description: '为省选采购大量模拟器,预算严格压价极低,但完成后学术声望大幅提升。',
basePurchaseMin: 5000,
basePurchaseMax: 20000,
priceDiscount: 0.4, // 要求40%折扣
reputationBonus: 20, // 完成后声誉+20
relationshipBonus: 0.2 // 每次交易增加0.2关系值
},
hacker: {
id: 'hacker',
name: '黑客',
icon: '💻',
description: '可能窃取库存,也可能高价购买并留下技术',
stealChance: 0.3, // 30%概率窃取库存
stealAmount: 0.1, // 窃取10%库存
highPriceChance: 0.4, // 40%概率高价购买
highPriceMultiplier: 2.0, // 高价是原价的2倍
techGiftChance: 0.3, // 30%概率留下技术
relationshipBonus: 0.05 // 每次交易增加0.05关系值
}
},
// 客户出现概率配置
CUSTOMER_PROBABILITIES: {
normal: 0.50, // 普通客户 50%
blogger: 0.10, // 博主 10%
distributor: 0.15, // 经销商 15%
student: 0.08, // 学生 8%
government: 0.07, // 政府 7%
hacker: 0.10 // 黑客 10%
},
// 客户关系等级配置
RELATIONSHIP_LEVELS: [
{ level: 0, name: '陌生人', minRelationship: 0, discount: 0, bonusOrderChance: 0 },
{ level: 1, name: '熟客', minRelationship: 1, discount: 0.02, bonusOrderChance: 0.1 },
{ level: 2, name: '好友', minRelationship: 3, discount: 0.05, bonusOrderChance: 0.2 },
{ level: 3, name: 'VIP', minRelationship: 6, discount: 0.08, bonusOrderChance: 0.3 },
{ level: 4, name: '合作伙伴', minRelationship: 10, discount: 0.12, bonusOrderChance: 0.4 },
{ level: 5, name: '战略伙伴', minRelationship: 15, discount: 0.15, bonusOrderChance: 0.5 }
]
};
// ==================== 工具函数 ====================
function formatNumber(num) {
return num.toLocaleString('zh-CN');
}
function formatMoney(amount) {
return '¥' + formatNumber(amount);
}
function randomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function randomFloat(min, max) {
return Math.random() * (max - min) + min;
}
function clamp(value, min, max) {
return Math.min(Math.max(value, min), max);
}
// ==================== 日志系统 ====================
function addLog(message, type = 'neutral') {
const logEntries = document.getElementById('log-entries');
const entry = document.createElement('div');
entry.className = `log-entry ${type}`;
entry.textContent = `第${GameState.day}天: ${message}`;
logEntries.insertBefore(entry, logEntries.firstChild);
// 只保留最近10条日志
while (logEntries.children.length > 10) {
logEntries.removeChild(logEntries.lastChild);
}
}
// ==================== UI更新函数 ====================
function updateUI() {
// 更新头部信息
document.getElementById('current-day').textContent = GameState.day;
document.getElementById('sold-count').textContent = formatNumber(GameState.totalSold);
// 更新无尽模式显示
const daysLimit = document.getElementById('days-limit');
const endlessBadge = document.getElementById('endless-badge');
if (GameState.endlessMode) {
daysLimit.textContent = '';
endlessBadge.style.display = 'inline';
} else {
daysLimit.textContent = '/ 90';
endlessBadge.style.display = 'none';
}
// 更新进度条
const progressPercent = GameState.endlessMode ? 100 : (GameState.totalSold / CONFIG.TARGET_SALES) * 100;
const progressBar = document.getElementById('sales-progress');
progressBar.style.width = `${progressPercent}%`;
// 根据完成度改变进度条颜色
progressBar.classList.remove('low', 'medium', 'high');
if (progressPercent < 33) {
progressBar.classList.add('low');
} else if (progressPercent < 66) {
progressBar.classList.add('medium');
} else {
progressBar.classList.add('high');
}
// 更新状态面板
document.getElementById('inventory').textContent = formatNumber(GameState.inventory);
document.getElementById('money').textContent = formatMoney(GameState.money);
// 更新成本价显示(定价区域)
const costPriceDisplay = document.getElementById('cost-price-display');
if (costPriceDisplay) {
costPriceDisplay.textContent = GameState.costPrice;
}
document.getElementById('reputation').textContent = `${GameState.reputation}/100`;
// 更新声誉条
document.getElementById('reputation-fill').style.width = `${GameState.reputation}%`;
// 库存警告
const inventoryEl = document.getElementById('inventory');
inventoryEl.classList.remove('warning', 'error');
if (GameState.inventory < 10000) {
inventoryEl.classList.add('error');
} else if (GameState.inventory < 30000) {
inventoryEl.classList.add('warning');
}
// 更新天气
const weatherConfig = CONFIG.WEATHER[GameState.weather];
document.getElementById('weather-icon').textContent = weatherConfig.icon;
document.getElementById('weather').textContent = weatherConfig.name;
// 更新预估销量
updateEstimatedSales();
// 更新活跃效果
updateActiveEffects();
// 更新店铺列表
updateShopsList();
// 更新赛事日历
updateEventCalendar();
// 检查并显示当前赛事
checkCurrentEvent();
// 更新手动赛事区域显示(无尽模式且超过90天)
const hostEventSection = document.getElementById('host-event-section');
if (hostEventSection) {
const shouldShow = GameState.endlessMode && GameState.day > 90;
hostEventSection.style.display = shouldShow ? 'block' : 'none';
}
// 更新无尽模式批发标签
const wholesaleTabBtn = document.getElementById('wholesale-tab-btn');
if (wholesaleTabBtn) {
wholesaleTabBtn.style.display = GameState.endlessMode ? 'block' : 'none';
}
// 更新批发信息
if (GameState.endlessMode) {
const remaining = CONFIG.WHOLESALE_MAX_DAILY - GameState.todayPurchase;
const wholesaleRemaining = document.getElementById('wholesale-remaining');
const wholesaleTodayPurchase = document.getElementById('wholesale-today-purchase');
const stockoutDaysDisplay = document.getElementById('stockout-days-display');
const stockoutLimitDisplay = document.getElementById('stockout-limit-display');
if (wholesaleRemaining) wholesaleRemaining.textContent = formatNumber(Math.max(0, remaining)) + ' 个';
if (wholesaleTodayPurchase) wholesaleTodayPurchase.textContent = formatNumber(GameState.todayPurchase) + ' 个';
if (stockoutDaysDisplay) stockoutDaysDisplay.textContent = GameState.stockoutDays + ' 天';
if (stockoutLimitDisplay) stockoutLimitDisplay.textContent = CONFIG.STOCKOUT_LIMIT + ' 天';
}
// 更新升级系统显示
updateUpgradeSystem();
// 更新赛事倒计时
updateEventCountdown();
// 更新自定义比赛状态显示
updateCustomEventDisplay();
// 更新学术研究院UI(如果已解锁)
if (GameState.academy && GameState.academy.unlocked) {
updateAcademyUI();
}
// 同步所有文本与真实值
syncAllText();
// 更新营销选项显示
updateMarketingOptions();
// 如果股票市场已解锁,渲染股票市场页面
if (GameState.stockMarket.unlocked) {
renderStockMarket();
}
// 初始化工厂和实验室显示
if (GameState.restaurantLevel >= 2) {
updateCannedPreview();
}
if (GameState.restaurantLevel >= 3) {
updateExperimentAmount(1000);
updateCultureAmount(1000);
}
}
function updateEstimatedSales() {
if (GameState.todaySales.session1.hasSold && GameState.todaySales.session2.hasSold) {
document.getElementById('estimated-sales').textContent = '今日销售已完成';
return;
}
const estimated = calculateEstimatedSales();
const sessionNum = !GameState.todaySales.session1.hasSold ? 1 : 2;
document.getElementById('estimated-sales').textContent = `第${sessionNum}次预估: 约 ${formatNumber(estimated)} 个`;
}
// ==================== 同步所有文本与真实值 ====================
function syncAllText() {
console.log('syncAllText called, restaurantLevel:', GameState.restaurantLevel);
// 更新天数限制显示
const daysLimit = document.getElementById('days-limit');
if (daysLimit) {
if (GameState.endlessMode) {
daysLimit.textContent = '(无尽)';
} else {
daysLimit.textContent = `/ ${CONFIG.MAX_DAYS}`;
}
}
// 更新销售目标显示
const salesTarget = document.getElementById('sales-target');
if (salesTarget) {
salesTarget.textContent = formatNumber(CONFIG.TARGET_SALES);
}
// 更新价格滑块的最大值 - 设置为当前最高定价的110%
const priceSlider = document.getElementById('price-slider');
if (priceSlider) {
const maxPrice = GameState.restaurantLevel >= 1 ? CONFIG.RESTAURANT_MAX_PRICE : 15;
const sliderMax = Math.floor(maxPrice * 1.10);
// 同时使用setAttribute和property确保生效
priceSlider.setAttribute('max', sliderMax.toString());
priceSlider.max = sliderMax;
console.log('✅ Price slider updated:');
console.log(' - Base max price:', maxPrice);
console.log(' - Slider max (110%):', sliderMax);
console.log(' - Attribute max:', priceSlider.getAttribute('max'));
console.log(' - Property max:', priceSlider.max);
}
// 更新销售按钮文本
const salesBtn = document.getElementById('start-sales-btn');
if (salesBtn && !GameState.todaySales.session1.hasSold && !GameState.todaySales.session2.hasSold) {
salesBtn.textContent = `开始第${GameState.day}次销售`;
}
// 更新网页标题
document.title = `${GameState.gameTitle} - Simulator Simulator`;
}
function updateUpgradeSystem() {
const upgradeSection = document.getElementById('upgrade-section');
const restaurantUpgrade = document.getElementById('restaurant-upgrade');
const factoryUpgrade = document.getElementById('factory-upgrade');
const labUpgrade = document.getElementById('lab-upgrade');
const academyUnlock = document.getElementById('academy-unlock');
const stockMarketUnlock = document.getElementById('stock-market-unlock');
const cannedSection = document.getElementById('canned-production-section');
const labSection = document.getElementById('lab-production-section');
// 子标签按钮
const factorySubtabBtn = document.getElementById('factory-subtab-btn');
const labSubtabBtn = document.getElementById('lab-subtab-btn');
const researchUpgradesSubtabBtn = document.getElementById('research-upgrades-subtab-btn');
const academySubtabBtn = document.getElementById('academy-subtab-btn');
const stockMarketSubtabBtn = document.getElementById('stock-market-subtab-btn');
// 显示升级区域
if (GameState.endlessMode || GameState.restaurantLevel > 0) {
upgradeSection.style.display = 'block';
// 根据等级显示不同选项
if (GameState.restaurantLevel === 0 && GameState.canUpgradeToRestaurant) {
restaurantUpgrade.style.display = 'block';
factoryUpgrade.style.display = 'none';
labUpgrade.style.display = 'none';
academyUnlock.style.display = 'none';
} else if (GameState.restaurantLevel === 1) {
restaurantUpgrade.style.display = 'none';
factoryUpgrade.style.display = 'block';
labUpgrade.style.display = 'none';
academyUnlock.style.display = 'none';
// 如果已解锁餐馆且未解锁股票,显示股票市场解锁选项
if (stockMarketUnlock) {
stockMarketUnlock.style.display = !GameState.stockMarket.unlocked ? 'block' : 'none';
}
} else if (GameState.restaurantLevel === 2) {
restaurantUpgrade.style.display = 'none';
factoryUpgrade.style.display = 'none';
labUpgrade.style.display = 'block';
academyUnlock.style.display = 'none';
// 如果已解锁餐馆且未解锁股票,显示股票市场解锁选项
if (stockMarketUnlock) {
stockMarketUnlock.style.display = !GameState.stockMarket.unlocked ? 'block' : 'none';
}
} else if (GameState.restaurantLevel >= 3) {
restaurantUpgrade.style.display = 'none';
factoryUpgrade.style.display = 'none';
labUpgrade.style.display = 'none';
// 实验室等级>=3时,如果未解锁研究院则显示解锁选项
academyUnlock.style.display = GameState.academy.unlocked ? 'none' : 'block';
// 如果已解锁餐馆且未解锁股票,显示股票市场解锁选项
if (stockMarketUnlock) {
stockMarketUnlock.style.display = !GameState.stockMarket.unlocked ? 'block' : 'none';
}
}
} else {
upgradeSection.style.display = 'none';
}
// 显示/隐藏工厂子标签按钮(餐馆等级>=1时显示)
if (factorySubtabBtn) {
factorySubtabBtn.style.display = GameState.restaurantLevel >= 1 ? 'block' : 'none';
}
// 显示/隐藏实验室子标签按钮(餐馆等级>=2时显示)
if (labSubtabBtn) {
labSubtabBtn.style.display = GameState.restaurantLevel >= 2 ? 'block' : 'none';
}
// 显示/隐藏研究升级子标签按钮(实验室等级>=3时显示)
if (researchUpgradesSubtabBtn) {
researchUpgradesSubtabBtn.style.display = GameState.restaurantLevel >= 3 ? 'block' : 'none';
}
// 显示/隐藏研究院子标签按钮(研究院解锁后显示)
if (academySubtabBtn) {
const shouldShow = GameState.restaurantLevel >= 3 && GameState.academy.unlocked;
academySubtabBtn.style.display = shouldShow ? 'block' : 'none';
}
// 显示/隐藏股票市场子标签按钮(股票市场解锁后显示)
if (stockMarketSubtabBtn) {
stockMarketSubtabBtn.style.display = GameState.stockMarket.unlocked ? 'block' : 'none';
}
// 显示产品包生产控制
if (GameState.cannedProduction.enabled) {
cannedSection.style.display = 'block';
const cannedSlider = document.getElementById('canned-slider');
if (cannedSlider) {
cannedSlider.value = GameState.cannedProduction.simulatorsPerCan;
}
const cannedDisplay = document.getElementById('canned-simulators-display');
if (cannedDisplay) {
cannedDisplay.textContent = GameState.cannedProduction.simulatorsPerCan;
}
const dailyInputSlider = document.getElementById('daily-input-slider');
if (dailyInputSlider) {
dailyInputSlider.value = GameState.cannedProduction.dailyInput;
}
const dailyInputDisplay = document.getElementById('daily-input-display');
if (dailyInputDisplay) {
dailyInputDisplay.textContent = formatNumber(GameState.cannedProduction.dailyInput);
}
// 更新预计收益显示
updateCannedPreview();
} else {
cannedSection.style.display = 'none';
}
// 显示实验室生产控制
if (GameState.labProduction.enabled) {
labSection.style.display = 'block';
const experimentSlider = document.getElementById('experiment-slider');
if (experimentSlider) {
experimentSlider.value = GameState.labProduction.experimentAmount;
}
const experimentDisplay = document.getElementById('experiment-amount-display');
if (experimentDisplay) {
experimentDisplay.textContent = formatNumber(GameState.labProduction.experimentAmount);
}
// 显示实验等级和销量提升
const experimentLevelEl = document.getElementById('experiment-level-display');
if (experimentLevelEl) {
const level = GameState.labProduction.experimentLevel;
const bonus = (level / 1000 * 100).toFixed(1);
experimentLevelEl.textContent = `实验等级: ${formatNumber(level)} (销量+${bonus}%)`;
}
// 更新研究点数显示
const techPointsDisplay = document.getElementById('tech-points-display');
if (techPointsDisplay) {
techPointsDisplay.textContent = formatNumber(GameState.techPoints);
}
const upgradeTechPoints = document.getElementById('upgrade-tech-points');
if (upgradeTechPoints) {
upgradeTechPoints.textContent = formatNumber(GameState.techPoints);
}
const cultureSlider = document.getElementById('culture-slider');
if (cultureSlider) {
cultureSlider.value = GameState.labProduction.cultureAmount;
}
const cultureDisplay = document.getElementById('culture-amount-display');
if (cultureDisplay) {
cultureDisplay.textContent = formatNumber(GameState.labProduction.cultureAmount);
}
// 更新批量复制预计消耗和冷却状态
updateCultureAmount(GameState.labProduction.cultureAmount);
// 显示冷却状态
const cultureCooldownEl = document.getElementById('culture-cooldown-display');
if (cultureCooldownEl) {
const lastDay = GameState.labProduction.lastCultureDay;
// 获取升级效果
const bonuses = getUpgradeBonuses();
const cooldownReduction = bonuses.cultureCooldownReduction;
const actualCooldown = Math.max(1, 10 - cooldownReduction);
if (lastDay > 0) {
const daysSince = GameState.day - lastDay;
if (daysSince < actualCooldown) {
const remaining = actualCooldown - daysSince;
cultureCooldownEl.textContent = `🕒 冷却中: 还需 ${remaining} 天 (第${lastDay + actualCooldown}天可用)`;
cultureCooldownEl.style.color = 'var(--error)';
} else {
cultureCooldownEl.textContent = '✅ 已就绪: 可以使用';
cultureCooldownEl.style.color = 'var(--success)';
}
} else {
cultureCooldownEl.textContent = '✅ 未使用过: 可以立即使用';
cultureCooldownEl.style.color = 'var(--success)';
}
}
} else {
labSection.style.display = 'none';
}
// 更新价格滑块最大值(设置为最高定价的99%作为违法上限)
const priceSlider = document.getElementById('price-slider');
if (priceSlider) {
const maxPrice = GameState.restaurantLevel >= 1 ? CONFIG.RESTAURANT_MAX_PRICE : 15;
const illegalPriceThreshold = Math.floor(maxPrice * 0.99);
priceSlider.max = illegalPriceThreshold;
}
}
// ==================== 更新营销选项显示 ====================
function updateMarketingOptions() {
const marketingGrid = document.getElementById('marketing-grid');
if (!marketingGrid) return;
marketingGrid.innerHTML = '';
Object.entries(CONFIG.MARKETING_OPTIONS).forEach(([type, config]) => {
// 检查是否已解锁
const isUnlocked = GameState.day >= config.unlockDay;
const item = document.createElement('div');
item.className = 'marketing-item';
item.dataset.type = type;
if (!isUnlocked) {
item.classList.add('locked');
item.innerHTML = `
<div class="marketing-icon">🔒</div>
<h3>${config.name}</h3>
<p class="cost">第 ${config.unlockDay} 天解锁</p>
<p class="effect">敬请期待</p>
<button class="btn btn-secondary buy-ad-btn" disabled>未解锁</button>
`;
} else {
// 检查是否已有相同类型的广告
const existingEffect = GameState.activeMarketing.find(effect => effect.type === type);
item.innerHTML = `
<div class="marketing-icon">${config.icon}</div>
<h3>${config.name}</h3>
<p class="cost">成本: ¥${config.cost.toLocaleString()}</p>
<p class="effect">销量+${(config.salesBonus * 100).toFixed(0)}%, ${config.reputationBonus > 0 ? '声誉+' + config.reputationBonus + ', ' : ''}持续${config.duration}天</p>
<button class="btn btn-secondary buy-ad-btn" ${existingEffect ? 'disabled' : ''}>
${existingEffect ? `已购买 (剩余${existingEffect.daysLeft}天)` : '购买'}
</button>
`;
}
marketingGrid.appendChild(item);
});
// 重新绑定购买按钮事件
document.querySelectorAll('.buy-ad-btn').forEach(btn => {
if (!btn.disabled) {
btn.addEventListener('click', (e) => {
const itemType = e.target.closest('.marketing-item').dataset.type;
buyMarketing(itemType);
});
}
});
}
function updateActiveEffects() {
const effectsList = document.getElementById('effects-list');
effectsList.innerHTML = '';
// 无尽模式标识
if (GameState.endlessMode) {
const div = document.createElement('div');
div.className = 'effect-item';
div.textContent = '🌟 无尽模式中';
div.style.color = 'var(--secondary)';
div.style.fontWeight = 'bold';
effectsList.appendChild(div);
}
// 合约状态
if (GameState.contractSigned) {
const div = document.createElement('div');
div.className = 'effect-item';
div.textContent = `📋 生产基地合约 (下次送达: 第${GameState.nextDeliveryDay}天)`;
effectsList.appendChild(div);
}
// 显示营销效果
GameState.activeMarketing.forEach(effect => {
const config = CONFIG.MARKETING_OPTIONS[effect.type];
if (config) {
const div = document.createElement('div');
div.className = 'effect-item';
div.textContent = `${config.name} (剩余${effect.daysLeft}天)`;
effectsList.appendChild(div);
}
});
// 显示特殊效果
if (GameState.specialEffects.qualityLabel) {
const div = document.createElement('div');
div.className = 'effect-item';
div.textContent = '✨ 优质模拟器标签 (+¥1/个)';
effectsList.appendChild(div);
}
if (GameState.specialEffects.newRecipe) {
const div = document.createElement('div');
div.className = 'effect-item';
div.textContent = '🍲 新语言解锁 (销量+20%)';
effectsList.appendChild(div);
}
if (GameState.specialEffects.competitorDebuff > 0) {
const div = document.createElement('div');
div.className = 'effect-item';
div.textContent = `⚠️ 对拍模拟器贩子发起负面宣传 (剩余${GameState.specialEffects.competitorDebuff}天)`;
effectsList.appendChild(div);
}
}
function updateShopsList() {
const shopsList = document.getElementById('shops-list');
shopsList.innerHTML = '';
CONFIG.SHOPS.forEach(shop => {
const isOwned = GameState.ownedShops.includes(shop.id);