Merge branch 'second' of git.kingsome.cn:node/card_svr into second
This commit is contained in:
commit
f1ddeb7b38
@ -255,7 +255,7 @@ export class BattleHandler {
|
||||
let lst: SkillTarget[] = [];
|
||||
lst.push(st.oppClone());
|
||||
if(this.isFlowing()){
|
||||
this._cacheSkills.push(...lst);
|
||||
this._cacheSkills.push(...lst);
|
||||
}
|
||||
return lst;
|
||||
};
|
||||
@ -293,8 +293,8 @@ export class BattleHandler {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(this.isFlowing()){
|
||||
this._cacheSkills.push(...lst);
|
||||
if(this.isFlowing() && lst.length > 0){
|
||||
this._cacheSkills.push(...lst);
|
||||
}
|
||||
return lst;
|
||||
};
|
||||
@ -516,7 +516,15 @@ export class BattleHandler {
|
||||
public onCardLinkReady(aplayer: Player, fromplayer?: Player){
|
||||
let ph = this.getPlayer(aplayer);
|
||||
let fromph = this.getPlayer(fromplayer);
|
||||
ph && ph.onCardLinkReady(fromph);
|
||||
if(!ph){
|
||||
return 0;
|
||||
}
|
||||
|
||||
this.beginFlow();
|
||||
|
||||
ph.onCardLinkReady(fromph);
|
||||
|
||||
return this.endFlow();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -576,7 +584,14 @@ export class BattleHandler {
|
||||
public onCardDroped(aplayer: Player, dropcards: Card[], fromplayer?: Player){
|
||||
let ph = this.getPlayer(aplayer);
|
||||
let fromph = this.getPlayer(fromplayer);
|
||||
ph && ph.onCardDroped(dropcards, fromph);
|
||||
if(!ph){
|
||||
return 0;
|
||||
}
|
||||
this.beginFlow();
|
||||
|
||||
ph.onCardDroped(dropcards, fromph);
|
||||
|
||||
return this.endFlow();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -591,7 +606,14 @@ export class BattleHandler {
|
||||
}
|
||||
let ph = this.getPlayer(aplayer);
|
||||
let fromph = this.getPlayer(fromplayer);
|
||||
ph && ph.onCardGetted(getcards, fromph);
|
||||
if(!ph){
|
||||
return 0;
|
||||
}
|
||||
this.beginFlow();
|
||||
|
||||
ph.onCardGetted(getcards, fromph);
|
||||
|
||||
return this.endFlow();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -706,6 +728,11 @@ export class BattleHandler {
|
||||
fromplayer: from? from.getId(): null});
|
||||
};
|
||||
|
||||
public onPlayerDropCardNotify(aplayer: PlayerHandler, count: number, from?: PlayerHandler): number{
|
||||
this._room.giveUpCard(aplayer.getId(), count);
|
||||
return count;
|
||||
};
|
||||
|
||||
public onSkillResultNotify(skillres: SkillTarget[]){
|
||||
if(!skillres || skillres.length <= 0){
|
||||
return;
|
||||
@ -768,6 +795,14 @@ export class BattleHandler {
|
||||
|
||||
public onPlayerAddHPNotify(aplayer: PlayerHandler, addhp: number){
|
||||
return this._room.updateHp(aplayer.getId(), addhp);
|
||||
}
|
||||
};
|
||||
//end------------------------------------------------
|
||||
|
||||
public onSkillResult(skillres: SkillTarget[]){
|
||||
if(this.isFlowing()){ //已处理过
|
||||
// this._cacheSkills.push(...skillres);
|
||||
}else{
|
||||
this.onSkillResultNotify(skillres);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import CfgMan from "../CfgMan";
|
||||
import {Skill} from "../skill/Skill";
|
||||
import SkillMan from "../skill/SkillMan";
|
||||
|
||||
import { EnhanceEffectType, PowerValueType, TriggerType } from "../skill/SkillConst";
|
||||
import { EnhanceEffectType, PowerValueType, SkillEffectType, TriggerType } from "../skill/SkillConst";
|
||||
import { PlayerHandler } from "./PlayerHandler";
|
||||
import { PetInfo, PetInfoMsg } from "../../../message/PetInfo";
|
||||
import { SkillParam, SkillTarget } from "../skill/SkillParam";
|
||||
@ -50,6 +50,8 @@ export class PetHandler {
|
||||
|
||||
_selfskills: number[] = [];
|
||||
|
||||
_buffs: Map<number, number> = new Map();
|
||||
|
||||
_idx: number;
|
||||
|
||||
_bakBaseap: number;
|
||||
@ -252,7 +254,7 @@ export class PetHandler {
|
||||
}
|
||||
if(n >= 0){
|
||||
this.dataChanged();
|
||||
return value;
|
||||
return -value;
|
||||
}
|
||||
|
||||
return this.addBaseAP(n);
|
||||
@ -267,9 +269,11 @@ export class PetHandler {
|
||||
return 0;
|
||||
}
|
||||
|
||||
let res = value;
|
||||
this._bakBaseap = this._baseap;
|
||||
this._baseap += value;
|
||||
if(this._baseap <= 0){
|
||||
res = -this._bakBaseap;
|
||||
if(this._isHero){
|
||||
let tmp = this._baseap;
|
||||
this._baseap = 0;
|
||||
@ -284,7 +288,7 @@ export class PetHandler {
|
||||
this.dataChanged();
|
||||
}
|
||||
|
||||
return value;
|
||||
return res;
|
||||
};
|
||||
|
||||
public addExAP(value: number, skill: Skill): number{
|
||||
@ -304,11 +308,22 @@ export class PetHandler {
|
||||
this._bakTotalap = this.totalAP();
|
||||
};
|
||||
|
||||
public getHP(){
|
||||
return this._owner.getHP();
|
||||
};
|
||||
|
||||
public beHurt(value: number): number{
|
||||
let rv = value - value * this._exredhurt;
|
||||
if(rv < 0){
|
||||
return 0;
|
||||
rv = 0;
|
||||
}else if(rv > 0){
|
||||
// 圣盾减伤后消失
|
||||
if(this.hasShield()){
|
||||
this.delShield();
|
||||
rv = 0;
|
||||
}
|
||||
}
|
||||
|
||||
let res = this.subAP(rv);
|
||||
|
||||
if(res != 0){
|
||||
@ -320,19 +335,26 @@ export class PetHandler {
|
||||
|
||||
public addHP(value: number){
|
||||
if(value == 0){
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
if(this._isHero){
|
||||
if(this._owner.canBeKill(value) && this.canReborn()){
|
||||
// 直接复活
|
||||
this._owner.simpleCheckSkills([this._rebornskill], this);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
this._owner.addHP(value);
|
||||
return this._owner.addHP(value);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
public addHPS(value: number){
|
||||
this._hps += value;
|
||||
(value != 0) && this.dataChanged();
|
||||
return value;
|
||||
};
|
||||
|
||||
public addReduceHurt(value: number){
|
||||
this._exredhurt += value;
|
||||
(value != 0) && this.dataChanged();
|
||||
@ -458,6 +480,19 @@ export class PetHandler {
|
||||
return count;
|
||||
};
|
||||
|
||||
public hasShield(): boolean{
|
||||
return this._buffs.get(SkillEffectType.BUFF_SHIELD) > 0;
|
||||
};
|
||||
|
||||
public delShield(): boolean{
|
||||
let n = this.delBuff(SkillEffectType.BUFF_SHIELD);
|
||||
if(n >= 0){
|
||||
this.dataChanged();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
public hasHaloSkill(): boolean{
|
||||
return this._halos.length > 0;
|
||||
};
|
||||
@ -476,8 +511,8 @@ export class PetHandler {
|
||||
this._halos.forEach((item: Skill)=>{
|
||||
if(item.isEffSelfPet(this, apet)){
|
||||
if(item.isAPHaloSkill()){
|
||||
bok = true;
|
||||
if(apet._addEffHalo(item)){
|
||||
bok = true;
|
||||
} // 加战力
|
||||
}else if(item.isBuffHaloSkill()){
|
||||
item.trigger(new SkillParam(0, 0, 0, this._owner,
|
||||
@ -502,6 +537,41 @@ export class PetHandler {
|
||||
return bok;
|
||||
};
|
||||
|
||||
public addBuff(buffid: number, buffcount: number = 1): number{
|
||||
let n = this._buffs.get(buffid);
|
||||
// todo: 暂时不叠加
|
||||
if(n){
|
||||
return n;
|
||||
}
|
||||
let cnt = buffcount;
|
||||
this._buffs.set(buffid, cnt);
|
||||
this.dataChanged();
|
||||
return cnt;
|
||||
};
|
||||
|
||||
public delBuff(buffid: number, buffcount: number = 0): number{
|
||||
let n = this._buffs.get(buffid);
|
||||
if(typeof(n) != 'number'){
|
||||
return -1;
|
||||
}
|
||||
if(buffcount == 0){
|
||||
n = 0;
|
||||
}else{
|
||||
n-=buffcount;
|
||||
if(n < 0){
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(n <= 0){
|
||||
this._buffs.delete(buffid);
|
||||
}else{
|
||||
this._buffs.set(buffid, n);
|
||||
}
|
||||
this.dataChanged();
|
||||
return n;
|
||||
};
|
||||
|
||||
public checkSkills(tgtype: TriggerType, tgtv: any, sp: SkillParam, cb?: any){
|
||||
if(this._isSilent){
|
||||
return;
|
||||
@ -548,7 +618,7 @@ export class PetHandler {
|
||||
obj.effectCount = this._orignEffCnt;
|
||||
obj.hps = this._hps;
|
||||
obj.point = this._orignCardPoint;
|
||||
obj.buffs = [];
|
||||
obj.buffs = [...this._buffs.keys()];
|
||||
return obj;
|
||||
};
|
||||
|
||||
|
@ -300,14 +300,28 @@ export class PlayerHandler {
|
||||
return this._owner.onPlayerStealCardNotify(this, dstplayer, count);
|
||||
};
|
||||
|
||||
public dropCard(count: number, from?: PlayerHandler): number{
|
||||
return this._owner.onPlayerDropCardNotify(this, count, from);
|
||||
};
|
||||
|
||||
public addHP(value: number): number{
|
||||
return this._owner.onPlayerAddHPNotify(this, value);
|
||||
let oldhp = this.getHP();
|
||||
let newhp = this._owner.onPlayerAddHPNotify(this, value);
|
||||
return newhp - oldhp;
|
||||
};
|
||||
|
||||
public getHP(){
|
||||
return this._player.hp;
|
||||
};
|
||||
|
||||
public addHPS(value: number): number{
|
||||
return this._self? this._self.addHPS(value): 0;
|
||||
};
|
||||
|
||||
public getHPS(): number{
|
||||
return this._self? this._self._hps: 0;
|
||||
};
|
||||
|
||||
public addEM(value: number): number{
|
||||
return this._self? this._self.addEM(value): 0;
|
||||
};
|
||||
@ -326,6 +340,10 @@ export class PlayerHandler {
|
||||
}
|
||||
};
|
||||
|
||||
public addReduceHurt(value: number){
|
||||
return this._self? this._self.addReduceHurt(value): 0;
|
||||
};
|
||||
|
||||
public totalAP(){
|
||||
return this._self? this._self.totalAP(): 0;
|
||||
};
|
||||
@ -351,10 +369,18 @@ 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 beSilent(count: number){
|
||||
return this._self? this._self.beSilent(count): 0;
|
||||
};
|
||||
|
||||
public taunt(){
|
||||
this._self && this._self.taunt();
|
||||
};
|
||||
|
||||
public canBeKill(subhp: number): boolean{
|
||||
if(subhp >= 0){
|
||||
return false;
|
||||
@ -639,7 +665,7 @@ export class PlayerHandler {
|
||||
});
|
||||
});
|
||||
|
||||
// this._owner.onSkillResultNotify(reslst);
|
||||
this._owner.onSkillResult(reslst);
|
||||
};
|
||||
|
||||
singleCheckSkills(apet: PetHandler, tgttype: TriggerType, tgtvalue?: any, tgtsp?: SkillParam){
|
||||
@ -657,7 +683,7 @@ export class PlayerHandler {
|
||||
reslst.push(st);
|
||||
}
|
||||
});
|
||||
// this._owner.onSkillResultNotify(reslst);
|
||||
this._owner.onSkillResult(reslst);
|
||||
};
|
||||
|
||||
simpleCheckSkills(skills: Skill[], apet?: PetHandler, param?: SkillParam): SkillTarget[]{
|
||||
@ -683,7 +709,7 @@ export class PlayerHandler {
|
||||
});
|
||||
});
|
||||
|
||||
// this._owner.onSkillResultNotify(reslst);
|
||||
this._owner.onSkillResult(reslst);
|
||||
|
||||
return reslst;
|
||||
};
|
||||
@ -705,5 +731,13 @@ export class PlayerHandler {
|
||||
|
||||
addTotalCard(v: number){
|
||||
this._totalcc += v;
|
||||
};
|
||||
|
||||
addBuff(buffid: number, buffcount: number = 1): number{
|
||||
return this._self? this._self.addBuff(buffid, buffcount): 0;
|
||||
};
|
||||
|
||||
delBuff(buffid: number, buffcount: number = 0): number{
|
||||
return this._self? this._self.delBuff(buffid, buffcount): -1;
|
||||
}
|
||||
}
|
||||
|
@ -108,11 +108,6 @@ export class Skill {
|
||||
return this._data.effect_typeid == SkillEffectType.CARD_CHG_EN;
|
||||
};
|
||||
|
||||
isHurtSkill(){
|
||||
return this._data.effect_typeid == SkillEffectType.HURT_POWER ||
|
||||
this._data.effect_typeid == SkillEffectType.HURT_ALL;
|
||||
};
|
||||
|
||||
isAttackSkill(){
|
||||
return this._data.effect_typeid == SkillEffectType.ATTACK;
|
||||
};
|
||||
@ -424,6 +419,20 @@ export class Skill {
|
||||
tgt.fail(efftype, -1);
|
||||
}
|
||||
break;
|
||||
case SkillEffectType.CARD_DROP:
|
||||
{
|
||||
if(tgt.dsttype == GameUnitType.PLAYER){
|
||||
let n = (tgt.dst as PlayerHandler).dropCard(res, tgt.srcplayer);
|
||||
if(n >= 0){
|
||||
tgt.success(efftype, n);
|
||||
}else{
|
||||
tgt.fail(efftype, n);
|
||||
}
|
||||
}else{
|
||||
tgt.fail(efftype, -1);
|
||||
}
|
||||
break;
|
||||
}break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -443,9 +452,19 @@ export class Skill {
|
||||
case SkillEffectType.HURT_POWER:
|
||||
case SkillEffectType.HURT_ALL:
|
||||
let effv = this.EMV(effvalue);
|
||||
if(tgt.dsttype != GameUnitType.NONE && tgt.dsttype != GameUnitType.PLAYER){
|
||||
let n = (tgt.dst as PetHandler).beHurt(effv);
|
||||
tgt.success(efftype, n);
|
||||
if(tgt.dsttype != GameUnitType.NONE){
|
||||
let oldhp = tgt.dst.getHP();
|
||||
let n = tgt.dst.beHurt(effv);
|
||||
if(n != 0){
|
||||
tgt.success(SkillEffectType.HURT_POWER, n);
|
||||
}
|
||||
let dthp = tgt.dst.getHP() - oldhp;
|
||||
if(dthp != 0){
|
||||
tgt.success(SkillEffectType.HURT_HP, dthp);
|
||||
}
|
||||
if(!this.canEM()){
|
||||
//todo: 吸血
|
||||
}
|
||||
}else{
|
||||
tgt.fail(efftype, -1);
|
||||
}
|
||||
@ -457,7 +476,7 @@ export class Skill {
|
||||
|
||||
handleHP(effvalue: number, tgt: SkillTarget){
|
||||
let efftype = SkillEffectType.HURT_HP;
|
||||
if(tgt.dsttype == GameUnitType.PLAYER || tgt.dsttype == GameUnitType.HERO){
|
||||
if(tgt.dsttype != GameUnitType.NONE){
|
||||
let effv = this.EMV(effvalue);
|
||||
let n = tgt.dst.addHP(effv);
|
||||
tgt.success(efftype, n);
|
||||
@ -466,6 +485,17 @@ export class Skill {
|
||||
}
|
||||
};
|
||||
|
||||
handleHPS(effvalue: number, tgt: SkillTarget){
|
||||
let efftype = SkillEffectType.HP_STEAL_ENHANCE;
|
||||
if(tgt.dsttype != GameUnitType.NONE){
|
||||
let effv = effvalue;
|
||||
let n = tgt.dst.addHPS(effv);
|
||||
tgt.success(efftype, n);
|
||||
}else{
|
||||
tgt.fail(efftype, -1);
|
||||
}
|
||||
};
|
||||
|
||||
summon(efftype: SkillEffectType, exparam: SkillParam, tgt: SkillTarget){
|
||||
switch(efftype){
|
||||
case SkillEffectType.SUMMON_NPC:
|
||||
@ -546,8 +576,8 @@ export class Skill {
|
||||
|
||||
taunt(tgt:SkillTarget){
|
||||
let efftype = SkillEffectType.TAUNT;
|
||||
if(tgt.dsttype != GameUnitType.NONE && tgt.dsttype != GameUnitType.PLAYER){
|
||||
(tgt.dst as PetHandler).taunt();
|
||||
if(tgt.dsttype != GameUnitType.NONE){
|
||||
tgt.dst.taunt();
|
||||
tgt.success(efftype, 1);
|
||||
}else{
|
||||
tgt.fail(efftype, -1);
|
||||
@ -555,13 +585,28 @@ export class Skill {
|
||||
};
|
||||
|
||||
addBuff(efftype: SkillEffectType, effvalue: number, tgt: SkillTarget){
|
||||
|
||||
switch(efftype){
|
||||
case SkillEffectType.BUFF_SHIELD:
|
||||
if(tgt.dsttype != GameUnitType.NONE){
|
||||
let n = tgt.dst.addBuff(efftype);
|
||||
if(n){
|
||||
tgt.success(efftype, n);
|
||||
}else{
|
||||
tgt.fail(efftype, n);
|
||||
}
|
||||
}else{
|
||||
tgt.fail(efftype, -1);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
reduceHurt(effvalue: number, tgt: SkillTarget){
|
||||
let efftype = SkillEffectType.HURT_REDUCE;
|
||||
if(tgt.dsttype != GameUnitType.NONE && tgt.dsttype != GameUnitType.PLAYER){
|
||||
let n = (tgt.dst as PetHandler).addReduceHurt(effvalue);
|
||||
if(tgt.dsttype != GameUnitType.NONE){
|
||||
let n = tgt.dst.addReduceHurt(effvalue);
|
||||
tgt.success(efftype, n);
|
||||
}else{
|
||||
tgt.fail(efftype, -1);
|
||||
@ -591,6 +636,10 @@ export class Skill {
|
||||
return effvalue + ev;
|
||||
};
|
||||
|
||||
canEM(){
|
||||
return this._data.spellpower;
|
||||
};
|
||||
|
||||
reborn(tgt: SkillTarget){
|
||||
let efftype = SkillEffectType.REBORN;
|
||||
if(tgt.dsttype != GameUnitType.NONE){
|
||||
@ -621,11 +670,12 @@ export class Skill {
|
||||
|
||||
attack(effvalue: number, tgt: SkillTarget, param: SkillParam, isAtkBack: boolean = false){
|
||||
let efftype = isAtkBack? SkillEffectType.ATTACK_BACK: SkillEffectType.ATTACK;
|
||||
if(tgt.dsttype == GameUnitType.HERO || tgt.dsttype == GameUnitType.PET){
|
||||
if(tgt.dsttype != GameUnitType.NONE && tgt.dsttype != GameUnitType.PLAYER){
|
||||
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){
|
||||
if(res <= 0){
|
||||
tgt.success(efftype, res);
|
||||
// if(this._data.quoteskillid){
|
||||
// let dp = this._data.skill_users? param.oppClone(): param;
|
||||
@ -635,6 +685,13 @@ export class Skill {
|
||||
// }
|
||||
// (tgt.dst as PetHandler).attack(pet, dp, 0, true);
|
||||
// }
|
||||
let dthp = tgt.dst.getHP() - oldhp;
|
||||
if(dthp != 0){
|
||||
tgt.success(SkillEffectType.HURT_HP, dthp);
|
||||
}
|
||||
if(!this.canEM()){
|
||||
//todo: 吸血
|
||||
}
|
||||
}else{
|
||||
tgt.fail(efftype, -1);
|
||||
}
|
||||
|
@ -164,6 +164,11 @@ export const enum SkillRangeUnitType{
|
||||
* 26.重生(并获得死前战力)
|
||||
* 27.遭受反击的伤害参数,减半
|
||||
* 28.使获得技能(引用技能ID)
|
||||
* 29.弃掉手牌
|
||||
* 30.获得圣盾:圣盾的拥有者,可以使自己受到的一次伤害数值为0(或视为规避一次伤害)
|
||||
数值0的伤害,不算受到伤害
|
||||
圣盾这个状态,在受到一次伤害后,便消失;且不可叠加次数。
|
||||
* 31.使目标的吸血+(数值%)
|
||||
*/
|
||||
export const enum SkillEffectType
|
||||
{
|
||||
@ -189,6 +194,9 @@ export const enum SkillEffectType
|
||||
REBORN = 26,
|
||||
ATTACK_BACK = 27,
|
||||
SKILL_GET = 28,
|
||||
CARD_DROP = 29,
|
||||
BUFF_SHIELD = 30,
|
||||
HP_STEAL_ENHANCE = 31,
|
||||
};
|
||||
|
||||
// 技能效果参数类型
|
||||
|
@ -50,12 +50,14 @@ export class SkillResult{
|
||||
effect_res: number;
|
||||
err: number;
|
||||
bsuccess: boolean;
|
||||
beffsrc: boolean;
|
||||
|
||||
constructor(efftype: number, effres: number, issuccess: boolean, err: number = 0) {
|
||||
constructor(efftype: number, effres: number, issuccess: boolean, err: number = 0, issrc: boolean = false) {
|
||||
this.effect_type = efftype;
|
||||
this.effect_res = effres;
|
||||
this.err = err;
|
||||
this.bsuccess = issuccess;
|
||||
this.beffsrc = issrc;
|
||||
}
|
||||
};
|
||||
|
||||
@ -71,7 +73,7 @@ export class SkillTarget{
|
||||
lasttime: number;
|
||||
bresok: boolean = false;
|
||||
|
||||
res: SkillResult;
|
||||
res: SkillResult[];
|
||||
|
||||
constructor(skill: Skill, splayer?: PlayerHandler, spet?: PetHandler, dstobj?: any, dsttype?: GameUnitType) {
|
||||
this.srcplayer = splayer;
|
||||
@ -119,6 +121,26 @@ export class SkillTarget{
|
||||
return (this.dst as PetHandler)._owner;
|
||||
};
|
||||
|
||||
public srcPet(): PetHandler{
|
||||
if(this.srcpet){
|
||||
return this.srcpet;
|
||||
}
|
||||
if(this.srcplayer){
|
||||
return this.srcplayer._self;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
public srcPlayer(): PlayerHandler{
|
||||
if(this.srcplayer){
|
||||
return this.srcplayer;
|
||||
}
|
||||
if(this.srcpet){
|
||||
return this.srcpet._owner;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
oppClone(){
|
||||
let st = new SkillTarget(this.srcskill);
|
||||
|
||||
@ -142,18 +164,20 @@ export class SkillTarget{
|
||||
};
|
||||
|
||||
public checkRes(){
|
||||
|
||||
if(!this.res){
|
||||
this.res = [];
|
||||
}
|
||||
};
|
||||
|
||||
public success(efftype: number, effres: number){
|
||||
public success(efftype: number, effres: number, effsrc: boolean = false){
|
||||
this.checkRes();
|
||||
this.res = new SkillResult(efftype, effres, true);
|
||||
this.res.push(new SkillResult(efftype, effres, true, 0, effsrc));
|
||||
this.bresok = true;
|
||||
};
|
||||
|
||||
public fail(efftype: number, err: number){
|
||||
this.checkRes();
|
||||
this.res = new SkillResult(efftype, 0, false, err);
|
||||
this.res.push(new SkillResult(efftype, 0, false, err));
|
||||
};
|
||||
|
||||
public getLastTime(){
|
||||
@ -171,18 +195,10 @@ export class SkillTarget{
|
||||
if(!this.res){
|
||||
msg.errcode = -1;
|
||||
}else{
|
||||
let ed = new SKillEffectData();
|
||||
if(this.dsttype == GameUnitType.PLAYER){
|
||||
ed.pos = 0;
|
||||
ed.player = (this.dst as PlayerHandler).getId();
|
||||
}else {
|
||||
ed.pos = (this.dst as PetHandler)._idx;
|
||||
ed.player = (this.dst as PetHandler)._owner.getId();
|
||||
}
|
||||
ed.effect_id = this.res.effect_type;
|
||||
ed.val = this.res.bsuccess? this.res.effect_res: this.res.err;
|
||||
ed.result = this.res.bsuccess? 0: -1;
|
||||
obj.datas.push(ed);
|
||||
this.res.forEach((item: SkillResult) => {
|
||||
let ed = this.exportResData(item);
|
||||
ed && obj.datas.push(ed);
|
||||
});
|
||||
}
|
||||
return msg;
|
||||
};
|
||||
@ -200,8 +216,24 @@ export class SkillTarget{
|
||||
obj.pos = st.srcpet? st.srcpet._idx: 0;
|
||||
obj.datas = [];
|
||||
lst.forEach((item: SkillTarget) => {
|
||||
if(item.res){
|
||||
let ed = new SKillEffectData();
|
||||
item.res && item.res.forEach((skres: SkillResult) => {
|
||||
let ed = item.exportResData(skres);
|
||||
ed && obj.datas.push(ed);
|
||||
});
|
||||
});
|
||||
return msg;
|
||||
};
|
||||
|
||||
public exportResData(skres: SkillResult, sk?: SkillTarget): SKillEffectData{
|
||||
let item = sk? sk: this;
|
||||
let res = skres;
|
||||
|
||||
if(res){
|
||||
let ed = new SKillEffectData();
|
||||
if(res.beffsrc){
|
||||
ed.pos = item.srcPet()._idx;
|
||||
ed.player = item.srcPlayer().getId();
|
||||
}else{
|
||||
if(item.dsttype == GameUnitType.PLAYER){
|
||||
ed.pos = 0;
|
||||
ed.player = (item.dst as PlayerHandler).getId();
|
||||
@ -209,14 +241,15 @@ export class SkillTarget{
|
||||
ed.pos = (item.dst as PetHandler)._idx;
|
||||
ed.player = (item.dst as PetHandler)._owner.getId();
|
||||
}
|
||||
|
||||
let res = item.res;
|
||||
ed.effect_id = res.effect_type;
|
||||
ed.val = res.bsuccess? res.effect_res: res.err;
|
||||
ed.result = res.bsuccess? 0: -1;
|
||||
obj.datas.push(ed);
|
||||
}
|
||||
});
|
||||
return msg;
|
||||
|
||||
ed.effect_id = res.effect_type;
|
||||
ed.val = res.bsuccess? res.effect_res: res.err;
|
||||
ed.result = res.bsuccess? 0: -1;
|
||||
|
||||
return ed;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
@ -99,6 +99,7 @@ let TriggerManager = {
|
||||
case SkillEffectType.CARD_STEAL:
|
||||
case SkillEffectType.CARD_CHG_EN:
|
||||
case SkillEffectType.CARD_GETDIRECT:
|
||||
case SkillEffectType.CARD_DROP:
|
||||
tgts.forEach((item)=>{
|
||||
sender.handleCard(effectid, effv, item);
|
||||
});
|
||||
@ -129,6 +130,7 @@ let TriggerManager = {
|
||||
});
|
||||
break;
|
||||
case SkillEffectType.POWER_ADD_BUFF:
|
||||
case SkillEffectType.BUFF_SHIELD:
|
||||
tgts.forEach((item)=>{
|
||||
sender.addBuff(effectid, effv, item);
|
||||
});
|
||||
@ -162,6 +164,11 @@ let TriggerManager = {
|
||||
sender.attack(ev, item, param, atkback);
|
||||
});
|
||||
break;
|
||||
case SkillEffectType.HP_STEAL_ENHANCE:
|
||||
tgts.forEach((item)=>{
|
||||
sender.handleHPS(effv, item);
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -171,23 +178,6 @@ let TriggerManager = {
|
||||
|
||||
handleEffectParam(effectid: SkillEffectType, paramlst: any) {
|
||||
return paramlst;
|
||||
switch (effectid) {
|
||||
case SkillEffectType.NONE:
|
||||
case SkillEffectType.CARD_ADD:
|
||||
case SkillEffectType.CARD_ADD_LIMIT:
|
||||
case SkillEffectType.CARD_STEAL:
|
||||
case SkillEffectType.CARD_CHG_EN:
|
||||
case SkillEffectType.POWER_ENHANCE:
|
||||
case SkillEffectType.POWEREX_ENHANCE:
|
||||
case SkillEffectType.HURT_POWER:
|
||||
case SkillEffectType.SUMMON_NPC:
|
||||
case SkillEffectType.SUMMON_SKILL:
|
||||
case SkillEffectType.TAUNT:
|
||||
case SkillEffectType.HURT_HP:
|
||||
case SkillEffectType.POWER_ADD_BUFF:
|
||||
case SkillEffectType.HURT_REDUCE:
|
||||
break;
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user