增加受击对象判定
This commit is contained in:
parent
c0c3bc37fa
commit
48ff9a7e8e
@ -312,9 +312,9 @@ export class BattleHandler {
|
|||||||
return lst;
|
return lst;
|
||||||
};
|
};
|
||||||
|
|
||||||
public getSkillTargets(skill: Skill, param: SkillParam): SkillTarget[]{
|
public getSkillTargets(skill: Skill, param: SkillParam, lastph: PlayerHandler): SkillTarget[]{
|
||||||
let lst: SkillTarget[] = [];
|
let lst: SkillTarget[] = [];
|
||||||
let players = this.getTargetPlayers(skill._data.friendlyid, param.srcplayer, param.dstplayer);
|
let players = this.getTargetPlayers(skill._data.friendlyid, param.srcplayer, param.dstplayer, lastph);
|
||||||
if(players.length > 0){
|
if(players.length > 0){
|
||||||
switch(skill._data.targetid){
|
switch(skill._data.targetid){
|
||||||
case GameUnitType.PLAYER:
|
case GameUnitType.PLAYER:
|
||||||
@ -362,10 +362,10 @@ export class BattleHandler {
|
|||||||
return lst;
|
return lst;
|
||||||
};
|
};
|
||||||
|
|
||||||
public getTargetPlayers(gct: GameCampType, src:PlayerHandler, dst:PlayerHandler): PlayerHandler[]{
|
public getTargetPlayers(gct: GameCampType, src:PlayerHandler, dst:PlayerHandler, last: PlayerHandler): PlayerHandler[]{
|
||||||
let lst: PlayerHandler[] = [];
|
let lst: PlayerHandler[] = [];
|
||||||
switch(gct){
|
switch(gct){
|
||||||
case GameCampType.SELF:
|
case GameCampType.SELFPLAYER:
|
||||||
if(src && src.isAlive()){
|
if(src && src.isAlive()){
|
||||||
lst.push(src);
|
lst.push(src);
|
||||||
}
|
}
|
||||||
@ -399,7 +399,7 @@ export class BattleHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GameCampType.ALL:
|
case GameCampType.ALLPLAYER:
|
||||||
for(let [key, obj] of this._players){
|
for(let [key, obj] of this._players){
|
||||||
if(obj && obj.isAlive()){
|
if(obj && obj.isAlive()){
|
||||||
lst.push(obj);
|
lst.push(obj);
|
||||||
@ -442,17 +442,22 @@ export class BattleHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!bfind){
|
if(!bfind){
|
||||||
return this.getTargetPlayers(GameCampType.RANDOM_ENEMY, src, dst);
|
return this.getTargetPlayers(GameCampType.RANDOM_ENEMY, src, dst, last);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GameCampType.ALL_EXSELF:
|
case GameCampType.ALLPLAYER_EXSELF:
|
||||||
for(let [key, obj] of this._players){
|
for(let [key, obj] of this._players){
|
||||||
if(obj && obj.isAlive() && obj != src){
|
if(obj && obj.isAlive() && obj != src){
|
||||||
lst.push(obj);
|
lst.push(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case GameCampType.LAST_HURT:
|
||||||
|
if(last && last != src && last.isAlive()){
|
||||||
|
lst.push(last);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ export class Skill {
|
|||||||
|
|
||||||
// 技能光环是否能影响dst
|
// 技能光环是否能影响dst
|
||||||
canEffect(srcpet: PetHandler, dstpet: PetHandler){
|
canEffect(srcpet: PetHandler, dstpet: PetHandler){
|
||||||
if(this._data.friendlyid != GameCampType.SELF){
|
if(this._data.friendlyid != GameCampType.SELFPLAYER){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let tgok = false;
|
let tgok = false;
|
||||||
@ -224,8 +224,8 @@ export class Skill {
|
|||||||
return this._owner._owner.singleSkillTargets(this, this._petowner, this._petowner);
|
return this._owner._owner.singleSkillTargets(this, this._petowner, this._petowner);
|
||||||
};
|
};
|
||||||
|
|
||||||
getTargets(param: SkillParam): SkillTarget[]{
|
getTargets(param: SkillParam, lastph?: PlayerHandler): SkillTarget[]{
|
||||||
return this._owner._owner.getSkillTargets(this, param);
|
return this._owner._owner.getSkillTargets(this, param, lastph);
|
||||||
};
|
};
|
||||||
|
|
||||||
getOppTargets(st: SkillTarget): SkillTarget[]{
|
getOppTargets(st: SkillTarget): SkillTarget[]{
|
||||||
@ -294,7 +294,8 @@ export class Skill {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_triggerSubSkill(sk: Skill, skid: number, skusertype: number, skcount: number, skmaxcount: number, param: SkillParam, sts: SkillTarget[], cb?: any){
|
_triggerSubSkill(sk: Skill, skid: number, skusertype: number, skcount: number, skmaxcount: number,
|
||||||
|
param: SkillParam, sts: SkillTarget[], cb: any, lastph: PlayerHandler){
|
||||||
if(skid && !sk){
|
if(skid && !sk){
|
||||||
sk = this._owner.newSkill(skid);
|
sk = this._owner.newSkill(skid);
|
||||||
sk.setOrignParam(this._orign_effcnt, this._orign_cardpt, this._from, this._petowner, 0);
|
sk.setOrignParam(this._orign_effcnt, this._orign_cardpt, this._from, this._petowner, 0);
|
||||||
@ -315,7 +316,7 @@ export class Skill {
|
|||||||
let ncount = this.getQuoteValue(skcount, skmaxcount, this._orign_effcnt);
|
let ncount = this.getQuoteValue(skcount, skmaxcount, this._orign_effcnt);
|
||||||
|
|
||||||
for(let i=0; i<ncount;i++){
|
for(let i=0; i<ncount;i++){
|
||||||
sk.trigger(param, cb);
|
sk.trigger(param, cb, lastph);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -338,7 +339,7 @@ export class Skill {
|
|||||||
this._cb && this._cb(this, param, res);
|
this._cb && this._cb(this, param, res);
|
||||||
};
|
};
|
||||||
|
|
||||||
trigger(param: SkillParam, cb?: any) {
|
trigger(param: SkillParam, cb?: any, lastph?: PlayerHandler) {
|
||||||
let bnormal = !this._sts;
|
let bnormal = !this._sts;
|
||||||
|
|
||||||
let ncount = this.getFinalValue(EnhanceCustomType.RELEASE_TIMES, this._data.release_times,
|
let ncount = this.getFinalValue(EnhanceCustomType.RELEASE_TIMES, this._data.release_times,
|
||||||
@ -346,23 +347,23 @@ export class Skill {
|
|||||||
|
|
||||||
for(let i = 0; i < ncount; i++){
|
for(let i = 0; i < ncount; i++){
|
||||||
if(bnormal){
|
if(bnormal){
|
||||||
this.setTargets(this.getTargets(param));
|
this.setTargets(this.getTargets(param, lastph));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.isSummonSkill()){
|
if(!this.isSummonSkill()){
|
||||||
this._real_trigger(param, cb);
|
this._real_trigger(param, cb);
|
||||||
|
|
||||||
this._triggerSubSkill(this._subskill, this._data.quoteskillid, this._data.skill_usersid,
|
this._triggerSubSkill(this._subskill, this._data.quoteskillid, this._data.skill_usersid,
|
||||||
this._data.quoteskill_times, this._data.quoteskill_timesmax, param, this._sts, cb);
|
this._data.quoteskill_times, this._data.quoteskill_timesmax, param, this._sts, cb, lastph);
|
||||||
|
|
||||||
this._triggerSubSkill(this._subskill2, this._data.quoteskill2id, this._data.skill2_usersid,
|
this._triggerSubSkill(this._subskill2, this._data.quoteskill2id, this._data.skill2_usersid,
|
||||||
this._data.quoteskill2_times, this._data.quoteskill2_timesmax, param, this._sts, cb);
|
this._data.quoteskill2_times, this._data.quoteskill2_timesmax, param, this._sts, cb, lastph);
|
||||||
}else{
|
}else{
|
||||||
this._triggerSubSkill(this._subskill, this._data.quoteskillid, this._data.skill_usersid,
|
this._triggerSubSkill(this._subskill, this._data.quoteskillid, this._data.skill_usersid,
|
||||||
this._data.quoteskill_times, this._data.quoteskill_timesmax, param, this._sts, cb);
|
this._data.quoteskill_times, this._data.quoteskill_timesmax, param, this._sts, cb, lastph);
|
||||||
|
|
||||||
this._triggerSubSkill(this._subskill2, this._data.quoteskill2id, this._data.skill2_usersid,
|
this._triggerSubSkill(this._subskill2, this._data.quoteskill2id, this._data.skill2_usersid,
|
||||||
this._data.quoteskill2_times, this._data.quoteskill2_timesmax, param, this._sts, cb);
|
this._data.quoteskill2_times, this._data.quoteskill2_timesmax, param, this._sts, cb, lastph);
|
||||||
|
|
||||||
this._real_trigger(param, cb);
|
this._real_trigger(param, cb);
|
||||||
}
|
}
|
||||||
@ -387,7 +388,7 @@ export class Skill {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})){
|
})){
|
||||||
this.trigger(tg_target, cb);
|
this.trigger(tg_target, cb, tg_value);
|
||||||
return 1;
|
return 1;
|
||||||
}else{
|
}else{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -349,19 +349,21 @@ export const enum GameUnitType {
|
|||||||
* 8.全部敌方(势力)中的随机一个
|
* 8.全部敌方(势力)中的随机一个
|
||||||
* 9.先对家,不存在,执行第八条
|
* 9.先对家,不存在,执行第八条
|
||||||
* 10.(自己外)全体(势力);两个对手+自己的队友
|
* 10.(自己外)全体(势力);两个对手+自己的队友
|
||||||
|
* 11.对自己造成伤害的敌方(势力)
|
||||||
*/
|
*/
|
||||||
export const enum GameCampType {
|
export const enum GameCampType {
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
SELF = 1,
|
SELFPLAYER = 1,
|
||||||
FRIEND = 2,
|
FRIEND = 2,
|
||||||
MYTEAM = 3,
|
MYTEAM = 3,
|
||||||
ENEMY = 4,
|
ENEMY = 4,
|
||||||
ENEMYTEAM = 5,
|
ENEMYTEAM = 5,
|
||||||
ALL = 6,
|
ALLPLAYER = 6,
|
||||||
RANDOM_US = 7,
|
RANDOM_US = 7,
|
||||||
RANDOM_ENEMY = 8,
|
RANDOM_ENEMY = 8,
|
||||||
FACE_ENEMY = 9,
|
FACE_ENEMY = 9,
|
||||||
ALL_EXSELF = 10,
|
ALLPLAYER_EXSELF = 10,
|
||||||
|
LAST_HURT = 11,
|
||||||
};
|
};
|
||||||
|
|
||||||
// 战力参数数值
|
// 战力参数数值
|
||||||
|
Loading…
x
Reference in New Issue
Block a user