导表+完善连牌逻辑

This commit is contained in:
yuexin 2021-03-03 15:29:52 +08:00
parent 186434cb85
commit 901886725b
3 changed files with 27 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@ -29,15 +29,16 @@ export class PlayerHandler {
public _friend: PlayerHandler; public _friend: PlayerHandler;
public _cardstate: CondType = CondType.NO_COND;
public _cardlinkfrom: PlayerHandler = null;
public _isdied: boolean = false; public _isdied: boolean = false;
_totalcc: number = 0; private _totalcc: number = 0;
private _totalem: number = 0; private _totalem: number = 0;
private _cardstate: CondType = CondType.NO_COND;
private _cardlinkfrom: PlayerHandler = null;
private _cardlinkcards: Card[] = null;
public init(aplayer: Player, owner: BattleHandler){ public init(aplayer: Player, owner: BattleHandler){
this._owner = owner; this._owner = owner;
this._player = aplayer; this._player = aplayer;
@ -696,6 +697,23 @@ export class PlayerHandler {
return obj? obj.getEffValue(): 0; return obj? obj.getEffValue(): 0;
}; };
public isLinkCard(ct: CondType): boolean{
let bok = false;
switch(ct){
case CondType.CARD_ACTION_LINK_OTHER:
case CondType.CARD_ACTION_LINK_SELF:
bok = this._cardstate == ct;
break;
case CondType.CARD_ACTION_LINK:
bok = this._cardstate == CondType.CARD_ACTION_LINK_OTHER ||
this._cardstate == CondType.CARD_ACTION_LINK_SELF;
break;
default:
break;
}
return bok && this._cardlinkcards && this._cardlinkcards.length > 1;
};
onCardLinkReady(fromplayer: PlayerHandler){ onCardLinkReady(fromplayer: PlayerHandler){
this.checkSkills(TriggerType.CARD_LINK_BEFORE); this.checkSkills(TriggerType.CARD_LINK_BEFORE);
}; };
@ -703,6 +721,7 @@ export class PlayerHandler {
onCardLinkEnd(linkcards: Card[], fromplayer: PlayerHandler){ onCardLinkEnd(linkcards: Card[], fromplayer: PlayerHandler){
this._cardstate = fromplayer? CondType.CARD_ACTION_LINK_OTHER: CondType.CARD_ACTION_LINK_SELF; this._cardstate = fromplayer? CondType.CARD_ACTION_LINK_OTHER: CondType.CARD_ACTION_LINK_SELF;
this._cardlinkfrom = fromplayer; this._cardlinkfrom = fromplayer;
this._cardlinkcards = linkcards;
this.checkSkills(TriggerType.CARD_LINK_AFTER, fromplayer); this.checkSkills(TriggerType.CARD_LINK_AFTER, fromplayer);
}; };
@ -735,6 +754,7 @@ export class PlayerHandler {
this.onCardChanged(this._cardlinkfrom); this.onCardChanged(this._cardlinkfrom);
this._cardstate = CondType.NO_COND; // 重置状态 this._cardstate = CondType.NO_COND; // 重置状态
this._cardlinkfrom = null; this._cardlinkfrom = null;
this._cardlinkcards = null;
}; };
onRoundStart(){ onRoundStart(){
@ -745,6 +765,7 @@ export class PlayerHandler {
this.checkSkills(TriggerType.ROUND_END_MYSELF); this.checkSkills(TriggerType.ROUND_END_MYSELF);
this._cardstate = CondType.NO_COND; // 重置状态 this._cardstate = CondType.NO_COND; // 重置状态
this._cardlinkfrom = null; this._cardlinkfrom = null;
this._cardlinkcards = null;
}; };
onGameStart(){ onGameStart(){

View File

@ -36,10 +36,8 @@ export class Condition {
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:
case CondType.CARD_ACTION_LINK_SELF: case CondType.CARD_ACTION_LINK_SELF:
return tg_owner._cardstate == this._type;
case CondType.CARD_ACTION_LINK: case CondType.CARD_ACTION_LINK:
return tg_owner._cardstate == CondType.CARD_ACTION_LINK_OTHER || return tg_owner.isLinkCard(this._type);
tg_owner._cardstate == CondType.CARD_ACTION_LINK_SELF;
case CondType.SELF: case CondType.SELF:
return tg_value? tg_value == tg_owner: true; return tg_value? tg_value == tg_owner: true;
case CondType.FRIEND: case CondType.FRIEND: