Skip to content

Commit 1f2e888

Browse files
authored
Merge pull request #40 from MengLeiFudge/test
添加深空来敌元驱动相关计算
2 parents 0cfb008 + c8367b1 commit 1f2e888

File tree

6 files changed

+36
-10
lines changed

6 files changed

+36
-10
lines changed

src/contexts.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ import {useSetState} from "ahooks";
88
/** set_game_name_and_data(game_name, game_data) */
99
export const GameInfoSetterContext = createContext(null);
1010
export const SchemeDataSetterContext = createContext(null);
11-
12-
/** set_settings(prop, value) */
11+
/** set_settings({prop: value}) */
1312
export const SettingsSetterContext = createContext(null);
14-
1513
export const GlobalStateContext = createContext(null);
1614
export const SettingsContext = createContext(null);
1715
export const GameInfoContext = createContext(null);
@@ -43,6 +41,7 @@ const DEFAULT_SETTINGS = {
4341
proliferate_itself: true,
4442
acc_rate: 1.0,
4543
inc_rate: 1.0,
44+
blue_buff: false,
4645

4746
mineralize_list: [],
4847
natural_production_line: []

src/global_state.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ export class GlobalState {
159159
continue;
160160
}
161161
var recipe_id = item_data[item][scheme_data.item_recipe_choices[item]];
162+
let recipe = game_data.recipe_data[recipe_id];
163+
if (game_data.TheyComeFromVoidEnable && settings.blue_buff && Object.keys(recipe["原料"]).length >= 2) {
164+
//大部分情况下不会出现循环配方,此处无视,直接赋值
165+
recipe["产物"][Object.keys(recipe["原料"])[0]] = Object.values(recipe["产物"])[0];
166+
}
162167
item_graph[item]["产出倍率"] = 1 * game_data.recipe_data[recipe_id]["产物"][item];
163168
var produce_rate = 1;//净产出一个目标产物时公式的执行次数,用于考虑增产等对原料消耗的影响
164169
var material_num = 0;

src/natural_production_line.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export function NplRows() {
9797
const npl = settings.natural_production_line;
9898

9999
function set_npl(new_npl) {
100-
set_settings("natural_production_line", new_npl);
100+
set_settings({"natural_production_line": new_npl});
101101
console.log("set_npl", new_npl);
102102
}
103103

src/needs_list.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export function NeedsList({needs_list, set_needs_list}) {
7171
"目标物品": item,
7272
"建筑数量": 10, "配方id": 1, "增产点数": 0, "增产模式": 0, "建筑": 0
7373
});
74-
set_settings("natural_production_line", new_npl);
74+
set_settings({"natural_production_line": new_npl});
7575
}
7676

7777
const is_min = global_state.settings.is_time_unit_minute;

src/result.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,23 +185,23 @@ export function Result({needs_list, set_needs_list}) {
185185
item_graph[item]["原料"] = {};
186186

187187
console.log("mineralize_list", new_mineralize_list);
188-
set_settings("mineralize_list", new_mineralize_list);
188+
set_settings({"mineralize_list": new_mineralize_list});
189189
}
190190

191191
function unmineralize(item) {
192192
let new_mineralize_list = structuredClone(mineralize_list);
193193
// editing item_graph!
194194
item_graph[item] = structuredClone(mineralize_list[item]);
195195
delete new_mineralize_list[item];
196-
set_settings("mineralize_list", new_mineralize_list);
196+
set_settings({"mineralize_list": new_mineralize_list});
197197
}
198198

199199
function clear_mineralize_list() {
200200
for (let item in mineralize_list) {
201201
// editing item_graph!
202202
item_graph[item] = structuredClone(mineralize_list[item]);
203203
}
204-
set_settings("mineralize_list", {});
204+
set_settings({"mineralize_list": {}});
205205
}
206206

207207
let mineralize_doms = Object.keys(mineralize_list).map(item => (

src/settings.jsx

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ export function Settings() {
66
const set_settings = useContext(SettingsSetterContext);
77
const DEFAULT_SETTINGS = useContext(DefaultSettingsContext);
88
const global_state = useContext(GlobalStateContext);
9-
let display = global_state.game_data.GenesisBookEnable ? "" : "none";
9+
let GenesisBookEnable = global_state.game_data.GenesisBookEnable ? "" : "none";
10+
let TheyComeFromVoidEnable = global_state.game_data.TheyComeFromVoidEnable ? "" : "none";
1011

1112
let fix_multiple = Math.pow(10, settings.fixed_num);
1213
let percent_val = {
@@ -90,7 +91,7 @@ export function Settings() {
9091
<td className="ps-2">{"/s(星球资源详情)"}</td>
9192
</tr>
9293
</tbody>
93-
<tbody style={{display: display}}>
94+
<tbody style={{display: GenesisBookEnable}}>
9495
<tr>
9596
<td>巨星氦面板</td>
9697
<td className="ps-2">
@@ -274,5 +275,26 @@ export function Settings() {
274275
</tr>
275276
</tbody>
276277
</table>
278+
<table style={{display: TheyComeFromVoidEnable}}>
279+
<tbody>
280+
<tr>
281+
<td colSpan={4}>【深空来敌元驱动】</td>
282+
</tr>
283+
<tr>
284+
<td colSpan={4}>注意:更改任意元驱动状态后,必须重新选择MOD!</td>
285+
</tr>
286+
<tr>
287+
<td colSpan={4}>PS:鼠标悬停在元驱动名称上以查看具体效果</td>
288+
</tr>
289+
<tr>
290+
<td title="制造厂在制造原材料至少2种的配方时,每产出1个产物,会返还1个第1位置的原材料">蓝Buff</td>
291+
<td className="ps-2">{settings.blue_buff ? "启用" : "禁用"}</td>
292+
<td className="ps-2">
293+
<button onClick={e => change_bool_setting(e, "blue_buff")}>
294+
{settings.blue_buff ? "改为禁用" : "改为启用"}</button>
295+
</td>
296+
</tr>
297+
</tbody>
298+
</table>
277299
</div>;
278300
}

0 commit comments

Comments
 (0)