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

This commit is contained in:
zhl 2020-12-03 19:22:45 +08:00
commit 3b729fbd73
10 changed files with 388 additions and 119 deletions

View File

@ -1,4 +1,5 @@
import { BaseConst } from "../../constants/BaseConst"; import { BaseConst } from "../../constants/BaseConst";
import { EnhanceEffectType } from "./skill/SkillConst";
let CfgMan = { let CfgMan = {
/** /**
@ -20,6 +21,29 @@ let CfgMan = {
findEffCardCfg(cardid: number){ findEffCardCfg(cardid: number){
return global.$cfg.get(BaseConst.EFFECTCARD).get(cardid); return global.$cfg.get(BaseConst.EFFECTCARD).get(cardid);
},
calcEnhanceValue(obj:{
eT: EnhanceEffectType,
eV: number,
eR: number,
aP: number,
}){
if(!obj){
return 0;
}
switch(obj.eT){
case EnhanceEffectType.EN_POWER_BYAP:
case EnhanceEffectType.EN_SKILL_BYAP:
return obj.eV * obj.eR * obj.aP;
case EnhanceEffectType.EN_POWER_BYCFG:
case EnhanceEffectType.EN_SKILL_BYCFG:
return obj.eV * obj.eR;
case EnhanceEffectType.EN_SUBSKILL_BYCFG:
return obj.eR;
default:
return 0;
}
} }
}; };

View File

@ -5,6 +5,8 @@ import { PlayerHandler } from "./PlayerHandler";
import CfgMan from "../CfgMan"; import CfgMan from "../CfgMan";
import { EffectCardType } from "../skill/SkillConst"; import { EffectCardType } from "../skill/SkillConst";
import { Pet } from "rooms/schema/Pet"; import { Pet } from "rooms/schema/Pet";
import {SkillParam} from "../skill/SkillParam";
export class BattleHandler { export class BattleHandler {
private _cs: CardGameState; private _cs: CardGameState;
@ -26,9 +28,13 @@ export class BattleHandler {
}; };
public getPlayer(aplayer: Player){ public getPlayer(aplayer: Player){
return this._players.get(aplayer); return aplayer? this._players.get(aplayer): null;
}; };
/**
* 使
* @param obj
*/
public useCard(obj: public useCard(obj:
{srcplayer: Player, card: Card, cardpoint: number, eff_cnt: number, dstplayer: Player, dstpet: Pet}) {srcplayer: Player, card: Card, cardpoint: number, eff_cnt: number, dstplayer: Player, dstpet: Pet})
{ {
@ -38,15 +44,21 @@ export class BattleHandler {
let ph = this.getPlayer(obj.srcplayer); let ph = this.getPlayer(obj.srcplayer);
let dstph = this.getPlayer(obj.dstplayer);
let dstpt = dstph? dstph.getPet(obj.dstpet): null;
if(!ph){ if(!ph){
return false; return false;
} }
ph.useCard(obj); let ps = new SkillParam(obj.card.id, obj.cardpoint, obj.eff_cnt, ph, dstph, dstpt);
ph.useCard(ps);
}; };
/** /**
* * 使
* @param obj * @param obj
*/ */
public useSkill(obj:{ public useSkill(obj:{
@ -109,7 +121,7 @@ export class BattleHandler {
*/ */
public onPlayerRoundStart(aplayer: Player){ public onPlayerRoundStart(aplayer: Player){
} };
/** /**
* *
@ -117,5 +129,5 @@ export class BattleHandler {
*/ */
public onPlayerRoundEnd(aplayer: Player){ public onPlayerRoundEnd(aplayer: Player){
} };
} }

View File

@ -3,33 +3,34 @@ import { Pet } from "../../schema/Pet";
import CfgMan from "../CfgMan"; import CfgMan from "../CfgMan";
import {Skill} from "../skill/Skill"; import {Skill} from "../skill/Skill";
import SkillMan from "../skill/SkillMan";
import { EnhanceEffectType, PowerValueType } from "../skill/SkillConst";
import { PlayerHandler } from "./PlayerHandler"; import { PlayerHandler } from "./PlayerHandler";
export class PetHandler { export class PetHandler {
private _pet: Pet; _pet: Pet;
private _owner: PlayerHandler; _owner: PlayerHandler;
_id: number; _id: number;
_cfg: UnitCfg; _cfg: UnitCfg;
_exskills: number[] = []; _skills: Map<number, Skill> = new Map();
_baseap: number; _bornSkills: Skill[];
_dieSkills: Skill[];
_halos: Skill[];
_exap: number; _baseap: number; // 基础
_haloap: number = 0; // 光环
_exredhurt: number; _exredhurt: number;
_halos: Map<number, Skill> = new Map(); _isHero: boolean = false;
public init(apet: Pet, owner: PlayerHandler){ public init(apet: Pet, owner: PlayerHandler){
this._pet = apet; this._pet = apet;
this._owner = owner; this._owner = owner;
}; };
public addGroupAttr(attrstr: string, value: number){
};
public addAttr(attrstr: string, value: number, sender: Skill){
};
public setParam(obj:{ public setParam(obj:{
id: number, ap?: number, effcnt?: number, exskillid: number[]} id: number, ap?: number, effcnt?: number, exskillid: number[]}
@ -37,15 +38,122 @@ export class PetHandler {
this._id = obj.id || 0; this._id = obj.id || 0;
this._cfg = CfgMan.findUnitCfg(this._id); this._cfg = CfgMan.findUnitCfg(this._id);
if(!obj.ap){ if(!obj.ap){
this._baseap = 0;//this._cfg.powernum; this._baseap = this._cfg.powernum;
}else{ }else{
this._baseap = obj.ap; this._baseap = obj.ap;
} if(this._cfg.powernum_typeid == PowerValueType.RATIO){
this._exskills.length = 0; this._baseap *= this._cfg.powernum;
obj.exskillid && obj.exskillid.forEach((skillid: number)=>{
if(skillid > 0){
this._exskills.push(skillid);
} }
}
if(obj.effcnt && this._isEnhancePower(this._cfg.edd_effid)){
this._baseap += CfgMan.calcEnhanceValue({eT: this._cfg.edd_effid, eV:this._cfg.edd_effnum,
eR: obj.effcnt, aP: obj.ap});
}
this._skills.clear();
this.addSkill(this._cfg.base_skill1id);
this.addSkill(this._cfg.base_skill2id);
this.addSkill(this._cfg.base_skill3id);
obj.exskillid && obj.exskillid.forEach((skillid: number)=>{
this.addSkill(skillid, true);
}); });
} };
private _isEnhancePower(enid: number){
return enid == EnhanceEffectType.EN_POWER_BYCFG || enid == EnhanceEffectType.EN_POWER_BYAP;
};
public addHalo(halo: Skill){
this._halos.push(halo);
};
public addSkill(skillid: number, isExSkill?: boolean){
if(skillid > 0){
let obj = this._skills.get(skillid);
if(!obj){
obj = SkillMan.getSkill(skillid);
if(obj){
obj.setOwner(this);
this._skills.set(skillid, obj);
if(isExSkill){
obj.isExSkill = true;
}
if(obj.isBornSkill()){
this._bornSkills.push(obj);
}else if(obj.isDieSkill()){
this._dieSkills.push(obj);
}else if(obj.isHaloSkill()){
this._halos.push(obj);
}
}
return true;
}
}
return false;
};
public delSkill(skillid:number){
if(skillid > 0){
let obj = this._skills.get(skillid);
if(obj){
let idx = this._bornSkills.indexOf(obj);
if(idx >= 0){
this._bornSkills.splice(idx, 1);
}
idx = this._dieSkills.indexOf(obj);
if(idx >= 0){
this._dieSkills.splice(idx, 1);
}
idx = this._halos.indexOf(obj);
if(idx >= 0){
this._halos.splice(idx, 1);
}
}
this._skills.delete(skillid);
}
};
public addAP(value: number){
this._haloap += value;
if(this._haloap < 0){
this._baseap += this._haloap;
this._haloap = 0;
}
if(this._baseap < 0){
this.die();
}
};
public totalAP(){
return this._baseap + this._haloap;
};
public beHurt(value: number){
this.addAP(-value);
};
public born(param: any){
this._owner && this._owner.onPetBorned(this, param);
};
public die(){
this._dieSkills.forEach((item: Skill)=>{
});
this._owner && this._owner.onPetDied(this);
};
public attack(skill: Skill){
};
public checkHalo(apet: PetHandler){
this._halos.forEach((item: Skill)=>{
});
};
} }

View File

@ -8,6 +8,7 @@ import { Pet } from "rooms/schema/Pet";
import { EffectCardType } from "../skill/SkillConst"; import { EffectCardType } from "../skill/SkillConst";
import { UnitCfg } from "cfg/parsers/UnitCfg"; import { UnitCfg } from "cfg/parsers/UnitCfg";
import { Skill } from "../skill/Skill"; import { Skill } from "../skill/Skill";
import { SkillParam } from "../skill/SkillParam";
export class PlayerHandler { export class PlayerHandler {
public _player: Player; public _player: Player;
@ -26,12 +27,15 @@ export class PlayerHandler {
private _owner: BattleHandler; private _owner: BattleHandler;
_friend: PlayerHandler;
public init(aplayer: Player, owner: BattleHandler){ public init(aplayer: Player, owner: BattleHandler){
this._owner = owner; this._owner = owner;
this._player = aplayer; this._player = aplayer;
this._playercfg = CfgMan.findPlayerCfg(this._player.heroId); this._playercfg = CfgMan.findPlayerCfg(this._player.heroId);
this._self = new PetHandler(); this._self = new PetHandler();
this._self.init(null, this); this._self.init(null, this);
this._self._isHero = true;
let lst = this._playercfg.ex_skill? [this._playercfg.ex_skill]: null; let lst = this._playercfg.ex_skill? [this._playercfg.ex_skill]: null;
this._self.setParam({id: this._playercfg.herounit_id, exskillid: lst}); this._self.setParam({id: this._playercfg.herounit_id, exskillid: lst});
this._unitcfg = this._playercfg && CfgMan.findUnitCfg(this._playercfg.herounit_id); this._unitcfg = this._playercfg && CfgMan.findUnitCfg(this._playercfg.herounit_id);
@ -65,10 +69,15 @@ export class PlayerHandler {
return pr; return pr;
}; };
public useCard(obj: public getPet(pet: Pet){
{card: Card, cardpoint: number, eff_cnt: number, dstplayer: Player, dstpet: Pet}) return this._pets.find((item:PetHandler)=>{
return item._pet == pet;
})
};
public useCard(obj: SkillParam)
{ {
let cfg = CfgMan.findEffCardCfg(obj.card.id); let cfg = CfgMan.findEffCardCfg(obj.cardid);
if(!cfg){ if(!cfg){
return false; return false;
} }
@ -81,19 +90,52 @@ export class PlayerHandler {
pet.setParam({id: cfg.eff1Id, ap:obj.cardpoint, effcnt: obj.eff_cnt, exskillid: pet.setParam({id: cfg.eff1Id, ap:obj.cardpoint, effcnt: obj.eff_cnt, exskillid:
[cfg.eff2Id, cfg.eff3Id, cfg.eff4Id, cfg.eff5Id]}); [cfg.eff2Id, cfg.eff3Id, cfg.eff4Id, cfg.eff5Id]});
//todo: build pet init json -> client
pet.born(obj);
}else if(cfg.typeId == EffectCardType.MAGIC){ }else if(cfg.typeId == EffectCardType.MAGIC){
} }
}; };
public useSkill(obj:{ public useSkill(obj: SkillParam)
skillid: number, dstplayer: Player, dstpet: Pet})
{ {
}; };
public addSkill(skillid: number){ public addSkill(skillid: number){
} };
public checkHalo(apet:PetHandler){
this._pets.forEach((obj: PetHandler)=>{
if(obj != apet){
obj.checkHalo(apet);
}
apet.checkHalo(obj);
});
};
public setFriend(aplayer: PlayerHandler){
this._friend = aplayer;
};
public onPetBorned(apet: PetHandler, param: SkillParam){
// 战吼
apet._bornSkills.forEach((item: Skill)=>{
item.trigger(param);
});
//todo: build bornskill json -> client
// 光环
this.checkHalo(apet);
//todo: build haloskill json -> client
};
public onPetDied(apet: PetHandler){
};
public isMyPet(apet: PetHandler){
return this._pets.includes(apet);
}
} }

View File

@ -14,13 +14,15 @@ import { CondType, CondDecideType } from "./SkillConst";
export class Condition { export class Condition {
public _type: number; public _type: number;
private _cdt: CondDecideType; private _cdt: CondDecideType;
private _v: number;
public init(cond_type: number, cond_dt: CondDecideType){ public init(cond_type: CondType, cond_dt: CondDecideType, cond_value: number){
this._type = cond_type; this._type = cond_type;
this._cdt = cond_dt; this._cdt = cond_dt;
this._v = cond_value;
}; };
public isOK(tg_value: any, tg_owner: PlayerHandler, cond_v: number){ public isOK(tg_value: any, tg_owner: PlayerHandler){
if(this._type == CondType.NO_COND){ if(this._type == CondType.NO_COND){
return true; return true;
} }
@ -28,10 +30,10 @@ export class Condition {
switch (this._type) { switch (this._type) {
case CondType.CARD_COUNT_CURR: case CondType.CARD_COUNT_CURR:
v = tg_owner.getCurrCardCount(); v = tg_owner.getCurrCardCount();
return this._isok(v,cond_v,this._cdt); return this._isok(v,this._v,this._cdt);
case CondType.CARD_COUNT_TOTAL: case CondType.CARD_COUNT_TOTAL:
v = tg_owner.getTotalCardCount(); v = tg_owner.getTotalCardCount();
return this._isok(v,cond_v,this._cdt); return this._isok(v,this._v,this._cdt);
case CondType.CARD_ACTION_LINK: case CondType.CARD_ACTION_LINK:
return (tg_value == this._type); return (tg_value == this._type);
case CondType.CARD_ACTION_LINK_OTHER: case CondType.CARD_ACTION_LINK_OTHER:

View File

@ -1,5 +1,8 @@
import { SkillCfg } from "cfg/parsers/SkillCfg";
import { PetHandler } from "../Handler/PetHandler"; import { PetHandler } from "../Handler/PetHandler";
import { TriggerType } from "./SkillConst"; import { PlayerHandler } from "../Handler/PlayerHandler";
import { GameCampType, GameUnitType, SkillEffectType, SkillRangeUnitType, SkillType, TriggerType } from "./SkillConst";
import { SkillParam } from "./SkillParam";
import TriggerManager from "./TriggerMan"; import TriggerManager from "./TriggerMan";
export class Skill { export class Skill {
@ -10,10 +13,10 @@ export class Skill {
_movegrid: number; _movegrid: number;
_visiongrid: number; _visiongrid: number;
_id: number; _id: number;
_data: any; _data: SkillCfg;
_type: any; _type: any;
_show_effect: any[]; _show_effect: any[];
_params: any; _param: number;
_tgctrl: any; _tgctrl: any;
_condv: any; _condv: any;
_condv2: any; _condv2: any;
@ -49,6 +52,7 @@ export class Skill {
_acrp: any; _acrp: any;
attr: any; attr: any;
groupattr: any; groupattr: any;
isExSkill: boolean = false;
// LIFE-CYCLE CALLBACKS: // LIFE-CYCLE CALLBACKS:
// onLoad () {}; // onLoad () {};
@ -57,7 +61,7 @@ export class Skill {
// update (dt) {}; // update (dt) {};
init(skillid: number, skilldata: any, manager: any) { init(skillid: number, skilldata: SkillCfg, manager: any) {
this._currCount = 0; // 当前计数 this._currCount = 0; // 当前计数
this._roundCount = 0; // 回合数 this._roundCount = 0; // 回合数
this._startround = 0; // 触发后回合数 this._startround = 0; // 触发后回合数
@ -66,54 +70,24 @@ export class Skill {
this._visiongrid = 0; this._visiongrid = 0;
this._id = skillid; this._id = skillid;
this._data = skilldata; this._data = skilldata;
this._type = skilldata.effec_id; this._type = skilldata.skill_typeid;
// this._show_effect = this.initSkillShowEffectData(); // this._show_effect = this.initSkillShowEffectData();
// todo: 根据bufftype处理paramlst // todo: 根据bufftype处理paramlst
this._params = TriggerManager.handleEffectParam(this._type, skilldata.effec_valu); this._param = TriggerManager.handleEffectParam(this._type, skilldata.eff_num);
this._tgctrl = TriggerManager.addSkillTrigger(this._id, skilldata.triggerType, skilldata.condType, skilldata.condition_valu); this._tgctrl = TriggerManager.addSkillTrigger(this._id, skilldata.tigger_typeid,
skilldata.cond_typeid, skilldata.cond_rangeid, skilldata.cond_num);
// if (this._params.length > 4) {
// this._maxvalue = this._params[4];
// }
this._man = manager; this._man = manager;
}; };
initSkillShowEffectData() {
//0: "3,0,1,1,1,1"
let _show_effect = [];
for (let i = 0; i < this._data.show_effect.length; i++) {
let effect = this._data.show_effect[i].split(',');
if (effect == '') {
continue;
}
let tmp = {
'times': Number(effect[0]),
'fight_type': Number(effect[1]),
'delay': Number(effect[2]),
'trigger': Number(effect[3]),
'effect': Number(effect[4]),
'loop': Number(effect[5]),
'speed': Number(effect[6]),
'data': this._data,
'sound': effect.length > 7? ''+effect[7]: ''
}
_show_effect.push(tmp);
}
return _show_effect;
};
triggerType() { triggerType() {
return this._data.trigger_id; return this._data.tigger_typeid;
}; };
skillname() { skillname() {
return this._data.name; return this._data.name;
}; };
icon() {
return this._data.icon ? this._data.icon : '';
};
clear() { clear() {
this._id = 0; this._id = 0;
this._data = null; this._data = null;
@ -127,18 +101,70 @@ export class Skill {
return true; return true;
}; };
isBornSkill(){
return this._type == SkillType.BORN;
};
isDieSkill(){
return this._type == SkillType.DEAD;
};
isHaloSkill(){
return this._type == SkillType.HALO;
};
isTauntSkill(){
return this._data.effect_typeid == SkillEffectType.TAUNT;
};
// 是否是稀有技能 // 是否是稀有技能
isRareSkill() { isRareSkill() {
return this._data && (this._data.is_sp == 1); return false;
}; };
// 是否是获得即起效技能 // 是否是获得即起效技能
isIMMSkill() { isIMMSkill() {
return this._data && (this._data.trigger_id == TriggerType.NO_COND); return this._data && (this._data.tigger_typeid == TriggerType.NO_COND);
};
canEffectPet(apet: PetHandler){
switch(this._data.targetid){
case GameUnitType.PLAYER:
return false;
case GameUnitType.BATTLEUNIT:
return apet != null;
case GameUnitType.HERO:
return apet && apet._isHero;
case GameUnitType.PET:
return apet && !apet._isHero;
default:
return true;
}
};
canEffectCamp(aplayer: PlayerHandler){
let isselfplayer = this._owner._owner == aplayer;
let isteamplayer = this._owner._owner._friend == aplayer;
switch(this._data.friendlyid){
case GameCampType.SELF:
return isselfplayer;
case GameCampType.FRIEND:
return isteamplayer;
case GameCampType.MYTEAM:
return isselfplayer || isteamplayer;
case GameCampType.ENEMY:
case GameCampType.ENEMYTEAM:
return !isselfplayer && !isteamplayer;
case GameCampType.ALL:
return true;
default:
return false;
}
}; };
canComposition() { canComposition() {
return this._data.is_composition == 1; return false;
}; };
// 割草技能溅射相关 // 割草技能溅射相关
@ -146,7 +172,7 @@ export class Skill {
return this._splashinfo; return this._splashinfo;
}; };
trigger(param: any) { trigger(param: SkillParam) {
//触发buff效果 //触发buff效果
let bok = TriggerManager.onTrigger(this, param); let bok = TriggerManager.onTrigger(this, param);
@ -332,11 +358,6 @@ export class Skill {
} }
}; };
addGroupAttr(attrstr: string, value: number) {
this._owner.addGroupAttr(attrstr, value);
this.groupattr_value = value;
};
// 是否是团队加属性技能 // 是否是团队加属性技能
isGroupAttrSkill() { isGroupAttrSkill() {
if (this.groupattr) { if (this.groupattr) {
@ -345,23 +366,6 @@ export class Skill {
return false; return false;
}; };
// 增加属性
addAttr(attrstr: string, value: number) {
// if(!this._attrmap){
// this._attrmap = {};
// }
// this._tmp = btemp;
// let n = this._attrmap[attrstr];
// if(n){
// this._attrmap[attrstr] = n + value;
// }else{
// this._attrmap[attrstr] = value;
// }
// this._delayround = delaycount? delaycount: 0;
this._owner.addAttr(attrstr, value, this);
};
// 是否是加属性技能 // 是否是加属性技能
isAttrSkill() { isAttrSkill() {
if (this.attr) { if (this.attr) {
@ -491,13 +495,7 @@ export class Skill {
obj._id = this._id; obj._id = this._id;
obj._data = this._data; obj._data = this._data;
obj._type = this._type; obj._type = this._type;
this._params.forEach((element: any) => { obj._param = this._param;
if (!obj._params) {
obj._params = [];
}
obj._params.push(element);
});
// obj._params = this._params;
obj._tgctrl = this._tgctrl; obj._tgctrl = this._tgctrl;
obj._condv = this._condv; obj._condv = this._condv;
obj._man = this._man; obj._man = this._man;

View File

@ -1,3 +1,4 @@
// 判断条件
export const enum CondType export const enum CondType
{ {
NO_COND = 0, NO_COND = 0,
@ -13,6 +14,7 @@ export const enum CondType
CARD_ACTION_LINK_SELF = 5, CARD_ACTION_LINK_SELF = 5,
}; };
// 判断方式
export const enum CondDecideType { export const enum CondDecideType {
NO_DECIDE = 0, NO_DECIDE = 0,
@ -23,6 +25,7 @@ export const enum CondDecideType {
EQUAL = 3, EQUAL = 3,
}; };
// 触发类型
export const enum TriggerType export const enum TriggerType
{ {
NO_COND = 0, NO_COND = 0,
@ -33,19 +36,22 @@ export const enum TriggerType
CARD_USED = 3, CARD_USED = 3,
CARD_DROP = 4, CARD_DROP_MYROUND = 4,
ROUND_END_MYSELF = 5, ROUND_END_MYSELF = 5,
CARD_GETTED = 6, CARD_GETTED = 6,
ROUND_START_MYSELF = 6, CARD_DROP_OTHERROUND = 7,
ROUND_START_MYSELF = 8,
}; };
// 技能大类
export const enum SkillType{ export const enum SkillType{
NONE = 0, NONE = 0,
MAGIC = 1, MAGIC = 1,
SHOUT = 2, BORN = 2,
DEAD = 3, DEAD = 3,
HALO = 4, HALO = 4,
NORMAL = 5, NORMAL = 5,
@ -53,6 +59,16 @@ export const enum SkillType{
EN_POINT = 7, EN_POINT = 7,
}; };
// 技能作用范围(对单位而言)
export const enum SkillRangeUnitType{
NONE = 0,
SELF = 1,
OTHER = 2,
ALL = 3,
ALL_EXSELF = 4,
};
// 技能效果类型
export const enum SkillEffectType export const enum SkillEffectType
{ {
NONE = 0, NONE = 0,
@ -71,9 +87,55 @@ export const enum SkillEffectType
HURT_RED = 12, HURT_RED = 12,
}; };
// 技能效果参数类型
export const enum SkillEffectValueType
{
NONE = 0,
NUMBER = 1,
RATIO = 2,
};
// 效果卡类型
export const enum EffectCardType export const enum EffectCardType
{ {
NONE = 0, NONE = 0,
NPC = 1, NPC = 1,
MAGIC = 2, MAGIC = 2,
}; };
// 技能效果强化类型
export const enum EnhanceEffectType {
NONE = 0,
EN_SKILL_BYCFG = 1, // 1.(使效果参数)+效果强化参数*效果强化牌数
EN_SKILL_BYAP = 2, // 2.(使效果参数)+效果强化参数的倍速*联合牌总点数*效果强化牌数
EN_SUBSKILL_BYCFG = 3, // 3.(使引用随从、技能的次数)+效果强化牌数
EN_POWER_BYCFG = 4, // 4.(使出场战力)+效果强化参数*效果强化牌数
EN_POWER_BYAP = 5,// 5.(使出场战力)+效果强化参数的倍速*联合牌总点数*效果强化牌数
};
// 游戏单位类型
export const enum GameUnitType {
NONE = 0,
PLAYER = 1,
BATTLEUNIT = 2,
HERO = 2,
PET = 3,
};
// 游戏敌我阵营
export const enum GameCampType {
NONE = 0,
SELF = 1,
FRIEND = 2,
MYTEAM = 3,
ENEMY = 4,
ENEMYTEAM = 5,
ALL = 6,
};
// 战力参数数值
export const enum PowerValueType {
NONE = 0,
NUMBER = 1,
RATIO = 2,
};

View File

@ -47,4 +47,4 @@ let SkillMan = {
} }
}; };
module.exports = SkillMan; export default SkillMan;

View File

@ -0,0 +1,20 @@
import {PlayerHandler} from "../Handler/PlayerHandler";
import {PetHandler} from "../Handler/PetHandler";
export class SkillParam{
cardid: number;
cardpoint: number;
eff_cnt: number;
srcplayer: PlayerHandler;
dstplayer: PlayerHandler;
dstpet: PetHandler;
constructor(cardid: number, cardpoint: number, effcnt: number, srcplayer: PlayerHandler, dstplayer: PlayerHandler, dstpet: PetHandler){
this.cardid = cardid;
this.cardpoint = cardpoint;
this.eff_cnt = effcnt;
this.srcplayer = srcplayer;
this.dstplayer = dstplayer;
this.dstpet = dstpet;
}
};

View File

@ -11,6 +11,7 @@ import { PetHandler } from "../Handler/PetHandler";
import { Condition } from "./Condition"; import { Condition } from "./Condition";
import { Skill } from "./Skill"; import { Skill } from "./Skill";
import { CondDecideType, CondType, SkillEffectType, TriggerType } from "./SkillConst"; import { CondDecideType, CondType, SkillEffectType, TriggerType } from "./SkillConst";
import { SkillParam } from "./SkillParam";
import { Trigger } from "./Trigger"; import { Trigger } from "./Trigger";
import { TriggerCtrl } from "./TriggerCtrl"; import { TriggerCtrl } from "./TriggerCtrl";
@ -23,19 +24,19 @@ let TriggerManager = {
_conditionmap: new Map(), _conditionmap: new Map(),
addSkillTrigger(skill_id: number, tg_type: TriggerType, tg_cond: CondType, tg_cond_decide: CondDecideType) { addSkillTrigger(skill_id: number, tg_type: TriggerType, tg_cond: CondType, tg_cond_decide: CondDecideType, tg_cond_v: number) {
let obj = this.getSkillTrigger(skill_id); let obj = this.getSkillTrigger(skill_id);
if (!obj) { if (!obj) {
obj = this._newTrigger(skill_id, tg_type, tg_cond, tg_cond_decide); obj = this._newTrigger(skill_id, tg_type, tg_cond, tg_cond_decide, tg_cond_v);
this._skillmap.set(skill_id, obj); this._skillmap.set(skill_id, obj);
} }
return obj; return obj;
}, },
addBuffTrigger(buff_id: number, tg_type: TriggerType, tg_cond: CondType, tg_cond_decide: CondDecideType) { addBuffTrigger(buff_id: number, tg_type: TriggerType, tg_cond: CondType, tg_cond_decide: CondDecideType, tg_cond_v: number) {
let obj = this.getBuffTrigger(buff_id); let obj = this.getBuffTrigger(buff_id);
if (!obj) { if (!obj) {
obj = this._newTrigger(buff_id, tg_type, tg_cond, tg_cond_decide); obj = this._newTrigger(buff_id, tg_type, tg_cond, tg_cond_decide, tg_cond_v);
this._buffmap.set(buff_id, obj); this._buffmap.set(buff_id, obj);
} }
return obj; return obj;
@ -49,7 +50,7 @@ let TriggerManager = {
return this._buffmap.get(buff_id); return this._buffmap.get(buff_id);
}, },
_newTrigger(id: number, tg_type: TriggerType, tg_cond: CondType, tg_cond_decide: CondDecideType) { _newTrigger(id: number, tg_type: TriggerType, tg_cond: CondType, tg_cond_decide: CondDecideType, tg_cond_v: number) {
let tobj = this._triggermap.get(tg_type); let tobj = this._triggermap.get(tg_type);
if (!tobj) { if (!tobj) {
tobj = new Trigger(); tobj = new Trigger();
@ -60,7 +61,7 @@ let TriggerManager = {
let cobj = this._conditionmap.get(tg_cond); let cobj = this._conditionmap.get(tg_cond);
if (!cobj) { if (!cobj) {
cobj = new Condition(); cobj = new Condition();
cobj.init(tg_cond, tg_cond_decide); cobj.init(tg_cond, tg_cond_decide, tg_cond_v);
this._conditionmap.set(tg_cond, cobj); this._conditionmap.set(tg_cond, cobj);
} }
@ -71,9 +72,9 @@ let TriggerManager = {
}, },
onTrigger(sender: Skill, target: any) { onTrigger(sender: Skill, target: SkillParam) {
let effectid = sender._type; let effectid = sender._type;
let paramlst = sender._params; let paramlst = sender._param;
let owner = sender._owner; let owner = sender._owner;
let bResOk = true; let bResOk = true;
switch (effectid) { switch (effectid) {
@ -97,7 +98,7 @@ let TriggerManager = {
return bResOk; return bResOk;
}, },
handleEffectParam(effectid: SkillEffectType, paramlst: any[]) { handleEffectParam(effectid: SkillEffectType, paramlst: any) {
return paramlst; return paramlst;
switch (effectid) { switch (effectid) {
case SkillEffectType.NONE: case SkillEffectType.NONE: