修改判定累计牌数的方法
This commit is contained in:
parent
f9e523a4cc
commit
67875c52cb
@ -4,7 +4,7 @@ import { HeroCfg } from "../../../cfg/parsers/HeroCfg";
|
|||||||
import { BattleHandler } from "./BattleHandler";
|
import { BattleHandler } from "./BattleHandler";
|
||||||
import CfgMan from "../CfgMan";
|
import CfgMan from "../CfgMan";
|
||||||
import { Pet } from "rooms/schema/Pet";
|
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 { UnitCfg } from "cfg/parsers/UnitCfg";
|
||||||
import { Skill } from "../skill/Skill";
|
import { Skill } from "../skill/Skill";
|
||||||
import { SkillParam, SkillTarget } from "../skill/SkillParam";
|
import { SkillParam, SkillTarget } from "../skill/SkillParam";
|
||||||
@ -50,7 +50,10 @@ export class PlayerHandler {
|
|||||||
return this._player.cards.size;
|
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;
|
return this._totalcc;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -465,5 +468,9 @@ export class PlayerHandler {
|
|||||||
|
|
||||||
resetTotalCard(){
|
resetTotalCard(){
|
||||||
this._totalcc = 0;
|
this._totalcc = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
addTotalCard(v: number){
|
||||||
|
this._totalcc += v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,8 @@ import { CondType, CondDecideType } from "./SkillConst";
|
|||||||
|
|
||||||
export class Condition {
|
export class Condition {
|
||||||
public _type: number;
|
public _type: number;
|
||||||
private _cdt: CondDecideType;
|
public _cdt: CondDecideType;
|
||||||
private _v: number;
|
public _v: number;
|
||||||
|
|
||||||
public init(cond_type: CondType, cond_dt: CondDecideType, cond_value: number){
|
public init(cond_type: CondType, cond_dt: CondDecideType, cond_value: number){
|
||||||
this._type = cond_type;
|
this._type = cond_type;
|
||||||
@ -32,7 +32,7 @@ export class Condition {
|
|||||||
v = tg_owner.getCurrCardCount();
|
v = tg_owner.getCurrCardCount();
|
||||||
return this._isok(v,this._v,this._cdt);
|
return this._isok(v,this._v,this._cdt);
|
||||||
case CondType.CARD_COUNT_TOTAL:
|
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);
|
return this._isok(v,this._v,this._cdt);
|
||||||
case CondType.CARD_ACTION_LINK_OTHER:
|
case CondType.CARD_ACTION_LINK_OTHER:
|
||||||
return !!tg_value;
|
return !!tg_value;
|
||||||
|
@ -3,7 +3,7 @@ import { SKillEffectData } from "message/SkillInfo";
|
|||||||
import CfgMan from "../CfgMan";
|
import CfgMan from "../CfgMan";
|
||||||
import { PetHandler } from "../Handler/PetHandler";
|
import { PetHandler } from "../Handler/PetHandler";
|
||||||
import { PlayerHandler } from "../Handler/PlayerHandler";
|
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 { SkillParam, SkillTarget } from "./SkillParam";
|
||||||
import { TriggerCtrl } from "./TriggerCtrl";
|
import { TriggerCtrl } from "./TriggerCtrl";
|
||||||
import TriggerManager from "./TriggerMan";
|
import TriggerManager from "./TriggerMan";
|
||||||
@ -214,9 +214,6 @@ export class Skill {
|
|||||||
|
|
||||||
this._man && this._man.onSkillTrigger(this, param, res);
|
this._man && this._man.onSkillTrigger(this, param, res);
|
||||||
|
|
||||||
if(this.isTotalCardSkill()){
|
|
||||||
this._owner && this._owner.resetTotalCard();
|
|
||||||
}
|
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -227,7 +224,15 @@ export class Skill {
|
|||||||
this._startround++;
|
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);
|
this.trigger(tg_target, cb);
|
||||||
return 1;
|
return 1;
|
||||||
}else{
|
}else{
|
||||||
|
@ -32,7 +32,7 @@ export class TriggerCtrl{
|
|||||||
}
|
}
|
||||||
if(this._tg.isOK(tg_type)){
|
if(this._tg.isOK(tg_type)){
|
||||||
if(this._cond.isOK(tg_value, tg_owner)){
|
if(this._cond.isOK(tg_value, tg_owner)){
|
||||||
callback && callback();
|
callback && callback(this._cond._cdt, this._cond._v);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user