增加状态变化的来源
This commit is contained in:
parent
9684468f7c
commit
960e8afa85
@ -6,7 +6,7 @@ import CfgMan from "../CfgMan";
|
||||
import { EffectCardType, GameCampType, GameUnitType, SkillRangeUnitType } from "../skill/SkillConst";
|
||||
import { Pet } from "rooms/schema/Pet";
|
||||
import {SkillParam, SkillTarget} from "../skill/SkillParam";
|
||||
import { Room } from "colyseus";
|
||||
import { nosync, Room } from "colyseus";
|
||||
import { Skill } from "../skill/Skill";
|
||||
import { PetHandler } from "./PetHandler";
|
||||
import { SKillEffectData, SkillInfoMsg } from "message/SkillInfo";
|
||||
@ -723,11 +723,11 @@ export class BattleHandler {
|
||||
return this._room.sNeedChangePet(aplayer.getId());
|
||||
};
|
||||
|
||||
public onUpdatePetNotify(apet: PetHandler){
|
||||
return this._room.updatePet([apet.exportInfo()]);
|
||||
public onUpdatePetNotify(apet: PetHandler, from?: PetHandler){
|
||||
return this._room.updatePet([apet.exportInfo()], from? from._owner.getId(): null);
|
||||
};
|
||||
|
||||
public onUpdatePetsNotify(pets: PetHandler[]){
|
||||
public onUpdatePetsNotify(pets: PetHandler[], from?: PetHandler){
|
||||
if(!pets || pets.length <= 0){
|
||||
return;
|
||||
}
|
||||
@ -735,7 +735,7 @@ export class BattleHandler {
|
||||
pets.forEach((item: PetHandler)=>{
|
||||
lst.push(item.exportInfo());
|
||||
});
|
||||
return this._room.updatePet(lst);
|
||||
return this._room.updatePet(lst, from? from._owner.getId(): null);
|
||||
};
|
||||
|
||||
public onPlayerAddCardNotify(aplayer: PlayerHandler, count: number, maxcount: number,
|
||||
@ -755,7 +755,7 @@ export class BattleHandler {
|
||||
};
|
||||
|
||||
public onPlayerDropCardNotify(aplayer: PlayerHandler, count: number, from?: PlayerHandler): number{
|
||||
return this._room.giveUpCard(aplayer.getId(), count);
|
||||
return this._room.giveUpCard(aplayer.getId(), count, from? from.getId(): null);
|
||||
};
|
||||
|
||||
public onSkillResultNotify(skillres: SkillTarget[]){
|
||||
@ -818,8 +818,8 @@ export class BattleHandler {
|
||||
// });
|
||||
};
|
||||
|
||||
public onPlayerAddHPNotify(aplayer: PlayerHandler, addhp: number){
|
||||
return this._room.updateHp(aplayer.getId(), addhp);
|
||||
public onPlayerAddHPNotify(aplayer: PlayerHandler, addhp: number, from?: PlayerHandler){
|
||||
return this._room.updateHp(aplayer.getId(), addhp, from? from.getId(): null);
|
||||
};
|
||||
//end------------------------------------------------
|
||||
|
||||
|
@ -233,7 +233,7 @@ export class PetHandler {
|
||||
return this._owner.handleSkill(skillid, count, obj, this);
|
||||
};
|
||||
|
||||
public subAP(value: number):number {
|
||||
public subAP(value: number, from: PetHandler):number {
|
||||
// this._exap += value;
|
||||
// if(this._exap < 0){
|
||||
// this._baseap += this._exap;
|
||||
@ -264,10 +264,10 @@ export class PetHandler {
|
||||
return -value;
|
||||
}
|
||||
|
||||
return this.addBaseAP(n);
|
||||
return this.addBaseAP(n, from);
|
||||
};
|
||||
|
||||
public addBaseAP(value: number): number{
|
||||
public addBaseAP(value: number, from: PetHandler): number{
|
||||
if(value == 0){
|
||||
return 0;
|
||||
}
|
||||
@ -285,7 +285,7 @@ export class PetHandler {
|
||||
let tmp = this._baseap;
|
||||
this._baseap = 0;
|
||||
this.dataChanged();
|
||||
this.addHP(tmp);
|
||||
this.addHP(tmp, from);
|
||||
}else{
|
||||
this.dataChanged();
|
||||
this.die();
|
||||
@ -298,7 +298,7 @@ export class PetHandler {
|
||||
return res;
|
||||
};
|
||||
|
||||
public addExAP(value: number, skill: Skill): number{
|
||||
public addExAP(value: number, from: PetHandler): number{
|
||||
// return this.addAP(value);
|
||||
return 0;
|
||||
};
|
||||
@ -319,7 +319,7 @@ export class PetHandler {
|
||||
return this._owner.getHP();
|
||||
};
|
||||
|
||||
public beHurt(value: number): number{
|
||||
public beHurt(value: number, from: PetHandler): number{
|
||||
let rv = value - value * this._exredhurt;
|
||||
if(rv < 0){
|
||||
rv = 0;
|
||||
@ -331,7 +331,7 @@ export class PetHandler {
|
||||
}
|
||||
}
|
||||
|
||||
let res = this.subAP(rv);
|
||||
let res = this.subAP(rv, from);
|
||||
|
||||
if(res != 0){
|
||||
this._owner.onBeHurt(this, res);
|
||||
@ -340,7 +340,7 @@ export class PetHandler {
|
||||
return res;
|
||||
};
|
||||
|
||||
public addHP(value: number){
|
||||
public addHP(value: number, from: PetHandler){
|
||||
if(value == 0){
|
||||
return 0;
|
||||
}
|
||||
@ -350,8 +350,7 @@ export class PetHandler {
|
||||
this._owner.simpleCheckSkills([this._rebornskill], this);
|
||||
return 0;
|
||||
}
|
||||
this._owner.addHP(value);
|
||||
return this._owner.addHP(value);
|
||||
return this._owner.addHP(value, from);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
@ -411,7 +410,7 @@ export class PetHandler {
|
||||
|
||||
let bakap = apet.totalAP();
|
||||
|
||||
let n = apet.beHurt(myap);
|
||||
let n = apet.beHurt(myap, this);
|
||||
|
||||
!isAtkBack && this._owner.onBeAttack(apet, param);
|
||||
|
||||
|
@ -304,12 +304,20 @@ export class PlayerHandler {
|
||||
return this._owner.onPlayerDropCardNotify(this, count, from);
|
||||
};
|
||||
|
||||
public addHP(value: number): number{
|
||||
public addHP(value: number, from: PetHandler): number{
|
||||
let oldhp = this.getHP();
|
||||
let newhp = this._owner.onPlayerAddHPNotify(this, value);
|
||||
let newhp = this._owner.onPlayerAddHPNotify(this, value, from._owner);
|
||||
return newhp - oldhp;
|
||||
};
|
||||
|
||||
public addBaseAP(value: number, from: PetHandler): number{
|
||||
return this._self? this._self.addBaseAP(value, from): 0;
|
||||
};
|
||||
|
||||
public addExAP(value: number, from: PetHandler): number{
|
||||
return 0;
|
||||
};
|
||||
|
||||
public getHP(){
|
||||
return this._player.hp;
|
||||
};
|
||||
@ -369,8 +377,8 @@ export class PlayerHandler {
|
||||
return this._self? this._self.attack(sk, apet, param, ev, isAtkBack): 0;
|
||||
};
|
||||
|
||||
public beHurt(value: number): number{
|
||||
return this._self? this._self.beHurt(value): 0;
|
||||
public beHurt(value: number, from: PetHandler): number{
|
||||
return this._self? this._self.beHurt(value, from): 0;
|
||||
};
|
||||
|
||||
public beSilent(count: number){
|
||||
|
@ -384,7 +384,7 @@ export class Skill {
|
||||
switch(efftype){
|
||||
case SkillEffectType.CARD_ADD:
|
||||
if(tgt.dsttype == GameUnitType.PLAYER){
|
||||
let n = (tgt.dst as PlayerHandler).addCard(res, tgt.srcplayer);
|
||||
let n = (tgt.dst as PlayerHandler).addCard(res, tgt.srcPlayer());
|
||||
if(n >= 0){
|
||||
tgt.success(efftype, n);
|
||||
}else{
|
||||
@ -396,7 +396,7 @@ export class Skill {
|
||||
break;
|
||||
case SkillEffectType.CARD_ADD_LIMIT:
|
||||
if(tgt.dsttype == GameUnitType.PLAYER){
|
||||
let n = (tgt.dst as PlayerHandler).addCardLimit(res, tgt.srcplayer);
|
||||
let n = (tgt.dst as PlayerHandler).addCardLimit(res, tgt.srcPlayer());
|
||||
if(n >= 0){
|
||||
tgt.success(efftype, n);
|
||||
}else{
|
||||
@ -426,7 +426,7 @@ export class Skill {
|
||||
let cardid = this._data.quotecardid;
|
||||
let ncount = this.getQuoteValue(this._data.quotecard_times, this._data.quotecard_timesmax, this._orign_effcnt);
|
||||
|
||||
let n = (tgt.dst as PlayerHandler).addDirectCard(cardid, ncount, tgt.srcplayer);
|
||||
let n = (tgt.dst as PlayerHandler).addDirectCard(cardid, ncount, tgt.srcPlayer());
|
||||
if(n >= 0){
|
||||
tgt.success(efftype, n);
|
||||
}else{
|
||||
@ -439,7 +439,7 @@ export class Skill {
|
||||
case SkillEffectType.CARD_DROP:
|
||||
{
|
||||
if(tgt.dsttype == GameUnitType.PLAYER){
|
||||
let n = (tgt.dst as PlayerHandler).dropCard(res, tgt.srcplayer);
|
||||
let n = (tgt.dst as PlayerHandler).dropCard(res, tgt.srcPlayer());
|
||||
if(n >= 0){
|
||||
tgt.success(efftype, n);
|
||||
}else{
|
||||
@ -459,8 +459,9 @@ export class Skill {
|
||||
switch(efftype){
|
||||
case SkillEffectType.POWER_ENHANCE:
|
||||
case SkillEffectType.POWEREX_ENHANCE:
|
||||
if(tgt.dsttype != GameUnitType.NONE && tgt.dsttype != GameUnitType.PLAYER){
|
||||
let n = efftype == SkillEffectType.POWER_ENHANCE? (tgt.dst as PetHandler).addBaseAP(effvalue): (tgt.dst as PetHandler).addExAP(effvalue, this);
|
||||
if(tgt.dsttype != GameUnitType.NONE){
|
||||
let n = efftype == SkillEffectType.POWER_ENHANCE? tgt.dst.addBaseAP(effvalue, tgt.srcPet())
|
||||
: tgt.dst.addExAP(effvalue, tgt.srcPet());
|
||||
tgt.success(efftype, n);
|
||||
}else{
|
||||
tgt.fail(efftype, -1);
|
||||
@ -471,7 +472,7 @@ export class Skill {
|
||||
let effv = this.EMV(effvalue);
|
||||
if(tgt.dsttype != GameUnitType.NONE){
|
||||
let oldhp = tgt.dst.getHP();
|
||||
let n = tgt.dst.beHurt(effv);
|
||||
let n = tgt.dst.beHurt(effv, tgt.srcPet());
|
||||
if(n != 0){
|
||||
tgt.success(SkillEffectType.HURT_POWER, n);
|
||||
}
|
||||
@ -501,7 +502,7 @@ export class Skill {
|
||||
let efftype = SkillEffectType.HURT_HP;
|
||||
if(tgt.dsttype != GameUnitType.NONE){
|
||||
let effv = this.EMV(effvalue);
|
||||
let n = tgt.dst.addHP(effv);
|
||||
let n = tgt.dst.addHP(effv, tgt.srcPet());
|
||||
tgt.success(efftype, n);
|
||||
}else{
|
||||
tgt.fail(efftype, -1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user