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

View File

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

View File

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

View File

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