From 787d6af948552ed45bd4485cd26f5a1b417ccaef Mon Sep 17 00:00:00 2001 From: zhl Date: Tue, 2 Feb 2021 10:42:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E6=97=B6=E6=9B=B4=E6=96=B0=E6=96=B0?= =?UTF-8?q?=E6=89=8B=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/rooms/commands/BeginGameCommand.ts | 13 ++++++++----- src/utils/game.util.ts | 13 ++++++++++++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/rooms/commands/BeginGameCommand.ts b/src/rooms/commands/BeginGameCommand.ts index 6537844..a2f9b89 100644 --- a/src/rooms/commands/BeginGameCommand.ts +++ b/src/rooms/commands/BeginGameCommand.ts @@ -14,11 +14,14 @@ export class BeginGameCommand extends Command { async execute() { this.state.maxCardId = 0; - let card0 = gameUtil.initCardQue(1); - let card1 = gameUtil.initCardQue(card0.length + 1); - let cardAll = card0.concat(card1); - cardAll.randomSort(); - this.state.cardQueue = cardAll; + // let card0 = gameUtil.initCardQue(1); + // let card1 = gameUtil.initCardQue(card0.length + 1); + // let cardAll = card0.concat(card1); + // cardAll.randomSort(); + let card0 = gameUtil.initSampleCards(1) + // let card1 = gameUtil.initSampleCards(card0.length + 1) + // let cardAll = card0.concat(card1) + this.state.cardQueue = card0; let i = 0; for (let [id] of this.state.players) { this.room.addCard(id, new GameEnv().playerInitNums[i++], 0); diff --git a/src/utils/game.util.ts b/src/utils/game.util.ts index 477b08b..948debb 100644 --- a/src/utils/game.util.ts +++ b/src/utils/game.util.ts @@ -4,7 +4,7 @@ import {Player} from "../rooms/schema/Player"; import {BaseConst} from "../constants/BaseConst"; import {SystemCardCfg} from "../cfg/parsers/SystemCardCfg"; import {EffectCardCfg} from "../cfg/parsers/EffectCardCfg"; -import {cardLog, error} from "../common/Debug"; +import { cardLog, debugRoom, error } from '../common/Debug' import {Room} from "colyseus"; import {PlayerStateConst} from "../constants/PlayerStateConst"; import {GameEnv} from "../cfg/GameEnv"; @@ -39,6 +39,17 @@ let gameUtil = { cards.randomSort(); return cards; }, + initSampleCards(beginNum: number) { + let cardArr = [[1, 1, 20012, 1], [2, 3, 20102, 11], [3, 4, 20032, 1], [4, 10, 20102, 11], [5, 10, 20042, 1], [6, 1, 20012, 1], [7, 3, 20102, 11], [8, 4, 20032, 1], [9, 5, 20102, 11], [10, 6, 20102, 11], [11, 1, 20012, 1], [12, 5, 20102, 11], [13, 5, 20032, 1], [14, 5, 20102, 11], [15, 5, 20102, 11], [16, 6, 20102, 11], [17, 1, 20012, 1], [18, 3, 20102, 11], [19, 5, 20102, 11], [20, 7, 20102, 11], [21, 8, 20042, 1], [22, 10, 20102, 11], [23, 4, 20102, 11], [24, 7, 20052, 1], [25, 3, 20102, 11], [26, 7, 20052, 1], [27, 6, 20072, 1], [28, 1, 20052, 1], [29, 5, 20102, 11], [30, 4, 20052, 1], [31, 0, 20112, 2], [32, 5, 20102, 11], [33, 5, 20062, 1], [34, 2, 20102, 11], [35, 4, 20062, 1], [36, 1, 20072, 1], [37, 1, 20102, 11], [38, 1, 20062, 1], [39, 9, 20042, 1], [40, 0, 20112, 2], [41, 6, 20102, 11], [42, 8, 20072, 1], [43, 0, 20112, 2], [44, 0, 20112, 2], [45, 0, 20112, 2], [46, 0, 20112, 2], [47, 0, 20112, 2], [48, 0, 20112, 2], [49, 10, 20042, 1], [50, 0, 20112, 2], [51, 5, 20102, 11], [52, 5, 20082, 1], [53, 5, 20102, 11], [54, 5, 20052, 1], [55, 0, 20122, 3], [56, 0, 20122, 3], [57, 0, 20122, 3], [58, 0, 20122, 3], [59, 0, 20122, 3], [60, 0, 20122, 3], [61, 0, 20122, 3], [62, 0, 20122, 3], [63, 0, 20112, 2], [64, 0, 20112, 2], [65, 0, 20112, 2], [66, 0, 20112, 2], [67, 0, 20112, 2], [68, 0, 20112, 2]] + let cards: Card[] = []; + for (let i = cardArr.length - 1; i >=0; i--) { + let subarr = cardArr[i] + let card = new Card(subarr[0], subarr[1], subarr[3], subarr[2]) + cards.push(card) + } + debugRoom(cards) + return cards + }, /** * 随机生成一张指定效果的卡 * @param effectId