Commit 51982f32 authored by Chunchi Che's avatar Chunchi Che

fix Mat.tsx

parent ad8414d7
Pipeline #21437 passed with stages
in 13 minutes and 28 seconds
......@@ -9,11 +9,11 @@ export default (draw: ygopro.StocGameMessage.MsgDraw) => {
const drawLength = draw.cards.length;
const popCards = matStore.decks
.of(draw.player)
.slice(deckLength - drawLength, drawLength);
.splice(deckLength - drawLength, drawLength);
const data = zip(popCards, draw.cards).map(([pop, hand]) => {
return { uuid: pop.uuid, id: hand };
});
matStore.hands.of(draw.player).add(data);
matStore.hands.of(draw.player).add(data, ygopro.CardPosition.FACEUP_ATTACK);
};
......@@ -72,8 +72,7 @@ export default (move: MsgMove) => {
}
case ygopro.CardZone.REMOVED:
case ygopro.CardZone.GRAVE:
case ygopro.CardZone.EXTRA:
case ygopro.CardZone.HAND: {
case ygopro.CardZone.EXTRA: {
if (uuid) {
matStore
.in(to.location)
......@@ -82,6 +81,15 @@ export default (move: MsgMove) => {
}
break;
}
case ygopro.CardZone.HAND: {
if (uuid) {
matStore
.in(to.location)
.of(to.controler)
.insert(uuid, code, to.sequence);
}
break;
}
case ygopro.CardZone.OVERLAY: {
if (reason == REASON_MATERIAL && uuid) {
// 超量素材在进行超量召唤时,若玩家未选择超量怪兽的位置,会“沉到决斗盘下面”,`reason`字段值是`REASON_MATERIAL`
......
import { v4 as v4uuid } from "uuid";
import { ygopro } from "@/api";
import { store } from "@/stores";
......@@ -22,6 +24,36 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
matStore.magics.of(0).forEach((x) => (x.location.controler = 0));
matStore.magics.of(1).forEach((x) => (x.location.controler = 1));
matStore.decks.of(0).add(Array(start.deckSize1).fill(0));
matStore.decks.of(1).add(Array(start.deckSize2).fill(0));
for (let i = 0; i < start.deckSize1; i++) {
matStore.decks.of(0).push({
uuid: v4uuid(),
occupant: {
id: 0,
data: {},
text: {},
},
location: {
controler: 0,
zone: ygopro.CardZone.DECK,
},
counters: {},
idleInteractivities: [],
});
}
for (let i = 0; i < start.deckSize2; i++) {
matStore.decks.of(1).push({
uuid: v4uuid(),
occupant: {
id: 0,
data: {},
text: {},
},
location: {
controler: 0,
zone: ygopro.CardZone.DECK,
},
counters: {},
idleInteractivities: [],
});
}
};
......@@ -155,9 +155,9 @@ function cardStateToCol(state: RenderCard): number {
case YgoZone.EXTRA:
return 5;
case YgoZone.HAND:
return -state.sequence;
return 4 - state.sequence;
case YgoZone.SZONE:
return state.sequence >= 5 ? 5 : -state.sequence;
return state.sequence >= 5 ? 5 : 4 - state.sequence;
case YgoZone.DECK:
case YgoZone.REMOVED:
case YgoZone.GRAVE:
......@@ -167,7 +167,7 @@ function cardStateToCol(state: RenderCard): number {
? state.sequence == 5
? 3
: 1
: -state.sequence;
: 4 - state.sequence;
default:
return 0;
}
......@@ -215,9 +215,10 @@ function CardStateToFaceDown(state: RenderCard): boolean {
const position = state.location.position;
return (
position === YgoPosition.FACEDOWN ||
position === YgoPosition.FACEDOWN_ATTACK ||
position === YgoPosition.FACEDOWN_DEFENSE ||
((position === YgoPosition.FACEDOWN ||
position === YgoPosition.FACEDOWN_ATTACK ||
position === YgoPosition.FACEDOWN_DEFENSE) &&
state.location.zone != YgoZone.HAND) ||
state.occupant!.id == 0
);
}
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