29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
import {Command} from "@colyseus/command";
|
|
import {CardGameState} from "../schema/CardGameState";
|
|
import {Player} from "../schema/Player";
|
|
import {PlayerStateConst} from "../../constants/PlayerStateConst";
|
|
import {singleton} from "../../common/Singleton";
|
|
import {GameEnv} from "../../cfg/GameEnv";
|
|
|
|
/**
|
|
* 玩家死亡
|
|
*/
|
|
export class PlayDeadCommand extends Command<CardGameState, {player: Player}> {
|
|
|
|
execute({player} = this.payload) {
|
|
player.state = PlayerStateConst.PLAYER_DEAD;
|
|
this.room.battleMan.onPlayerDead(player);
|
|
for (let [, p] of this.state.players) {
|
|
if (p.id !== player.id && p.team == player.team) {
|
|
if (p.state !== PlayerStateConst.PLAYER_DEAD) {
|
|
// let amount = p.cards.size;
|
|
// this.room.drawCardFromPlayer(p.id, player.id, amount);
|
|
// 20201216 18:32 修改
|
|
this.room.addCard(p.id, singleton(GameEnv).teamDeadAddNum, 0);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|