增加技能时间统计

This commit is contained in:
y.x 2020-12-08 21:20:49 +08:00
parent 3ec1883d29
commit 12b33fcb19
2 changed files with 18 additions and 0 deletions

View File

@ -358,9 +358,18 @@ export class BattleHandler {
return; return;
} }
let lst: SkillInfoMsg[] = []; let lst: SkillInfoMsg[] = [];
let difflst: SkillTarget[] = [];
skillres.forEach((item: SkillTarget)=>{ skillres.forEach((item: SkillTarget)=>{
lst.push(item.exportData()); lst.push(item.exportData());
if(!difflst.includes(item)){
difflst.push(item);
}
}); });
let tm = 0;
difflst.forEach((item: SkillTarget) =>{
tm += item.getLastTime();
});
//todo:
this._room.bMsgQueue(lst); this._room.bMsgQueue(lst);
}; };

View File

@ -50,6 +50,9 @@ export class SkillTarget{
dst: any; dst: any;
dsttype: GameUnitType; dsttype: GameUnitType;
lasttime: number;
bresok: boolean = false;
res: SkillResult[]; res: SkillResult[];
constructor(skill: Skill, splayer?: PlayerHandler, spet?: PetHandler, dstobj?: any, dsttype?: GameUnitType) { constructor(skill: Skill, splayer?: PlayerHandler, spet?: PetHandler, dstobj?: any, dsttype?: GameUnitType) {
@ -59,6 +62,7 @@ export class SkillTarget{
this.srcskillid = skill._id; this.srcskillid = skill._id;
this.dst = dstobj; this.dst = dstobj;
this.dsttype = dsttype; this.dsttype = dsttype;
this.lasttime = skill._data.indicate_time;
}; };
public LoadParam(sp: SkillParam){ public LoadParam(sp: SkillParam){
@ -82,6 +86,7 @@ export class SkillTarget{
public success(efftype: number, effres: number){ public success(efftype: number, effres: number){
this.checkRes(); this.checkRes();
this.res.push(new SkillResult(efftype, effres, true)); this.res.push(new SkillResult(efftype, effres, true));
this.bresok = true;
}; };
public fail(efftype: number, err: number){ public fail(efftype: number, err: number){
@ -89,6 +94,10 @@ export class SkillTarget{
this.res.push(new SkillResult(efftype, 0, false, err)); this.res.push(new SkillResult(efftype, 0, false, err));
}; };
public getLastTime(){
return this.bresok? this.lasttime: 0;
};
public exportData(): SkillInfoMsg{ public exportData(): SkillInfoMsg{
let msg = new SkillInfoMsg(); let msg = new SkillInfoMsg();
msg.data = new SkillInfoData(); msg.data = new SkillInfoData();