Commit 995af3ec authored by Chunchi Che's avatar Chunchi Che

fix extra

parent f73fb761
Pipeline #21454 passed with stages
in 13 minutes and 21 seconds
......@@ -2,7 +2,6 @@ import { v4 as v4uuid } from "uuid";
import { ygopro } from "@/api";
import { store } from "@/stores";
const { matStore } = store;
export default (start: ygopro.StocGameMessage.MsgStart) => {
......@@ -77,4 +76,9 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
idleInteractivities: [],
});
}
// 在`WaitRoom`页面会设置自己的额外卡组,但那时候拿不到正确的`controller`值,因为不知道自己是先攻还是后手,因此这里需要重新为自己的额外卡组设置`controller`值
matStore
.in(ygopro.CardZone.EXTRA)
.me.forEach((state) => (state.location.controler = 1 - opponent));
};
......@@ -110,7 +110,7 @@ export const Mat = () => {
? onCardClick(card)
: card.location.zone == YgoZone.DECK
? () => {}
: onFieldClick(renderCards, card.location.zone)
: onFieldClick(renderCards, card)
}
/>
))}
......@@ -260,8 +260,12 @@ const onCardClick = (state: CardState) => () => {
}
};
const onFieldClick = (states: Array<CardState>, zone: YgoZone) => () => {
const displayStates = states.filter((state) => state.location.zone == zone);
const onFieldClick = (states: Array<CardState>, clicked: CardState) => () => {
const displayStates = states.filter(
(state) =>
state.location.zone == clicked.location.zone &&
state.location.controler === clicked.location.controler
);
messageStore.cardListModal.list = displayStates.map((item) => ({
meta: item.occupant,
......
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