diff --git a/src/global.d.ts b/src/global.d.ts index 614a8aa..8d22373 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -16,8 +16,10 @@ declare global { */ import {Client, Room} from "colyseus"; import {PetInfoMsg} from "./message/PetInfo"; +import {BattleHandler} from "./rooms/logic/Handler/BattleHandler"; declare module "colyseus" { interface Room { + battleMan: BattleHandler; /** * 广播玩家加入房间 * @param data diff --git a/src/rooms/commands/SelectPetCommand.ts b/src/rooms/commands/SelectPetCommand.ts index 0d011c0..d30f86c 100644 --- a/src/rooms/commands/SelectPetCommand.ts +++ b/src/rooms/commands/SelectPetCommand.ts @@ -3,17 +3,20 @@ import { CardGameState } from "../schema/CardGameState"; import {Client} from "colyseus"; import {NextTurnCommand} from "./NextTurnCommand"; import {TurnEndCommand} from "./TurnEndCommand"; +import {Player} from "../schema/Player"; +import {Card} from "../schema/Card"; +import {Pet} from "../schema/Pet"; /** * 选择随从或者法术 */ export class SelectPetCommand extends Command { - execute({client, cardId, playerId, pos, effCards}: {client: Client, cardId: string, playerId: string, pos: number, effCards: string[]}) { + execute({client, cardId, playerId, pos, effCards} = this.payload) { let sessionId = this.state.currentTurn; let player = this.state.players.get(sessionId); let ap = 0; @@ -32,6 +35,15 @@ export class SelectPetCommand extends Command = new Map(); - + _room: Room; public init(cs: CardGameState, room: Room){ @@ -43,14 +43,14 @@ export class BattleHandler { }; - + /** * 使用卡片 - * @param obj + * @param obj */ public useCard(obj: - {srcplayer: Player, card: Card, cardpoint: number, eff_cnt: number, dstplayer: Player, dstpet: Pet}) + {srcplayer: Player, card: number, cardpoint: number, eff_cnt: number, dstplayer: Player, dstpet: Pet}) { if(!obj || obj.card){ return false; @@ -66,14 +66,14 @@ export class BattleHandler { return false; } - let ps = new SkillParam(obj.card.id, obj.cardpoint, obj.eff_cnt, ph, dstph, dstpt); + let ps = new SkillParam(obj.card, obj.cardpoint, obj.eff_cnt, ph, dstph, dstpt); ph.useCard(ps); }; /** * 使用技能 - * @param obj + * @param obj */ public useSkill(obj:{ srcplayer: Player, skillid: number, dstplayer: Player, dstpet: Pet @@ -98,7 +98,7 @@ export class BattleHandler { public onCardLinkOver(aplayer: Player, linkcards: Card[]){ }; - + /** * 使用卡牌结束(暂时自动回调,无需外部触发) * @param obj :使用卡牌相关操作 @@ -131,7 +131,7 @@ export class BattleHandler { /** * 玩家回合开始 - * @param aplayer + * @param aplayer */ public onPlayerRoundStart(aplayer: Player){ @@ -139,9 +139,9 @@ export class BattleHandler { /** * 玩家回合结束 - * @param aplayer + * @param aplayer */ public onPlayerRoundEnd(aplayer: Player){ }; -} \ No newline at end of file +}