获得技能效果优化
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[]{
|
||||
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 {
|
||||
|
@ -214,9 +214,13 @@ export class PlayerHandler {
|
||||
};
|
||||
|
||||
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{
|
||||
let obj = SkillMan.getSkill(skillid);
|
||||
if(obj){
|
||||
@ -225,11 +229,7 @@ export class PlayerHandler {
|
||||
return obj;
|
||||
};
|
||||
|
||||
public addSkill(skillid: number, count: number = 1, sender?: PetHandler): Skill[]{
|
||||
return this._self? this._self.addSkill(skillid, count, sender): null;
|
||||
};
|
||||
|
||||
public handleSkill(skillid: number, count: number, param: SkillParam, pet: PetHandler):SkillTarget[]{
|
||||
public handleSkill(skillid: number, count: number, pet: PetHandler, sender?: PetHandler, param?: SkillParam):SkillTarget[]{
|
||||
let cfg = CfgMan.findSkillCfg(skillid);
|
||||
if(!cfg){
|
||||
return null;
|
||||
@ -243,23 +243,21 @@ export class PlayerHandler {
|
||||
}else {
|
||||
let bhalo = false;
|
||||
let bchged = false;
|
||||
for(let i = 0; i < count; i++){
|
||||
let sl = pet.addSkill(skillid);
|
||||
if(sl && sl.length > 0){
|
||||
bchged = true;
|
||||
sl.forEach((obj: Skill)=>{
|
||||
if(obj.isBornSkill()){
|
||||
lst.push(obj);
|
||||
}else if(obj.isDieSkill()){
|
||||
//nothing to do
|
||||
}else if(obj.isAPHaloSkill() || obj.isBuffHaloSkill()){
|
||||
//only handle halo, not handle skill
|
||||
bhalo = true;
|
||||
}else{
|
||||
lst.push(obj);
|
||||
}
|
||||
});
|
||||
}
|
||||
let sl = pet.addSkill(skillid, count, sender);
|
||||
if(sl && sl.length > 0){
|
||||
bchged = true;
|
||||
sl.forEach((obj: Skill)=>{
|
||||
if(obj.isBornSkill()){
|
||||
lst.push(obj);
|
||||
}else if(obj.isDieSkill()){
|
||||
//nothing to do
|
||||
}else if(obj.isAPHaloSkill() || obj.isBuffHaloSkill()){
|
||||
//only handle halo, not handle skill
|
||||
bhalo = true;
|
||||
}else{
|
||||
lst.push(obj);
|
||||
}
|
||||
});
|
||||
}
|
||||
if(bhalo){
|
||||
this.onHaloAdd(pet, true);
|
||||
@ -751,6 +749,9 @@ export class PlayerHandler {
|
||||
};
|
||||
|
||||
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);
|
||||
if(sp && sp.cardid == 0 && apet){
|
||||
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){
|
||||
case SkillEffectType.SUMMON_NPC:
|
||||
{
|
||||
@ -549,6 +549,10 @@ export class Skill {
|
||||
case SkillEffectType.SUMMON_SKILL:
|
||||
{
|
||||
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 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,
|
||||
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);
|
||||
let bres1 = false, bres2 = false;
|
||||
|
||||
ncount = this.getFinalValue(EnhanceCustomType.GET_TIMES, this._data.getskill2_times, this._data.getskill2_timesmax,
|
||||
exparam.edd_cnt, true);
|
||||
obj = tgt.getTarget(this._data.skill2_ownersid);
|
||||
let n2 = obj? obj.addSkill(this._data.getskill2id, ncount, sender): 0;
|
||||
n2 && tgt.success(efftype, this._data.getskill2id);
|
||||
if(this._data.getskillid){
|
||||
let obj = tgt.getTarget(this._data.skill_ownersid);
|
||||
if(!obj){
|
||||
tgt.fail(efftype, this._data.getskillid);
|
||||
}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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user