Commit fed01778 authored by Chunchi Che's avatar Chunchi Che

fix posChange

parent 80533877
import { ygopro } from "@/api"; import { ygopro } from "@/api";
import MsgPosChange = ygopro.StocGameMessage.MsgPosChange; import MsgPosChange = ygopro.StocGameMessage.MsgPosChange;
import { cardStore, fetchEsHintMeta, matStore } from "@/stores"; import { cardStore, fetchEsHintMeta } from "@/stores";
export default (posChange: MsgPosChange) => { export default (posChange: MsgPosChange) => {
const { location, controler, sequence } = posChange.card_info; const { location, controler, sequence } = posChange.card_info;
cardStore.at(location, controler, sequence).position = posChange.cur_position; const target = cardStore.at(location, controler, sequence);
if (target) {
switch (location) { target.position = posChange.cur_position;
case ygopro.CardZone.MZONE: { } else {
matStore.monsters.of(controler)[sequence].location.position = console.warn(`<PosChange>target from ${posChange.card_info} is null`);
posChange.cur_position;
break;
}
case ygopro.CardZone.SZONE: {
matStore.magics.of(controler)[sequence].location.position =
posChange.cur_position;
break;
}
default: {
console.log(`Unhandled zone ${location}`);
}
} }
fetchEsHintMeta({ fetchEsHintMeta({
originMsg: 1600, originMsg: 1600,
}); });
......
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