:Merge branch 'second' of git.kingsome.cn:node/card_svr into second
This commit is contained in:
commit
209f6ea322
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -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
@ -39,7 +39,7 @@ export class SkillCfg implements Cfg{
|
||||
public getskillid: number;
|
||||
public getskill_times: number;
|
||||
public getskill_timesmax: number;
|
||||
public skill_owners: number;
|
||||
public skill_ownersid: number;
|
||||
|
||||
public decode(data: any) {
|
||||
this.id = data.id;
|
||||
@ -78,7 +78,7 @@ export class SkillCfg implements Cfg{
|
||||
this.getskillid = data.getskillid;
|
||||
this.getskill_times = data.getskill_times;
|
||||
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 {
|
||||
|
@ -22,10 +22,12 @@ export class BattleHandler {
|
||||
private _playerids: Map<string, Player> = new Map();
|
||||
|
||||
_room: Room;
|
||||
private _cardusing: boolean;
|
||||
private _flowing: boolean;
|
||||
private _sktime: number;
|
||||
private _gamestart: boolean = false;
|
||||
|
||||
private _cacheSkills: SkillTarget[] = [];
|
||||
|
||||
//--------------------对外接口--player相关---(外部调用)----------------------------
|
||||
public init(cs: CardGameState, room: Room){
|
||||
this._cs = cs;
|
||||
@ -211,6 +213,15 @@ export class BattleHandler {
|
||||
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[]{
|
||||
let lst: SkillTarget[] = [];
|
||||
let players = this.getTargetPlayers(skill._data.friendlyid, param.srcplayer, param.dstplayer);
|
||||
@ -244,6 +255,9 @@ export class BattleHandler {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(this.isFlowing()){
|
||||
this._cacheSkills.push(...lst);
|
||||
}
|
||||
return lst;
|
||||
};
|
||||
|
||||
@ -344,24 +358,31 @@ export class BattleHandler {
|
||||
return lst;
|
||||
};
|
||||
|
||||
public beginUseCard(){
|
||||
this._cardusing = true;
|
||||
this._sktime = 0;
|
||||
};
|
||||
|
||||
public endUseCard(){
|
||||
this._cardusing = false;
|
||||
};
|
||||
|
||||
public isUsingCard(){
|
||||
return this._cardusing;
|
||||
};
|
||||
|
||||
public checkPets(){
|
||||
this._players.forEach((item: PlayerHandler) => {
|
||||
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;
|
||||
}
|
||||
|
||||
this.beginUseCard();
|
||||
this.beginFlow();
|
||||
|
||||
let pt = obj.cardpoint;
|
||||
|
||||
@ -408,9 +429,7 @@ export class BattleHandler {
|
||||
|
||||
this.onUseCardEnd(ps);
|
||||
|
||||
this.endUseCard();
|
||||
|
||||
return this._sktime*1000;
|
||||
return this.endFlow();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -470,10 +489,16 @@ export class BattleHandler {
|
||||
public onCardLinkOver(aplayer: Player, linkcards: Card[], fromplayer?: Player){
|
||||
let ph = this.getPlayer(aplayer);
|
||||
let fromph = this.getPlayer(fromplayer);
|
||||
ph && ph.onCardLinkEnd(linkcards, fromph);
|
||||
|
||||
//1
|
||||
if(!ph){
|
||||
return 0;
|
||||
}
|
||||
|
||||
this.beginFlow();
|
||||
|
||||
ph.onCardLinkEnd(linkcards, fromph);
|
||||
|
||||
return this.endFlow();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -483,10 +508,14 @@ export class BattleHandler {
|
||||
*/
|
||||
public onCardDiscarded(aplayer: Player, card: Card){
|
||||
let ph = this.getPlayer(aplayer);
|
||||
ph && ph.onCardDiscarded(card);
|
||||
|
||||
//1
|
||||
if(!ph){
|
||||
return 0;
|
||||
}
|
||||
this.beginFlow();
|
||||
|
||||
ph.onCardDiscarded(card);
|
||||
|
||||
return this.endFlow();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -498,9 +527,6 @@ export class BattleHandler {
|
||||
return;
|
||||
}
|
||||
sp.srcplayer && sp.srcplayer.onUseCardEnd(sp);
|
||||
|
||||
//1
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -539,10 +565,15 @@ export class BattleHandler {
|
||||
this._gamestart = true;
|
||||
}
|
||||
let ph = this.getPlayer(aplayer);
|
||||
ph && ph.onRoundStart();
|
||||
|
||||
//1
|
||||
if(!ph){
|
||||
return 0;
|
||||
}
|
||||
|
||||
this.beginFlow();
|
||||
|
||||
ph.onRoundStart();
|
||||
|
||||
return this.endFlow();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -551,11 +582,15 @@ export class BattleHandler {
|
||||
*/
|
||||
public onPlayerRoundEnd(aplayer: Player){
|
||||
let ph = this.getPlayer(aplayer);
|
||||
ph && ph.onRoundEnd();
|
||||
this.checkPets();
|
||||
|
||||
//1
|
||||
if(!ph){
|
||||
return 0;
|
||||
}
|
||||
this.beginFlow();
|
||||
|
||||
ph.onRoundEnd();
|
||||
// this.checkPets();
|
||||
|
||||
return this.endFlow();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -671,26 +706,26 @@ export class BattleHandler {
|
||||
tm += st.getLastTime();
|
||||
skid += st.srcskillid + '|';
|
||||
|
||||
st.isHurtSkill() && item.forEach((v: SkillTarget)=>{
|
||||
if(v.targetIsPet()){
|
||||
let ph = v.targetPlayer();
|
||||
if(!checklst.includes(ph)){
|
||||
checklst.push(ph);
|
||||
}
|
||||
}
|
||||
})
|
||||
// st.isHurtSkill() && item.forEach((v: SkillTarget)=>{
|
||||
// if(v.targetIsPet()){
|
||||
// let ph = v.targetPlayer();
|
||||
// if(!checklst.includes(ph)){
|
||||
// checklst.push(ph);
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
});
|
||||
|
||||
if(this.isUsingCard()){
|
||||
if(this.isFlowing()){
|
||||
this._sktime += tm;
|
||||
}else{
|
||||
this._room.addScheduleTime(tm*1000, skid);
|
||||
}
|
||||
this._room.bMsgQueue(lst);
|
||||
|
||||
checklst.forEach((item: PlayerHandler) => {
|
||||
item.checkPets();
|
||||
});
|
||||
// checklst.forEach((item: PlayerHandler) => {
|
||||
// item.checkPets();
|
||||
// });
|
||||
};
|
||||
|
||||
public onPlayerAddHPNotify(aplayer: PlayerHandler, addhp: number){
|
||||
|
@ -261,7 +261,7 @@ export class PetHandler {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(value > 0 && this.isAlive()){
|
||||
if(value > 0 && !this.isAlive()){
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -368,17 +368,24 @@ export class PetHandler {
|
||||
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);
|
||||
|
||||
// let myap = this.totalAP();
|
||||
// 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);
|
||||
|
||||
!isAtkBack && this._owner.onBeAttack(apet, param);
|
||||
|
||||
let nowap = apet.totalAP();
|
||||
|
||||
return n;
|
||||
};
|
||||
|
||||
|
@ -240,7 +240,6 @@ export class PlayerHandler {
|
||||
let sk = this.newSkill(skillid);
|
||||
lst.push(sk);
|
||||
}
|
||||
// this._owner.onSkillResultNotify(lst);
|
||||
}else {
|
||||
let bhalo = false;
|
||||
let bchged = false;
|
||||
@ -348,8 +347,8 @@ export class PlayerHandler {
|
||||
return this._self? this._self.reborn(): false;
|
||||
};
|
||||
|
||||
public attack(apet: PetHandler, param: SkillParam, ev: number, isAtkBack: boolean = false){
|
||||
return this._self? this._self.attack(apet, param, ev, isAtkBack): 0;
|
||||
public attack(sk: Skill, apet: PetHandler, param: SkillParam, ev: number, isAtkBack: boolean = false){
|
||||
return this._self? this._self.attack(sk, apet, param, ev, isAtkBack): 0;
|
||||
};
|
||||
|
||||
public beSilent(count: number){
|
||||
@ -592,7 +591,7 @@ export class PlayerHandler {
|
||||
let reslst: SkillTarget[] = [];
|
||||
this._self && this._self.checkSkills(tgttype, tgtvalue, sp, (skill: Skill, ap: SkillParam, res: SkillTarget[])=>{
|
||||
if(res){
|
||||
reslst = reslst.concat(res);
|
||||
reslst.push(...res);
|
||||
}else{
|
||||
let st = new SkillTarget(skill);
|
||||
st.LoadParam(sp);
|
||||
@ -607,7 +606,7 @@ export class PlayerHandler {
|
||||
sp.srcpet = item;
|
||||
item.checkSkills(tgttype, tgtvalue, sp, (skill: Skill, ap: SkillParam, res: SkillTarget[])=>{
|
||||
if(res){
|
||||
reslst = reslst.concat(res);
|
||||
reslst.push(...res);
|
||||
}else{
|
||||
let st = new SkillTarget(skill);
|
||||
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){
|
||||
@ -627,14 +626,14 @@ export class PlayerHandler {
|
||||
let reslst: SkillTarget[] = [];
|
||||
apet.checkSkills(tgttype, tgtvalue, sp, (skill: Skill, ap: SkillParam, res: SkillTarget[])=>{
|
||||
if(res){
|
||||
reslst = reslst.concat(res);
|
||||
reslst.push(...res);
|
||||
}else{
|
||||
let st = new SkillTarget(skill);
|
||||
st.LoadParam(sp);
|
||||
reslst.push(st);
|
||||
}
|
||||
});
|
||||
this._owner.onSkillResultNotify(reslst);
|
||||
// this._owner.onSkillResultNotify(reslst);
|
||||
};
|
||||
|
||||
simpleCheckSkills(skills: Skill[], apet?: PetHandler, param?: SkillParam): SkillTarget[]{
|
||||
@ -651,7 +650,7 @@ export class PlayerHandler {
|
||||
skills.forEach((item: Skill)=>{
|
||||
item.checkTrigger(TriggerType.NO_COND, 0, sp, (skill: Skill, ap: SkillParam, res: SkillTarget[])=>{
|
||||
if(res){
|
||||
reslst = reslst.concat(res);
|
||||
reslst.push(...res);
|
||||
}else{
|
||||
let st = new SkillTarget(skill);
|
||||
st.LoadParam(sp);
|
||||
@ -660,7 +659,7 @@ export class PlayerHandler {
|
||||
});
|
||||
});
|
||||
|
||||
this._owner.onSkillResultNotify(reslst);
|
||||
// this._owner.onSkillResultNotify(reslst);
|
||||
|
||||
return reslst;
|
||||
};
|
||||
|
@ -194,6 +194,10 @@ export class Skill {
|
||||
return this._owner._owner.getSkillTargets(this, param);
|
||||
};
|
||||
|
||||
getOppTargets(st: SkillTarget): SkillTarget[]{
|
||||
return this._owner._owner.getSkillOppTargets(st);
|
||||
};
|
||||
|
||||
getEnhanceValue(param: SkillParam): number{
|
||||
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){
|
||||
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++){
|
||||
this._trigger(param, cb);
|
||||
this._trigger(sp, cb);
|
||||
}
|
||||
};
|
||||
|
||||
@ -504,10 +516,19 @@ export class Skill {
|
||||
sender = tgt.srcplayer._self;
|
||||
}
|
||||
}
|
||||
if(this._data.skill_owners){
|
||||
obj = tgt.dst;
|
||||
}else{
|
||||
switch(this._data.skill_ownersid){
|
||||
case SkillUserType.NONE:
|
||||
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;
|
||||
@ -603,7 +624,7 @@ export class Skill {
|
||||
if(tgt.dsttype == GameUnitType.HERO || tgt.dsttype == GameUnitType.PET){
|
||||
let obj = tgt.srcpet? tgt.srcpet: tgt.srcplayer;
|
||||
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){
|
||||
tgt.success(efftype, res);
|
||||
// if(this._data.quoteskillid){
|
||||
|
@ -81,7 +81,7 @@ let TriggerManager = {
|
||||
|
||||
let tgts;
|
||||
if(target && effectid == SkillEffectType.ATTACK_BACK){
|
||||
tgts = [target.oppClone()];
|
||||
tgts = sender.getOppTargets(target);
|
||||
}else{
|
||||
tgts = sender.getTargets(param);
|
||||
}
|
||||
@ -158,7 +158,7 @@ let TriggerManager = {
|
||||
let atkback = effectid == SkillEffectType.ATTACK_BACK;
|
||||
tgts.forEach((item)=>{
|
||||
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);
|
||||
});
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user