add dsttype limit

This commit is contained in:
yuexin 2020-12-04 19:39:59 +08:00
parent f97fe76644
commit 8927efab0a
4 changed files with 45 additions and 106 deletions

View File

@ -20,6 +20,8 @@ export class PetHandler {
_dieSkills: Skill[] = [];
_halos: Skill[] = [];
_otherhalos: Skill[] = [];
_baseap: number; // 基础
_exap: number = 0; // 额外
@ -82,7 +84,7 @@ export class PetHandler {
if(!obj){
obj = SkillMan.getSkill(skillid);
if(obj){
obj.setOwner(this);
obj.setOwner(this._owner);
this._skills.set(skillid, obj);
this._selfskills.push(skillid);
if(obj.isBornSkill()){
@ -172,13 +174,13 @@ export class PetHandler {
this._owner && this._owner.onPetDied(this);
};
public attack(skill: Skill){
public useSkill(skillid: number){
};
public checkHalo(apet: PetHandler){
this._halos.forEach((item: Skill)=>{
});
};

View File

@ -3,9 +3,8 @@ import { PetHandler } from "./PetHandler";
import { HeroCfg } from "../../../cfg/parsers/HeroCfg";
import { BattleHandler } from "./BattleHandler";
import CfgMan from "../CfgMan";
import { Card } from "rooms/schema/Card";
import { Pet } from "rooms/schema/Pet";
import { EffectCardType, GameUnitType } from "../skill/SkillConst";
import { EffectCardType, GameUnitType, TriggerType } from "../skill/SkillConst";
import { UnitCfg } from "cfg/parsers/UnitCfg";
import { Skill } from "../skill/Skill";
import { SkillParam, SkillTarget } from "../skill/SkillParam";
@ -42,7 +41,7 @@ export class PlayerHandler {
};
public getCurrCardCount(){
return 0;
return this._player.cards.size;
};
public getTotalCardCount(){
@ -129,13 +128,13 @@ export class PlayerHandler {
pet.born(obj);
}else if(cfg.type_id == EffectCardType.MAGIC){
}
};
public useSkill(obj: SkillParam)
public useSkill(skillid: number, obj: SkillParam)
{
};
public addSkill(skillid: number){
@ -190,7 +189,7 @@ export class PlayerHandler {
// 战吼
let reslst: SkillTarget[] = [];
apet._bornSkills.forEach((item: Skill)=>{
let lst = item.trigger(param);
let lst = item.checkTrigger(TriggerType.NO_COND, 0, param);
reslst = reslst.concat(lst);
});
@ -206,6 +205,10 @@ export class PlayerHandler {
};
public onSkillEnd(askill: Skill, res: SkillTarget[]){
};
public isMyPet(apet: PetHandler){
return this._pets.includes(apet);
};

View File

@ -13,47 +13,18 @@ export class Skill {
_roundCount: number;
_startround: number;
_delayround: number;
_movegrid: number;
_visiongrid: number;
_id: number;
_data: SkillCfg;
_type: any;
_show_effect: any[];
_param: number;
_tgctrl: TriggerCtrl;
_maxvalue: any;
_man: any;
_splashinfo: {};
_owner: PetHandler;
attr_value: any;
groupattr_value: any;
_aclst: any;
_skill1pr: any;
_skill2pr: any;
start: any;
_owner: PlayerHandler;
_start: boolean;
_cb: any;
atk_attr: any;
_tmp: any;
atk_type: any;
atk_value: any;
atk_count: any;
_attrmap: any;
wudi: any;
_need_disappear: boolean;
_atkfirst: any;
_no_move: any;
_no_atk: any;
_no_atkback: any;
_hide: any;
_imm_ph: any;
_imm_magic: any;
_immeffid: number;
_immlst: any;
_acrp: any;
attr: any;
groupattr: any;
isExSkill: boolean = false;
ap: number = 0;
rd: number = 0;
// LIFE-CYCLE CALLBACKS:
// onLoad () {};
@ -67,12 +38,10 @@ export class Skill {
this._roundCount = 0; // 回合数
this._startround = 0; // 触发后回合数
this._delayround = 0; // 延迟回合数
this._movegrid = 0;
this._visiongrid = 0;
this._id = skillid;
this._data = skilldata;
this._type = skilldata.skill_typeid;
// this._show_effect = this.initSkillShowEffectData();
// todo: 根据bufftype处理paramlst
this._param = TriggerManager.handleEffectParam(this._type, skilldata.eff_num);
this._tgctrl = TriggerManager.addSkillTrigger(this._id, skilldata.tigger_typeid,
@ -145,55 +114,8 @@ export class Skill {
return this._data.rangeid == SkillRangeUnitType.ALL;
};
isEffectValidPet(apet: PetHandler){
switch(this._data.rangeid){
case SkillRangeUnitType.SELF:
return this._owner == apet;
case SkillRangeUnitType.OTHER:
case SkillRangeUnitType.ALL_EXSELF:
return this._owner != apet;
default:
return true;
}
};
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;
}
};
getTargets(param: SkillParam): SkillTarget[]{
return this._owner._owner._owner.getSkillTargets(this, param);
return this._owner._owner.getSkillTargets(this, param);
};
getEnhanceValue(param: SkillParam): number{
@ -211,7 +133,7 @@ export class Skill {
this._currCount++;
if (!this.start) {
if (!this._start) {
this._start = true;
}
@ -222,7 +144,7 @@ export class Skill {
return res;
};
checkTrigger(tg_type: TriggerType, tg_value: any, tg_target: any, cb: any) {
checkTrigger(tg_type: TriggerType, tg_value: any, tg_target: SkillParam, cb?: any) {
if (tg_type == TriggerType.ROUND_START_MYSELF) {
this._roundCount++;
if (this._start) {
@ -246,12 +168,18 @@ export class Skill {
if(n >= 0){
tgt.success(efftype, n);
}
}else{
tgt.fail(efftype, -1);
}
break;
case SkillEffectType.CARD_ADD_LIMIT:
let n = tgt.dst.addCardLimit(res);
if(n >= 0){
tgt.success(efftype, n);
if(tgt.dsttype == GameUnitType.PLAYER){
let n = tgt.dst.addCardLimit(res);
if(n >= 0){
tgt.success(efftype, n);
}
}else{
tgt.fail(efftype, -1);
}
break;
case SkillEffectType.CARD_STEAL:
@ -260,6 +188,8 @@ export class Skill {
if(n >= 0){
tgt.success(efftype, n);
}
}else{
tgt.fail(efftype, -1);
}
break;
case SkillEffectType.CARD_CHG_EN:
@ -277,12 +207,16 @@ export class Skill {
if(tgt.dsttype != GameUnitType.NONE && tgt.dsttype != GameUnitType.PLAYER){
let n = efftype == SkillEffectType.POWER_ENHANCE? tgt.dst.addBaseAP(effvalue): tgt.dst.addExAP(effvalue);
tgt.success(efftype, n);
}else{
tgt.fail(efftype, -1);
}
break;
case SkillEffectType.HURT_POWER:
if(tgt.dsttype != GameUnitType.NONE && tgt.dsttype != GameUnitType.PLAYER){
let n = tgt.dst.beHurt(effvalue);
tgt.success(efftype, n);
}else{
tgt.fail(efftype, -1);
}
break;
default:
@ -295,6 +229,8 @@ export class Skill {
if(tgt.dsttype == GameUnitType.PLAYER){
let n = tgt.dst.addHp(effvalue);
tgt.success(efftype, n);
}else{
tgt.fail(efftype, -1);
}
}
};
@ -309,14 +245,16 @@ export class Skill {
reduceHurt(efftype: SkillEffectType, effvalue: number, tgt: SkillTarget){
if(efftype == SkillEffectType.HURT_REDUCE){
if(tgt.dsttype == GameUnitType.PLAYER){
if(tgt.dsttype != GameUnitType.NONE && tgt.dsttype != GameUnitType.PLAYER){
let n = tgt.dst.addReduceHurt(effvalue);
tgt.success(efftype, n);
}else{
tgt.fail(efftype, -1);
}
}
};
setOwner(owner: PetHandler) {
setOwner(owner: PlayerHandler) {
this._owner = owner;
};
@ -330,16 +268,12 @@ export class Skill {
obj._roundCount = 0; // 回合数
obj._startround = 0; // 触发后回合数
obj._delayround = 0; // 延迟回合数
obj._movegrid = 0;
obj._visiongrid = 0;
obj._id = this._id;
obj._data = this._data;
obj._type = this._type;
obj._param = this._param;
obj._tgctrl = this._tgctrl;
obj._man = this._man;
obj._show_effect = this._show_effect;
obj._maxvalue = this._maxvalue;
return obj;
};
};

View File

@ -24,7 +24,7 @@ export class TriggerCtrl{
this._cond = condobj;
};
checkTrigger(tg_type: TriggerType, tg_value: any, tg_owner: any, callback?: any): boolean{
checkTrigger(tg_type: TriggerType, tg_value: any, tg_owner: PlayerHandler, callback?: any): boolean{
if(tg_type == TriggerType.NO_COND){
// callback && callback();
return true;