package extend.mj.player.rulestate;

import com.game.state.StateBase;

import extend.mj.Config;
import extend.mj.EXMainServer;
import extend.mj.EXPlayer;
import extend.mj.EXRoom;
import extend.mj.EXScore;

/**
 * ��Ӧ���ƴ���״̬
 * 
 *
 * 2017��8��30��
 * PROtherWinState.java
 */
public class PROtherWinState extends StateBase<EXPlayer>{

	@Override
	public void enter(EXPlayer owner) {
		EXRoom room = (EXRoom) owner.room;
		
		EXPlayer activePlayer =  (EXPlayer)room.playerMapBySeat.get(owner.room.activeSeat);
		int score = room.di_fen;
		//int qg_type = room.config.getInt(Config.ROOM_CONFIG_QG_TYPE);
		if(room.config.getBoolean(Config.ROOM_CONFIG_QIANGGANG_DIANPAO) == false &&owner.winType == 1) {
			score = room.di_fen * ( room.maxPlayers - 1);
		}
		room.addScore(owner,activePlayer, score,EXScore.WIN);
		room.addPiaoNiaoScore(owner, activePlayer);
		activePlayer.settleLog.add(Config.SETTLE_DIAN_PAO);
		activePlayer.winer = 2;
		
		owner.settleLog.add(Config.SETTLE_JIE_PAO);
		EXMainServer.gameCtr.winEvent(owner,activePlayer.seat,room.activeCard);

		room.bankerSeat = owner.seat;
		room.winCount += 1;
		owner.winer = 1;
		owner.winCard = room.activeCard;

		room.winCallback( owner ,owner.winCard);
	}

}
