From 69b271f610c5079da6ce41989885ee031acf201d Mon Sep 17 00:00:00 2001 From: zhl Date: Fri, 4 Dec 2020 17:19:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E8=8B=B1=E9=9B=84?= =?UTF-8?q?=E7=9A=84ap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/rooms/schema/Player.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/rooms/schema/Player.ts b/src/rooms/schema/Player.ts index a20d790..e22a071 100644 --- a/src/rooms/schema/Player.ts +++ b/src/rooms/schema/Player.ts @@ -23,11 +23,7 @@ export class Player extends Schema { */ @type("number") hp: number; - /** - * 当前点数 - */ - @type("number") - ap: number; + /** * 状态 * 0: 正常状态 @@ -57,10 +53,9 @@ export class Player extends Schema { this.id = id; this.state = 0; this.hp = 200; - this.ap = 30; this.heroId = heroId; this.team = team; - for (let i = 0; i < singleton(GameEnv).maxPlayerPetCount; i++) { + for (let i = 0; i < singleton(GameEnv).maxPlayerPetCount + 1; i++) { this.pets.set(i+'', new Pet()); } } From 315499b6b1b1f076a8f79f01e4e179ae43567761 Mon Sep 17 00:00:00 2001 From: zhl Date: Fri, 4 Dec 2020 17:43:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E9=85=8D=E8=A1=A8,?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E8=8B=B1=E9=9B=84unit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/rooms/commands/SelectHeroCommand.ts | 13 +++++++++++++ src/rooms/schema/Pet.ts | 2 +- src/rooms/schema/Player.ts | 5 +++-- src/utils/game.util.ts | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/rooms/commands/SelectHeroCommand.ts b/src/rooms/commands/SelectHeroCommand.ts index 098306e..2b16e47 100644 --- a/src/rooms/commands/SelectHeroCommand.ts +++ b/src/rooms/commands/SelectHeroCommand.ts @@ -5,6 +5,7 @@ import {PlayerStateConst} from "../../constants/PlayerStateConst"; import {BeginGameCommand} from "./BeginGameCommand"; import {BattleHandler} from "../logic/Handler/BattleHandler"; import {BaseConst} from "../../constants/BaseConst"; +import {error} from "../../common/Debug"; /** * 选择英雄 @@ -17,8 +18,20 @@ export class SelectHeroCommand extends Command(); + skills: number[] = new ArraySchema(); @type(["number"]) extSkills = new ArraySchema() diff --git a/src/rooms/schema/Player.ts b/src/rooms/schema/Player.ts index e22a071..ba2ef10 100644 --- a/src/rooms/schema/Player.ts +++ b/src/rooms/schema/Player.ts @@ -3,6 +3,7 @@ import {Pet} from "./Pet"; import {Card} from "./Card"; import {singleton} from "../../common/Singleton"; import {GameEnv} from "../../cfg/GameEnv"; +import {PlayerStateConst} from "../../constants/PlayerStateConst"; export class Player extends Schema { @@ -51,8 +52,8 @@ export class Player extends Schema { constructor(id: string, heroId: number, team: number) { super(); this.id = id; - this.state = 0; - this.hp = 200; + this.state = PlayerStateConst.PLAYER_NORMAL; + this.hp = 0; this.heroId = heroId; this.team = team; for (let i = 0; i < singleton(GameEnv).maxPlayerPetCount + 1; i++) { diff --git a/src/utils/game.util.ts b/src/utils/game.util.ts index 9161ab3..0ab0e45 100644 --- a/src/utils/game.util.ts +++ b/src/utils/game.util.ts @@ -201,7 +201,7 @@ let gameUtil = { * @param player */ calcTotalAp(player: Player) { - let result = player.ap; + let result = 0; for (let [pid, pet] of player.pets) { result += pet.ap; }