Commit 0d08c12d authored by Chunchi Che's avatar Chunchi Che

save

parent 180cdfd5
Pipeline #20820 passed with stages
in 22 minutes and 50 seconds
import { Reducer } from "react";
import { ygopro } from "../../api/ocgcore/idl/ocgcore";
import {
clearIdleInteractivities,
......@@ -6,6 +7,7 @@ import {
updateCardData,
} from "./generic";
import { judgeSelf } from "./util";
import MsgReloadField = ygopro.StocGameMessage.MsgReloadField;
type MsgUpdateData = ReturnType<
typeof ygopro.StocGameMessage.MsgUpdateData.prototype.toObject
>;
......@@ -124,3 +126,12 @@ export const updateFieldDataImpl: DuelReducer<MsgUpdateData> = (
}
}
};
export const reloadFieldImpl: DuelReducer<MsgReloadField> = (state, action) => {
const _duel_rule = action.payload.duel_rule;
for (const reload of action.payload.actions) {
const player = reload.player;
// MZONE
}
};
......@@ -8,6 +8,7 @@ import { CardMeta } from "../../api/cards";
import { ygopro } from "../../api/ocgcore/idl/ocgcore";
import { fetchCard } from "../../api/cards";
import { DuelState } from "./mod";
import ReloadFieldAction = ygopro.StocGameMessage.MsgReloadField.ZoneAction;
type UpdateDataAction = ReturnType<
typeof ygopro.StocGameMessage.MsgUpdateData.Action.prototype.toObject
>;
......@@ -33,6 +34,7 @@ export interface CardState {
sequence: number;
}>; // 选择位置状态下的互动信息
overlay_materials?: CardMeta[]; // 超量素材
reload?: boolean; // 这个字段会在收到MSG_RELOAD_FIELD的时候设置成true,在收到MSG_UPDATE_DATE的时候设置成false
}
export enum InteractType {
......@@ -328,3 +330,24 @@ export function updateCardData<T extends DuelFieldState>(
}
}
}
export function reloadFieldMeta<T extends DuelFieldState>(
state: T,
actions: ReloadFieldAction[],
controler: number
) {
const cards = actions.map((action) => {
// FIXME: OVERLAY
return {
location: {
controler,
location: action.zone,
position: action.position,
},
idleInteractivities: [],
reload: true,
};
});
state.inner = cards;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment