新版本准备

This commit is contained in:
yuexin 2020-12-18 19:04:28 +08:00
parent c9aaf18a82
commit 0ba72b440b
7 changed files with 161 additions and 18 deletions

BIN
doc/todolist.xmind Normal file

Binary file not shown.

View File

@ -2,6 +2,7 @@ import { EffectCardCfg } from "cfg/parsers/EffectCardCfg";
import { HeroCfg } from "cfg/parsers/HeroCfg";
import { SkillCfg } from "cfg/parsers/SkillCfg";
import { UnitCfg } from "cfg/parsers/UnitCfg";
import arrUtil from "utils/array.util";
import { BaseConst } from "../../constants/BaseConst";
import { EffectCardType, EnhanceEffectType, SkillEffectSignType, SkillEffectValueType, SkillTargetType } from "./skill/SkillConst";
@ -12,6 +13,8 @@ let CfgMan = {
*/
_cardcache: new Map(),
_typecards: new Map(),
findPlayerCfg(playerid: number): HeroCfg{
return global.$cfg.get(BaseConst.HERO).get(playerid);
},
@ -109,6 +112,38 @@ let CfgMan = {
this._cardcache.set(cardid + '', {target: res});
return res;
},
randomCard(subtype: number): number{
if(this._typecards.size == 0){
for(let [key, val] of global.$cfg.get(BaseConst.EFFECTCARD)){
let id1 = val.affix1id;
let id2 = val.affix2id;
if(id1){
let lst = this._typecards.get(id1 + '');
if(!lst){
lst = [key];
this._typecards.set(id1 + '', lst);
}else{
lst.push(key);
}
}
if(id2 && id2 != id1){
let lst = this._typecards.get(id2 + '');
if(!lst){
lst = [key];
this._typecards.set(id2 + '', lst);
}else{
lst.push(key);
}
}
}
}
let obj = this._typecards.get(subtype + '');
return obj? arrUtil.randomOne(obj): 0;
}
};

View File

@ -102,7 +102,7 @@ export class BattleHandler {
{
let pet = apet;
let bok = this.petIsValid(pet, players, ct);
if(checktaunt && (!bok || !pet._istaunt)){
if(checktaunt && (!bok || !pet.isTaunt())){
for(let i = 0; i < players.length;i++){
let obj = players[i].findTauntPet();
if(obj){

View File

@ -29,6 +29,8 @@ export class PetHandler {
_baseap: number; // 基础
_basehp: number = 0;
// _exap: number = 0; // 额外
_exredhurt: number = 0; // 减伤
@ -37,10 +39,15 @@ export class PetHandler {
_istaunt: boolean = false; // 是否是嘲讽
_isSilent: boolean = false; // 是否被沉默
_silentCD: number = 0; // 沉默剩余回合
_selfskills: number[] = [];
_idx: number;
_bakBaseap: number;
public init(apet: Pet, owner: PlayerHandler, index: number){
this._pet = apet;
this._owner = owner;
@ -188,6 +195,7 @@ export class PetHandler {
if(value <= 0){
return 0;
}
let n = -value;
for(let i = 0; i < this._effhalos.length;i++){
let dv = this._effhalos[i].addHaloValue(n);
@ -196,21 +204,20 @@ export class PetHandler {
break;
}
}
if(n < 0){
this._baseap += n;
this._ceilBaseAP();
if(n >= 0){
this.dataChanged();
return value;
}
this.dataChanged();
if(this._baseap <= 0){
this.die();
}
return value;
return this.addBaseAP(n);
};
public addBaseAP(value: number): number{
if(value == 0){
return 0;
}
this._bakBaseap = this._baseap;
this._baseap += value;
this._ceilBaseAP();
this.dataChanged();
@ -254,11 +261,22 @@ export class PetHandler {
this._owner && this._owner.onPetBorned(this, param);
};
public isDead(){
return this._baseap <= 0;
};
public die(){
this.clear();
this._owner && this._owner.onPetDied(this);
};
public reborn(){
this._effhalos.forEach((item: Skill) => {
item.resetHaloValue();
});
this._baseap = this._bakBaseap;
this._bakBaseap = 0;
};
public clear(){
if(this._halos.length > 0){
this._halos.length = 0;
@ -276,10 +294,30 @@ export class PetHandler {
this._istaunt = false;
};
public isTaunt(){
return this._istaunt;
};
public isSilent(){
return this._isSilent;
};
public summonPet(petid: number, count: number = 1, exparam: SkillParam):number{
return this._owner.summonPet(petid, count, exparam);
};
public beSilent(count: number){
this._isSilent = true;
this._silentCD = count;
if(this.hasHaloSkill()){
}
};
public hasHaloSkill(): boolean{
return this._halos.length > 0;
};
public hasHalo(skill: Skill): boolean{
return this._halos.includes(skill);
};
@ -314,6 +352,9 @@ export class PetHandler {
};
public checkSkills(tgtype: TriggerType, tgtv: any, sp: SkillParam, cb?: any){
if(this._isSilent){
return;
}
this._waitskills.forEach((item: Skill) => {
item.checkTrigger(tgtype, tgtv, sp, cb);
});

View File

@ -270,16 +270,24 @@ export class PlayerHandler {
this._owner.onAddPetNotify(apet);
// 战吼
this.simpleCheckSkills(apet._bornSkills, apet, param);
if(!apet.isSilent()){
this.simpleCheckSkills(apet._bornSkills, apet, param);
}
};
public onPetDied(apet: PetHandler){
this._owner.onDelPetNotify(apet);
public onPetDied(apet: PetHandler): boolean{
// 遗愿
this.simpleCheckSkills(apet._dieSkills);
if(!apet.isSilent()){
this.simpleCheckSkills(apet._dieSkills);
}
this.delPet(apet);
if(apet.isDead()){
this._owner.onDelPetNotify(apet);
apet.clear();
this.delPet(apet);
}
return true;
};
public onPetChanged(apet: PetHandler){
@ -350,11 +358,11 @@ export class PlayerHandler {
};
public findTauntPet(): PetHandler{
if(this._self && this._self._istaunt){
if(this._self && this._self.isTaunt()){
return this._self;
}
return this._pets.find((item: PetHandler) =>{
return item._istaunt;
return item.isTaunt();
})
};

View File

@ -24,6 +24,7 @@ export class Skill {
_cb: any;
halo_v: number = -1;
reborn_v: number = -1;
rd: number = 0;
// LIFE-CYCLE CALLBACKS:
@ -198,6 +199,10 @@ export class Skill {
return 0;
};
resetHaloValue(){
this.halo_v = -1;
};
trigger(param: SkillParam, cb?: any) {
//触发buff效果
let res = TriggerManager.onTrigger(this, param);

View File

@ -1,4 +1,16 @@
// 判断条件
/**
* 0.
* 1.
* 2.
* 3./
* 4.
* 5.
* 6.
* 7.
* 8.ID40122
*/
export const enum CondType
{
NO_COND = 0,
@ -12,6 +24,12 @@ export const enum CondType
CARD_ACTION_LINK_OTHER = 4,
CARD_ACTION_LINK_SELF = 5,
BE_ATTACK = 6,
BE_HURT = 7,
BEFORE_ATTACK = 8,
};
// 判断方式
@ -96,6 +114,14 @@ export const enum SkillRangeUnitType{
* 11.HP
* 12.[]
* 13.
* 21.ID
* 22.
* 23.HP均有效
* 24.
* 25.N回合N=
* 26.
* 27.
* 28.使ID
*/
export const enum SkillEffectType
{
@ -114,6 +140,13 @@ export const enum SkillEffectType
POWER_ADD_BUFF = 12,
HURT_REDUCE = 13,
CARD_GETDIRECT = 21,
ATTACK = 22,
HURT_ALL = 23,
ENHANCE_MAGIC = 24,
SILENT = 25,
REBORN = 26,
ATTACK_BACK = 27,
SKILL_GET = 28,
};
// 技能效果参数类型
@ -147,6 +180,9 @@ export const enum EffectCardType
* 3.使+
* 4.使+*
* 5.使+**
* 21.使+a牌数
* 22.使+a牌数
* 23.使+a牌数
*/
export const enum EnhanceEffectType {
NONE = 0,
@ -155,6 +191,9 @@ export const enum EnhanceEffectType {
EN_SUBSKILL_BYCFG = 3,
EN_POWER_BYCFG = 4,
EN_POWER_BYAP = 5,
EN_SKILL_USECOUNT_MIN = 21,
EN_SKILL_USECOUNT_MAX = 22,
EN_SKILL_QCOUNT_MAX = 23,
};
// 游戏单位类型
@ -168,6 +207,18 @@ export const enum GameUnitType {
};
// 游戏敌我阵营
/**
* 1.
* 2.
* 3.
* 4.
* 5.
* 6.
* 7.
* 8.
* 9.
*/
export const enum GameCampType {
NONE = 0,
SELF = 1,
@ -176,6 +227,9 @@ export const enum GameCampType {
ENEMY = 4,
ENEMYTEAM = 5,
ALL = 6,
RANDOM_US = 7,
RANDOM_ENEMY = 8,
FACE_ENEMY = 9,
};
// 战力参数数值