光环处理
This commit is contained in:
parent
d8e6a96dae
commit
3d9c6b6c15
@ -23,7 +23,7 @@ export class PetHandler {
|
||||
_dieSkills: Skill[] = [];
|
||||
_halos: Skill[] = [];
|
||||
|
||||
_effhalos: Skill[] = [];
|
||||
_effhalos: Map<Skill, number> = new Map();
|
||||
|
||||
_waitskills: Skill[] = [];
|
||||
|
||||
@ -126,13 +126,13 @@ export class PetHandler {
|
||||
};
|
||||
|
||||
public clearEffHalos(){
|
||||
this._effhalos.length = 0;
|
||||
this._effhalos.clear();
|
||||
// this._exap = 0;
|
||||
};
|
||||
|
||||
private _addEffHalo(skill: Skill): boolean{
|
||||
if(!this.hasEffHalo(skill)){
|
||||
this._effhalos.push(skill);
|
||||
this._effhalos.set(skill, skill.getHaloValue());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -141,8 +141,8 @@ export class PetHandler {
|
||||
|
||||
public getEffHaloV(): number{
|
||||
let n = 0;
|
||||
this._effhalos.forEach((item: Skill) => {
|
||||
n += item.getHaloValue();
|
||||
this._effhalos.forEach((value: number) => {
|
||||
n += value;
|
||||
});
|
||||
return n;
|
||||
// return this._exap;
|
||||
@ -150,8 +150,8 @@ export class PetHandler {
|
||||
|
||||
public getExSkills(): number[]{
|
||||
let lst: number[] = [];
|
||||
this._effhalos.forEach((item: Skill) =>{
|
||||
lst.push(item._data.id);
|
||||
this._effhalos.forEach((value: number, key: Skill) =>{
|
||||
lst.push(key._data.id);
|
||||
});
|
||||
return lst;
|
||||
};
|
||||
@ -245,11 +245,17 @@ export class PetHandler {
|
||||
this._bakTotalap = this.totalAP();
|
||||
|
||||
let n = -value;
|
||||
for(let i = 0; i < this._effhalos.length;i++){
|
||||
let dv = this._effhalos[i].addHaloValue(n);
|
||||
n -= dv;
|
||||
if(n >= 0){
|
||||
break;
|
||||
|
||||
for( let [k, v] of this._effhalos){
|
||||
if(v > 0){
|
||||
n += v;
|
||||
if(n >= 0){
|
||||
this._effhalos.set(k, n);
|
||||
break;
|
||||
}else{
|
||||
this._effhalos.set(k, 0);
|
||||
n += v;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(n >= 0){
|
||||
@ -420,8 +426,8 @@ export class PetHandler {
|
||||
}
|
||||
|
||||
if(!this.isAlive()){
|
||||
this._effhalos.forEach((item: Skill) => {
|
||||
item.resetHaloValue();
|
||||
this._effhalos.forEach((v: number, k: Skill) => {
|
||||
this._effhalos.set(k, k.getHaloValue());
|
||||
});
|
||||
|
||||
this._baseap = this._bakBaseap;
|
||||
@ -510,7 +516,7 @@ export class PetHandler {
|
||||
};
|
||||
|
||||
public hasEffHalo(skill: Skill): boolean{
|
||||
return this._effhalos.includes(skill);
|
||||
return this._effhalos.has(skill);
|
||||
};
|
||||
|
||||
// 自己的光环是否加到apet上
|
||||
@ -534,10 +540,10 @@ export class PetHandler {
|
||||
// remove掉apet的光环
|
||||
public removeEffHalo(apet: PetHandler): boolean{
|
||||
let bok = false;
|
||||
for(let i = this._effhalos.length - 1; i >=0;i--){
|
||||
let sk = this._effhalos[i];
|
||||
if(apet.hasHalo(sk)){
|
||||
this._effhalos.splice(i, 1);
|
||||
|
||||
for(let [k, v] of this._effhalos){
|
||||
if(apet.hasHalo(k)){
|
||||
this._effhalos.delete(k);
|
||||
bok = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user