吸血处理

This commit is contained in:
yuexin 2021-01-04 13:57:51 +08:00
parent f1ddeb7b38
commit 74925e8768
3 changed files with 28 additions and 9 deletions

View File

@ -729,8 +729,7 @@ export class BattleHandler {
};
public onPlayerDropCardNotify(aplayer: PlayerHandler, count: number, from?: PlayerHandler): number{
this._room.giveUpCard(aplayer.getId(), count);
return count;
return this._room.giveUpCard(aplayer.getId(), count);
};
public onSkillResultNotify(skillres: SkillTarget[]){

View File

@ -466,6 +466,14 @@ export class PetHandler {
return this._isSilent;
};
public canHPS(){
return this._hps > 0;
};
public HPS(value: number): number{
return this._hps * Math.abs(value);
};
public summonPet(petid: number, count: number = 1, exparam: SkillParam):number{
return this._owner.summonPet(petid, count, exparam);
};

View File

@ -462,8 +462,14 @@ export class Skill {
if(dthp != 0){
tgt.success(SkillEffectType.HURT_HP, dthp);
}
if(!this.canEM()){
//todo: 吸血
let hv = n + dthp;
let pet = tgt.srcPet();
if(!this.canEM() && hv != 0 && pet && pet.canHPS()){
//吸血
let sv = pet.HPS(hv);
if(sv != 0){
tgt.success(SkillEffectType.HURT_POWER, sv, true);
}
}
}else{
tgt.fail(efftype, -1);
@ -674,9 +680,9 @@ export class Skill {
let obj = tgt.srcpet? tgt.srcpet: tgt.srcplayer;
let v = effvalue;
let oldhp = tgt.dst.getHP();
let res = obj.attack(this, (tgt.dst as PetHandler), param, v, isAtkBack);
if(res <= 0){
tgt.success(efftype, res);
let n = obj.attack(this, (tgt.dst as PetHandler), param, v, isAtkBack);
if(n <= 0){
tgt.success(efftype, n);
// if(this._data.quoteskillid){
// let dp = this._data.skill_users? param.oppClone(): param;
// let pet = tgt.srcpet;
@ -689,8 +695,14 @@ export class Skill {
if(dthp != 0){
tgt.success(SkillEffectType.HURT_HP, dthp);
}
if(!this.canEM()){
//todo: 吸血
let hv = n + dthp;
let pet = tgt.srcPet();
if(!this.canEM() && hv != 0 && pet && pet.canHPS()){
//吸血
let sv = pet.HPS(hv);
if(sv != 0){
tgt.success(SkillEffectType.HURT_POWER, sv, true);
}
}
}else{
tgt.fail(efftype, -1);