package extend.zp.player.rule;

import com.game.Global;

import extend.zp.EXMainServer;
import extend.zp.EXPlayer;
import extend.zp.EXRoom;
import extend.zp.player.rulestate.PRChi;
import extend.zp.player.rulestate.PRChiState;
import extend.zp.tip.IRuleBase;


public class RuleChi implements IRuleBase {
	@Override
	public boolean condition(EXPlayer player) {
		return player.chi(player.getRoom().activeCard, this);
	}

	@Override
	public void action(EXPlayer player) {
		EXRoom room = (EXRoom) player.room;
		int activeCard=room.activeCard;
		PRChi.prChi(activeCard, player);
		room.activeCard = 0;
		room.lastDiscardSeat = 0;
		EXMainServer.gameCtr.changeActiveSeat(room, player.seat);
		player.stateMachine.changeState(Global.getState(PRChiState.class));
	}
}
