Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加深空来敌元驱动相关计算 #40

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/contexts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ import {useSetState} from "ahooks";
/** set_game_name_and_data(game_name, game_data) */
export const GameInfoSetterContext = createContext(null);
export const SchemeDataSetterContext = createContext(null);

/** set_settings(prop, value) */
/** set_settings({prop: value}) */
export const SettingsSetterContext = createContext(null);

export const GlobalStateContext = createContext(null);
export const SettingsContext = createContext(null);
export const GameInfoContext = createContext(null);
Expand Down Expand Up @@ -43,6 +41,7 @@ const DEFAULT_SETTINGS = {
proliferate_itself: true,
acc_rate: 1.0,
inc_rate: 1.0,
blue_buff: false,

mineralize_list: [],
natural_production_line: []
Expand Down
5 changes: 5 additions & 0 deletions src/global_state.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ export class GlobalState {
continue;
}
var recipe_id = item_data[item][scheme_data.item_recipe_choices[item]];
let recipe = game_data.recipe_data[recipe_id];
if (game_data.TheyComeFromVoidEnable && settings.blue_buff && Object.keys(recipe["原料"]).length >= 2) {
//大部分情况下不会出现循环配方,此处无视,直接赋值
recipe["产物"][Object.keys(recipe["原料"])[0]] = Object.values(recipe["产物"])[0];
}
item_graph[item]["产出倍率"] = 1 * game_data.recipe_data[recipe_id]["产物"][item];
var produce_rate = 1;//净产出一个目标产物时公式的执行次数,用于考虑增产等对原料消耗的影响
var material_num = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/natural_production_line.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export function NplRows() {
const npl = settings.natural_production_line;

function set_npl(new_npl) {
set_settings("natural_production_line", new_npl);
set_settings({"natural_production_line": new_npl});
console.log("set_npl", new_npl);
}

Expand Down
2 changes: 1 addition & 1 deletion src/needs_list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function NeedsList({needs_list, set_needs_list}) {
"目标物品": item,
"建筑数量": 10, "配方id": 1, "增产点数": 0, "增产模式": 0, "建筑": 0
});
set_settings("natural_production_line", new_npl);
set_settings({"natural_production_line": new_npl});
}

const is_min = global_state.settings.is_time_unit_minute;
Expand Down
6 changes: 3 additions & 3 deletions src/result.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,23 +185,23 @@ export function Result({needs_list, set_needs_list}) {
item_graph[item]["原料"] = {};

console.log("mineralize_list", new_mineralize_list);
set_settings("mineralize_list", new_mineralize_list);
set_settings({"mineralize_list": new_mineralize_list});
}

function unmineralize(item) {
let new_mineralize_list = structuredClone(mineralize_list);
// editing item_graph!
item_graph[item] = structuredClone(mineralize_list[item]);
delete new_mineralize_list[item];
set_settings("mineralize_list", new_mineralize_list);
set_settings({"mineralize_list": new_mineralize_list});
}

function clear_mineralize_list() {
for (let item in mineralize_list) {
// editing item_graph!
item_graph[item] = structuredClone(mineralize_list[item]);
}
set_settings("mineralize_list", {});
set_settings({"mineralize_list": {}});
}

let mineralize_doms = Object.keys(mineralize_list).map(item => (
Expand Down
26 changes: 24 additions & 2 deletions src/settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export function Settings() {
const set_settings = useContext(SettingsSetterContext);
const DEFAULT_SETTINGS = useContext(DefaultSettingsContext);
const global_state = useContext(GlobalStateContext);
let display = global_state.game_data.GenesisBookEnable ? "" : "none";
let GenesisBookEnable = global_state.game_data.GenesisBookEnable ? "" : "none";
let TheyComeFromVoidEnable = global_state.game_data.TheyComeFromVoidEnable ? "" : "none";

let fix_multiple = Math.pow(10, settings.fixed_num);
let percent_val = {
Expand Down Expand Up @@ -90,7 +91,7 @@ export function Settings() {
<td className="ps-2">{"/s(星球资源详情)"}</td>
</tr>
</tbody>
<tbody style={{display: display}}>
<tbody style={{display: GenesisBookEnable}}>
<tr>
<td>巨星氦面板</td>
<td className="ps-2">
Expand Down Expand Up @@ -274,5 +275,26 @@ export function Settings() {
</tr>
</tbody>
</table>
<table style={{display: TheyComeFromVoidEnable}}>
<tbody>
<tr>
<td colSpan={4}>【深空来敌元驱动】</td>
</tr>
<tr>
<td colSpan={4}>注意:更改任意元驱动状态后,必须重新选择MOD!</td>
</tr>
<tr>
<td colSpan={4}>PS:鼠标悬停在元驱动名称上以查看具体效果</td>
</tr>
<tr>
<td title="制造厂在制造原材料至少2种的配方时,每产出1个产物,会返还1个第1位置的原材料">蓝Buff</td>
<td className="ps-2">{settings.blue_buff ? "启用" : "禁用"}</td>
<td className="ps-2">
<button onClick={e => change_bool_setting(e, "blue_buff")}>
{settings.blue_buff ? "改为禁用" : "改为启用"}</button>
</td>
</tr>
</tbody>
</table>
</div>;
}
Loading