Commit 287d4894 authored by Chunchi Che's avatar Chunchi Che

update move service

parent 69b4f458
Pipeline #20049 passed with stages
in 4 minutes and 24 seconds
......@@ -63,6 +63,7 @@ import {
clearMonsterIdleInteractivitiesImpl,
removeMonsterImpl,
setMonsterPositionImpl,
removeOverlayImpl,
monsterCase,
} from "./monstersSlice";
import {
......@@ -185,6 +186,7 @@ const duelSlice = createSlice({
clearMonsterIdleInteractivities: clearMonsterIdleInteractivitiesImpl,
setMonsterPosition: setMonsterPositionImpl,
removeMonster: removeMonsterImpl,
removeOverlay: removeOverlayImpl,
// 魔法陷阱区相关`Reducer`
initMagics: initMagicsImpl,
......@@ -285,6 +287,7 @@ export const {
clearMonsterIdleInteractivities,
setMonsterPosition,
removeMonster,
removeOverlay,
initMagics,
addMagicPlaceInteractivities,
clearMagicPlaceInteractivities,
......
......@@ -267,6 +267,32 @@ export const removeMonsterImpl: CaseReducer<
removeOverlay(monsters, action.payload.sequence);
};
// 删除超量素材
export const removeOverlayImpl: CaseReducer<
DuelState,
PayloadAction<{
controler: number;
sequence: number;
overlaySequence: number;
}>
> = (state, action) => {
const controler = action.payload.controler;
const sequence = action.payload.sequence;
const overlaySequence = action.payload.overlaySequence;
const monsters = judgeSelf(controler, state)
? state.meMonsters
: state.opMonsters;
if (monsters) {
const target = monsters.inner.find((_, idx) => idx == sequence);
if (target && target.overlay_materials) {
target.overlay_materials = target.overlay_materials.filter(
(_, idx) => idx != overlaySequence
);
}
}
};
// 改变怪兽表示形式
export const setMonsterPositionImpl: CaseReducer<
DuelState,
......
......@@ -12,6 +12,7 @@ import {
removeHand,
removeMagic,
removeMonster,
removeOverlay,
} from "../../reducers/duel/mod";
import { fetchMagicMeta } from "../../reducers/duel/magicSlice";
import { fetchCemeteryMeta } from "../../reducers/duel/cemeretySlice";
......@@ -68,6 +69,17 @@ export default (move: MsgMove, dispatch: AppDispatch) => {
break;
}
case ygopro.CardZone.OVERLAY: {
dispatch(
removeOverlay({
controler: from.controler,
sequence: from.sequence,
overlaySequence: from.overlay_sequence,
})
);
break;
}
default: {
console.log(`Unhandled zone type ${from.location}`);
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