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