Commit 96f67f7c authored by Chunchi Che's avatar Chunchi Che

update move service

parent 287d4894
Pipeline #20050 passed with stages
in 4 minutes and 55 seconds
...@@ -169,6 +169,7 @@ export const fetchOverlayMeta = createAsyncThunk( ...@@ -169,6 +169,7 @@ export const fetchOverlayMeta = createAsyncThunk(
controler: number; controler: number;
sequence: number; sequence: number;
overlayCodes: number[]; overlayCodes: number[];
append?: boolean;
}) => { }) => {
const controler = param.controler; const controler = param.controler;
const sequence = param.sequence; const sequence = param.sequence;
...@@ -221,6 +222,7 @@ export const monsterCase = (builder: ActionReducerMapBuilder<DuelState>) => { ...@@ -221,6 +222,7 @@ export const monsterCase = (builder: ActionReducerMapBuilder<DuelState>) => {
const controler = action.meta.arg.controler; const controler = action.meta.arg.controler;
const sequence = action.meta.arg.sequence; const sequence = action.meta.arg.sequence;
const overlayCodes = action.meta.arg.overlayCodes; const overlayCodes = action.meta.arg.overlayCodes;
const append = action.meta.arg.append;
const metas = overlayCodes.map((id) => { const metas = overlayCodes.map((id) => {
return { id, data: {}, text: {} }; return { id, data: {}, text: {} };
...@@ -231,7 +233,13 @@ export const monsterCase = (builder: ActionReducerMapBuilder<DuelState>) => { ...@@ -231,7 +233,13 @@ export const monsterCase = (builder: ActionReducerMapBuilder<DuelState>) => {
if (monsters) { if (monsters) {
const target = monsters.inner.find((_, idx) => idx == sequence); const target = monsters.inner.find((_, idx) => idx == sequence);
if (target && target.occupant) { if (target && target.occupant) {
target.overlay_materials = metas; if (append) {
target.overlay_materials = (target.overlay_materials || []).concat(
metas
);
} else {
target.overlay_materials = metas;
}
} }
} }
}); });
...@@ -245,8 +253,13 @@ export const monsterCase = (builder: ActionReducerMapBuilder<DuelState>) => { ...@@ -245,8 +253,13 @@ export const monsterCase = (builder: ActionReducerMapBuilder<DuelState>) => {
: state.opMonsters; : state.opMonsters;
if (monsters) { if (monsters) {
const target = monsters.inner.find((_, idx) => idx == sequence); const target = monsters.inner.find((_, idx) => idx == sequence);
if (target && target.occupant) { for (const meta of overlayMetas) {
target.overlay_materials = overlayMetas; for (const overlay of target?.overlay_materials || []) {
if (meta.id == overlay.id) {
overlay.data = meta.data;
overlay.text = meta.text;
}
}
} }
} }
}); });
......
...@@ -165,7 +165,21 @@ export default (move: MsgMove, dispatch: AppDispatch) => { ...@@ -165,7 +165,21 @@ export default (move: MsgMove, dispatch: AppDispatch) => {
break; break;
} }
case ygopro.CardZone.OVERLAY: { case ygopro.CardZone.OVERLAY: {
OVERLAY_STACK.push({ code, sequence: to.overlay_sequence }); if (to.sequence > 6) {
// 超量素材在进行超量召唤时,若玩家未选择超量怪兽的位置,会“沉到决斗盘下面”,这时候素材们的sequence会暂时大于6
// 这时候将它们放到一个栈中,待超量怪兽的Move消息到来时从栈中获取超量素材补充到状态中
OVERLAY_STACK.push({ code, sequence: to.overlay_sequence });
} else {
// 其他情况下,比如“宵星的机神 丁吉尔苏”的“补充超量素材”效果,直接更新状态中
dispatch(
fetchOverlayMeta({
controler: to.controler,
sequence: to.sequence,
overlayCodes: [code],
append: true,
})
);
}
break; break;
} }
......
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