Merge branch 'master' of http://git.kingsome.cn/node/card_svr
This commit is contained in:
commit
f32117aa05
@ -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<CardGameState, {client: Client, h
|
||||
this.room.sSelectHero(client, {errcode: 1, errmsg: '无法找到对应英雄的配置'});
|
||||
return;
|
||||
}
|
||||
const heroData = heroMap.get(heroId);
|
||||
player.heroId = heroId;
|
||||
const unitMap = global.$cfg.get(BaseConst.UNIT);
|
||||
const unitData = unitMap.get(heroData.herounit_id);
|
||||
if (!unitData) {
|
||||
error(`未找到英雄的Unit配置: ${heroId}`);
|
||||
}
|
||||
player.state = PlayerStateConst.PLAYER_SELECT_HERO;
|
||||
player.hp = unitData.hero_hp;
|
||||
let heroPet = player.pets.get('0');
|
||||
heroPet.ap = unitData.powernum;
|
||||
if (unitData.base_skill1id) heroPet.skills.push(unitData.base_skill1id);
|
||||
if (unitData.base_skill2id) heroPet.skills.push(unitData.base_skill2id);
|
||||
if (unitData.base_skill3id) heroPet.skills.push(unitData.base_skill3id);
|
||||
this.room.battleMan.addPlayer(player);
|
||||
this.room.bSelectHero({errocode: 0, errmsg: '', player: client.sessionId, heroId: heroId});
|
||||
let readyCount = 0;
|
||||
|
@ -16,7 +16,7 @@ export class Pet extends Schema {
|
||||
harmReduce?: number;
|
||||
|
||||
@type(["number"])
|
||||
skills = new ArraySchema<number>();
|
||||
skills: number[] = new ArraySchema<number>();
|
||||
|
||||
@type(["number"])
|
||||
extSkills = new ArraySchema<number>()
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user