Commit 0dd2c218 authored by Chunchi Che's avatar Chunchi Che

fix ectra deck diff from main deck

parent 24a7c1b4
......@@ -17,7 +17,6 @@ import { EventEmitter } from "eventemitter3";
/* eslint no-var: 0 */
declare global {
var myExtraDeckCodes: number[] = [];
interface Console {
color: (
color: string,
......
import { flatten } from "lodash-es";
import { v4 as v4uuid } from "uuid";
import PlayerType = ygopro.StocGameMessage.MsgStart.PlayerType;
import { ygopro } from "@/api";
import { useConfig } from "@/config";
import { sleep } from "@/infra";
......@@ -21,11 +21,6 @@ const TOKEN_SIZE = 13; // 每人场上最多就只可能有13个token
export default async (start: ygopro.StocGameMessage.MsgStart) => {
// 先初始化`matStore`
matStore.selfType = start.playerType;
const opponent =
start.playerType === PlayerType.FirstStrike ||
start.playerType === PlayerType.Observer
? 1
: 0;
if (sideStore.stage !== SideStage.NONE) {
// 更新Side状态
......@@ -87,10 +82,8 @@ export default async (start: ygopro.StocGameMessage.MsgStart) => {
);
cardStore.inner.push(...cards);
// 设置自己的额外卡组,信息是在waitroom之中拿到的
cardStore
.at(ygopro.CardZone.EXTRA, 1 - opponent)
.forEach((card) => (card.code = window.myExtraDeckCodes?.pop() ?? 0));
// note: 额外卡组的卡会在对局开始后通过`UpdateData` msg更新
if (replayStore.isReplay) {
replayStart();
......
......@@ -4,6 +4,7 @@ import { callCardMove } from "@/ui/Duel/PlayMat/Card";
import MsgUpdateData = ygopro.StocGameMessage.MsgUpdateData;
import { TYPE_TOKEN } from "@/common";
export default async (updateData: MsgUpdateData) => {
const { player: controller, zone, actions } = updateData;
if (controller !== undefined && zone !== undefined && actions !== undefined) {
......
......@@ -41,10 +41,6 @@ export const ReplayModal: React.FC = () => {
// 标记为回放模式
replayStore.isReplay = true;
// 初始化额外卡组
// FIXME: 这样写应该不对,有空来修
window.myExtraDeckCodes = [];
await connectSrvpro({
ip: "",
player: "",
......
......@@ -60,7 +60,6 @@ export const Component: React.FC = () => {
};
const onSummit = () => {
sendUpdateDeck(deck);
window.myExtraDeckCodes = [...deck.extra];
};
useEffect(() => {
......
......@@ -111,8 +111,6 @@ export const Component: React.FC = () => {
sendUpdateDeck(deck);
// 设置side里面的卡组
sideStore.deck = deck;
// 设置额外卡组数据
window.myExtraDeckCodes = [...deck.extra];
sendHsReady();
} else {
message.error("请先选择卡组");
......
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