
//============================================================================
/**
 *
 *@file		sub_231.s
 *@brief	戦闘シーケンス
 *			気絶によるポケモン入れ替えシーケンス（入れ替え戦用）
 *@author	HisashiSogabe
 *@data		2005.07.20
 *
 */
//============================================================================
	.text

	.include	"waza_seq_def.h"

SUB_231:
	//TEMP_WORKが１の時は相手側の瀕死
	IF						IF_FLAG_EQ,BUF_PARA_TEMP_WORK,1,ENEMY_RESHUFFLE

//自分が瀕死の時のチェック
MINE_RESHUFFLE:
	//自分が瀕死の時の入れ替えチェックは野生戦のみ
	IF						IF_FLAG_BIT,BUF_PARA_FIGHT_TYPE,FIGHT_TYPE_TRAINER,SUB_231_YES1
	MESSAGE					NextPokeMsg,TAG_NONE
	SERVER_WAIT
	YES_NO_SELECT			YNTYPE_NEXT_POKEMON
	YES_NO_SELECT_WAIT		SUB_231_YES1,SUB_231_NO1
SUB_231_YES1:
	POKEMON_LIST
	POKEMON_LIST_WAIT
	POKEMON_RESHUFFLE		SIDE_RESHUFFLE
	BRANCH					SUB_231_NO2
SUB_231_NO1:
	ESCAPE_ACT_CHECK		SIDE_MINE,SUB_231_ESCAPE
	GOSUB					SUB_SEQ_ESCAPE_NG
	BRANCH					SUB_231_YES1
SUB_231_ESCAPE:
	GOSUB					SUB_SEQ_ESCAPE
	SEQ_END

//敵が瀕死の時のチェック
ENEMY_RESHUFFLE:
	POKEMON_LIST
	POKEMON_LIST_WAIT
POKE_RESHUFFLE:
	POKEMON_RESHUFFLE		SIDE_RESHUFFLE
//	MESSAGE					TorikaeruMsg,TAG_TRTYPE_TRNAME_NICK_TRNAME,SIDE_RESHUFFLE,SIDE_RESHUFFLE,SIDE_RESHUFFLE_AFTER,SIDE_MINE
	MESSAGE					TorikaeruMsg,TAG_TRTYPE_TRNAME_NICK_TRNAME,SIDE_RESHUFFLE,SIDE_RESHUFFLE,SIDE_RESHUFFLE,SIDE_MINE
	SERVER_WAIT
	YES_NO_SELECT			YNTYPE_CHANGE_POKEMON
	YES_NO_SELECT_WAIT		SUB_231_YES2,SUB_231_NO2
SUB_231_YES2:
	//reshuffle_clientを退避
	VALUE_WORK				VAL_SET,BUF_PARA_RESHUFFLE_CLIENT_TEMP,BUF_PARA_RESHUFFLE_CLIENT
	//ポケモンリストを呼び出し
	POKEMON_LIST_CALL
	POKEMON_LIST_CALL_WAIT	NoReshuffle
	GOSUB					SUB_SEQ_POKEMON_RESHUFFLE
NoReshuffle:
	//reshuffle_clientを元に戻す
	VALUE_WORK				VAL_SET,BUF_PARA_RESHUFFLE_CLIENT,BUF_PARA_RESHUFFLE_CLIENT_TEMP
SUB_231_NO2:
	BALL_GAUGE_RESOURCE_LOAD
	BALL_GAUGE_SET			SIDE_RESHUFFLE
	SERVER_WAIT
	KURIDASU_MESSAGE		SIDE_RESHUFFLE
	SERVER_WAIT
	BALL_GAUGE_OUT			SIDE_RESHUFFLE
	SERVER_WAIT
	BALL_GAUGE_RESOURCE_DELETE
	POKEMON_APPEAR			SIDE_RESHUFFLE
	SERVER_WAIT
	HP_GAUGE_IN				SIDE_RESHUFFLE
	SERVER_WAIT
	GOSUB					SUB_SEQ_MAKIBISI_CHECK
	//気絶していたら、気絶エフェクトへ
	IF						IF_FLAG_NBIT,BUF_PARA_SERVER_STATUS_FLAG,SERVER_STATUS_FLAG_KIZETSU,SUB_231_END
	GOSUB					SUB_SEQ_KIZETSU
SUB_231_END:
	POKEMON_RESHUFFLE_LOOP	POKE_RESHUFFLE
	SEQ_END

