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

This commit is contained in:
zhl 2020-12-31 17:25:55 +08:00
commit 209f6ea322
10 changed files with 135 additions and 73 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
[{"id":10002,"type_id":1,"count":0,"point":0,"weight":""},{"id":10012,"type_id":1,"count":20,"point":1,"weight":"20012:100|20032:100|20042:100|20052:100|20062:100|20072:100|20082:100|20102:700"},{"id":10022,"type_id":1,"count":20,"point":2,"weight":"20012:100|20032:100|20042:100|20052:100|20062:100|20072:100|20082:100|20102:700"},{"id":10032,"type_id":1,"count":20,"point":3,"weight":"20012:100|20032:100|20042:100|20052:100|20062:100|20072:100|20082:100|20102:700"},{"id":10042,"type_id":1,"count":20,"point":4,"weight":"20012:100|20032:100|20042:100|20052:100|20062:100|20072:100|20082:100|20102:700"},{"id":10052,"type_id":1,"count":20,"point":5,"weight":"20012:100|20032:100|20042:100|20052:100|20062:100|20072:100|20082:100|20102:700"},{"id":10062,"type_id":1,"count":20,"point":6,"weight":"20012:100|20032:100|20042:100|20052:100|20062:100|20072:100|20082:100|20102:700"},{"id":10072,"type_id":1,"count":20,"point":7,"weight":"20012:100|20032:100|20042:100|20052:100|20062:100|20072:100|20082:100|20102:700"},{"id":10082,"type_id":1,"count":20,"point":8,"weight":"20012:100|20032:100|20042:100|20052:100|20062:100|20072:100|20082:100|20102:700"},{"id":10092,"type_id":1,"count":20,"point":9,"weight":"20012:100|20032:100|20042:100|20052:100|20062:100|20072:100|20082:100|20102:700"},{"id":10102,"type_id":1,"count":20,"point":10,"weight":"20012:100|20032:100|20042:100|20052:100|20062:100|20072:100|20082:100|20102:700"},{"id":10112,"type_id":2,"count":20,"point":10,"weight":"20112:100"},{"id":10122,"type_id":3,"count":8,"point":10,"weight":"20122:100"},{"id":10132,"type_id":4,"count":0,"point":10,"weight":"20132:0"}] [{"id":10002,"type_id":1,"count":0,"point":0,"weight":""},{"id":10012,"type_id":1,"count":20,"point":1,"weight":"20012:100|20032:100|20042:100|20052:150|20062:150|20072:150|20082:150|20102:750"},{"id":10022,"type_id":1,"count":20,"point":2,"weight":"20012:100|20032:100|20042:100|20052:150|20062:150|20072:150|20082:150|20102:750"},{"id":10032,"type_id":1,"count":20,"point":3,"weight":"20012:100|20032:100|20042:100|20052:150|20062:150|20072:150|20082:150|20102:750"},{"id":10042,"type_id":1,"count":20,"point":4,"weight":"20012:100|20032:100|20042:100|20052:150|20062:150|20072:150|20082:150|20102:750"},{"id":10052,"type_id":1,"count":20,"point":5,"weight":"20012:100|20032:100|20042:100|20052:150|20062:150|20072:150|20082:150|20102:750"},{"id":10062,"type_id":1,"count":20,"point":6,"weight":"20012:100|20032:100|20042:100|20052:150|20062:150|20072:150|20082:150|20102:750"},{"id":10072,"type_id":1,"count":20,"point":7,"weight":"20012:100|20032:100|20042:100|20052:150|20062:150|20072:150|20082:150|20102:750"},{"id":10082,"type_id":1,"count":20,"point":8,"weight":"20012:100|20032:100|20042:100|20052:150|20062:150|20072:150|20082:150|20102:750"},{"id":10092,"type_id":1,"count":20,"point":9,"weight":"20012:100|20032:100|20042:100|20052:150|20062:150|20072:150|20082:150|20102:750"},{"id":10102,"type_id":1,"count":20,"point":10,"weight":"20012:100|20032:100|20042:100|20052:150|20062:150|20072:150|20082:150|20102:750"},{"id":10112,"type_id":2,"count":20,"point":10,"weight":"20112:100"},{"id":10122,"type_id":3,"count":8,"point":10,"weight":"20122:100"},{"id":10132,"type_id":4,"count":0,"point":10,"weight":"20132:0"}]

File diff suppressed because one or more lines are too long

View File

@ -39,7 +39,7 @@ export class SkillCfg implements Cfg{
public getskillid: number; public getskillid: number;
public getskill_times: number; public getskill_times: number;
public getskill_timesmax: number; public getskill_timesmax: number;
public skill_owners: number; public skill_ownersid: number;
public decode(data: any) { public decode(data: any) {
this.id = data.id; this.id = data.id;
@ -78,7 +78,7 @@ export class SkillCfg implements Cfg{
this.getskillid = data.getskillid; this.getskillid = data.getskillid;
this.getskill_times = data.getskill_times; this.getskill_times = data.getskill_times;
this.getskill_timesmax = data.getskill_timesmax; this.getskill_timesmax = data.getskill_timesmax;
this.skill_owners = data.skill_owners; this.skill_ownersid = data.skill_ownersid;
}; };
public isOK (uniqueID: number, param1: any, param2: any): boolean { public isOK (uniqueID: number, param1: any, param2: any): boolean {

View File

@ -22,10 +22,12 @@ export class BattleHandler {
private _playerids: Map<string, Player> = new Map(); private _playerids: Map<string, Player> = new Map();
_room: Room; _room: Room;
private _cardusing: boolean; private _flowing: boolean;
private _sktime: number; private _sktime: number;
private _gamestart: boolean = false; private _gamestart: boolean = false;
private _cacheSkills: SkillTarget[] = [];
//--------------------对外接口--player相关---(外部调用)---------------------------- //--------------------对外接口--player相关---(外部调用)----------------------------
public init(cs: CardGameState, room: Room){ public init(cs: CardGameState, room: Room){
this._cs = cs; this._cs = cs;
@ -211,6 +213,15 @@ export class BattleHandler {
return bok? pet: null; return bok? pet: null;
}; };
public getSkillOppTargets(st: SkillTarget): SkillTarget[]{
let lst: SkillTarget[] = [];
lst.push(st.oppClone());
if(this.isFlowing()){
this._cacheSkills.push(...lst);
}
return lst;
};
public getSkillTargets(skill: Skill, param: SkillParam): SkillTarget[]{ public getSkillTargets(skill: Skill, param: SkillParam): SkillTarget[]{
let lst: SkillTarget[] = []; let lst: SkillTarget[] = [];
let players = this.getTargetPlayers(skill._data.friendlyid, param.srcplayer, param.dstplayer); let players = this.getTargetPlayers(skill._data.friendlyid, param.srcplayer, param.dstplayer);
@ -244,6 +255,9 @@ export class BattleHandler {
break; break;
} }
} }
if(this.isFlowing()){
this._cacheSkills.push(...lst);
}
return lst; return lst;
}; };
@ -344,24 +358,31 @@ export class BattleHandler {
return lst; return lst;
}; };
public beginUseCard(){
this._cardusing = true;
this._sktime = 0;
};
public endUseCard(){
this._cardusing = false;
};
public isUsingCard(){
return this._cardusing;
};
public checkPets(){ public checkPets(){
this._players.forEach((item: PlayerHandler) => { this._players.forEach((item: PlayerHandler) => {
item.checkPets(true); item.checkPets(true);
}); });
}; };
public isFlowing(){
return this._flowing;
};
public beginFlow(){
this._flowing = true;
this._sktime = 0;
this._cacheSkills.length = 0;
};
public endFlow(){
if(this._cacheSkills.length > 0){
this.onSkillResultNotify(this._cacheSkills);
this._cacheSkills.length = 0;
}
this._flowing = false;
this.checkPets();
return this._sktime * 1000;
};
//--------------------对外接口(外部调用)---------------------------- //--------------------对外接口(外部调用)----------------------------
/** /**
* 使 * 使
@ -389,7 +410,7 @@ export class BattleHandler {
dstpt = dstph._self; dstpt = dstph._self;
} }
this.beginUseCard(); this.beginFlow();
let pt = obj.cardpoint; let pt = obj.cardpoint;
@ -408,9 +429,7 @@ export class BattleHandler {
this.onUseCardEnd(ps); this.onUseCardEnd(ps);
this.endUseCard(); return this.endFlow();
return this._sktime*1000;
}; };
/** /**
@ -470,10 +489,16 @@ export class BattleHandler {
public onCardLinkOver(aplayer: Player, linkcards: Card[], fromplayer?: Player){ public onCardLinkOver(aplayer: Player, linkcards: Card[], fromplayer?: Player){
let ph = this.getPlayer(aplayer); let ph = this.getPlayer(aplayer);
let fromph = this.getPlayer(fromplayer); let fromph = this.getPlayer(fromplayer);
ph && ph.onCardLinkEnd(linkcards, fromph);
//1 if(!ph){
return 0; return 0;
}
this.beginFlow();
ph.onCardLinkEnd(linkcards, fromph);
return this.endFlow();
}; };
/** /**
@ -483,10 +508,14 @@ export class BattleHandler {
*/ */
public onCardDiscarded(aplayer: Player, card: Card){ public onCardDiscarded(aplayer: Player, card: Card){
let ph = this.getPlayer(aplayer); let ph = this.getPlayer(aplayer);
ph && ph.onCardDiscarded(card); if(!ph){
return 0;
}
this.beginFlow();
ph.onCardDiscarded(card);
//1 return this.endFlow();
return 0;
}; };
/** /**
@ -498,9 +527,6 @@ export class BattleHandler {
return; return;
} }
sp.srcplayer && sp.srcplayer.onUseCardEnd(sp); sp.srcplayer && sp.srcplayer.onUseCardEnd(sp);
//1
return 0;
}; };
/** /**
@ -539,10 +565,15 @@ export class BattleHandler {
this._gamestart = true; this._gamestart = true;
} }
let ph = this.getPlayer(aplayer); let ph = this.getPlayer(aplayer);
ph && ph.onRoundStart(); if(!ph){
return 0;
}
//1 this.beginFlow();
return 0;
ph.onRoundStart();
return this.endFlow();
}; };
/** /**
@ -551,11 +582,15 @@ export class BattleHandler {
*/ */
public onPlayerRoundEnd(aplayer: Player){ public onPlayerRoundEnd(aplayer: Player){
let ph = this.getPlayer(aplayer); let ph = this.getPlayer(aplayer);
ph && ph.onRoundEnd(); if(!ph){
this.checkPets(); return 0;
}
this.beginFlow();
//1 ph.onRoundEnd();
return 0; // this.checkPets();
return this.endFlow();
}; };
/** /**
@ -671,26 +706,26 @@ export class BattleHandler {
tm += st.getLastTime(); tm += st.getLastTime();
skid += st.srcskillid + '|'; skid += st.srcskillid + '|';
st.isHurtSkill() && item.forEach((v: SkillTarget)=>{ // st.isHurtSkill() && item.forEach((v: SkillTarget)=>{
if(v.targetIsPet()){ // if(v.targetIsPet()){
let ph = v.targetPlayer(); // let ph = v.targetPlayer();
if(!checklst.includes(ph)){ // if(!checklst.includes(ph)){
checklst.push(ph); // checklst.push(ph);
} // }
} // }
}) // })
}); });
if(this.isUsingCard()){ if(this.isFlowing()){
this._sktime += tm; this._sktime += tm;
}else{ }else{
this._room.addScheduleTime(tm*1000, skid); this._room.addScheduleTime(tm*1000, skid);
} }
this._room.bMsgQueue(lst); this._room.bMsgQueue(lst);
checklst.forEach((item: PlayerHandler) => { // checklst.forEach((item: PlayerHandler) => {
item.checkPets(); // item.checkPets();
}); // });
}; };
public onPlayerAddHPNotify(aplayer: PlayerHandler, addhp: number){ public onPlayerAddHPNotify(aplayer: PlayerHandler, addhp: number){

View File

@ -261,7 +261,7 @@ export class PetHandler {
return 0; return 0;
} }
if(value > 0 && this.isAlive()){ if(value > 0 && !this.isAlive()){
return 0; return 0;
} }
@ -368,17 +368,24 @@ export class PetHandler {
this._owner.onPetDied(this); this._owner.onPetDied(this);
}; };
public attack(apet: PetHandler, param: SkillParam, ev: number = 0, isAtkBack: boolean = false){ public attack(sk: Skill, apet: PetHandler, param: SkillParam, ev: number = 0, isAtkBack: boolean = false){
!isAtkBack && this._owner.onAttackBefore(this, param); !isAtkBack && this._owner.onAttackBefore(this, param);
// let myap = this.totalAP(); // let myap = this.totalAP();
// myap += myap*ev; // myap += myap*ev;
let myap = ev? ev: this.totalAP();
let rv = sk.getEffValue(param.edd_cnt, param.cardpoint, this.totalAP());
let myap = isAtkBack? ev: rv;
let bakap = apet.totalAP();
let n = apet.beHurt(myap); let n = apet.beHurt(myap);
!isAtkBack && this._owner.onBeAttack(apet, param); !isAtkBack && this._owner.onBeAttack(apet, param);
let nowap = apet.totalAP();
return n; return n;
}; };

View File

@ -240,7 +240,6 @@ export class PlayerHandler {
let sk = this.newSkill(skillid); let sk = this.newSkill(skillid);
lst.push(sk); lst.push(sk);
} }
// this._owner.onSkillResultNotify(lst);
}else { }else {
let bhalo = false; let bhalo = false;
let bchged = false; let bchged = false;
@ -348,8 +347,8 @@ export class PlayerHandler {
return this._self? this._self.reborn(): false; return this._self? this._self.reborn(): false;
}; };
public attack(apet: PetHandler, param: SkillParam, ev: number, isAtkBack: boolean = false){ public attack(sk: Skill, apet: PetHandler, param: SkillParam, ev: number, isAtkBack: boolean = false){
return this._self? this._self.attack(apet, param, ev, isAtkBack): 0; return this._self? this._self.attack(sk, apet, param, ev, isAtkBack): 0;
}; };
public beSilent(count: number){ public beSilent(count: number){
@ -592,7 +591,7 @@ export class PlayerHandler {
let reslst: SkillTarget[] = []; let reslst: SkillTarget[] = [];
this._self && this._self.checkSkills(tgttype, tgtvalue, sp, (skill: Skill, ap: SkillParam, res: SkillTarget[])=>{ this._self && this._self.checkSkills(tgttype, tgtvalue, sp, (skill: Skill, ap: SkillParam, res: SkillTarget[])=>{
if(res){ if(res){
reslst = reslst.concat(res); reslst.push(...res);
}else{ }else{
let st = new SkillTarget(skill); let st = new SkillTarget(skill);
st.LoadParam(sp); st.LoadParam(sp);
@ -607,7 +606,7 @@ export class PlayerHandler {
sp.srcpet = item; sp.srcpet = item;
item.checkSkills(tgttype, tgtvalue, sp, (skill: Skill, ap: SkillParam, res: SkillTarget[])=>{ item.checkSkills(tgttype, tgtvalue, sp, (skill: Skill, ap: SkillParam, res: SkillTarget[])=>{
if(res){ if(res){
reslst = reslst.concat(res); reslst.push(...res);
}else{ }else{
let st = new SkillTarget(skill); let st = new SkillTarget(skill);
st.LoadParam(sp); st.LoadParam(sp);
@ -616,7 +615,7 @@ export class PlayerHandler {
}); });
}); });
this._owner.onSkillResultNotify(reslst); // this._owner.onSkillResultNotify(reslst);
}; };
singleCheckSkills(apet: PetHandler, tgttype: TriggerType, tgtvalue?: any, tgtsp?: SkillParam){ singleCheckSkills(apet: PetHandler, tgttype: TriggerType, tgtvalue?: any, tgtsp?: SkillParam){
@ -627,14 +626,14 @@ export class PlayerHandler {
let reslst: SkillTarget[] = []; let reslst: SkillTarget[] = [];
apet.checkSkills(tgttype, tgtvalue, sp, (skill: Skill, ap: SkillParam, res: SkillTarget[])=>{ apet.checkSkills(tgttype, tgtvalue, sp, (skill: Skill, ap: SkillParam, res: SkillTarget[])=>{
if(res){ if(res){
reslst = reslst.concat(res); reslst.push(...res);
}else{ }else{
let st = new SkillTarget(skill); let st = new SkillTarget(skill);
st.LoadParam(sp); st.LoadParam(sp);
reslst.push(st); reslst.push(st);
} }
}); });
this._owner.onSkillResultNotify(reslst); // this._owner.onSkillResultNotify(reslst);
}; };
simpleCheckSkills(skills: Skill[], apet?: PetHandler, param?: SkillParam): SkillTarget[]{ simpleCheckSkills(skills: Skill[], apet?: PetHandler, param?: SkillParam): SkillTarget[]{
@ -651,7 +650,7 @@ export class PlayerHandler {
skills.forEach((item: Skill)=>{ skills.forEach((item: Skill)=>{
item.checkTrigger(TriggerType.NO_COND, 0, sp, (skill: Skill, ap: SkillParam, res: SkillTarget[])=>{ item.checkTrigger(TriggerType.NO_COND, 0, sp, (skill: Skill, ap: SkillParam, res: SkillTarget[])=>{
if(res){ if(res){
reslst = reslst.concat(res); reslst.push(...res);
}else{ }else{
let st = new SkillTarget(skill); let st = new SkillTarget(skill);
st.LoadParam(sp); st.LoadParam(sp);
@ -660,7 +659,7 @@ export class PlayerHandler {
}); });
}); });
this._owner.onSkillResultNotify(reslst); // this._owner.onSkillResultNotify(reslst);
return reslst; return reslst;
}; };

View File

@ -194,6 +194,10 @@ export class Skill {
return this._owner._owner.getSkillTargets(this, param); return this._owner._owner.getSkillTargets(this, param);
}; };
getOppTargets(st: SkillTarget): SkillTarget[]{
return this._owner._owner.getSkillOppTargets(st);
};
getEnhanceValue(param: SkillParam): number{ getEnhanceValue(param: SkillParam): number{
return CfgMan.calcEnhanceValue(this._data.edd_effid, this._data.edd_effnum, param.edd_cnt, param.cardpoint); return CfgMan.calcEnhanceValue(this._data.edd_effid, this._data.edd_effnum, param.edd_cnt, param.cardpoint);
}; };
@ -329,8 +333,16 @@ export class Skill {
if(ncount == 0){ if(ncount == 0){
ncount = 1; ncount = 1;
} }
let sp;
if(param.srcpet != this._petowner){
sp = param.clone();
sp.srcpet = this._petowner;
sp.srcplayer = sp.srcpet._owner;
}else{
sp = param;
}
for(let i=0; i<ncount;i++){ for(let i=0; i<ncount;i++){
this._trigger(param, cb); this._trigger(sp, cb);
} }
}; };
@ -504,10 +516,19 @@ export class Skill {
sender = tgt.srcplayer._self; sender = tgt.srcplayer._self;
} }
} }
if(this._data.skill_owners){ switch(this._data.skill_ownersid){
obj = tgt.dst; case SkillUserType.NONE:
}else{ obj = tgt.srcpet? tgt.srcpet: tgt.srcplayer;
obj = tgt.srcpet? tgt.srcpet: tgt.srcplayer; break;
case SkillUserType.TARGET:
obj = tgt.dst;
break;
case SkillUserType.SRC_HERO:
obj = tgt.srcplayer? tgt.srcplayer: tgt.srcpet._owner;
break;
case SkillUserType.SRC_PLAYER:
obj = tgt.srcplayer;
break;
} }
let n = obj? obj.addSkill(this._data.getskillid, ncount, sender): 0; let n = obj? obj.addSkill(this._data.getskillid, ncount, sender): 0;
@ -603,7 +624,7 @@ export class Skill {
if(tgt.dsttype == GameUnitType.HERO || tgt.dsttype == GameUnitType.PET){ if(tgt.dsttype == GameUnitType.HERO || tgt.dsttype == GameUnitType.PET){
let obj = tgt.srcpet? tgt.srcpet: tgt.srcplayer; let obj = tgt.srcpet? tgt.srcpet: tgt.srcplayer;
let v = effvalue; let v = effvalue;
let res = obj.attack((tgt.dst as PetHandler), param, v, isAtkBack); let res = obj.attack(this, (tgt.dst as PetHandler), param, v, isAtkBack);
if(res){ if(res){
tgt.success(efftype, res); tgt.success(efftype, res);
// if(this._data.quoteskillid){ // if(this._data.quoteskillid){

View File

@ -81,7 +81,7 @@ let TriggerManager = {
let tgts; let tgts;
if(target && effectid == SkillEffectType.ATTACK_BACK){ if(target && effectid == SkillEffectType.ATTACK_BACK){
tgts = [target.oppClone()]; tgts = sender.getOppTargets(target);
}else{ }else{
tgts = sender.getTargets(param); tgts = sender.getTargets(param);
} }
@ -158,7 +158,7 @@ let TriggerManager = {
let atkback = effectid == SkillEffectType.ATTACK_BACK; let atkback = effectid == SkillEffectType.ATTACK_BACK;
tgts.forEach((item)=>{ tgts.forEach((item)=>{
let obj = item.srcpet? item.srcpet: item.srcplayer; let obj = item.srcpet? item.srcpet: item.srcplayer;
let ev = sender.getEffValue(param.edd_cnt, param.cardpoint, atkback? obj.bakTotalAP(): obj.totalAP()); let ev = atkback? sender.getEffValue(0, 0, obj.bakTotalAP()): 0;
sender.attack(ev, item, param, atkback); sender.attack(ev, item, param, atkback);
}); });
break; break;