Merge branch 'master' of git.kingsome.cn:node/card_svr

This commit is contained in:
zhl 2020-12-11 17:27:41 +08:00
commit 73a85c1d0d
4 changed files with 23 additions and 11 deletions

View File

@ -4,7 +4,7 @@ import { HeroCfg } from "../../../cfg/parsers/HeroCfg";
import { BattleHandler } from "./BattleHandler";
import CfgMan from "../CfgMan";
import { Pet } from "rooms/schema/Pet";
import { EffectCardType, GameUnitType, SkillType, TriggerType } from "../skill/SkillConst";
import { CondDecideType, CondType, EffectCardType, GameUnitType, SkillType, TriggerType } from "../skill/SkillConst";
import { UnitCfg } from "cfg/parsers/UnitCfg";
import { Skill } from "../skill/Skill";
import { SkillParam, SkillTarget } from "../skill/SkillParam";
@ -50,7 +50,10 @@ export class PlayerHandler {
return this._player.cards.size;
};
public getTotalCardCount(){
public getTotalCardCount(ct: CondDecideType, v: number): number{
if(ct == CondDecideType.EQUAL && this._totalcc > v){
return v;
}
return this._totalcc;
};
@ -465,5 +468,9 @@ export class PlayerHandler {
resetTotalCard(){
this._totalcc = 0;
};
addTotalCard(v: number){
this._totalcc += v;
}
}

View File

@ -13,8 +13,8 @@ import { CondType, CondDecideType } from "./SkillConst";
export class Condition {
public _type: number;
private _cdt: CondDecideType;
private _v: number;
public _cdt: CondDecideType;
public _v: number;
public init(cond_type: CondType, cond_dt: CondDecideType, cond_value: number){
this._type = cond_type;
@ -32,7 +32,7 @@ export class Condition {
v = tg_owner.getCurrCardCount();
return this._isok(v,this._v,this._cdt);
case CondType.CARD_COUNT_TOTAL:
v = tg_owner.getTotalCardCount();
v = tg_owner.getTotalCardCount(this._cdt, this._v);
return this._isok(v,this._v,this._cdt);
case CondType.CARD_ACTION_LINK_OTHER:
return !!tg_value;

View File

@ -3,7 +3,7 @@ import { SKillEffectData } from "message/SkillInfo";
import CfgMan from "../CfgMan";
import { PetHandler } from "../Handler/PetHandler";
import { PlayerHandler } from "../Handler/PlayerHandler";
import { GameCampType, GameUnitType, SkillEffectType, SkillEffectValueType, SkillRangeUnitType, SkillType, TriggerType } from "./SkillConst";
import { CondDecideType, GameCampType, GameUnitType, SkillEffectType, SkillEffectValueType, SkillRangeUnitType, SkillType, TriggerType } from "./SkillConst";
import { SkillParam, SkillTarget } from "./SkillParam";
import { TriggerCtrl } from "./TriggerCtrl";
import TriggerManager from "./TriggerMan";
@ -214,9 +214,6 @@ export class Skill {
this._man && this._man.onSkillTrigger(this, param, res);
if(this.isTotalCardSkill()){
this._owner && this._owner.resetTotalCard();
}
return res;
};
@ -227,7 +224,15 @@ export class Skill {
this._startround++;
}
}
if(this._tgctrl.checkTrigger(tg_type, tg_value, this._owner)){
if(this._tgctrl.checkTrigger(tg_type, tg_value, this._owner, (cdt: CondDecideType, v: number)=>{
if(this.isTotalCardSkill()){
if(cdt == CondDecideType.EQUAL){
this._owner.addTotalCard(-v);
}else if(cdt == CondDecideType.GREATER){
this._owner.resetTotalCard();
}
}
})){
this.trigger(tg_target, cb);
return 1;
}else{

View File

@ -32,7 +32,7 @@ export class TriggerCtrl{
}
if(this._tg.isOK(tg_type)){
if(this._cond.isOK(tg_value, tg_owner)){
callback && callback();
callback && callback(this._cond._cdt, this._cond._v);
return true;
}
}