更新hp, 更新随从信息, 弃卡, 这3个方法增加fromplayer

This commit is contained in:
zhl 2021-01-06 13:58:44 +08:00
parent 2a0d3371d4
commit 14152740d0
2 changed files with 9 additions and 6 deletions

9
src/global.d.ts vendored
View File

@ -186,8 +186,9 @@ declare module "colyseus" {
* , 广
* @param dstplayer
* @param count
* @param fromplayer
*/
giveUpCard(dstplayer: string, count: number): number;
giveUpCard(dstplayer: string, count: number, fromplayer?: string): number;
/**
* , 广
@ -205,14 +206,16 @@ declare module "colyseus" {
* @param dstplayer
* @param hp
* @param reason
* @param fromplayer
*/
updateHp(dstplayer: string, hp: number, reason?: string): number;
updateHp(dstplayer: string, hp: number, reason?: string, fromplayer?: string): number;
/**
*
* @param datas
* @param fromplayer
*/
updatePet(datas: PetInfo[]): void;
updatePet(datas: PetInfo[], fromplayer?: string): void;
/**
* room.mainClock设定任务

View File

@ -45,7 +45,7 @@ Object.defineProperties(Room.prototype, {
}
},
giveUpCard: {
value: function (dstplayer: string, count: number){
value: function (dstplayer: string, count: number, fromplayer?: string){
let player = this.state.players.get(dstplayer);
let tmpCards = gameUtil.removeCard(player, count);
let time = this.battleMan.onCardDroped(player, tmpCards);
@ -105,7 +105,7 @@ Object.defineProperties(Room.prototype, {
}
},
updateHp: {
value: function (dstplayer: string, hp: number, reason?: string): number {
value: function (dstplayer: string, hp: number, reason?: string, fromplayer?: string): number {
let player = this.state.players.get(dstplayer);
if (!player) {
error(`updateHp 未找到玩家 ${dstplayer}`);
@ -130,7 +130,7 @@ Object.defineProperties(Room.prototype, {
* @param data
*/
updatePet: {
value: function (datas: PetInfo[]): void {
value: function (datas: PetInfo[], fromplayer?: string): void {
let playerSet: Set<string> = new Set();
for (let obj of datas) {
let pid = obj.player;