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

fix extra

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