技能完善/导表

This commit is contained in:
yuexin 2021-01-18 11:45:47 +08:00
parent 58ac45ab0b
commit 42e51fb93e
6 changed files with 34 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -19,6 +19,7 @@ export class SkillCfg implements Cfg{
public targetid: number;
public ridicule: number;
public spellpower: number;
public halve: number;
public rangeid: number;
public select_targetID: number;
public eff_numtypeid: number;
@ -74,6 +75,7 @@ export class SkillCfg implements Cfg{
this.targetid = data.targetid;
this.ridicule = data.ridicule;
this.spellpower = data.spellpower;
this.halve = data.halve;
this.rangeid = data.rangeid;
this.select_targetID = data.select_targetID;
this.eff_numtypeid = data.eff_numtypeid;

View File

@ -737,6 +737,8 @@ export class BattleHandler {
ph.onCardGetted(getcards, fromph);
// return this.endFlow('onCardGetted');
return 0;
};

View File

@ -29,6 +29,7 @@ export class PlayerHandler {
public _friend: PlayerHandler;
public _cardstate: CondType = CondType.NO_COND;
public _cardlinkfrom: PlayerHandler = null;
_totalcc: number = 0;
@ -50,6 +51,7 @@ export class PlayerHandler {
this._totalcc = 0;
this._totalem = 0;
this._cardstate = CondType.NO_COND;
this._cardlinkfrom = null;
};
public updateHero(bclear: boolean = false){
@ -690,29 +692,39 @@ export class PlayerHandler {
onCardLinkEnd(linkcards: Card[], fromplayer: PlayerHandler){
this._cardstate = fromplayer? CondType.CARD_ACTION_LINK_OTHER: CondType.CARD_ACTION_LINK_SELF;
this._cardlinkfrom = fromplayer;
this.checkSkills(TriggerType.CARD_LINK_AFTER, fromplayer);
};
onCardDroped(dropcards: Card[], srcplayer: PlayerHandler){
this.onCardChanged(srcplayer);
this.checkSkills(TriggerType.CARD_DROP_MYROUND);
};
onCardDiscarded(discardcard: Card){
this.onCardChanged();
this.checkSkills(TriggerType.CARD_DISCARD_MYROUND);
};
onCardGetted(getcards: Card[], srcplayer: PlayerHandler){
this.onCardChanged(srcplayer);
getcards && (this._totalcc += getcards.length);
this.checkSkills(TriggerType.CARD_GETTED);
};
onCardChanged(srcplayer: PlayerHandler){
onCardChanged(srcplayer?: PlayerHandler){
this.checkSkills(TriggerType.CARD_CHANGED, srcplayer);
};
onUseCardEnd(sp: SkillParam){
this.checkSkills(TriggerType.CARD_USED);
this.onCardChanged(this._cardlinkfrom);
this._cardstate = CondType.NO_COND; // 重置状态
this._cardlinkfrom = null;
};
onRoundStart(){
@ -722,6 +734,7 @@ export class PlayerHandler {
onRoundEnd(){
this.checkSkills(TriggerType.ROUND_END_MYSELF);
this._cardstate = CondType.NO_COND; // 重置状态
this._cardlinkfrom = null;
};
onGameStart(){

View File

@ -485,7 +485,7 @@ export class Skill {
break;
case SkillEffectType.HURT_POWER:
case SkillEffectType.HURT_ALL:
let effv = this.EMV(effvalue);
let effv = this.EMV(effvalue, tgt.targetIsFriend());
if(tgt.dsttype != GameUnitType.NONE){
let oldhp = tgt.dst.getHP();
let n = tgt.dst.beHurt(effv, tgt.srcPet());
@ -521,7 +521,7 @@ export class Skill {
handleHP(effvalue: number, tgt: SkillTarget){
let efftype = SkillEffectType.HURT_HP;
if(tgt.dsttype != GameUnitType.NONE){
let effv = this.EMV(effvalue);
let effv = this.EMV(effvalue, tgt.targetIsFriend());
let n = tgt.dst.addHP(effv, tgt.srcPet());
tgt.success(efftype, n);
tgt.success(SkillEffectType.CHG_HP, n);
@ -663,12 +663,16 @@ export class Skill {
}
};
EMV(effvalue: number){
EMV(effvalue: number, isfriend: boolean){
let v = effvalue;
if(this._data.halve && isfriend){
v /= 2;
}
if(!this._data.spellpower){
return effvalue;
return v;
}
let ev = this._owner.getEM();
return effvalue + ev;
return v + ev;
};
canEM(){

View File

@ -130,6 +130,12 @@ export class SkillTarget{
return this.srcskilltype == SkillEffectType.ATTACK_BACK;
};
public targetIsFriend(){
let srcp = this.srcPlayer();
let dstp = this.targetPlayer();
return srcp == dstp || (srcp && srcp._friend == dstp);
};
public targetIsPet(){
return this.dsttype == GameUnitType.PET || this.dsttype == GameUnitType.BATTLEUNIT;
};