Merge branch 'master' of git.kingsome.cn:node/card_svr
This commit is contained in:
commit
a0c87cd98f
@ -78,6 +78,24 @@ export class BattleHandler {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public getFinalTarget(players: PlayerHandler[], apet: PetHandler, ct: GameUnitType,
|
||||||
|
checktaunt: boolean=false): PetHandler
|
||||||
|
{
|
||||||
|
let pet = apet;
|
||||||
|
let bok = this.petIsValid(pet, players, ct);
|
||||||
|
if(checktaunt && (!bok || !pet._istaunt)){
|
||||||
|
for(let i = 0; i < players.length;i++){
|
||||||
|
let obj = players[i].findTauntPet();
|
||||||
|
if(obj){
|
||||||
|
pet = obj;
|
||||||
|
bok = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bok? pet: null;
|
||||||
|
};
|
||||||
|
|
||||||
public getSkillTargets(skill: Skill, param: SkillParam): SkillTarget[]{
|
public getSkillTargets(skill: Skill, param: SkillParam): 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);
|
||||||
@ -92,10 +110,10 @@ export class BattleHandler {
|
|||||||
case GameUnitType.HERO:
|
case GameUnitType.HERO:
|
||||||
case GameUnitType.PET:
|
case GameUnitType.PET:
|
||||||
if(skill.isSingleTarget()){
|
if(skill.isSingleTarget()){
|
||||||
if(param.dstpet && this.petIsValid(param.dstpet, players, skill._data.targetid)){
|
let pet = this.getFinalTarget(players, param.dstpet, skill._data.targetid,
|
||||||
lst.push(new SkillTarget(skill, param.srcplayer, param.srcpet,
|
skill.isHurtPowerSkill());
|
||||||
param.dstpet, param.dstpet._isHero? GameUnitType.HERO: GameUnitType.PET));
|
pet && lst.push(new SkillTarget(skill, param.srcplayer, param.srcpet,
|
||||||
}
|
pet, pet._isHero? GameUnitType.HERO: GameUnitType.PET));
|
||||||
}else{
|
}else{
|
||||||
if(skill.isAllTarget()){
|
if(skill.isAllTarget()){
|
||||||
players.forEach((item: PlayerHandler)=>{
|
players.forEach((item: PlayerHandler)=>{
|
||||||
@ -127,35 +145,41 @@ export class BattleHandler {
|
|||||||
let lst: PlayerHandler[] = [];
|
let lst: PlayerHandler[] = [];
|
||||||
switch(gct){
|
switch(gct){
|
||||||
case GameCampType.SELF:
|
case GameCampType.SELF:
|
||||||
|
if(src && src.isAlive()){
|
||||||
lst.push(src);
|
lst.push(src);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GameCampType.FRIEND:
|
case GameCampType.FRIEND:
|
||||||
let obj = this.getFriend(src);
|
let obj = this.getFriend(src);
|
||||||
obj && lst.push(obj);
|
if(obj && obj.isAlive()){
|
||||||
|
lst.push(obj);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GameCampType.MYTEAM:
|
case GameCampType.MYTEAM:
|
||||||
if(src){
|
if(src){
|
||||||
lst.push(src);
|
src.isAlive() && lst.push(src);
|
||||||
let obj = this.getFriend(src);
|
let obj = this.getFriend(src);
|
||||||
obj && lst.push(obj);
|
obj && obj.isAlive() && lst.push(obj);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GameCampType.ENEMY:
|
case GameCampType.ENEMY:
|
||||||
if(dst && dst._friend != src){
|
if(dst && dst._friend != src && dst.isAlive()){
|
||||||
lst.push(dst);
|
lst.push(dst);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GameCampType.ENEMYTEAM:
|
case GameCampType.ENEMYTEAM:
|
||||||
for(let [key, obj] of this._players){
|
for(let [key, obj] of this._players){
|
||||||
if(obj != src && obj != src._friend){
|
if(obj != src && obj != src._friend && obj.isAlive()){
|
||||||
lst.push(obj);
|
lst.push(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GameCampType.ALL:
|
case GameCampType.ALL:
|
||||||
for(let [key, obj] of this._players){
|
for(let [key, obj] of this._players){
|
||||||
|
if(obj && obj.isAlive()){
|
||||||
lst.push(obj);
|
lst.push(obj);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -170,9 +194,9 @@ export class BattleHandler {
|
|||||||
*/
|
*/
|
||||||
public useCard(obj:
|
public useCard(obj:
|
||||||
{srcplayer: Player, card: number, cardpoint: number, dbpt_cnt: number, eff_cnt: number, dstplayer: Player, dstpet: Pet})
|
{srcplayer: Player, card: number, cardpoint: number, dbpt_cnt: number, eff_cnt: number, dstplayer: Player, dstpet: Pet})
|
||||||
{
|
:number{
|
||||||
if(!obj || !obj.card){
|
if(!obj || !obj.card){
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
let ph = this.getPlayer(obj.srcplayer);
|
let ph = this.getPlayer(obj.srcplayer);
|
||||||
@ -182,7 +206,7 @@ export class BattleHandler {
|
|||||||
let dstpt = dstph? dstph.getPet(obj.dstpet): null;
|
let dstpt = dstph? dstph.getPet(obj.dstpet): null;
|
||||||
|
|
||||||
if(!ph){
|
if(!ph){
|
||||||
return false;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
let pt = obj.cardpoint;
|
let pt = obj.cardpoint;
|
||||||
@ -197,6 +221,8 @@ export class BattleHandler {
|
|||||||
ph.useCard(ps);
|
ph.useCard(ps);
|
||||||
|
|
||||||
this.onUseCardEnd(ps);
|
this.onUseCardEnd(ps);
|
||||||
|
|
||||||
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -308,15 +334,19 @@ export class BattleHandler {
|
|||||||
|
|
||||||
// --------------------调用外部接口函数--------------------------
|
// --------------------调用外部接口函数--------------------------
|
||||||
public onAddPetNotify(apet: PetHandler){
|
public onAddPetNotify(apet: PetHandler){
|
||||||
return this._room.bAddPet(apet.exportData());
|
return this._room.bAddPet(apet.exportInfoMsg());
|
||||||
};
|
};
|
||||||
|
|
||||||
public onDelPetNotify(apet: PetHandler){
|
public onDelPetNotify(apet: PetHandler){
|
||||||
return this._room.bRemovePet(apet.exportRemoveData());
|
return this._room.bRemovePet(apet.exportRemoveMsg());
|
||||||
};
|
};
|
||||||
|
|
||||||
public onPlayerAddCardNotify(aplayer: PlayerHandler, count: number, maxcount: number){
|
public onUpdatePetNotify(apet: PetHandler){
|
||||||
return this._room.addCard(aplayer.getId(), count, maxcount);
|
return this._room.updatePet([apet.exportInfo()])
|
||||||
|
};
|
||||||
|
|
||||||
|
public onPlayerAddCardNotify(aplayer: PlayerHandler, count: number, maxcount: number, from?: PlayerHandler){
|
||||||
|
return this._room.addCard(aplayer.getId(), count, maxcount, 1, from? from.getId(): null);
|
||||||
};
|
};
|
||||||
|
|
||||||
public onPlayerStealCardNotify(srcplayer: PlayerHandler, dstplayer: PlayerHandler, count: number){
|
public onPlayerStealCardNotify(srcplayer: PlayerHandler, dstplayer: PlayerHandler, count: number){
|
||||||
@ -328,15 +358,23 @@ export class BattleHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let lst: SkillInfoMsg[] = [];
|
let lst: SkillInfoMsg[] = [];
|
||||||
|
let difflst: SkillTarget[] = [];
|
||||||
skillres.forEach((item: SkillTarget)=>{
|
skillres.forEach((item: SkillTarget)=>{
|
||||||
lst.push(item.exportData());
|
lst.push(item.exportData());
|
||||||
|
if(!difflst.includes(item)){
|
||||||
|
difflst.push(item);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
let tm = 0;
|
||||||
|
difflst.forEach((item: SkillTarget) =>{
|
||||||
|
tm += item.getLastTime();
|
||||||
|
});
|
||||||
|
//todo:
|
||||||
this._room.bMsgQueue(lst);
|
this._room.bMsgQueue(lst);
|
||||||
};
|
};
|
||||||
|
|
||||||
public onPlayerAddHPNotify(aplayer: PlayerHandler, addhp: number){
|
public onPlayerAddHPNotify(aplayer: PlayerHandler, addhp: number){
|
||||||
//todo:
|
return this._room.updateHp(aplayer.getId(), addhp);
|
||||||
return addhp;
|
|
||||||
}
|
}
|
||||||
//end------------------------------------------------
|
//end------------------------------------------------
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,10 @@ import SkillMan from "../skill/SkillMan";
|
|||||||
|
|
||||||
import { EnhanceEffectType, PowerValueType, TriggerType } from "../skill/SkillConst";
|
import { EnhanceEffectType, PowerValueType, TriggerType } from "../skill/SkillConst";
|
||||||
import { PlayerHandler } from "./PlayerHandler";
|
import { PlayerHandler } from "./PlayerHandler";
|
||||||
import { PetInfoMsg } from "../../../message/PetInfo";
|
import { PetInfo, PetInfoMsg } from "../../../message/PetInfo";
|
||||||
import { SkillParam } from "../skill/SkillParam";
|
import { SkillParam, SkillTarget } from "../skill/SkillParam";
|
||||||
import { RemovePetMsg } from "../../../message/RemovePetMsg";
|
import { RemovePetMsg } from "../../../message/RemovePetMsg";
|
||||||
|
import { SKillEffectData } from "message/SkillInfo";
|
||||||
|
|
||||||
export class PetHandler {
|
export class PetHandler {
|
||||||
_pet: Pet;
|
_pet: Pet;
|
||||||
@ -28,7 +29,7 @@ export class PetHandler {
|
|||||||
|
|
||||||
_baseap: number; // 基础
|
_baseap: number; // 基础
|
||||||
|
|
||||||
_exap: number = 0; // 额外
|
// _exap: number = 0; // 额外
|
||||||
|
|
||||||
_exredhurt: number = 0; // 减伤
|
_exredhurt: number = 0; // 减伤
|
||||||
|
|
||||||
@ -46,7 +47,7 @@ export class PetHandler {
|
|||||||
this._idx = index;
|
this._idx = index;
|
||||||
};
|
};
|
||||||
|
|
||||||
public setParam(id: number, param?: SkillParam, exskillid?: number[]){
|
public loadData(id: number, param?: SkillParam, exskillid?: number[]){
|
||||||
this._id = id || 0;
|
this._id = id || 0;
|
||||||
this._cfg = CfgMan.findUnitCfg(this._id);
|
this._cfg = CfgMan.findUnitCfg(this._id);
|
||||||
if(!param || !param.cardpoint){
|
if(!param || !param.cardpoint){
|
||||||
@ -87,21 +88,30 @@ export class PetHandler {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public clearEffHalos(){
|
public clearEffHalos(){
|
||||||
// this._effhalos.length = 0;
|
this._effhalos.length = 0;
|
||||||
this._exap = 0;
|
// this._exap = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
public addEffHalo(skill: Skill, ap: number){
|
public addEffHalo(skill: Skill){
|
||||||
this._exap += ap;
|
this._effhalos.push(skill);
|
||||||
|
// this._exap += ap;
|
||||||
};
|
};
|
||||||
|
|
||||||
public addSkill(skillid: number, halocb?: any){
|
public getEffHaloV(): number{
|
||||||
|
let n = 0;
|
||||||
|
this._effhalos.forEach((item: Skill) => {
|
||||||
|
n += item.getHaloValue();
|
||||||
|
});
|
||||||
|
return n;
|
||||||
|
// return this._exap;
|
||||||
|
};
|
||||||
|
|
||||||
|
public addSkill(skillid: number){
|
||||||
if(skillid > 0){
|
if(skillid > 0){
|
||||||
let obj = this._skills.get(skillid);
|
let obj = this._skills.get(skillid);
|
||||||
if(!obj){
|
if(!obj){
|
||||||
obj = SkillMan.getSkill(skillid);
|
obj = this._owner.newSkill(skillid);
|
||||||
if(obj){
|
if(obj){
|
||||||
obj.setOwner(this._owner);
|
|
||||||
this._skills.set(skillid, obj);
|
this._skills.set(skillid, obj);
|
||||||
this._selfskills.push(skillid);
|
this._selfskills.push(skillid);
|
||||||
if(obj.isBornSkill()){
|
if(obj.isBornSkill()){
|
||||||
@ -110,7 +120,6 @@ export class PetHandler {
|
|||||||
this._dieSkills.push(obj);
|
this._dieSkills.push(obj);
|
||||||
}else if(obj.isHaloSkill()){
|
}else if(obj.isHaloSkill()){
|
||||||
this._halos.push(obj);
|
this._halos.push(obj);
|
||||||
halocb && halocb(this);
|
|
||||||
}else{
|
}else{
|
||||||
this._waitskills.push(obj);
|
this._waitskills.push(obj);
|
||||||
}
|
}
|
||||||
@ -149,41 +158,68 @@ export class PetHandler {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public addAP(value: number){
|
public useSkill(skillid: number, count: number, obj: SkillParam): SkillTarget[]{
|
||||||
this._exap += value;
|
return this._owner.handleSkill(skillid, count, obj, this);
|
||||||
if(this._exap < 0){
|
};
|
||||||
this._baseap += this._exap;
|
|
||||||
this._exap = 0;
|
public subAP(value: number):number {
|
||||||
|
// this._exap += value;
|
||||||
|
// if(this._exap < 0){
|
||||||
|
// this._baseap += this._exap;
|
||||||
|
// this._exap = 0;
|
||||||
|
// }
|
||||||
|
if(value <= 0){
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
let n = -value;
|
||||||
|
for(let i = 0; i < this._effhalos.length;i++){
|
||||||
|
let dv = this._effhalos[i].addHaloValue(n);
|
||||||
|
n -= dv;
|
||||||
|
if(n >= 0){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(n < 0){
|
||||||
|
this._baseap += n;
|
||||||
|
}
|
||||||
|
this.dataChanged();
|
||||||
if(this._baseap < 0){
|
if(this._baseap < 0){
|
||||||
this.die();
|
this.die();
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
public addBaseAP(value: number){
|
public addBaseAP(value: number): number{
|
||||||
|
if(value == 0){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
this._baseap += value;
|
this._baseap += value;
|
||||||
|
this.dataChanged();
|
||||||
if(this._baseap < 0){
|
if(this._baseap < 0){
|
||||||
this.die();
|
this.die();
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
public addExAP(value: number){
|
public addExAP(value: number, skill: Skill){
|
||||||
return this.addAP(value);
|
// return this.addAP(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
public totalAP(){
|
public totalAP(){
|
||||||
return this._baseap + this._exap;
|
return this._baseap + this.getEffHaloV();
|
||||||
};
|
};
|
||||||
|
|
||||||
public beHurt(value: number){
|
public beHurt(value: number): number{
|
||||||
let res = value * this._exredhurt;
|
let res = value - value * this._exredhurt;
|
||||||
return this.addAP(-res);
|
if(res < 0){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return this.subAP(res);
|
||||||
};
|
};
|
||||||
|
|
||||||
public addReduceHurt(value: number){
|
public addReduceHurt(value: number){
|
||||||
this._exredhurt += value;
|
this._exredhurt += value;
|
||||||
|
(value != 0) && this.dataChanged();
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -197,8 +233,23 @@ export class PetHandler {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public clear(){
|
public clear(){
|
||||||
|
if(this._halos.length > 0){
|
||||||
this._halos.length = 0;
|
this._halos.length = 0;
|
||||||
this._owner.onHaloChanged(this);
|
this._owner.onHaloChanged(this);
|
||||||
|
}
|
||||||
|
this._waitskills.length = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
public taunt(){
|
||||||
|
this._istaunt = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
public taunt_cancel(){
|
||||||
|
this._istaunt = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
public summonPet(petid: number, count: number = 1, exparam: SkillParam):number{
|
||||||
|
return this._owner.summonPet(petid, count, exparam);
|
||||||
};
|
};
|
||||||
|
|
||||||
public hasHalo(): boolean{
|
public hasHalo(): boolean{
|
||||||
@ -208,7 +259,7 @@ export class PetHandler {
|
|||||||
public checkHalo(apet: PetHandler){
|
public checkHalo(apet: PetHandler){
|
||||||
this._halos.forEach((item: Skill)=>{
|
this._halos.forEach((item: Skill)=>{
|
||||||
if(item.isEffSelfPet(this, apet)){
|
if(item.isEffSelfPet(this, apet)){
|
||||||
this.addEffHalo(item, item.getEffValue()); // 暂时都加战力
|
this.addEffHalo(item); // 暂时都加战力
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -219,12 +270,12 @@ export class PetHandler {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
public exportData(): PetInfoMsg{
|
public exportInfoMsg(): PetInfoMsg{
|
||||||
let obj = new PetInfoMsg({
|
let obj = new PetInfoMsg({
|
||||||
id: this._id,
|
id: this._id,
|
||||||
isHero: this._isHero,
|
isHero: this._isHero,
|
||||||
ap: this._baseap,
|
ap: this._baseap,
|
||||||
extAp: this._exap,
|
extAp: this.getEffHaloV(),
|
||||||
pos: this._idx,
|
pos: this._idx,
|
||||||
player: this._owner.getId(),
|
player: this._owner.getId(),
|
||||||
harmReduce: this._exredhurt,
|
harmReduce: this._exredhurt,
|
||||||
@ -234,11 +285,29 @@ export class PetHandler {
|
|||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
public exportRemoveData(): RemovePetMsg{
|
public exportRemoveMsg(): RemovePetMsg{
|
||||||
return new RemovePetMsg({
|
return new RemovePetMsg({
|
||||||
id: this._id,
|
id: this._id,
|
||||||
player: this._owner.getId(),
|
player: this._owner.getId(),
|
||||||
pos: this._idx
|
pos: this._idx
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public exportInfo(): PetInfo{
|
||||||
|
let obj = new PetInfo();
|
||||||
|
obj.id = this._id,
|
||||||
|
obj.isHero = this._isHero,
|
||||||
|
obj.ap = this._baseap,
|
||||||
|
obj.extAp = this.getEffHaloV(),
|
||||||
|
obj.pos = this._idx,
|
||||||
|
obj.player = this._owner.getId(),
|
||||||
|
obj.harmReduce = this._exredhurt,
|
||||||
|
obj.skills = this._selfskills,
|
||||||
|
obj.extSkills = this._exskills;
|
||||||
|
return obj;
|
||||||
|
};
|
||||||
|
|
||||||
|
public dataChanged(){
|
||||||
|
this._owner && this._owner.onPetChanged(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,10 +37,15 @@ export class PlayerHandler {
|
|||||||
this._self._isHero = true;
|
this._self._isHero = true;
|
||||||
let lst = this._playercfg.ex_skill? [this._playercfg.ex_skill]: null;
|
let lst = this._playercfg.ex_skill? [this._playercfg.ex_skill]: null;
|
||||||
let ps = new SkillParam(0, 0, 0, this, this._self, null, null);
|
let ps = new SkillParam(0, 0, 0, this, this._self, null, null);
|
||||||
this._self.setParam(this._playercfg.herounit_id, ps, lst);
|
this._self.loadData(this._playercfg.herounit_id, ps, lst);
|
||||||
this._unitcfg = this._playercfg && CfgMan.findUnitCfg(this._playercfg.herounit_id);
|
this._unitcfg = this._playercfg && CfgMan.findUnitCfg(this._playercfg.herounit_id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public clear(){
|
||||||
|
this._self = null;
|
||||||
|
this._pets.length = 0;
|
||||||
|
};
|
||||||
|
|
||||||
public getCurrCardCount(){
|
public getCurrCardCount(){
|
||||||
return this._player.cards.size;
|
return this._player.cards.size;
|
||||||
};
|
};
|
||||||
@ -76,6 +81,11 @@ export class PlayerHandler {
|
|||||||
return pr;
|
return pr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public delPet(ph: PetHandler){
|
||||||
|
let idx = this._pets.indexOf(ph);
|
||||||
|
(idx >= 0) && this._pets.splice(idx, 1);
|
||||||
|
};
|
||||||
|
|
||||||
public getPet(pet: Pet){
|
public getPet(pet: Pet){
|
||||||
return this._pets.find((item:PetHandler)=>{
|
return this._pets.find((item:PetHandler)=>{
|
||||||
return item._pet == pet;
|
return item._pet == pet;
|
||||||
@ -125,7 +135,7 @@ export class PlayerHandler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
obj.srcpet = pet;
|
obj.srcpet = pet;
|
||||||
pet.setParam(cfg.stageunit_id, obj,
|
pet.loadData(cfg.stageunit_id, obj,
|
||||||
[cfg.quoteskill1id, cfg.quoteskill2id, cfg.quoteskill3id, cfg.quoteskill4id]);
|
[cfg.quoteskill1id, cfg.quoteskill2id, cfg.quoteskill3id, cfg.quoteskill4id]);
|
||||||
}else if(cfg.type_id == EffectCardType.MAGIC){
|
}else if(cfg.type_id == EffectCardType.MAGIC){
|
||||||
this.useSkills([cfg.quoteskill1id, cfg.quoteskill2id, cfg.quoteskill3id, cfg.quoteskill4id], obj);
|
this.useSkills([cfg.quoteskill1id, cfg.quoteskill2id, cfg.quoteskill3id, cfg.quoteskill4id], obj);
|
||||||
@ -144,27 +154,7 @@ export class PlayerHandler {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public useSkill(skillid: number, count: number, obj: SkillParam): SkillTarget[]{
|
public useSkill(skillid: number, count: number, obj: SkillParam): SkillTarget[]{
|
||||||
let cfg = CfgMan.findSkillCfg(skillid);
|
return this.handleSkill(skillid, count, obj, this._self);
|
||||||
let lst:SkillTarget[] = [];
|
|
||||||
if(cfg.skill_typeid == SkillType.MAGIC){
|
|
||||||
for(let i = 0; i < count; i++){
|
|
||||||
let sk = this.newSkill(skillid);
|
|
||||||
sk.checkTrigger(TriggerType.NO_COND, 0, obj,
|
|
||||||
(sk: Skill, sp: SkillParam, res: SkillTarget[])=>{
|
|
||||||
if(res){
|
|
||||||
lst.concat(res);
|
|
||||||
}else{
|
|
||||||
lst.push()
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//todo: build json -> client
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
for(let i = 0; i < count; i++){
|
|
||||||
this._self.addSkill(skillid, this.onHaloChanged);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return lst;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public newSkill(skillid: number): Skill{
|
public newSkill(skillid: number): Skill{
|
||||||
@ -175,7 +165,45 @@ export class PlayerHandler {
|
|||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
summonPet(petid: number, count: number = 1, exparam: SkillParam):number{
|
public handleSkill(skillid: number, count: number, param: SkillParam, pet: PetHandler):SkillTarget[]{
|
||||||
|
let cfg = CfgMan.findSkillCfg(skillid);
|
||||||
|
let lst: Skill[] = [];
|
||||||
|
if(cfg.skill_typeid == SkillType.MAGIC){
|
||||||
|
for(let i = 0; i < count; i++){
|
||||||
|
let sk = this.newSkill(skillid);
|
||||||
|
lst.push(sk);
|
||||||
|
}
|
||||||
|
// this._owner.onSkillResultNotify(lst);
|
||||||
|
}else {
|
||||||
|
let bhalo = false;
|
||||||
|
let bchged = false;
|
||||||
|
for(let i = 0; i < count; i++){
|
||||||
|
let obj = pet.addSkill(skillid);
|
||||||
|
if(obj){
|
||||||
|
bchged = true;
|
||||||
|
if(obj.isBornSkill()){
|
||||||
|
lst.push(obj);
|
||||||
|
}else if(obj.isDieSkill()){
|
||||||
|
//nothing to do
|
||||||
|
}else if(obj.isHaloSkill()){
|
||||||
|
//only handle halo, not handle skill
|
||||||
|
bhalo = true;
|
||||||
|
}else{
|
||||||
|
lst.push(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(bhalo){
|
||||||
|
this.onHaloChanged(pet);
|
||||||
|
}
|
||||||
|
if(bchged){
|
||||||
|
pet.dataChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.simpleCheckSkills(lst, pet, param);
|
||||||
|
};
|
||||||
|
|
||||||
|
public summonPet(petid: number, count: number = 1, exparam: SkillParam):number{
|
||||||
let n = -1;
|
let n = -1;
|
||||||
for(let i = 0; i < count; i++){
|
for(let i = 0; i < count; i++){
|
||||||
let pet = this.newPet();
|
let pet = this.newPet();
|
||||||
@ -183,17 +211,17 @@ export class PlayerHandler {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
n++;
|
n++;
|
||||||
pet.setParam(petid, exparam);
|
pet.loadData(petid, exparam);
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
};
|
};
|
||||||
|
|
||||||
public addCard(count: number){
|
public addCard(count: number, from?: PlayerHandler){
|
||||||
return this._owner.onPlayerAddCardNotify(this, count, 0);
|
return this._owner.onPlayerAddCardNotify(this, count, 0, from);
|
||||||
};
|
};
|
||||||
|
|
||||||
public addCardLimit(maxcount: number){
|
public addCardLimit(maxcount: number, from?: PlayerHandler){
|
||||||
return this._owner.onPlayerAddCardNotify(this, 0, maxcount);
|
return this._owner.onPlayerAddCardNotify(this, 0, maxcount, from);
|
||||||
};
|
};
|
||||||
|
|
||||||
public stealCard(dstplayer: PlayerHandler, count: number){
|
public stealCard(dstplayer: PlayerHandler, count: number){
|
||||||
@ -208,7 +236,41 @@ export class PlayerHandler {
|
|||||||
return this._player.hp;
|
return this._player.hp;
|
||||||
};
|
};
|
||||||
|
|
||||||
public checkHalo(apet:PetHandler){
|
public setFriend(aplayer: PlayerHandler){
|
||||||
|
this._friend = aplayer;
|
||||||
|
};
|
||||||
|
|
||||||
|
public die(){
|
||||||
|
this.clear();
|
||||||
|
//todo:
|
||||||
|
};
|
||||||
|
|
||||||
|
public isAlive(): boolean{
|
||||||
|
return this._player.state != 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
public onPetBorned(apet: PetHandler, param: SkillParam){
|
||||||
|
this._owner.onAddPetNotify(apet);
|
||||||
|
|
||||||
|
// 战吼
|
||||||
|
this.simpleCheckSkills(apet._bornSkills, apet, param);
|
||||||
|
};
|
||||||
|
|
||||||
|
public onPetDied(apet: PetHandler){
|
||||||
|
this._owner.onDelPetNotify(apet);
|
||||||
|
|
||||||
|
// 遗愿
|
||||||
|
this.simpleCheckSkills(apet._dieSkills, apet);
|
||||||
|
|
||||||
|
this.delPet(apet);
|
||||||
|
};
|
||||||
|
|
||||||
|
public onPetChanged(apet: PetHandler){
|
||||||
|
this._owner.onUpdatePetNotify(apet);
|
||||||
|
};
|
||||||
|
|
||||||
|
public onHaloChanged(apet: PetHandler){
|
||||||
|
this._self.clearEffHalos();
|
||||||
this._pets.forEach((obj:PetHandler)=>{
|
this._pets.forEach((obj:PetHandler)=>{
|
||||||
obj.clearEffHalos();
|
obj.clearEffHalos();
|
||||||
});
|
});
|
||||||
@ -218,70 +280,28 @@ export class PlayerHandler {
|
|||||||
}
|
}
|
||||||
apet.checkHalo(obj);
|
apet.checkHalo(obj);
|
||||||
});
|
});
|
||||||
};
|
if(this._self != apet){
|
||||||
|
this._self.checkHalo(apet);
|
||||||
public setFriend(aplayer: PlayerHandler){
|
apet.checkHalo(this._self);
|
||||||
this._friend = aplayer;
|
|
||||||
};
|
|
||||||
|
|
||||||
public die(){
|
|
||||||
//todo:
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
public isDead(){
|
|
||||||
this._player.state == 2;
|
|
||||||
};
|
|
||||||
|
|
||||||
public onPetBorned(apet: PetHandler, param: SkillParam){
|
|
||||||
this._owner.onAddPetNotify(apet);
|
|
||||||
|
|
||||||
// 战吼
|
|
||||||
let reslst: SkillTarget[] = [];
|
|
||||||
apet._bornSkills.forEach((item: Skill)=>{
|
|
||||||
item.checkTrigger(TriggerType.NO_COND, 0, param, (skill: Skill, ap: SkillParam, res: SkillTarget[])=>{
|
|
||||||
if(res){
|
|
||||||
reslst = reslst.concat(res);
|
|
||||||
}else{
|
|
||||||
let st = new SkillTarget(skill);
|
|
||||||
st.LoadParam(param);
|
|
||||||
reslst.push(st);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
this._owner.onSkillResultNotify(reslst);
|
|
||||||
};
|
|
||||||
|
|
||||||
public onPetDied(apet: PetHandler){
|
|
||||||
this._owner.onDelPetNotify(apet);
|
|
||||||
|
|
||||||
// 遗愿
|
|
||||||
let ps = new SkillParam(0, 0, 0, this, apet, null, null);
|
|
||||||
let reslst: SkillTarget[] = [];
|
|
||||||
apet._dieSkills.forEach((item: Skill)=>{
|
|
||||||
item.checkTrigger(TriggerType.NO_COND, 0, ps, (skill: Skill, ap: SkillParam, res: SkillTarget[])=>{
|
|
||||||
if(res){
|
|
||||||
reslst = reslst.concat(res);
|
|
||||||
}else{
|
|
||||||
let st = new SkillTarget(skill);
|
|
||||||
st.LoadParam(ps);
|
|
||||||
reslst.push(st);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
this._owner.onSkillResultNotify(reslst);
|
|
||||||
};
|
|
||||||
|
|
||||||
public onHaloChanged(apet: PetHandler){
|
|
||||||
this.checkHalo(apet);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public isMyPet(apet: PetHandler){
|
public isMyPet(apet: PetHandler){
|
||||||
|
if(apet == this._self){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return this._pets.includes(apet);
|
return this._pets.includes(apet);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public findTauntPet(): PetHandler{
|
||||||
|
if(this._self && this._self._istaunt){
|
||||||
|
return this._self;
|
||||||
|
}
|
||||||
|
return this._pets.find((item: PetHandler) =>{
|
||||||
|
return item._istaunt;
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
public hasTransEffCardSkill(): boolean{
|
public hasTransEffCardSkill(): boolean{
|
||||||
if(!this._self){
|
if(!this._self){
|
||||||
return false;
|
return false;
|
||||||
@ -357,6 +377,26 @@ export class PlayerHandler {
|
|||||||
this._owner.onSkillResultNotify(reslst);
|
this._owner.onSkillResultNotify(reslst);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
simpleCheckSkills(skills: Skill[], apet?: PetHandler, param?: SkillParam): SkillTarget[]{
|
||||||
|
let ps = param? param: new SkillParam(0, 0, 0, this, apet, null, null);
|
||||||
|
let reslst: SkillTarget[] = [];
|
||||||
|
skills.forEach((item: Skill)=>{
|
||||||
|
item.checkTrigger(TriggerType.NO_COND, 0, ps, (skill: Skill, ap: SkillParam, res: SkillTarget[])=>{
|
||||||
|
if(res){
|
||||||
|
reslst = reslst.concat(res);
|
||||||
|
}else{
|
||||||
|
let st = new SkillTarget(skill);
|
||||||
|
st.LoadParam(ps);
|
||||||
|
reslst.push(st);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
this._owner.onSkillResultNotify(reslst);
|
||||||
|
|
||||||
|
return reslst;
|
||||||
|
};
|
||||||
|
|
||||||
resetTotalCard(){
|
resetTotalCard(){
|
||||||
this._totalcc = 0;
|
this._totalcc = 0;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ export class Skill {
|
|||||||
_start: boolean;
|
_start: boolean;
|
||||||
_cb: any;
|
_cb: any;
|
||||||
|
|
||||||
ap: number = 0;
|
halo_v: number = -1;
|
||||||
rd: number = 0;
|
rd: number = 0;
|
||||||
// LIFE-CYCLE CALLBACKS:
|
// LIFE-CYCLE CALLBACKS:
|
||||||
|
|
||||||
@ -99,6 +99,10 @@ export class Skill {
|
|||||||
return this._data.effect_typeid == SkillEffectType.CARD_CHG_EN;
|
return this._data.effect_typeid == SkillEffectType.CARD_CHG_EN;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
isHurtPowerSkill(){
|
||||||
|
return this._data.effect_typeid == SkillEffectType.HURT_POWER;
|
||||||
|
};
|
||||||
|
|
||||||
isSingleTarget(){
|
isSingleTarget(){
|
||||||
switch(this._data.rangeid){
|
switch(this._data.rangeid){
|
||||||
case SkillRangeUnitType.SELF:
|
case SkillRangeUnitType.SELF:
|
||||||
@ -131,6 +135,7 @@ export class Skill {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 是否能影响自己
|
||||||
isEffSelfPet(srcpet: PetHandler, dstpet: PetHandler){
|
isEffSelfPet(srcpet: PetHandler, dstpet: PetHandler){
|
||||||
if(this._data.friendlyid != GameCampType.SELF){
|
if(this._data.friendlyid != GameCampType.SELF){
|
||||||
return false;
|
return false;
|
||||||
@ -162,6 +167,33 @@ export class Skill {
|
|||||||
this._data.num_signid, this._data.eff_num, ap? ap: this._data.eff_num);
|
this._data.num_signid, this._data.eff_num, ap? ap: this._data.eff_num);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getHaloValue(ap?: number): number{
|
||||||
|
if(!this.isHaloSkill()){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if(this.halo_v < 0){
|
||||||
|
this.halo_v = this.getEffValue(ap);
|
||||||
|
}
|
||||||
|
return this.halo_v;
|
||||||
|
};
|
||||||
|
|
||||||
|
addHaloValue(v: number): number{
|
||||||
|
if(this.halo_v < 0){
|
||||||
|
this.halo_v = this.getEffValue();
|
||||||
|
}
|
||||||
|
if(this.halo_v > 0){
|
||||||
|
let tmp = this.halo_v;
|
||||||
|
this.halo_v += v;
|
||||||
|
if(this.halo_v < 0){
|
||||||
|
this.halo_v = 0;
|
||||||
|
return -tmp;
|
||||||
|
}else{
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
trigger(param: SkillParam, cb?: any) {
|
trigger(param: SkillParam, cb?: any) {
|
||||||
//触发buff效果
|
//触发buff效果
|
||||||
let res = TriggerManager.onTrigger(this, param);
|
let res = TriggerManager.onTrigger(this, param);
|
||||||
@ -204,7 +236,7 @@ export class Skill {
|
|||||||
switch(efftype){
|
switch(efftype){
|
||||||
case SkillEffectType.CARD_ADD:
|
case SkillEffectType.CARD_ADD:
|
||||||
if(tgt.dsttype == GameUnitType.PLAYER){
|
if(tgt.dsttype == GameUnitType.PLAYER){
|
||||||
let n = tgt.dst.addCard(res);
|
let n = tgt.dst.addCard(res, tgt.srcplayer);
|
||||||
if(n >= 0){
|
if(n >= 0){
|
||||||
tgt.success(efftype, n);
|
tgt.success(efftype, n);
|
||||||
}
|
}
|
||||||
@ -214,7 +246,7 @@ export class Skill {
|
|||||||
break;
|
break;
|
||||||
case SkillEffectType.CARD_ADD_LIMIT:
|
case SkillEffectType.CARD_ADD_LIMIT:
|
||||||
if(tgt.dsttype == GameUnitType.PLAYER){
|
if(tgt.dsttype == GameUnitType.PLAYER){
|
||||||
let n = tgt.dst.addCardLimit(res);
|
let n = tgt.dst.addCardLimit(res, tgt.srcplayer);
|
||||||
if(n >= 0){
|
if(n >= 0){
|
||||||
tgt.success(efftype, n);
|
tgt.success(efftype, n);
|
||||||
}
|
}
|
||||||
@ -245,7 +277,7 @@ export class Skill {
|
|||||||
case SkillEffectType.POWER_ENHANCE:
|
case SkillEffectType.POWER_ENHANCE:
|
||||||
case SkillEffectType.POWEREX_ENHANCE:
|
case SkillEffectType.POWEREX_ENHANCE:
|
||||||
if(tgt.dsttype != GameUnitType.NONE && tgt.dsttype != GameUnitType.PLAYER){
|
if(tgt.dsttype != GameUnitType.NONE && tgt.dsttype != GameUnitType.PLAYER){
|
||||||
let n = efftype == SkillEffectType.POWER_ENHANCE? tgt.dst.addBaseAP(effvalue): tgt.dst.addExAP(effvalue);
|
let n = efftype == SkillEffectType.POWER_ENHANCE? tgt.dst.addBaseAP(effvalue): tgt.dst.addExAP(effvalue, this);
|
||||||
tgt.success(efftype, n);
|
tgt.success(efftype, n);
|
||||||
}else{
|
}else{
|
||||||
tgt.fail(efftype, -1);
|
tgt.fail(efftype, -1);
|
||||||
@ -264,28 +296,27 @@ export class Skill {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
handleHP(efftype: SkillEffectType, effvalue: number, tgt: SkillTarget){
|
handleHP(effvalue: number, tgt: SkillTarget){
|
||||||
if(efftype == SkillEffectType.HURT_HP){
|
let efftype = SkillEffectType.HURT_HP;
|
||||||
if(tgt.dsttype == GameUnitType.PLAYER){
|
if(tgt.dsttype == GameUnitType.PLAYER){
|
||||||
let n = tgt.dst.addHp(effvalue);
|
let n = tgt.dst.addHp(effvalue);
|
||||||
tgt.success(efftype, n);
|
tgt.success(efftype, n);
|
||||||
}else{
|
}else{
|
||||||
tgt.fail(efftype, -1);
|
tgt.fail(efftype, -1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
summon(efftype: SkillEffectType, exparam: SkillParam, tgt: SkillTarget){
|
summon(efftype: SkillEffectType, exparam: SkillParam, tgt: SkillTarget){
|
||||||
let ncount = 1 + exparam.edd_cnt;
|
let ncount = 1 + exparam.edd_cnt;
|
||||||
switch(efftype){
|
switch(efftype){
|
||||||
case SkillEffectType.SUMMON_NPC:
|
case SkillEffectType.SUMMON_NPC:
|
||||||
let n = tgt.srcplayer.summonPet(this._data.quoteunitid, ncount, exparam);
|
let n = tgt.dst.summonPet(this._data.quoteunitid, ncount, exparam);
|
||||||
if(n >= 0){
|
if(n >= 0){
|
||||||
tgt.success(efftype, n);
|
tgt.success(efftype, n);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SkillEffectType.SUMMON_SKILL:
|
case SkillEffectType.SUMMON_SKILL:
|
||||||
let res = tgt.srcplayer.useSkill(this._data.quoteskillid, ncount, exparam);
|
let res = tgt.dst.useSkill(this._data.quoteskillid, ncount, exparam);
|
||||||
if(res){
|
if(res){
|
||||||
tgt.success(efftype, res.length);
|
tgt.success(efftype, res.length);
|
||||||
}
|
}
|
||||||
@ -295,19 +326,28 @@ export class Skill {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
taunt(tgt:SkillTarget){
|
||||||
|
let efftype = SkillEffectType.TAUNT;
|
||||||
|
if(tgt.dsttype != GameUnitType.NONE && tgt.dsttype != GameUnitType.PLAYER){
|
||||||
|
tgt.dst.taunt();
|
||||||
|
tgt.success(efftype, 1);
|
||||||
|
}else{
|
||||||
|
tgt.fail(efftype, -1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
addBuff(efftype: SkillEffectType, effvalue: number, tgt: SkillTarget){
|
addBuff(efftype: SkillEffectType, effvalue: number, tgt: SkillTarget){
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
reduceHurt(efftype: SkillEffectType, effvalue: number, tgt: SkillTarget){
|
reduceHurt(effvalue: number, tgt: SkillTarget){
|
||||||
if(efftype == SkillEffectType.HURT_REDUCE){
|
let efftype = SkillEffectType.HURT_REDUCE;
|
||||||
if(tgt.dsttype != GameUnitType.NONE && tgt.dsttype != GameUnitType.PLAYER){
|
if(tgt.dsttype != GameUnitType.NONE && tgt.dsttype != GameUnitType.PLAYER){
|
||||||
let n = tgt.dst.addReduceHurt(effvalue);
|
let n = tgt.dst.addReduceHurt(effvalue);
|
||||||
tgt.success(efftype, n);
|
tgt.success(efftype, n);
|
||||||
}else{
|
}else{
|
||||||
tgt.fail(efftype, -1);
|
tgt.fail(efftype, -1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
setOwner(owner: PlayerHandler) {
|
setOwner(owner: PlayerHandler) {
|
||||||
|
@ -50,6 +50,9 @@ export class SkillTarget{
|
|||||||
dst: any;
|
dst: any;
|
||||||
dsttype: GameUnitType;
|
dsttype: GameUnitType;
|
||||||
|
|
||||||
|
lasttime: number;
|
||||||
|
bresok: boolean = false;
|
||||||
|
|
||||||
res: SkillResult[];
|
res: SkillResult[];
|
||||||
|
|
||||||
constructor(skill: Skill, splayer?: PlayerHandler, spet?: PetHandler, dstobj?: any, dsttype?: GameUnitType) {
|
constructor(skill: Skill, splayer?: PlayerHandler, spet?: PetHandler, dstobj?: any, dsttype?: GameUnitType) {
|
||||||
@ -59,6 +62,7 @@ export class SkillTarget{
|
|||||||
this.srcskillid = skill._id;
|
this.srcskillid = skill._id;
|
||||||
this.dst = dstobj;
|
this.dst = dstobj;
|
||||||
this.dsttype = dsttype;
|
this.dsttype = dsttype;
|
||||||
|
this.lasttime = skill._data.indicate_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
public LoadParam(sp: SkillParam){
|
public LoadParam(sp: SkillParam){
|
||||||
@ -82,6 +86,7 @@ export class SkillTarget{
|
|||||||
public success(efftype: number, effres: number){
|
public success(efftype: number, effres: number){
|
||||||
this.checkRes();
|
this.checkRes();
|
||||||
this.res.push(new SkillResult(efftype, effres, true));
|
this.res.push(new SkillResult(efftype, effres, true));
|
||||||
|
this.bresok = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
public fail(efftype: number, err: number){
|
public fail(efftype: number, err: number){
|
||||||
@ -89,6 +94,10 @@ export class SkillTarget{
|
|||||||
this.res.push(new SkillResult(efftype, 0, false, err));
|
this.res.push(new SkillResult(efftype, 0, false, err));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public getLastTime(){
|
||||||
|
return this.bresok? this.lasttime: 0;
|
||||||
|
};
|
||||||
|
|
||||||
public exportData(): SkillInfoMsg{
|
public exportData(): SkillInfoMsg{
|
||||||
let msg = new SkillInfoMsg();
|
let msg = new SkillInfoMsg();
|
||||||
msg.data = new SkillInfoData();
|
msg.data = new SkillInfoData();
|
||||||
@ -102,6 +111,14 @@ export class SkillTarget{
|
|||||||
}else{
|
}else{
|
||||||
this.res.forEach((item: SkillResult) => {
|
this.res.forEach((item: SkillResult) => {
|
||||||
let ed = new SKillEffectData();
|
let ed = new SKillEffectData();
|
||||||
|
if(this.dsttype == GameUnitType.PLAYER){
|
||||||
|
ed.pos = 0;
|
||||||
|
ed.player = this.dst.getId();
|
||||||
|
}else {
|
||||||
|
ed.pos = this.dst._idx;
|
||||||
|
ed.player = this.dst._owner.getId();
|
||||||
|
}
|
||||||
|
ed.pos = this.dsttype != GameUnitType.PLAYER? this.dst:
|
||||||
ed.effect_id = item.effect_type;
|
ed.effect_id = item.effect_type;
|
||||||
ed.val = item.bsuccess? item.effect_res: item.err;
|
ed.val = item.bsuccess? item.effect_res: item.err;
|
||||||
ed.result = item.bsuccess? 0: -1;
|
ed.result = item.bsuccess? 0: -1;
|
||||||
|
@ -107,10 +107,12 @@ let TriggerManager = {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case SkillEffectType.TAUNT:
|
case SkillEffectType.TAUNT:
|
||||||
//todo: 不处理
|
tgts.forEach((item)=>{
|
||||||
|
sender.taunt(item);
|
||||||
|
});
|
||||||
case SkillEffectType.HURT_HP:
|
case SkillEffectType.HURT_HP:
|
||||||
tgts.forEach((item)=>{
|
tgts.forEach((item)=>{
|
||||||
sender.handleHP(effectid, effv + env, item);
|
sender.handleHP(effv + env, item);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case SkillEffectType.POWER_ADD_BUFF:
|
case SkillEffectType.POWER_ADD_BUFF:
|
||||||
@ -120,7 +122,7 @@ let TriggerManager = {
|
|||||||
break;
|
break;
|
||||||
case SkillEffectType.HURT_REDUCE:
|
case SkillEffectType.HURT_REDUCE:
|
||||||
tgts.forEach((item)=>{
|
tgts.forEach((item)=>{
|
||||||
sender.reduceHurt(effectid, effv + env, item);
|
sender.reduceHurt(effv + env, item);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user