小修改

This commit is contained in:
yuexin 2021-01-15 18:18:35 +08:00
parent 795232ce2d
commit d7af91972e

View File

@ -68,6 +68,10 @@ export class SkillResult{
this.err = err;
this.bsuccess = issuccess;
this.beffsrc = issrc;
};
public isSame(efftype: number, issrc: boolean): boolean{
return this.bsuccess && this.effect_type == efftype && this.beffsrc == issrc;
}
};
@ -202,9 +206,23 @@ export class SkillTarget{
}
};
public findRes(efftype: number, effsrc: boolean): SkillResult{
for(let i =0; i < this.res.length; i++){
if(this.res[i].isSame(efftype, effsrc)){
return this.res[i];
}
}
return null;
};
public success(efftype: number, effres: number, effsrc: boolean = false){
this.checkRes();
this.res.push(new SkillResult(efftype, effres, true, 0, effsrc));
let obj = this.findRes(efftype, effsrc);
if(obj){
obj.effect_res += effres;
}else{
this.res.push(new SkillResult(efftype, effres, true, 0, effsrc));
}
this.bresok = true;
};