获得技能效果优化
This commit is contained in:
parent
6dde5183f2
commit
053b9ee3e5
@ -234,7 +234,11 @@ export class PetHandler {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public useSkill(skillid: number, count: number, obj: SkillParam): SkillTarget[]{
|
public useSkill(skillid: number, count: number, obj: SkillParam): SkillTarget[]{
|
||||||
return this._owner.handleSkill(skillid, count, obj, this);
|
return this._owner.handleSkill(skillid, count, this, this, obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
public useSkillEx(skillid: number, count: number, sender: PetHandler): SkillTarget[]{
|
||||||
|
return this._owner.handleSkill(skillid, count, this, sender);
|
||||||
};
|
};
|
||||||
|
|
||||||
public subAP(value: number, from: PetHandler):number {
|
public subAP(value: number, from: PetHandler):number {
|
||||||
|
@ -214,9 +214,13 @@ export class PlayerHandler {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public useSkill(skillid: number, count: number, obj: SkillParam): SkillTarget[]{
|
public useSkill(skillid: number, count: number, obj: SkillParam): SkillTarget[]{
|
||||||
return this.handleSkill(skillid, count, obj, this._self);
|
return this.handleSkill(skillid, count, this._self, this._self, obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public useSkillEx(skillid: number, count: number, sender: PetHandler): SkillTarget[]{
|
||||||
|
return this.handleSkill(skillid, count, this._self, sender);
|
||||||
|
};
|
||||||
|
|
||||||
public newSkill(skillid: number): Skill{
|
public newSkill(skillid: number): Skill{
|
||||||
let obj = SkillMan.getSkill(skillid);
|
let obj = SkillMan.getSkill(skillid);
|
||||||
if(obj){
|
if(obj){
|
||||||
@ -225,11 +229,7 @@ export class PlayerHandler {
|
|||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
public addSkill(skillid: number, count: number = 1, sender?: PetHandler): Skill[]{
|
public handleSkill(skillid: number, count: number, pet: PetHandler, sender?: PetHandler, param?: SkillParam):SkillTarget[]{
|
||||||
return this._self? this._self.addSkill(skillid, count, sender): null;
|
|
||||||
};
|
|
||||||
|
|
||||||
public handleSkill(skillid: number, count: number, param: SkillParam, pet: PetHandler):SkillTarget[]{
|
|
||||||
let cfg = CfgMan.findSkillCfg(skillid);
|
let cfg = CfgMan.findSkillCfg(skillid);
|
||||||
if(!cfg){
|
if(!cfg){
|
||||||
return null;
|
return null;
|
||||||
@ -243,23 +243,21 @@ export class PlayerHandler {
|
|||||||
}else {
|
}else {
|
||||||
let bhalo = false;
|
let bhalo = false;
|
||||||
let bchged = false;
|
let bchged = false;
|
||||||
for(let i = 0; i < count; i++){
|
let sl = pet.addSkill(skillid, count, sender);
|
||||||
let sl = pet.addSkill(skillid);
|
if(sl && sl.length > 0){
|
||||||
if(sl && sl.length > 0){
|
bchged = true;
|
||||||
bchged = true;
|
sl.forEach((obj: Skill)=>{
|
||||||
sl.forEach((obj: Skill)=>{
|
if(obj.isBornSkill()){
|
||||||
if(obj.isBornSkill()){
|
lst.push(obj);
|
||||||
lst.push(obj);
|
}else if(obj.isDieSkill()){
|
||||||
}else if(obj.isDieSkill()){
|
//nothing to do
|
||||||
//nothing to do
|
}else if(obj.isAPHaloSkill() || obj.isBuffHaloSkill()){
|
||||||
}else if(obj.isAPHaloSkill() || obj.isBuffHaloSkill()){
|
//only handle halo, not handle skill
|
||||||
//only handle halo, not handle skill
|
bhalo = true;
|
||||||
bhalo = true;
|
}else{
|
||||||
}else{
|
lst.push(obj);
|
||||||
lst.push(obj);
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(bhalo){
|
if(bhalo){
|
||||||
this.onHaloAdd(pet, true);
|
this.onHaloAdd(pet, true);
|
||||||
@ -751,6 +749,9 @@ export class PlayerHandler {
|
|||||||
};
|
};
|
||||||
|
|
||||||
simpleCheckSkills(skills: Skill[], apet?: PetHandler, param?: SkillParam): SkillTarget[]{
|
simpleCheckSkills(skills: Skill[], apet?: PetHandler, param?: SkillParam): SkillTarget[]{
|
||||||
|
if(!skills || skills.length <= 0){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
let sp = param? param: new SkillParam(0, 0, 0, this, apet, this, apet);
|
let sp = param? param: new SkillParam(0, 0, 0, this, apet, this, apet);
|
||||||
if(sp && sp.cardid == 0 && apet){
|
if(sp && sp.cardid == 0 && apet){
|
||||||
if(!sp.edd_cnt){
|
if(!sp.edd_cnt){
|
||||||
|
@ -531,7 +531,7 @@ export class Skill {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
summon(efftype: SkillEffectType, exparam: SkillParam, tgt: SkillTarget){
|
summon(efftype: SkillEffectType, exparam: SkillParam, tgt: SkillTarget){
|
||||||
switch(efftype){
|
switch(efftype){
|
||||||
case SkillEffectType.SUMMON_NPC:
|
case SkillEffectType.SUMMON_NPC:
|
||||||
{
|
{
|
||||||
@ -549,6 +549,10 @@ export class Skill {
|
|||||||
case SkillEffectType.SUMMON_SKILL:
|
case SkillEffectType.SUMMON_SKILL:
|
||||||
{
|
{
|
||||||
let obj = tgt.srcpet? tgt.srcpet: tgt.srcplayer;
|
let obj = tgt.srcpet? tgt.srcpet: tgt.srcplayer;
|
||||||
|
if(!obj){
|
||||||
|
tgt.fail(efftype, -1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let n1 = this.getQuoteValue(this._data.quoteskill_times, this._data.quoteskill_timesmax, exparam.edd_cnt);
|
let n1 = this.getQuoteValue(this._data.quoteskill_times, this._data.quoteskill_timesmax, exparam.edd_cnt);
|
||||||
let r1 = obj.useSkill(this._data.quoteskillid, n1, exparam);
|
let r1 = obj.useSkill(this._data.quoteskillid, n1, exparam);
|
||||||
@ -574,19 +578,35 @@ export class Skill {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let ncount = this.getFinalValue(EnhanceCustomType.GET_TIMES, this._data.getskill_times, this._data.getskill_timesmax,
|
let bres1 = false, bres2 = false;
|
||||||
exparam.edd_cnt, true);
|
|
||||||
let obj = tgt.getTarget(this._data.skill_ownersid);
|
|
||||||
let n1 = obj? obj.addSkill(this._data.getskillid, ncount, sender): 0;
|
|
||||||
n1 && tgt.success(efftype, this._data.getskillid);
|
|
||||||
|
|
||||||
ncount = this.getFinalValue(EnhanceCustomType.GET_TIMES, this._data.getskill2_times, this._data.getskill2_timesmax,
|
if(this._data.getskillid){
|
||||||
exparam.edd_cnt, true);
|
let obj = tgt.getTarget(this._data.skill_ownersid);
|
||||||
obj = tgt.getTarget(this._data.skill2_ownersid);
|
if(!obj){
|
||||||
let n2 = obj? obj.addSkill(this._data.getskill2id, ncount, sender): 0;
|
tgt.fail(efftype, this._data.getskillid);
|
||||||
n2 && tgt.success(efftype, this._data.getskill2id);
|
}else{
|
||||||
|
let ncount = this.getFinalValue(EnhanceCustomType.GET_TIMES, this._data.getskill_times, this._data.getskill_timesmax,
|
||||||
|
exparam.edd_cnt, true);
|
||||||
|
let res = obj.useSkillEx(this._data.getskillid, ncount, sender);
|
||||||
|
res? tgt.success(efftype, this._data.getskillid): tgt.fail(efftype, this._data.getskillid);
|
||||||
|
}
|
||||||
|
bres1 = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(!n1 && !n2){
|
if(this._data.getskill2id){
|
||||||
|
let obj = tgt.getTarget(this._data.skill2_ownersid);
|
||||||
|
if(!obj){
|
||||||
|
tgt.fail(efftype, this._data.getskill2id);
|
||||||
|
}else{
|
||||||
|
let ncount = this.getFinalValue(EnhanceCustomType.GET_TIMES, this._data.getskill2_times, this._data.getskill2_timesmax,
|
||||||
|
exparam.edd_cnt, true);
|
||||||
|
let res = obj.useSkillEx(this._data.getskill2id, ncount, sender);
|
||||||
|
res? tgt.success(efftype, this._data.getskill2id): tgt.fail(efftype, this._data.getskill2id);
|
||||||
|
}
|
||||||
|
bres2 = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!bres1 && !bres2){
|
||||||
tgt.fail(efftype, -1);
|
tgt.fail(efftype, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user