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 a20d790..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 { @@ -23,11 +24,7 @@ export class Player extends Schema { */ @type("number") hp: number; - /** - * 当前点数 - */ - @type("number") - ap: number; + /** * 状态 * 0: 正常状态 @@ -55,12 +52,11 @@ export class Player extends Schema { constructor(id: string, heroId: number, team: number) { super(); this.id = id; - this.state = 0; - this.hp = 200; - this.ap = 30; + this.state = PlayerStateConst.PLAYER_NORMAL; + this.hp = 0; 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()); } } 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; }