select hero命令增加卡组id

This commit is contained in:
zhl 2021-01-13 14:03:44 +08:00
parent f90542ae69
commit 20ff488ecc
2 changed files with 4 additions and 3 deletions

View File

@ -74,7 +74,7 @@ export class GeneralRoom extends Room {
this.onMessage("select_hero_c2s", (client, message) => {
msgLog('select_hero from ', client.sessionId, JSON.stringify(message));
this.dispatcher.dispatch(new SelectHeroCommand(), {client, heroId: message.heroId});
this.dispatcher.dispatch(new SelectHeroCommand(), {client, heroId: message.heroId, cardGroup: message.cardgroup});
});
this.onMessage("gm", (client, message) => {

View File

@ -11,8 +11,8 @@ import {StateTypeEnum} from "../enums/StateTypeEnum";
/**
*
*/
export class SelectHeroCommand extends Command<CardGameState, { client: Client, heroId: number }> {
execute({client, heroId} = this.payload) {
export class SelectHeroCommand extends Command<CardGameState, { client: Client, heroId: number, cardGroup?: string }> {
execute({client, heroId, cardGroup} = this.payload) {
let player = this.state.players.get(client.sessionId);
if (player.state != PlayerStateConst.PLAYER_READY) {
return;
@ -48,6 +48,7 @@ export class SelectHeroCommand extends Command<CardGameState, { client: Client,
if (unitData.base_skill2id) heroPet.skills.push(unitData.base_skill2id);
if (unitData.base_skill3id) heroPet.skills.push(unitData.base_skill3id);
const effectMap = global.$cfg.get(BaseConst.EFFECTCARD);
// TODO: // 根据传入的卡组id去设置英雄可用的unit
for (let i = 1; i < 10; i++) {
if (!heroData[`follower${i}id`]) {
break;