导表+光环优化处理(未测试)

This commit is contained in:
yuexin 2021-01-14 19:20:24 +08:00
parent 17ea5b847e
commit aeaedccf8c
13 changed files with 90 additions and 58 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":30012,"herounit_id":52012,"ex_skill":0,"follower1id":51072,"follower2id":51082,"follower3id":51032,"follower4id":51052},{"id":30022,"herounit_id":52022,"ex_skill":0,"follower1id":51372,"follower2id":51162,"follower3id":51382,"follower4id":51332},{"id":30032,"herounit_id":52032,"ex_skill":0,"follower1id":51352,"follower2id":51042,"follower3id":51142,"follower4id":51062},{"id":30042,"herounit_id":52042,"ex_skill":0,"follower1id":51062,"follower2id":51122,"follower3id":51112,"follower4id":51042},{"id":30052,"herounit_id":52052,"ex_skill":0,"follower1id":51132,"follower2id":51082,"follower3id":51402,"follower4id":51112},{"id":30062,"herounit_id":52062,"ex_skill":0,"follower1id":51222,"follower2id":51272,"follower3id":51412,"follower4id":51042},{"id":30072,"herounit_id":52072,"ex_skill":0,"follower1id":51012,"follower2id":51082,"follower3id":51402,"follower4id":51152},{"id":30082,"herounit_id":52082,"ex_skill":0,"follower1id":51062,"follower2id":51272,"follower3id":51072,"follower4id":51052},{"id":30092,"herounit_id":52092,"ex_skill":0,"follower1id":51102,"follower2id":51372,"follower3id":51232,"follower4id":51292},{"id":30102,"herounit_id":52102,"ex_skill":0,"follower1id":51022,"follower2id":51092,"follower3id":51192,"follower4id":51392},{"id":30112,"herounit_id":52112,"ex_skill":0,"follower1id":51372,"follower2id":51162,"follower3id":51382,"follower4id":51332},{"id":30122,"herounit_id":52122,"ex_skill":0,"follower1id":51252,"follower2id":51052,"follower3id":51402,"follower4id":51132},{"id":30132,"herounit_id":52132,"ex_skill":0,"follower1id":51032,"follower2id":51342,"follower3id":51412,"follower4id":51252},{"id":30142,"herounit_id":52142,"ex_skill":0,"follower1id":51402,"follower2id":51202,"follower3id":51212,"follower4id":51342}] [{"id":30012,"herounit_id":52012,"org_gift":"1","ex_skill":0,"follower1id":51072,"follower2id":51082,"follower3id":51032,"follower4id":51152},{"id":30022,"herounit_id":52022,"org_gift":"","ex_skill":0,"follower1id":51372,"follower2id":51162,"follower3id":51382,"follower4id":51332},{"id":30032,"herounit_id":52032,"org_gift":"1","ex_skill":0,"follower1id":51052,"follower2id":51042,"follower3id":51122,"follower4id":51062},{"id":30042,"herounit_id":52042,"org_gift":"1","ex_skill":0,"follower1id":51062,"follower2id":51122,"follower3id":51072,"follower4id":51042},{"id":30052,"herounit_id":52052,"org_gift":"","ex_skill":0,"follower1id":51132,"follower2id":51082,"follower3id":51402,"follower4id":51112},{"id":30062,"herounit_id":52062,"org_gift":"","ex_skill":0,"follower1id":51222,"follower2id":51272,"follower3id":51412,"follower4id":51042},{"id":30072,"herounit_id":52072,"org_gift":"1","ex_skill":0,"follower1id":51012,"follower2id":51082,"follower3id":51032,"follower4id":51152},{"id":30082,"herounit_id":52082,"org_gift":"1","ex_skill":0,"follower1id":51062,"follower2id":51082,"follower3id":51072,"follower4id":51052},{"id":30092,"herounit_id":52092,"org_gift":"","ex_skill":0,"follower1id":51102,"follower2id":51372,"follower3id":51232,"follower4id":51292},{"id":30102,"herounit_id":52102,"org_gift":"","ex_skill":0,"follower1id":51022,"follower2id":51092,"follower3id":51192,"follower4id":51392},{"id":30112,"herounit_id":52112,"org_gift":"","ex_skill":0,"follower1id":51372,"follower2id":51162,"follower3id":51382,"follower4id":51332},{"id":30122,"herounit_id":52122,"org_gift":"","ex_skill":0,"follower1id":51252,"follower2id":51352,"follower3id":51402,"follower4id":51132},{"id":30132,"herounit_id":52132,"org_gift":"","ex_skill":0,"follower1id":51032,"follower2id":51342,"follower3id":51412,"follower4id":51252},{"id":30142,"herounit_id":52142,"org_gift":"","ex_skill":0,"follower1id":51402,"follower2id":51202,"follower3id":51212,"follower4id":51342}]

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -4,6 +4,7 @@ export class EffectCardCfg implements Cfg{
name: "EffectCardCfg"; name: "EffectCardCfg";
public id: number; public id: number;
public org_gift: number;
public type_id: number; public type_id: number;
public count: number; public count: number;
public weight: number; public weight: number;
@ -19,6 +20,7 @@ export class EffectCardCfg implements Cfg{
public decode(data: any) { public decode(data: any) {
this.id = data.id; this.id = data.id;
this.org_gift = data.org_gift;
this.type_id = data.type_id; this.type_id = data.type_id;
this.count = data.count; this.count = data.count;
this.weight = data.weight; this.weight = data.weight;

View File

@ -10,7 +10,6 @@ export class FormulaCfg implements Cfg{
public numtypeid: number; public numtypeid: number;
public prerequisite1id: number; public prerequisite1id: number;
public prerequisite2id: number; public prerequisite2id: number;
public : number;
public decode(data: any) { public decode(data: any) {
this.id = data.id; this.id = data.id;
@ -20,7 +19,6 @@ export class FormulaCfg implements Cfg{
this.numtypeid = data.numtypeid; this.numtypeid = data.numtypeid;
this.prerequisite1id = data.prerequisite1id; this.prerequisite1id = data.prerequisite1id;
this.prerequisite2id = data.prerequisite2id; this.prerequisite2id = data.prerequisite2id;
this. = data.;
}; };
public isOK (uniqueID: number, param1: any, param2: any): boolean { public isOK (uniqueID: number, param1: any, param2: any): boolean {

View File

@ -5,6 +5,7 @@ export class HeroCfg implements Cfg{
public id: number; public id: number;
public herounit_id: number; public herounit_id: number;
public org_gift: number;
public ex_skill: number; public ex_skill: number;
public follower1id: number; public follower1id: number;
public follower2id: number; public follower2id: number;
@ -14,6 +15,7 @@ export class HeroCfg implements Cfg{
public decode(data: any) { public decode(data: any) {
this.id = data.id; this.id = data.id;
this.herounit_id = data.herounit_id; this.herounit_id = data.herounit_id;
this.org_gift = data.org_gift;
this.ex_skill = data.ex_skill; this.ex_skill = data.ex_skill;
this.follower1id = data.follower1id; this.follower1id = data.follower1id;
this.follower2id = data.follower2id; this.follower2id = data.follower2id;

View File

@ -283,7 +283,8 @@ export class BattleHandler {
}else if(dst instanceof PlayerHandler){ }else if(dst instanceof PlayerHandler){
ut = GameUnitType.PLAYER; ut = GameUnitType.PLAYER;
} }
return new SkillTarget(sk, src? src._owner: sk._owner, src, dst, ut); let owner = sk? sk._owner: null;
return new SkillTarget(sk, src? src._owner: owner, src, dst, ut);
}; };
public singleSkillTargets(sk: Skill, src: PetHandler, dst: PetHandler | PlayerHandler): SkillTarget[]{ public singleSkillTargets(sk: Skill, src: PetHandler, dst: PetHandler | PlayerHandler): SkillTarget[]{
@ -294,6 +295,14 @@ export class BattleHandler {
return tgt? [tgt]: null; return tgt? [tgt]: null;
}; };
public singleSkillTarget(sk: Skill, src: PetHandler, dst: PetHandler | PlayerHandler): SkillTarget{
let tgt = this.buildSkillTarget(sk, src, dst);
if(this.isFlowing() && tgt){
this._cacheSkills.push(tgt);
}
return tgt;
};
public getSkillOppTargets(st: SkillTarget): SkillTarget[]{ public getSkillOppTargets(st: SkillTarget): SkillTarget[]{
let lst: SkillTarget[] = []; let lst: SkillTarget[] = [];
lst.push(st.oppClone()); lst.push(st.oppClone());

View File

@ -116,9 +116,9 @@ export class PetHandler {
this.addSkill(skillid); this.addSkill(skillid);
}); });
this._owner.onHaloAdd(this); this._owner.onPetBorned(this, param);
this.born(param); this._owner.onHaloAdd(this);
}; };
private _I(v: number): number{ private _I(v: number): number{
@ -135,15 +135,6 @@ export class PetHandler {
// this._exap = 0; // this._exap = 0;
}; };
private _addEffHalo(skill: Skill): boolean{
if(!this.hasEffHalo(skill)){
this._effhalos.set(skill, skill.getHaloValue());
return true;
}
return false;
// this._exap += ap;
};
public getEffHaloV(): number{ public getEffHaloV(): number{
let n = 0; let n = 0;
this._effhalos.forEach((value: number) => { this._effhalos.forEach((value: number) => {
@ -304,8 +295,11 @@ export class PetHandler {
return res; return res;
}; };
public addExAP(value: number, from: PetHandler): number{ public addExAP(value: number, sk: Skill, from: PetHandler): number{
// return this.addAP(value); if(!this.hasEffHalo(sk)){
this._effhalos.set(sk, value);
return value;
}
return 0; return 0;
}; };
@ -341,7 +335,7 @@ export class PetHandler {
let res = this.subAP(rv, from); let res = this.subAP(rv, from);
if(res != 0){ if(res != 0){
this._owner.onBeHurt(this, res); this._owner.onBeHurt(this, res, from);
} }
return res; return res;
@ -390,10 +384,6 @@ export class PetHandler {
return value; return value;
}; };
public born(param: SkillParam){
this._owner.onPetBorned(this, param);
};
public isAlive(){ public isAlive(){
if(this._isHero){ if(this._isHero){
return this._owner.isAlive(); return this._owner.isAlive();
@ -544,21 +534,19 @@ export class PetHandler {
}; };
// 自己的光环是否加到apet上 // 自己的光环是否加到apet上
public addEffHalo(apet: PetHandler): boolean{ public addEffHalo(apet: PetHandler): number{
let bok = false; let res = 0;
this._halos.forEach((item: Skill)=>{ this._halos.forEach((item: Skill)=>{
if(item.canEffect(this, apet)){ if(item.canEffect(this, apet)){
if(item.isAPHaloSkill()){ if(item.isAPHaloSkill()){
bok = true; res += apet.addExAP(item.getEffValue(), item, this); // 加战力
if(apet._addEffHalo(item)){
} // 加战力
}else if(item.isBuffHaloSkill()){ }else if(item.isBuffHaloSkill()){
item.trigger(new SkillParam(0, 0, 0, this._owner, item.trigger(new SkillParam(0, 0, 0, this._owner,
this, apet._owner, apet)); this, apet._owner, apet)); // 触发技能
} // 触发技能 }
} }
}); });
return bok; return res;
}; };
// remove加在自己身上的属于apet的光环 // remove加在自己身上的属于apet的光环

View File

@ -4,7 +4,7 @@ import { HeroCfg } from "../../../cfg/parsers/HeroCfg";
import { BattleHandler } from "./BattleHandler"; import { BattleHandler } from "./BattleHandler";
import CfgMan from "../CfgMan"; import CfgMan from "../CfgMan";
import { Pet } from "rooms/schema/Pet"; import { Pet } from "rooms/schema/Pet";
import { CondDecideType, CondType, EffectCardType, GameUnitType, SkillType, SkillUserType, TriggerType } from "../skill/SkillConst"; import { CondDecideType, CondType, EffectCardType, GameUnitType, SkillEffectType, SkillType, SkillUserType, TriggerType } 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, SkillTarget } from "../skill/SkillParam"; import { SkillParam, SkillTarget } from "../skill/SkillParam";
@ -324,8 +324,8 @@ export class PlayerHandler {
return this._self? this._self.addBaseAP(value, from): 0; return this._self? this._self.addBaseAP(value, from): 0;
}; };
public addExAP(value: number, from: PetHandler): number{ public addExAP(value: number, sender: Skill, from: PetHandler): number{
return 0; return this._self? this._self.addExAP(value, sender, from): 0;
}; };
public getHP(){ public getHP(){
@ -452,43 +452,72 @@ export class PlayerHandler {
* @param only_checkother : 只检查apet加给别人的光环 * @param only_checkother : 只检查apet加给别人的光环
*/ */
public onHaloAdd(apet: PetHandler, only_checkother: boolean = false){ public onHaloAdd(apet: PetHandler, only_checkother: boolean = false){
let lst: PetHandler[] = []; let pets: Map<PetHandler, number> = new Map();
if(only_checkother){ if(only_checkother){
this._pets.forEach((obj: PetHandler)=>{ this._pets.forEach((obj: PetHandler)=>{
if(apet.addEffHalo(obj)){ let n = apet.addEffHalo(obj);
lst.push(obj); if(n != 0){
pets.set(obj, n);
} }
}); });
if(this._self != apet){ if(this._self != apet){
if(apet.addEffHalo(this._self)){ let n = apet.addEffHalo(this._self);
lst.push(this._self); if(n != 0){
pets.set(this._self, n);
} }
} }
}else{ }else{
// apet加给自己 // apet加给自己
apet.addEffHalo(apet); let n = apet.addEffHalo(apet);
if(n != 0){
pets.set(apet, n);
}
// apet加给别人/别人加给apet // apet加给别人/别人加给apet
this._pets.forEach((obj: PetHandler)=>{ this._pets.forEach((obj: PetHandler)=>{
if(obj != apet){ if(obj != apet){
obj.addEffHalo(apet); let n = obj.addEffHalo(apet);
if(apet.addEffHalo(obj)){ if(n != 0){
lst.push(obj); if(pets.has(apet)){
pets.set(apet, pets.get(apet) + n);
}else{
pets.set(apet, n);
}
}
n = apet.addEffHalo(obj);
if(n != 0){
pets.set(obj, n);
} }
} }
}); });
// _self加给apet/apet加给_self // _self加给apet/apet加给_self
if(this._self != apet && this._self){ if(this._self != apet && this._self){
this._self.addEffHalo(apet); let n = this._self.addEffHalo(apet);
if(apet.addEffHalo(this._self)){ if(n != 0){
lst.push(this._self); if(pets.has(apet)){
pets.set(apet, pets.get(apet) + n);
}else{
pets.set(apet, n);
}
}
n = apet.addEffHalo(this._self);
if(n != 0){
pets.set(this._self, n);
} }
} }
} }
this._owner.onUpdatePetsNotify(lst, apet); if(pets.size > 0){
for(let [k, v] of pets){
let sk = this._owner.singleSkillTarget(null, apet, k);
sk.success(SkillEffectType.POWEREX_ENHANCE, v);
sk.success(SkillEffectType.CHG_AP, v);
}
this._owner.onUpdatePetsNotify([...pets.keys()], apet);
}
}; };
public onHaloRemove(apet: PetHandler){ public onHaloRemove(apet: PetHandler){
@ -523,8 +552,8 @@ export class PlayerHandler {
this.singleCheckSkills(apet, TriggerType.BE_ATTACK, null, sp); this.singleCheckSkills(apet, TriggerType.BE_ATTACK, null, sp);
}; };
public onBeHurt(apet: PetHandler, value: number){ public onBeHurt(apet: PetHandler, value: number, from: PetHandler){
this.singleCheckSkills(apet, TriggerType.BE_HURT); this.singleCheckSkills(apet, TriggerType.BE_HURT, from._owner);
}; };
public onShieldUsed(apet: PetHandler){ public onShieldUsed(apet: PetHandler){

View File

@ -1,3 +1,4 @@
import { sendFriendRequest } from "@colyseus/social";
import { SkillCfg } from "cfg/parsers/SkillCfg"; import { SkillCfg } from "cfg/parsers/SkillCfg";
import e from "express"; import e from "express";
import { SKillEffectData } from "message/SkillInfo"; import { SKillEffectData } from "message/SkillInfo";
@ -474,7 +475,7 @@ export class Skill {
case SkillEffectType.POWEREX_ENHANCE: case SkillEffectType.POWEREX_ENHANCE:
if(tgt.dsttype != GameUnitType.NONE){ if(tgt.dsttype != GameUnitType.NONE){
let n = efftype == SkillEffectType.POWER_ENHANCE? tgt.dst.addBaseAP(effvalue, tgt.srcPet()) let n = efftype == SkillEffectType.POWER_ENHANCE? tgt.dst.addBaseAP(effvalue, tgt.srcPet())
: tgt.dst.addExAP(effvalue, tgt.srcPet()); : tgt.dst.addExAP(effvalue, this, tgt.srcPet());
tgt.success(efftype, n); tgt.success(efftype, n);
tgt.success(SkillEffectType.CHG_AP, n); tgt.success(SkillEffectType.CHG_AP, n);
}else{ }else{

View File

@ -85,15 +85,18 @@ export class SkillTarget{
res: SkillResult[]; res: SkillResult[];
constructor(skill: Skill, splayer?: PlayerHandler, spet?: PetHandler, dstobj?: any, dsttype?: GameUnitType) { constructor(skill: Skill | number, splayer?: PlayerHandler, spet?: PetHandler, dstobj?: any, dsttype?: GameUnitType) {
let bsk = skill instanceof Skill;
let sk = bsk? (skill as Skill): null;
let sid = !bsk? (skill as number): 0;
this.srcplayer = splayer; this.srcplayer = splayer;
this.srcpet = spet; this.srcpet = spet;
this.srcskill = skill; this.srcskill = sk;
this.srcskillid = skill? skill._id: 0; this.srcskillid = sk? sk._id: sid;
this.srcskilltype = skill? skill._data.effect_typeid: 0; this.srcskilltype = sk? sk._data.effect_typeid: 0;
this.dst = dstobj; this.dst = dstobj;
this.dsttype = dsttype; this.dsttype = dsttype;
this.lasttime = skill? skill._data.indicate_time: 0; this.lasttime = sk? sk._data.indicate_time: 0;
}; };
public LoadParam(sp: SkillParam){ public LoadParam(sp: SkillParam){