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