更新hp, 更新随从信息, 弃卡, 这3个方法增加fromplayer
This commit is contained in:
parent
2a0d3371d4
commit
14152740d0
9
src/global.d.ts
vendored
9
src/global.d.ts
vendored
@ -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设定任务
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user