增加一个更改英雄的gm命令
This commit is contained in:
parent
86a6504958
commit
967b259108
@ -32,6 +32,9 @@ export class GMCommand extends Command<CardGameState, {client: Client, message:
|
||||
case 'setwin':
|
||||
this.setWin(arr[1]);
|
||||
break;
|
||||
case 'changehero':
|
||||
this.changeHero(arr[1]);
|
||||
break;
|
||||
case 'help':
|
||||
this.sendHelp(client, arr[1]);
|
||||
break;
|
||||
@ -50,6 +53,7 @@ export class GMCommand extends Command<CardGameState, {client: Client, message:
|
||||
str += '更新英雄血量: herohp:玩家index|血量 例: herohp:0|500 \n';
|
||||
str += '生成几张特定效果的卡: addcard:玩家index|效果卡id|数量 例: addcard:0|20011|1\n';
|
||||
str += '将某一队设为赢家: setwin:队伍index 例: setwin:0\n';
|
||||
str += '替换一个玩家的英雄: changehero:玩家index|heroid 例: changehero:3|30032\n';
|
||||
this.room.send(client,'notice_msg', str);
|
||||
}
|
||||
|
||||
@ -86,6 +90,25 @@ export class GMCommand extends Command<CardGameState, {client: Client, message:
|
||||
let client = this.room.getClient(player.id);
|
||||
this.room.send(client,'sync_card', {}, {afterNextPatch: true});
|
||||
}
|
||||
/**
|
||||
* 将一个玩家的英雄变成指定的英雄
|
||||
* changehero:玩家index|heroid
|
||||
* changehero:0|30032
|
||||
* @param msg
|
||||
*/
|
||||
changeHero(msg: string) {
|
||||
if (msg.indexOf('|') < 0) {
|
||||
error(`错误的GM命令格式: ${msg}`);
|
||||
return;
|
||||
}
|
||||
let arr = msg.split('|');
|
||||
let playerIdx = parseInt(arr[0]);
|
||||
let heroId = parseInt(arr[1]);
|
||||
let player = this.getPlayerByIdx(playerIdx);
|
||||
player.heroId = heroId;
|
||||
let client = this.room.getClient(player.id);
|
||||
this.room.send(client,'sync_hero', {playerid: player.id, heroid: heroId}, {afterNextPatch: true});
|
||||
}
|
||||
|
||||
/**
|
||||
* 将牌组中的卡全部变成指定的效果卡
|
||||
|
Loading…
x
Reference in New Issue
Block a user