Merge branch 'master' of git.kingsome.cn:node/card_svr

This commit is contained in:
zhl 2020-12-10 09:36:54 +08:00
commit 198685ae48
4 changed files with 30 additions and 36 deletions

View File

@ -62,6 +62,9 @@ export class PetHandler {
this._baseap += CfgMan.calcEnhanceValue(this._cfg.edd_effid, this._cfg.edd_effnum,
param.edd_cnt, this._baseap);
}
this._ceilBaseAP();
this._skills.clear();
this.addSkill(this._cfg.base_skill1id);
@ -72,13 +75,15 @@ export class PetHandler {
this.addSkill(skillid);
});
if(this._halos.length > 0){
this._owner.onHaloAdd(this, false);
}
this._owner.onHaloAdd(this, false);
this.born(param);
};
private _ceilBaseAP(){
this._baseap = Math.ceil(this._baseap);
};
private _isEnhancePower(enid: number){
return enid == EnhanceEffectType.EN_POWER_BYCFG || enid == EnhanceEffectType.EN_POWER_BYAP;
};
@ -92,7 +97,7 @@ export class PetHandler {
// this._exap = 0;
};
public addEffHalo(skill: Skill): boolean{
private _addEffHalo(skill: Skill): boolean{
if(!this.hasEffHalo(skill)){
this._effhalos.push(skill);
return true;
@ -193,6 +198,7 @@ export class PetHandler {
}
if(n < 0){
this._baseap += n;
this._ceilBaseAP();
}
this.dataChanged();
if(this._baseap < 0){
@ -206,6 +212,7 @@ export class PetHandler {
return 0;
}
this._baseap += value;
this._ceilBaseAP();
this.dataChanged();
if(this._baseap < 0){
this.die();
@ -274,11 +281,11 @@ export class PetHandler {
};
// 自己的光环是否加到apet上
public checkHalo(apet: PetHandler): boolean{
public addEffHalo(apet: PetHandler): boolean{
let bok = false;
this._halos.forEach((item: Skill)=>{
if(item.isEffSelfPet(this, apet)){
if(apet.addEffHalo(item)){
if(apet._addEffHalo(item)){
bok = true;
} // 暂时都加战力
}

View File

@ -86,10 +86,10 @@ export class PlayerHandler {
(idx >= 0) && this._pets.splice(idx, 1);
};
public getPet(pet: Pet){
public getPet(pet: Pet): PetHandler{
return this._pets.find((item:PetHandler)=>{
return item._pet == pet;
})
});
};
public exportAllPets(skill: Skill, param: SkillParam, expet: PetHandler, dst: SkillTarget[]): SkillTarget[]{
@ -280,56 +280,37 @@ export class PlayerHandler {
};
public onHaloAdd(apet: PetHandler, only_checkother: boolean = false){
let bkself = this._self._effhalos.length;
let bkpets: number[] = [];
let lst: PetHandler[] = [];
if(only_checkother){
this._pets.forEach((obj: PetHandler)=>{
if(apet.checkHalo(obj)){
if(apet.addEffHalo(obj)){
lst.push(obj);
}
});
if(this._self != apet){
if(apet.checkHalo(this._self)){
if(apet.addEffHalo(this._self)){
lst.push(this._self);
}
}
}else{
this._self.clearEffHalos();
this._pets.forEach((obj:PetHandler)=>{
bkpets.push(obj._effhalos.length);
obj.clearEffHalos();
});
apet.checkHalo(apet);
apet.addEffHalo(apet);
this._pets.forEach((obj: PetHandler)=>{
if(obj != apet){
obj.checkHalo(apet);
apet.checkHalo(obj);
obj.addEffHalo(apet);
if(apet.addEffHalo(obj)){
lst.push(obj);
}
}
});
if(this._self != apet){
this._self.checkHalo(apet);
apet.checkHalo(this._self);
}
if(bkself != this._self._effhalos.length){
if(this._self != apet){
this._self.addEffHalo(apet);
if(apet.addEffHalo(this._self)){
lst.push(this._self);
}
}
for(let i = 0; i < bkpets.length; i++){
let bk = bkpets[i];
let obj = this._pets[i];
if(obj != apet && obj._effhalos.length != bk){
lst.push(obj);
}
}
}
this._owner.onUpdatePetsNotify(lst);

View File

@ -144,12 +144,17 @@ export class Skill {
switch(this._data.targetid){
case GameUnitType.BATTLEUNIT:
tgok = this.isInRange(srcpet, dstpet);
break;
case GameUnitType.HERO:
tgok = dstpet._isHero;
break;
case GameUnitType.PET:
if(!dstpet._isHero){
tgok = this.isInRange(srcpet, dstpet);
}
break;
default:
break;
}
return tgok;
};

View File

@ -110,6 +110,7 @@ let TriggerManager = {
tgts.forEach((item)=>{
sender.taunt(item);
});
break;
case SkillEffectType.HURT_HP:
tgts.forEach((item)=>{
sender.handleHP(effv + env, item);