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 { ...@@ -63,6 +63,7 @@ import {
clearMonsterIdleInteractivitiesImpl, clearMonsterIdleInteractivitiesImpl,
removeMonsterImpl, removeMonsterImpl,
setMonsterPositionImpl, setMonsterPositionImpl,
removeOverlayImpl,
monsterCase, monsterCase,
} from "./monstersSlice"; } from "./monstersSlice";
import { import {
...@@ -185,6 +186,7 @@ const duelSlice = createSlice({ ...@@ -185,6 +186,7 @@ const duelSlice = createSlice({
clearMonsterIdleInteractivities: clearMonsterIdleInteractivitiesImpl, clearMonsterIdleInteractivities: clearMonsterIdleInteractivitiesImpl,
setMonsterPosition: setMonsterPositionImpl, setMonsterPosition: setMonsterPositionImpl,
removeMonster: removeMonsterImpl, removeMonster: removeMonsterImpl,
removeOverlay: removeOverlayImpl,
// 魔法陷阱区相关`Reducer` // 魔法陷阱区相关`Reducer`
initMagics: initMagicsImpl, initMagics: initMagicsImpl,
...@@ -285,6 +287,7 @@ export const { ...@@ -285,6 +287,7 @@ export const {
clearMonsterIdleInteractivities, clearMonsterIdleInteractivities,
setMonsterPosition, setMonsterPosition,
removeMonster, removeMonster,
removeOverlay,
initMagics, initMagics,
addMagicPlaceInteractivities, addMagicPlaceInteractivities,
clearMagicPlaceInteractivities, clearMagicPlaceInteractivities,
......
...@@ -267,6 +267,32 @@ export const removeMonsterImpl: CaseReducer< ...@@ -267,6 +267,32 @@ export const removeMonsterImpl: CaseReducer<
removeOverlay(monsters, action.payload.sequence); 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< export const setMonsterPositionImpl: CaseReducer<
DuelState, DuelState,
......
...@@ -12,6 +12,7 @@ import { ...@@ -12,6 +12,7 @@ import {
removeHand, removeHand,
removeMagic, removeMagic,
removeMonster, removeMonster,
removeOverlay,
} from "../../reducers/duel/mod"; } from "../../reducers/duel/mod";
import { fetchMagicMeta } from "../../reducers/duel/magicSlice"; import { fetchMagicMeta } from "../../reducers/duel/magicSlice";
import { fetchCemeteryMeta } from "../../reducers/duel/cemeretySlice"; import { fetchCemeteryMeta } from "../../reducers/duel/cemeretySlice";
...@@ -68,6 +69,17 @@ export default (move: MsgMove, dispatch: AppDispatch) => { ...@@ -68,6 +69,17 @@ export default (move: MsgMove, dispatch: AppDispatch) => {
break; break;
} }
case ygopro.CardZone.OVERLAY: {
dispatch(
removeOverlay({
controler: from.controler,
sequence: from.sequence,
overlaySequence: from.overlay_sequence,
})
);
break;
}
default: { default: {
console.log(`Unhandled zone type ${from.location}`); console.log(`Unhandled zone type ${from.location}`);
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