导表,新字段新类型处理

This commit is contained in:
yuexin 2020-12-31 18:32:33 +08:00
parent 209f6ea322
commit 24d55cd37d
10 changed files with 92 additions and 17 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

@ -15,6 +15,7 @@ export class SkillCfg implements Cfg{
public friendlyid: number;
public targetid: number;
public ridicule: number;
public spellpower: number;
public rangeid: number;
public select_targetID: number;
public eff_numtypeid: number;
@ -54,6 +55,7 @@ export class SkillCfg implements Cfg{
this.friendlyid = data.friendlyid;
this.targetid = data.targetid;
this.ridicule = data.ridicule;
this.spellpower = data.spellpower;
this.rangeid = data.rangeid;
this.select_targetID = data.select_targetID;
this.eff_numtypeid = data.eff_numtypeid;

View File

@ -7,6 +7,7 @@ export class UnitCfg implements Cfg{
public unittypei_id: number;
public hero_hp: number;
public spell_power: number;
public suck_blood: number;
public defense: number;
public race_id: number;
public job_id: number;
@ -25,6 +26,7 @@ export class UnitCfg implements Cfg{
this.unittypei_id = data.unittypei_id;
this.hero_hp = data.hero_hp;
this.spell_power = data.spell_power;
this.suck_blood = data.suck_blood;
this.defense = data.defense;
this.race_id = data.race_id;
this.job_id = data.job_id;

View File

@ -132,7 +132,7 @@ export class BattleHandler {
public getFinalTarget(ut: SkillRangeUnitType, players: PlayerHandler[], dstpet: PetHandler, srcpet: PetHandler,
senderpet: PetHandler, ct: GameUnitType,
checktaunt: boolean=false): PetHandler
checktaunt: boolean, isonlypet: boolean): PetHandler
{
let pet = dstpet;
let bok = false;
@ -147,7 +147,7 @@ export class BattleHandler {
if(checktaunt){
let lst:PetHandler[] = [];
players.forEach((item:PlayerHandler)=>{
item.findAllTauntPets(lst);
item.findAllTauntPets(lst, isonlypet);
});
if(lst.length > 0){
pet = arrUtil.randomOne(lst);
@ -157,7 +157,7 @@ export class BattleHandler {
if(!bok){
let lst:PetHandler[] = [];
players.forEach((item:PlayerHandler)=>{
item.findAllPets(lst);
item.findAllPets(lst, isonlypet);
});
if(lst.length > 0){
pet = arrUtil.randomOne(lst);
@ -171,7 +171,7 @@ export class BattleHandler {
if(checktaunt){
let lst:PetHandler[] = [];
players.forEach((item:PlayerHandler)=>{
item.findAllTauntPets(lst, expet);
item.findAllTauntPets(lst, isonlypet, expet);
});
if(lst.length > 0){
pet = arrUtil.randomOne(lst);
@ -181,7 +181,7 @@ export class BattleHandler {
if(!bok){
let lst:PetHandler[] = [];
players.forEach((item:PlayerHandler)=>{
item.findAllPets(lst, expet);
item.findAllPets(lst, isonlypet, expet);
});
if(lst.length > 0){
pet = arrUtil.randomOne(lst);
@ -193,6 +193,44 @@ export class BattleHandler {
pet = senderpet;
bok = !!pet;
break;
case SkillRangeUnitType.MAXAP_ONE:
{
let lst:PetHandler[] = [];
players.forEach((item:PlayerHandler)=>{
lst.push(item.getMaxAPPet(isonlypet));
});
pet = null;
if(lst.length > 0){
lst.forEach(element => {
if(!pet){
pet = element;
}else if(pet.totalAP() < element.totalAP()){
pet = element;
}
});
}
bok = !!pet;
}
break;
case SkillRangeUnitType.MINAP_ONE:
{
let lst:PetHandler[] = [];
players.forEach((item:PlayerHandler)=>{
lst.push(item.getMinAPPet(isonlypet));
});
pet = null;
if(lst.length > 0){
lst.forEach(element => {
if(!pet){
pet = element;
}else if(pet.totalAP() > element.totalAP()){
pet = element;
}
});
}
bok = !!pet;
}
break;
default:
{
bok = this.petIsValid(pet, players, ct);
@ -241,7 +279,7 @@ export class BattleHandler {
case GameUnitType.PET:
if(skill.isSingleTarget()){
let pet = this.getFinalTarget(skill._data.rangeid, players, param.dstpet, param.srcpet, skill._petowner,
skill._data.targetid, !!skill._data.ridicule);
skill._data.targetid, !!skill._data.ridicule, skill._data.targetid == GameUnitType.PET);
pet && lst.push(new SkillTarget(skill, param.srcplayer, param.srcpet,
pet, pet._isHero? GameUnitType.HERO: GameUnitType.PET));
}else{
@ -683,16 +721,16 @@ export class BattleHandler {
key += '|' + item.srcpet._idx;
}
key += '' + cnt;
if(lastkey != key && lastkey != ''){
cnt++;
}
lastkey = key;
let tmplst = resmap.get(key);
let realkey = key + '|' + cnt;
let tmplst = resmap.get(realkey);
if(!tmplst){
tmplst = [item];
resmap.set(key, tmplst);
resmap.set(realkey, tmplst);
}else{
tmplst.push(item);
}

View File

@ -60,6 +60,7 @@ export class PetHandler {
_orignEffCnt: number = 0;
_orignCardPoint: number = 0;
_hps: number;
public init(apet: Pet, owner: PlayerHandler, index: number){
this._pet = apet;
@ -75,6 +76,7 @@ export class PetHandler {
console.log('[error]no cfg:' + this._id);
}
this._exredhurt = this._cfg.defense / 100;
this._hps = this._cfg.suck_blood / 100;
this._enmagic = this._cfg.spell_power;
if(param){
@ -544,7 +546,9 @@ export class PetHandler {
obj.em = this._enmagic;
obj.silence = this._silentCD;
obj.effectCount = this._orignEffCnt;
obj.hps = this._hps;
obj.point = this._orignCardPoint;
obj.buffs = [];
return obj;
};

View File

@ -487,12 +487,12 @@ export class PlayerHandler {
});
};
public findAllTauntPets(lst: PetHandler[], expet?: PetHandler): number{
public findAllTauntPets(lst: PetHandler[], exself: boolean, expet?: PetHandler): number{
if(!lst){
return -1;
}
let ncnt = 0;
if(this._self && this._self.isTaunt() && this._self != expet){
if(!exself && this._self && this._self.isTaunt() && this._self != expet){
lst.push(this._self);
ncnt++;
}
@ -505,12 +505,12 @@ export class PlayerHandler {
return ncnt;
};
public findAllPets(lst: PetHandler[], expet?: PetHandler): number{
public findAllPets(lst: PetHandler[], exself: boolean, expet?: PetHandler): number{
if(!lst){
return -1;
}
let ncnt = 0;
if(this._self && this._self != expet){
if(!exself && this._self && this._self != expet){
lst.push(this._self);
ncnt++;
}
@ -523,6 +523,30 @@ export class PlayerHandler {
return ncnt;
};
public getMaxAPPet(exself: boolean): PetHandler{
let res: PetHandler = exself? null: this._self;
this._pets.forEach((item: PetHandler) =>{
if(!res){
res = item;
}else if(res.totalAP() < item.totalAP()){
res = item;
}
});
return res;
};
public getMinAPPet(exself: boolean): PetHandler{
let res: PetHandler = exself? null: this._self;
this._pets.forEach((item: PetHandler) =>{
if(!res){
res = item;
}else if(res.totalAP() > item.totalAP()){
res = item;
}
});
return res;
};
public hasTransEffCardSkill(): boolean{
if(!this._self){
return false;

View File

@ -584,7 +584,7 @@ export class Skill {
};
EMV(effvalue: number){
if(this._type != SkillType.MAGIC){
if(!this._data.spellpower){
return effvalue;
}
let ev = this._owner.getEM();

View File

@ -119,6 +119,8 @@ export const enum SkillType{
* 10.
* 11.
* 12.
* 13.
* 14.
*/
export const enum SkillRangeUnitType{
NONE = 0,
@ -133,6 +135,9 @@ export const enum SkillRangeUnitType{
OWNER = 10,
RANDOM_ONE_EXOWNER = 11,
ALL_EXOWNER = 12,
MAXAP_ONE = 13,
MINAP_ONE = 14,
};
// 技能效果类型

View File

@ -16,7 +16,7 @@ let SkillMan = {
_skillcb: function(p1:any, p2:any, p3:any, p4:any){},
onSkillTrigger(skill:Skill, param: any, bok: boolean) {
this._skillcb && this._skillcb(skill, param, bok, skill._owner);
this._skillcb?.(skill, param, bok, skill._owner);
},
addSkill(id: number, data: SkillCfg) {