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

This commit is contained in:
zhl 2021-01-13 14:03:55 +08:00
commit c17e5556cc
11 changed files with 226 additions and 186 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -33,6 +33,9 @@ export class SkillCfg implements Cfg{
public quoteunitid: number;
public quoteunit_times: number;
public quoteunit_timesmax: number;
public quotecardid: number;
public quotecard_times: number;
public quotecard_timesmax: number;
public quoteskillid: number;
public quoteskill_times: number;
public quoteskill_timesmax: number;
@ -41,9 +44,6 @@ export class SkillCfg implements Cfg{
public quoteskill2_times: number;
public quoteskill2_timesmax: number;
public skill2_usersid: number;
public quotecardid: number;
public quotecard_times: number;
public quotecard_timesmax: number;
public getskillid: number;
public getskill_times: number;
public getskill_timesmax: number;
@ -52,6 +52,10 @@ export class SkillCfg implements Cfg{
public getskill2_times: number;
public getskill2_timesmax: number;
public skill2_ownersid: number;
public getskill3id: number;
public getskill3_times: number;
public getskill3_timesmax: number;
public skill3_ownersid: number;
public decode(data: any) {
this.id = data.id;
@ -84,6 +88,9 @@ export class SkillCfg implements Cfg{
this.quoteunitid = data.quoteunitid;
this.quoteunit_times = data.quoteunit_times;
this.quoteunit_timesmax = data.quoteunit_timesmax;
this.quotecardid = data.quotecardid;
this.quotecard_times = data.quotecard_times;
this.quotecard_timesmax = data.quotecard_timesmax;
this.quoteskillid = data.quoteskillid;
this.quoteskill_times = data.quoteskill_times;
this.quoteskill_timesmax = data.quoteskill_timesmax;
@ -92,9 +99,6 @@ export class SkillCfg implements Cfg{
this.quoteskill2_times = data.quoteskill2_times;
this.quoteskill2_timesmax = data.quoteskill2_timesmax;
this.skill2_usersid = data.skill2_usersid;
this.quotecardid = data.quotecardid;
this.quotecard_times = data.quotecard_times;
this.quotecard_timesmax = data.quotecard_timesmax;
this.getskillid = data.getskillid;
this.getskill_times = data.getskill_times;
this.getskill_timesmax = data.getskill_timesmax;
@ -103,6 +107,10 @@ export class SkillCfg implements Cfg{
this.getskill2_times = data.getskill2_times;
this.getskill2_timesmax = data.getskill2_timesmax;
this.skill2_ownersid = data.skill2_ownersid;
this.getskill3id = data.getskill3id;
this.getskill3_times = data.getskill3_times;
this.getskill3_timesmax = data.getskill3_timesmax;
this.skill3_ownersid = data.skill3_ownersid;
};
public isOK (uniqueID: number, param1: any, param2: any): boolean {

View File

@ -273,6 +273,27 @@ export class BattleHandler {
return bok? pet: null;
};
public buildSkillTarget(sk: Skill, src: PetHandler, dst: PetHandler | PlayerHandler): SkillTarget{
if(!dst){
return null;
}
let ut = GameUnitType.NONE;
if(dst instanceof PetHandler){
ut = (dst as PetHandler)._isHero? GameUnitType.HERO: GameUnitType.PET;
}else if(dst instanceof PlayerHandler){
ut = GameUnitType.PLAYER;
}
return new SkillTarget(sk, src? src._owner: sk._owner, src, dst, ut);
};
public singleSkillTargets(sk: Skill, src: PetHandler, dst: PetHandler | PlayerHandler): SkillTarget[]{
let tgt = this.buildSkillTarget(sk, src, dst);
if(this.isFlowing() && tgt){
this._cacheSkills.push(tgt);
}
return tgt? [tgt]: null;
};
public getSkillOppTargets(st: SkillTarget): SkillTarget[]{
let lst: SkillTarget[] = [];
lst.push(st.oppClone());
@ -289,16 +310,22 @@ export class BattleHandler {
switch(skill._data.targetid){
case GameUnitType.PLAYER:
if(skill._data.rangeid == SkillRangeUnitType.PLAYER_BELINKED){
this._lastlinkph && lst.push(new SkillTarget(skill, param.srcplayer, param.srcpet, this._lastlinkph, GameUnitType.PLAYER));
this._lastlinkph && lst.push(
this.buildSkillTarget(skill, param.srcpet, this._lastlinkph)
);
}else{
players.forEach((item:PlayerHandler)=>{
lst.push(new SkillTarget(skill, param.srcplayer, param.srcpet, item, GameUnitType.PLAYER));
lst.push(
this.buildSkillTarget(skill, param.srcpet, item)
);
});
}
break;
case GameUnitType.HERO:
players.forEach((item:PlayerHandler)=>{
lst.push(new SkillTarget(skill, param.srcplayer, param.srcpet, item._self, GameUnitType.HERO));
lst.push(
this.buildSkillTarget(skill, param.srcpet, item._self)
);
});
break;
case GameUnitType.BATTLEUNIT:
@ -306,8 +333,9 @@ export class BattleHandler {
if(skill.isSingleTarget()){
let pet = this.getFinalTarget(skill._data.rangeid, players, param.dstpet, param.srcpet, skill._petowner,
skill._data.targetid, !!skill._data.ridicule, skill._data.targetid == GameUnitType.PET);
pet && lst.push(new SkillTarget(skill, param.srcplayer, param.srcpet,
pet, pet._isHero? GameUnitType.HERO: GameUnitType.PET));
pet && lst.push(
this.buildSkillTarget(skill, param.srcpet, pet)
);
}else{
let expet = skill.getExPet(param.srcpet);
players.forEach((item: PlayerHandler)=>{

View File

@ -5,7 +5,7 @@ import CfgMan from "../CfgMan";
import {Skill} from "../skill/Skill";
import SkillMan from "../skill/SkillMan";
import { EnhanceEffectType, PowerValueType, SkillEffectType, TriggerType } from "../skill/SkillConst";
import { EnhanceEffectType, PowerValueType, SkillEffectType, SkillUserType, TriggerType } from "../skill/SkillConst";
import { PlayerHandler } from "./PlayerHandler";
import { PetInfo, PetInfoMsg } from "../../../message/PetInfo";
import { SkillParam, SkillTarget } from "../skill/SkillParam";
@ -161,12 +161,12 @@ export class PetHandler {
return lst;
};
public addSkill(skillid: number, count: number = 1, sender?: PetHandler): Skill[]{
public addSkill(skillid: number, count: number = 1, eddcnt: number = -1, cp: number = -1, tgtflag: number = 0, from?: PetHandler): Skill[]{
let lst;
if(skillid > 0){
if(sender){
if(from){
let sk = this._skills.find((item: Skill) =>{
return item._id == skillid && item._sender == sender;
return item._id == skillid && item._from == from;
});
if(sk){
return lst;
@ -176,11 +176,14 @@ export class PetHandler {
for(let i = 0; i < count;i++){
let obj = this._owner.newSkill(skillid);
if(obj){
obj.setOrignParam(this._orignEffCnt, this._orignCardPoint, sender? sender: this, this);
this._skills.push(obj);
this._selfskills.push(skillid);
obj.setOrignParam(eddcnt < 0? this._orignEffCnt: eddcnt, cp < 0? this._orignCardPoint: cp, from? from: this, this, tgtflag);
let bkeep = true;
if(obj.isBornSkill()){
this._bornSkills.push(obj);
if(from && from != this){
bkeep = false; // 一次性技能使用
}else{
this._bornSkills.push(obj);
}
}else if(obj.isDieSkill()){
this._dieSkills.push(obj);
}else if(obj.isAPHaloSkill() || obj.isBuffHaloSkill()){
@ -189,6 +192,10 @@ export class PetHandler {
this._waitskills.push(obj);
}
lst.push(obj);
if(bkeep){
this._skills.push(obj);
this._selfskills.push(skillid);
}
}
}
}
@ -227,20 +234,12 @@ export class PetHandler {
public delSkills(sender: PetHandler){
for(let i = this._skills.length - 1; i >=0 ; i--){
let obj = this._skills[i];
if(obj._sender == sender){
if(obj._from == sender){
this.delSkill(obj, i);
}
}
};
public useSkill(skillid: number, count: number, obj: SkillParam): SkillTarget[]{
return this._owner.handleSkill(skillid, count, this, this, obj);
};
public useSkillEx(skillid: number, count: number, sender: PetHandler): SkillTarget[]{
return this._owner.handleSkill(skillid, count, this, sender);
};
public subAP(value: number, from: PetHandler):number {
// this._exap += value;
// if(this._exap < 0){
@ -502,6 +501,10 @@ export class PetHandler {
return this._owner.summonPet(petid, count, exparam);
};
public summonSkill(skillid: number, count: number, usertype: SkillUserType, from: Skill, param: SkillParam): SkillTarget[]{
return this._owner.handleSkill(skillid, count, usertype, this, from._petowner, param);
};
public beSilent(count: number){
this._isSilent = true;
this._silentCD = count;
@ -611,14 +614,6 @@ export class PetHandler {
if(this._isSilent){
return;
}
if(sp && sp.cardid == 0){
if(!sp.edd_cnt){
sp.edd_cnt = this._orignEffCnt;
}
if(!sp.cardpoint){
sp.cardpoint = this._orignCardPoint;
}
}
this._waitskills.forEach((item: Skill) => {
item.checkTrigger(tgtype, tgtv, sp, cb);
});

View File

@ -4,7 +4,7 @@ import { HeroCfg } from "../../../cfg/parsers/HeroCfg";
import { BattleHandler } from "./BattleHandler";
import CfgMan from "../CfgMan";
import { Pet } from "rooms/schema/Pet";
import { CondDecideType, CondType, EffectCardType, GameUnitType, SkillType, TriggerType } from "../skill/SkillConst";
import { CondDecideType, CondType, EffectCardType, GameUnitType, SkillType, SkillUserType, TriggerType } from "../skill/SkillConst";
import { UnitCfg } from "cfg/parsers/UnitCfg";
import { Skill } from "../skill/Skill";
import { SkillParam, SkillTarget } from "../skill/SkillParam";
@ -218,18 +218,10 @@ export class PlayerHandler {
public useSkills(skills: number[], obj: SkillParam)
{
skills && skills.forEach((item: number)=>{
this.useSkill(item, 1, obj);
this.handleSkill(item, 1, 0, this._self, this._self, obj);
});
};
public useSkill(skillid: number, count: number, obj: SkillParam): SkillTarget[]{
return this.handleSkill(skillid, count, this._self, this._self, obj);
};
public useSkillEx(skillid: number, count: number, sender: PetHandler): SkillTarget[]{
return this.handleSkill(skillid, count, this._self, sender);
};
public newSkill(skillid: number): Skill{
let obj = SkillMan.getSkill(skillid);
if(obj){
@ -238,22 +230,23 @@ export class PlayerHandler {
return obj;
};
public handleSkill(skillid: number, count: number, pet: PetHandler, sender?: PetHandler, param?: SkillParam):SkillTarget[]{
public handleSkill(skillid: number, count: number, tgtflag: number, pet: PetHandler, sender?: PetHandler, param?: SkillParam):SkillTarget[]{
let cfg = CfgMan.findSkillCfg(skillid);
if(!cfg){
return null;
}
let sp = param;
let lst: Skill[] = [];
if(cfg.skill_typeid == SkillType.MAGIC){
for(let i = 0; i < count; i++){
let sk = this.newSkill(skillid);
sk.setOrignParam(param.edd_cnt, param.cardpoint, pet, pet);
sk.setOrignParam(param.edd_cnt, param.cardpoint, sender, pet, tgtflag);
lst.push(sk);
}
}else {
let bhalo = false;
let bchged = false;
let sl = pet.addSkill(skillid, count, sender);
let sl = pet.addSkill(skillid, count, param.edd_cnt, param.cardpoint, tgtflag, sender);
if(sl && sl.length > 0){
bchged = true;
sl.forEach((obj: Skill)=>{
@ -274,9 +267,11 @@ export class PlayerHandler {
}
if(bchged){
pet.dataChanged(pet);
sp = param.clone();
sp.changeSrc(pet);
}
}
return this.simpleCheckSkills(lst, false, pet, param);
return this.simpleCheckSkills(lst, false, pet, sp);
};
public summonPet(petid: number, count: number = 1, exparam: SkillParam):number{
@ -292,6 +287,13 @@ export class PlayerHandler {
return n;
};
public summonSkill(skillid: number, count: number, usertype: SkillUserType, from: Skill, param: SkillParam): SkillTarget[]{
if(!skillid){
return null;
}
return this.handleSkill(skillid, count, usertype, this._self, from._petowner, param);
};
public addCard(count: number, from?: PlayerHandler): number{
return this._owner.onPlayerAddCardNotify(this, count, 0, from);
};
@ -508,24 +510,24 @@ export class PlayerHandler {
this._owner.onUpdatePetsNotify(lst, apet);
};
onAttackBefore(apet: PetHandler, sp?: SkillParam){
public onAttackBefore(apet: PetHandler, sp?: SkillParam){
this.singleCheckSkills(apet, TriggerType.BEFORE_ATTACK, null, sp);
};
onAttackAfter(apet: PetHandler, sp?: SkillParam){
public onAttackAfter(apet: PetHandler, sp?: SkillParam){
this.singleCheckSkills(apet, TriggerType.AFTER_ATTACK, null, sp);
};
// 暂不用
onBeAttack(apet: PetHandler, sp?: SkillParam){
public onBeAttack(apet: PetHandler, sp?: SkillParam){
this.singleCheckSkills(apet, TriggerType.BE_ATTACK, null, sp);
};
onBeHurt(apet: PetHandler, value: number){
public onBeHurt(apet: PetHandler, value: number){
this.singleCheckSkills(apet, TriggerType.BE_HURT);
};
onShieldUsed(apet: PetHandler){
public onShieldUsed(apet: PetHandler){
this.singleCheckSkills(apet, TriggerType.SHIELD_USED);
};
@ -680,7 +682,7 @@ export class PlayerHandler {
};
onUseCardEnd(sp: SkillParam){
this.checkSkills(TriggerType.CARD_USED, null, sp);
this.checkSkills(TriggerType.CARD_USED);
this._cardstate = CondType.NO_COND; // 重置状态
};
@ -763,14 +765,6 @@ export class PlayerHandler {
return null;
}
let sp = param? param: new SkillParam(0, 0, 0, this, apet, this, apet);
if(sp && sp.cardid == 0 && apet){
if(!sp.edd_cnt){
sp.edd_cnt = apet._orignEffCnt;
}
if(!sp.cardpoint){
sp.cardpoint = apet._orignCardPoint;
}
}
let reslst: SkillTarget[] = [];
skills.forEach((item: Skill)=>{
item.checkTrigger(runimm? TriggerType.NO_COND: TriggerType.NORMAL, null, sp, (skill: Skill, ap: SkillParam, res: SkillTarget[])=>{

View File

@ -33,8 +33,11 @@ export class Skill {
private _subskill: Skill;
private _subskill2: Skill;
_sender: PetHandler;
_from: PetHandler;
_petowner: PetHandler;
private _sts: SkillTarget[] = null;
// LIFE-CYCLE CALLBACKS:
// onLoad () {};
@ -121,6 +124,10 @@ export class Skill {
return this._type == SkillType.HALO_SKILL;
};
isSummonSkill(){
return this._data.effect_typeid == SkillEffectType.SKILL_GET;
};
isSingleTarget(){
switch(this._data.rangeid){
case SkillRangeUnitType.ALL:
@ -202,6 +209,20 @@ export class Skill {
return null;
};
getSourceTargets(): SkillTarget[]{
if(!this._from){
return null;
}
return this._owner._owner.singleSkillTargets(this, this._petowner, this._from);
};
getSelfTargets(): SkillTarget[]{
if(!this._petowner){
return null;
}
return this._owner._owner.singleSkillTargets(this, this._petowner, this._petowner);
};
getTargets(param: SkillParam): SkillTarget[]{
return this._owner._owner.getSkillTargets(this, param);
};
@ -210,11 +231,17 @@ export class Skill {
return this._owner._owner.getSkillOppTargets(st);
};
getQuoteValue(count: number, maxcount: number, effcount: number){
return this.getFinalValue(EnhanceCustomType.QUOTE_TIMES, count, maxcount,
effcount, true);
setTargets(tgt: SkillTarget[]){
// todo是否需要拷贝
if(tgt && tgt.length > 0){
this._sts = tgt;
}
};
getQuoteValue(count: number, maxcount: number, effcount: number){
return this.getFinalValue(EnhanceCustomType.QUOTE_TIMES, count, maxcount, effcount, true);
};
getEffValue(ac?: number, ap?: number, sp?: number): number{
let nmin = CfgMan.calcEffctValueEx(EnhanceCustomType.EFF_VALUE, this._data.eff_numtypeid, this._data.num_signid, this._data.eff_num, ap, sp);
let nmax = CfgMan.calcEffctValueEx(EnhanceCustomType.EFF_VALUE, this._data.eff_numtypeid, this._data.num_signid, this._data.eff_nummax, ap, sp);
@ -271,93 +298,76 @@ export class Skill {
_triggerSubSkill(sk: Skill, skid: number, skusertype: number, skcount: number, skmaxcount: number, param: SkillParam, sts: SkillTarget[], cb?: any){
if(skid && !sk){
sk = this._owner.newSkill(skid);
sk.setOrignParam(this._orign_effcnt, this._orign_cardpt, this._sender, this._petowner);
sk.setOrignParam(this._orign_effcnt, this._orign_cardpt, this._from, this._petowner, 0);
}
if(sk){
let pl = [];
let bst = false;
switch(skusertype){
case SkillUserType.SRC_HERO:
case SkillUserType.SRC_PLAYER:
{
let sp = param.clone();
let ph = sp.srcplayer? sp.srcplayer: sp.srcpet._owner;
sp.srcpet = ph._self;
pl.push(sp);
}
case SkillUserType.NONE:
sk.setTargets(null);
break;
case SkillUserType.TARGET:
if(sts && sts.length > 0){
sts.forEach((item: SkillTarget)=>{
let sp = param.oppClone();
if(item.dsttype != GameUnitType.NONE){
if(item.dsttype == GameUnitType.PLAYER){
sp.srcplayer = (item.dst as PlayerHandler);
sp.srcpet = sp.srcplayer._self;
}else {
sp.srcpet = (item.dst as PetHandler);
sp.srcplayer = sp.srcpet._owner;
}
}
pl.push(sp);
});
bst = true;
}else{
pl.push(param.oppClone());
}
sk.setTargets(sts);
break;
default:
pl.push(param);
case SkillUserType.SRC:
sk.setTargets(this.getSourceTargets());
break;
}
let ncount = this.getQuoteValue(skcount, skmaxcount, this._orign_effcnt);
for(let i=0; i<ncount;i++){
for(let j = 0; j < pl.length; j++){
let sp = pl[j];
let st = bst? sts[j]: null;
sk.trigger(sp, cb, st);
}
sk.trigger(param, cb);
}
}
};
_trigger(param: SkillParam, cb?: any, target?: SkillTarget) {
//触发buff效果
let res = TriggerManager.onTrigger(this, param, target);
this._currCount++;
if (!this._start) {
this._start = true;
_real_trigger(ncount: number, param: SkillParam, cb?: any) {
if(!this._sts){
this._sts = this.getTargets(param);
}
cb && cb(this, param, res);
for(let i=0; i<ncount;i++){
let res = TriggerManager.onTrigger(this, param, this._sts);
this._cb && this._cb(this, param, res);
this._triggerSubSkill(this._subskill, this._data.quoteskillid, this._data.skill_usersid,
this._data.quoteskill_times, this._data.quoteskill_timesmax, param, res, cb);
this._triggerSubSkill(this._subskill2, this._data.quoteskill2id, this._data.skill2_usersid,
this._data.quoteskill2_times, this._data.quoteskill2_timesmax, param, res, cb);
this._currCount++;
if (!this._start) {
this._start = true;
}
cb && cb(this, param, res);
this._cb && this._cb(this, param, res);
}
};
trigger(param: SkillParam, cb?: any, target?: SkillTarget) {
let ncount = this.getFinalValue(EnhanceCustomType.RELEASE_TIMES, this._data.release_times,
this._data.release_timesmax, this._orign_effcnt, true);
let sp;
// if(param.srcpet != this._petowner){
if(false){
sp = param.clone();
sp.srcpet = this._petowner;
sp.srcplayer = sp.srcpet._owner;
}else{
sp = param;
trigger(param: SkillParam, cb?: any) {
if(!this._sts){
this._sts = this.getTargets(param);
}
for(let i=0; i<ncount;i++){
this._trigger(sp, cb, target);
if(!this.isSummonSkill()){
let ncount = this.getFinalValue(EnhanceCustomType.RELEASE_TIMES, this._data.release_times,
this._data.release_timesmax, this._orign_effcnt, true);
this._real_trigger(ncount, param, cb);
this._triggerSubSkill(this._subskill, this._data.quoteskillid, this._data.skill_usersid,
this._data.quoteskill_times, this._data.quoteskill_timesmax, param, this._sts, cb);
this._triggerSubSkill(this._subskill2, this._data.quoteskill2id, this._data.skill2_usersid,
this._data.quoteskill2_times, this._data.quoteskill2_timesmax, param, this._sts, cb);
}else{
this._triggerSubSkill(this._subskill, this._data.quoteskillid, this._data.skill_usersid,
this._data.quoteskill_times, this._data.quoteskill_timesmax, param, this._sts, cb);
this._triggerSubSkill(this._subskill2, this._data.quoteskill2id, this._data.skill2_usersid,
this._data.quoteskill2_times, this._data.quoteskill2_timesmax, param, this._sts, cb);
let ncount = this.getFinalValue(EnhanceCustomType.RELEASE_TIMES, this._data.release_times,
this._data.release_timesmax, this._orign_effcnt, true);
this._real_trigger(ncount, param, cb);
}
};
@ -531,13 +541,8 @@ export class Skill {
}
};
summonSkill(skillid: number, count: number, countmax: number, obj: any, sender: PetHandler): SkillTarget[]{
if(!obj){
return null;
}else{
let ncount = this.getFinalValue(EnhanceCustomType.GET_TIMES, count, countmax, this._orign_effcnt, true);
return obj.useSkillEx(skillid, ncount, sender);
}
getGKValue(count: number, countmax: number, effcount: number): number{
return this.getFinalValue(EnhanceCustomType.GET_TIMES, count, countmax, effcount, true);
};
summon(efftype: SkillEffectType, exparam: SkillParam, tgt: SkillTarget){
@ -557,23 +562,7 @@ export class Skill {
break;
case SkillEffectType.SUMMON_SKILL:
{
let obj = tgt.srcpet? tgt.srcpet: tgt.srcplayer;
if(!obj){
tgt.fail(efftype, -1);
return;
}
let n1 = this.getQuoteValue(this._data.quoteskill_times, this._data.quoteskill_timesmax, this._orign_effcnt);
let r1 = obj.useSkill(this._data.quoteskillid, n1, exparam);
r1 && tgt.success(efftype, this._data.quoteskillid);
let n2 = this.getQuoteValue(this._data.quoteskill2_times, this._data.quoteskill2_timesmax, this._orign_effcnt);
let r2 = obj.useSkill(this._data.quoteskill2id, n2, exparam);
r2 && tgt.success(efftype, this._data.quoteskill2id);
if(!r1 && !r2){
tgt.fail(efftype, -1);
}
//nothing to do
}
break;
case SkillEffectType.SKILL_GET:
@ -587,23 +576,30 @@ export class Skill {
}
}
let bres1 = false, bres2 = false;
let bres1 = false, bres2 = false, bres3 = false;
if(this._data.getskillid){
let obj = tgt.getTarget(this._data.skill_ownersid);
let res = this.summonSkill(this._data.getskillid, this._data.getskill_times, this._data.getskill_timesmax, obj, sender);
let cnt = this.getGKValue(this._data.getskill_times, this._data.getskill_timesmax, this._orign_effcnt);
let res = tgt.dst.summonSkill(this._data.getskillid, cnt, this._data.skill_ownersid, this, exparam);
res? tgt.success(efftype, this._data.getskillid): tgt.fail(efftype, this._data.getskillid);
bres1 = true;
}
if(this._data.getskill2id){
let obj = tgt.getTarget(this._data.skill2_ownersid);
let res = this.summonSkill(this._data.getskill2id, this._data.getskill2_times, this._data.getskill2_timesmax, obj, sender);
let cnt = this.getGKValue(this._data.getskill2_times, this._data.getskill2_timesmax, this._orign_effcnt);
let res = tgt.dst.summonSkill(this._data.getskill2id, cnt, this._data.skill2_ownersid, this, exparam);
res? tgt.success(efftype, this._data.getskill2id): tgt.fail(efftype, this._data.getskill2id);
bres2 = true;
}
if(!bres1 && !bres2){
if(this._data.getskill3id){
let cnt = this.getGKValue(this._data.getskill3_times, this._data.getskill3_timesmax, this._orign_effcnt);
let res = tgt.dst.summonSkill(this._data.getskill3id, cnt, this._data.skill3_ownersid, this, exparam);
res? tgt.success(efftype, this._data.getskill3id): tgt.fail(efftype, this._data.getskill3id);
bres2 = true;
}
if(!bres1 && !bres2 && !bres3){
tgt.fail(efftype, -1);
}
}
@ -762,11 +758,21 @@ export class Skill {
this._cb = cb;
};
setOrignParam(effcnt: number, cardpoint: number, source: PetHandler, petowner: PetHandler){
setOrignParam(effcnt: number, cardpoint: number, source: PetHandler, petowner: PetHandler, tgtflag: number){
this._orign_effcnt = effcnt;
this._orign_cardpt = cardpoint;
this._sender = source;
this._from = source;
this._petowner = petowner;
switch(tgtflag){
case SkillUserType.TARGET:
if(source && source != petowner){
this.setTargets(this.getSelfTargets());
}
break;
case SkillUserType.SRC:
this.setTargets(this.getSourceTargets());
break;
}
};
isTotalCardSkill(){

View File

@ -392,6 +392,5 @@ export const enum SkillTargetType {
export const enum SkillUserType{
NONE = 0,
TARGET = 1,
SRC_PLAYER = 2,
SRC_HERO = 3,
SRC = 2,
}

View File

@ -43,6 +43,15 @@ export class SkillParam{
this.srcpet = this.dstpet;
this.dstpet = tmppet;
this.dstplayer = tmpplayer;
};
changeSrc(pet: PetHandler){
if(!pet){
return;
}
this.srcpet = pet;
this.srcplayer = pet._owner;
}
};
@ -80,11 +89,11 @@ export class SkillTarget{
this.srcplayer = splayer;
this.srcpet = spet;
this.srcskill = skill;
this.srcskillid = skill._id;
this.srcskilltype = skill._data.effect_typeid;
this.srcskillid = skill? skill._id: 0;
this.srcskilltype = skill? skill._data.effect_typeid: 0;
this.dst = dstobj;
this.dsttype = dsttype;
this.lasttime = skill._data.indicate_time;
this.lasttime = skill? skill._data.indicate_time: 0;
};
public LoadParam(sp: SkillParam){
@ -131,11 +140,8 @@ export class SkillTarget{
case SkillUserType.TARGET:
obj = this.dst;
break;
case SkillUserType.SRC_HERO:
obj = this.srcplayer? this.srcplayer: this.srcpet._owner;
break;
case SkillUserType.SRC_PLAYER:
obj = this.srcplayer;
case SkillUserType.SRC:
obj = this.srcPet();
break;
}
return obj;
@ -161,7 +167,11 @@ export class SkillTarget{
return null;
};
oppClone(){
public clone(){
return new SkillTarget(this.srcskill, this.srcplayer, this.srcpet, this.dst, this.dsttype);
};
public oppClone(){
let st = new SkillTarget(this.srcskill);
if(this.dsttype != GameUnitType.NONE){

View File

@ -74,17 +74,17 @@ let TriggerManager = {
},
onTrigger(sender: Skill, param: SkillParam, target: SkillTarget): SkillTarget[] {
onTrigger(sender: Skill, param: SkillParam, tgts: SkillTarget[]): SkillTarget[] {
let effectid = sender._data.effect_typeid;
let effv = sender.getEffValue(param.edd_cnt, param.cardpoint);
let tgts;
if(target && effectid == SkillEffectType.ATTACK_BACK){
tgts = sender.getOppTargets(target);
}else{
tgts = sender.getTargets(param);
}
// let tgts;
// if(target && effectid == SkillEffectType.ATTACK_BACK){
// tgts = sender.getOppTargets(target);
// }else{
// tgts = sender.getTargets(param);
// }
if(!tgts || tgts.length <= 0){
return null;