Merge branch 'second' of git.kingsome.cn:node/card_svr into second
This commit is contained in:
commit
f24800e8fc
File diff suppressed because one or more lines are too long
@ -28,6 +28,8 @@ export class BattleHandler {
|
|||||||
private _gamestart: boolean = false;
|
private _gamestart: boolean = false;
|
||||||
|
|
||||||
private _cacheSkills: SkillTarget[] = [];
|
private _cacheSkills: SkillTarget[] = [];
|
||||||
|
private _cachePets: PetHandler[] = [];
|
||||||
|
|
||||||
private _lastlinkph: PlayerHandler;
|
private _lastlinkph: PlayerHandler;
|
||||||
|
|
||||||
//--------------------对外接口--player相关---(外部调用)----------------------------
|
//--------------------对外接口--player相关---(外部调用)----------------------------
|
||||||
@ -412,9 +414,13 @@ export class BattleHandler {
|
|||||||
return lst;
|
return lst;
|
||||||
};
|
};
|
||||||
|
|
||||||
public checkPets(){
|
public checkPets(pets: PetHandler[]){
|
||||||
this._players.forEach((item: PlayerHandler) => {
|
pets.forEach((item: PetHandler) =>{
|
||||||
item.checkPets(true);
|
if(!item.isAlive()){
|
||||||
|
item.destroy();
|
||||||
|
}else{
|
||||||
|
item.resetBakAP();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -431,6 +437,7 @@ export class BattleHandler {
|
|||||||
if(this._flowcount == 0){
|
if(this._flowcount == 0){
|
||||||
this._sktime = 0;
|
this._sktime = 0;
|
||||||
this._cacheSkills.length = 0;
|
this._cacheSkills.length = 0;
|
||||||
|
this._cachePets.length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._flowcount++;
|
this._flowcount++;
|
||||||
@ -452,9 +459,23 @@ export class BattleHandler {
|
|||||||
this.onSkillResultNotify(this._cacheSkills);
|
this.onSkillResultNotify(this._cacheSkills);
|
||||||
this._cacheSkills.length = 0;
|
this._cacheSkills.length = 0;
|
||||||
}
|
}
|
||||||
this.checkPets();
|
let nt = this._sktime * 1000;
|
||||||
|
if(this._cachePets.length > 0){
|
||||||
|
if(nt > 0){
|
||||||
|
this._room.clock.setTimeout(()=>{
|
||||||
|
this.onUpdatePets(this._cachePets, null);
|
||||||
|
this.checkPets(this._cachePets);
|
||||||
|
this._cachePets.length = 0;
|
||||||
|
}, nt);
|
||||||
|
}else{
|
||||||
|
this.onUpdatePets(this._cachePets, null);
|
||||||
|
this.checkPets(this._cachePets);
|
||||||
|
this._cachePets.length = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
this._flowcount = res;
|
this._flowcount = res;
|
||||||
return this._sktime * 1000;
|
|
||||||
|
return nt;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._flowcount = res;
|
this._flowcount = res;
|
||||||
@ -755,24 +776,51 @@ export class BattleHandler {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public onUpdatePetNotify(apet: PetHandler, from: PetHandler){
|
public onUpdatePetNotify(apet: PetHandler, from: PetHandler){
|
||||||
return this._room.updatePet([apet.exportInfo()], from? from._owner.getId(): null);
|
this.onUpdatePets([apet], from, true);
|
||||||
|
|
||||||
|
if(this.isFlowing()){
|
||||||
|
if(!this._cachePets.includes(apet)){
|
||||||
|
this._cachePets.push(apet);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
let lst = [apet];
|
||||||
|
this.onUpdatePets(lst, from);
|
||||||
|
this.checkPets(lst);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public onUpdatePetsNotify(pets: PetHandler[], from: PetHandler){
|
public onUpdatePetsNotify(pets: PetHandler[], from: PetHandler){
|
||||||
if(!pets || pets.length <= 0){
|
if(!pets || pets.length <= 0){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let lst: PetInfo[] = [];
|
|
||||||
pets.forEach((item: PetHandler)=>{
|
this.onUpdatePets(pets, from, true);
|
||||||
lst.push(item.exportInfo());
|
|
||||||
});
|
if(this.isFlowing()){
|
||||||
return this._room.updatePet(lst, from? from._owner.getId(): null);
|
pets.forEach((item: PetHandler) =>{
|
||||||
|
if(!this._cachePets.includes(item)){
|
||||||
|
this._cachePets.push(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
this.onUpdatePets(pets, from);
|
||||||
|
this.checkPets(pets);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public onUpdatePets(infos: PetUpdateProcess[]){
|
public onUpdatePets(pets: PetHandler[], from: PetHandler, isstat: boolean = false){
|
||||||
infos.forEach((item: PetUpdateProcess) =>{
|
if(!pets || pets.length <= 0){
|
||||||
this._room.updatePet([item.info], item.from? item.from._owner.getId(): null);
|
return;
|
||||||
|
}
|
||||||
|
let lst: PetInfo[] = [];
|
||||||
|
pets.forEach((item: PetHandler) =>{
|
||||||
|
lst.push(item.exportInfo());
|
||||||
});
|
});
|
||||||
|
if(isstat){
|
||||||
|
this._room.updatePetStat(lst, from? from._owner.getId(): null);
|
||||||
|
}else{
|
||||||
|
this._room.updatePet(lst, from? from._owner.getId(): null);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public onPlayerAddCardNotify(aplayer: PlayerHandler, count: number, maxcount: number,
|
public onPlayerAddCardNotify(aplayer: PlayerHandler, count: number, maxcount: number,
|
||||||
|
@ -70,6 +70,10 @@ export class PetHandler {
|
|||||||
this._idx = index;
|
this._idx = index;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public destroy(){
|
||||||
|
this._owner && this._owner.delPet(this);
|
||||||
|
};
|
||||||
|
|
||||||
public loadData(id: number, param: SkillParam, exskillid?: number[], exap?: number){
|
public loadData(id: number, param: SkillParam, exskillid?: number[], exap?: number){
|
||||||
this._id = id || 0;
|
this._id = id || 0;
|
||||||
this._cfg = CfgMan.findUnitCfg(this._id);
|
this._cfg = CfgMan.findUnitCfg(this._id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user