code:
;-------------------------------------------------
;�ړ�
;-------------------------------------------------
@COM400
#DIM ��������
#DIM ������
#DIM �E�э���
#DIM �����~�܂�Ώ�
#DIM BUTTON�߂�
#DIM BUTTON�ؑ֍�
#DIM BUTTON�ؑ֒�
#DIM BUTTON�ؑ։E
#DIM ����܂���
BUTTON�߂� = MAXROOM + 1
BUTTON�ؑ֍� = MAXROOM + 2
BUTTON�ؑ֒� = MAXROOM + 4
BUTTON�ؑ։E = MAXROOM + 4
����܂��� = 0

IF IN_HOME(TFLAG:195) != 1 && NEXTCOM != -1
	NEXTCOM = -1
	RETURN 0
ENDIF
;�l���J�E���g�����Z�b�g
VARSET COUNTCHARA
;�����̐l���J�E���g��ݒ�
FOR LOCAL,1,CHARANUM
	COUNTCHARA:(CFLAG:LOCAL:���݈ʒu) ++
NEXT
�������� = 0
CALL TURN_RESET

DRAWLINE
;
;	// ����}�b�v�̕\����V�`�������
;

CALL DRAW_MAP

PRINTL
PRINTFORM ����{(CFLAG:MASTER:���݈ʒu)}:
PRINTFORMS NAME_FROM_PLACE(CFLAG:MASTER:���݈ʒu)
PRINTL �ɂ��܂�
SIF !CAN_MOVE(CFLAG:MASTER:���݈ʒu, CFLAG:MASTER:311) && CFLAG:MASTER:���݈ʒu != CFLAG:MASTER:311
	PRINTL [0] - �����֖߂�
FOR LOCAL, MINROOM(), MAXROOM
	SIF !CAN_MOVE(CFLAG:MASTER:���݈ʒu, LOCAL) & 1
		CONTINUE
	SIF NAME_FROM_PLACE(LOCAL) == ""
		CONTINUE
	SELECTCASE FLAG:�ړ���\��
		CASE 2
			PRINTFORM [{LOCAL}] -
			PRINTFORMSL NAME_FROM_PLACE(LOCAL)
		CASE 1
			PRINTFORM [{LOCAL}]-%NAME_FROM_PLACE(LOCAL),5,LEFT%
		CASE 0
	ENDSELECT
NEXT

IF !CAN_MOVE(CFLAG:MASTER:���݈ʒu, ENTRANCE) & 1 && CFLAG:MASTER:���݈ʒu != ENTRANCE
	PRINTFORM [{ENTRANCE}] -
	PRINTFORMSL NAME_FROM_PLACE(ENTRANCE)
ENDIF
PRINTFORM [{BUTTON�߂�}] - �߂�@�@
PRINTBUTTON "��]", BUTTON�ؑ֍�
PRINTBUTTON "�}�b�v�؂�ւ�",BUTTON�ؑ֒�
PRINTFORM ({TFLAG:�}�b�v�؂�ւ�})
PRINTBUTTON "[��",BUTTON�ؑ։E
SIF TALENT:MASTER:���ꏊ�@�m || TALENT:MASTER:�������@�m
	PRINTFORM �@�@[200] - �@�m���[�h
IF FLAG:�@�m���[�h == 1
	PRINT (��)
ELSEIF FLAG:�@�m���[�h == 2
	PRINT (��)
ENDIF
IF TALENT:MASTER:���ꏊ�@�m && FLAG:�@�m���[�h == 1
	PRINTBUTTON "[Z] - ���ꏊ�@�m�@�@ ", "Z"
ENDIF
IF TALENT:MASTER:�������@�m && FLAG:�@�m���[�h == 2
	PRINTBUTTON "[X] - �������@�m�@�@ ", "X"
ENDIF
PRINTBUTTON "[C] - �ړ���\���ؑց@�@", "C"

IF TALENT:MASTER:100 < -4 && !CFLAG:MASTER:���s
	PRINTL
	PRINT �i�����̂����J���c�j
ELSEIF TALENT:MASTER:100 < -4 && CFLAG:MASTER:���s
	PRINTL
	PRINT �i������Ă��炦�Ίy���j
ENDIF

DO
	INPUTS
	;�V�X�e���n���ɏ���
	SELECTCASE RESULTS
	CASE "Z", "z"
		SIF !TALENT:MASTER:���ꏊ�@�m || !AT_HOME(MASTER) || CFLAG:���ӂ�
			GOTO STR_RETRY
		TFLAG:206 = CFLAG:MASTER:���݈ʒu
		CALL HITOSAGASI()
		INPUT
		IF MAP_CAN_MOVE(RESULT) == 0
			IF TFLAG:�ړ��s�\���b�Z�[�W == 999
				PRINTFORMW �����������Ă���
				CLEARLINE 2
				REUSELASTLINE
			ELSE
				TRYCALLFORM MAP_CANNOT_WORD_{MAIN_MAP}(RESULT)
			ENDIF
			TFLAG:�ړ��s�\���b�Z�[�W = 0
			NEXTCOM = -1
			RETURN 0
		ELSEIF IN_HOME(RESULT) == 1
			CALL SKIP_MOVE(CFLAG:MASTER:���݈ʒu, RESULT)
			RETURN
		ENDIF
		RESTART
	CASE "X", "x"
		SIF !TALENT:MASTER:�������@�m || !AT_HOME(MASTER) || CFLAG:���ӂ�
			GOTO STR_RETRY
		TFLAG:206 = CFLAG:MASTER:���݈ʒu
		CALL OHEYA_CHECK
		INPUT
		IF MAP_CAN_MOVE(RESULT) == 0
			IF TFLAG:�ړ��s�\���b�Z�[�W == 999
				PRINTFORMW �����������Ă���
				CLEARLINE 2
				REUSELASTLINE
			ELSE
				TRYCALLFORM MAP_CANNOT_WORD_{MAIN_MAP}(RESULT)
			ENDIF
			TFLAG:�ړ��s�\���b�Z�[�W = 0
			NEXTCOM = -1
			RETURN 0
		ELSEIF IN_HOME(RESULT) == 1
			CALL SKIP_MOVE(CFLAG:MASTER:���݈ʒu, RESULT)
			RETURN
		ENDIF
		RESTART
	CASE "C", "c"
		FLAG:�ړ���\�� += 1
		SIF FLAG:�ړ���\�� > 2
			FLAG:�ړ���\�� = 0
		RESTART
	CASE ""
		CONTINUE
	ENDSELECT

	;���p�����̏ꍇ�̂ݔ���𑱍s
	IF ISNUMERIC(RESULTS)
		RESULT = TOINT(RESULTS)
	ELSE
		$STR_RETRY
		PRINTW �s���ȓ��͂ł�
		CLEARLINE 2
		REUSELASTLINE
		CONTINUE
	ENDIF

	;�V�X�e���n���ɏ���
	SELECTCASE RESULT
	CASE BUTTON�߂�, CFLAG:MASTER:���݈ʒu
		NEXTCOM = -1
		RETURN -1
	CASE BUTTON�ؑ֍�
		TFLAG:�}�b�v�؂�ւ� -= 1
		SIF TFLAG:�}�b�v�؂�ւ� <= 0
			TFLAG:�}�b�v�؂�ւ� = MAP_PAGES
		RESTART
	CASE BUTTON�ؑ։E
		TFLAG:�}�b�v�؂�ւ� += 1
		SIF TFLAG:�}�b�v�؂�ւ� > MAP_PAGES
			TFLAG:�}�b�v�؂�ւ� = 1
		RESTART
	CASE 0
		IF IN_HOME(CFLAG:MASTER:�����ʒu) != 1
			PRINTW �����ʒu���s���ł��B�����ɕύX���܂��B
			CFLAG:MASTER:�����ʒu = �f�t�H���g�����ʒu
		ENDIF
		CALL SKIP_MOVE(CFLAG:MASTER:���݈ʒu, CFLAG:MASTER:�����ʒu)
		RETURN
	CASE 200
		IF TALENT:MASTER:���ꏊ�@�m && TALENT:MASTER:�������@�m
			FLAG:�@�m���[�h += 1
			SIF FLAG:�@�m���[�h >= 3
				FLAG:�@�m���[�h = 0
		ELSEIF TALENT:MASTER:���ꏊ�@�m
			FLAG:�@�m���[�h = !FLAG:�@�m���[�h
		ELSEIF TALENT:MASTER:�������@�m
			FLAG:�@�m���[�h = (!FLAG:�@�m���[�h) * 2
		ENDIF
		RESTART
	ENDSELECT

	;�c��͒ʏ�̏ꏊ�̑I���������͌����

	;TW�̕��j�Ƃ��Ĕ񐄏��Ȃ񂾂��ǎ�ł����͂ł��ꂪ����Ɠ��͕����������ĕ֗��Ȃ�
	SIF INRANGE(RESULT, 1, 99)
		RESULT += MAIN_MAP * 100

	;�ړ��s�\�Ȃ�e����
	;�ړ��͈͊O
	IF IN_HOME(RESULT) != 1
		TFLAG:�}�b�v�؂�ւ� = 0
		PRINTW �ړ��͈͊O
		CLEARLINE 2
		REUSELASTLINE
		CONTINUE
	;�ړ��s�\��
	ELSEIF MAP_CAN_MOVE(RESULT) == 0
		TFLAG:�}�b�v�؂�ւ� = 0
		IF TFLAG:�ړ��s�\���b�Z�[�W == 999
			PRINTFORMW �����������Ă���
			CLEARLINE 2
			REUSELASTLINE
		ELSE
			TRYCALLFORM MAP_CANNOT_WORD_{MAIN_MAP}(RESULT)
		ENDIF
		TFLAG:�ړ��s�\���b�Z�[�W = 0
		CONTINUE
	ENDIF

	;ELSEIF CAN_SKIPMOVE(MAIN_MAP)	�����S���X�L�b�v���[�u�ɂ���
	CALL SKIP_MOVE(CFLAG:MASTER:���݈ʒu, RESULT)
	RETURN

	;eraTW4.570proto���_�ł͈ȉ��܂�܂鎀�ɕ���
	;�K��RETURN��RESTART�Ŕ�ԏ�ɁA���Ԍo�ߏ����Ȃǂ�SKIP_MOVE���ł���Ă���
	IF FLAG:70 == 1
		SIF TALENT:MASTER:100 < -4
		BASE:MASTER:TSP -= 15
		BASE:MASTER:TSP -= 5
		IF TFLAG:�^��
			BASE:MASTER:TSP -= 3
			CFLAG:(TFLAG:�^��):���݈ʒu = CFLAG:MASTER:���݈ʒu
		ENDIF
	ELSE
		;���l���m�œ��s���ĂĂ������ʂ�̑��x�ɂȂ�̂��l�̒m�b�̂�������
		SIF TALENT:MASTER:100 < -4 && !CFLAG:MASTER:���s
		TIME += 7
		TIME += 3
		IF CFLAG:93:���s && !GETBIT (FLAG:�v�[��, 0)
			TIME += 2
			BASE:MASTER:�̗� = MAX(BASE:MASTER:�̗� - 5,500)
		ENDIF
	ENDIF

	;eraTW4.570proto���_�ł͉B�����t���O���g���ĂȂ����ۂ��H�H�H
	;�ڂ����d�l��������Ƃ悭�킩��Ȃ�

		;�B����������
	;	�v����
	;IF CFLAG:MASTER:�B����
	;	FOR LOCAL, 1, CHARANUM
	;		;MASTER�̑O�^�[���ʒu�������������ꍇ
	;		IF (CFLAG:LOCAL:311 == CFLAG:MASTER:�O�^�[���ʒu) || (CFLAG:LOCAL:���݈ʒu == CFLAG:MASTER:311 && CFLAG:MASTER:�O�^�[���ʒu == CFLAG:MASTER:311)
	;			CFLAG:LOCAL:�B���� = 0
	;			CFLAG:LOCAL:�C�^�Y�� = 0
	;		ENDIF
	;		;MASTER�̌��݈ʒu�������������ꍇ
	;		SIF ((CFLAG:MASTER:���݈ʒu == CFLAG:LOCAL:311) && CFLAG:LOCAL:����) || ((CFLAG:LOCAL:���݈ʒu == CFLAG:MASTER:311 && CFLAG:MASTER:���݈ʒu == CFLAG:MASTER:311) && CFLAG:LOCAL:����)
	;			CFLAG:LOCAL:�B���� = 1
	;	NEXT
	;	;�����ȊO�͉B���o���Ȃ��c�n�Y
	;	IF CFLAG:MASTER:���݈ʒu < 13
	;		CFLAG:MASTER:�B���� = 0
	;		CFLAG:MASTER:�C�^�Y�� = 0
	;	ENDIF
	;ENDIF
	PREVCOM = 400
	STR:0 = �ړ�
	;NEXTCOM�ɉ�������̒l�������Ă���ꍇ�͂�������������Ȃ�
	;�����łȂ��΂���-1�Ń��Z�b�g
	SIF NEXTCOM == 0
		NEXTCOM = -1
	RETURN 0
	;���ɕ��򂱂��܂�
LOOP 1

;�ړ�
@COM_ABLE400
;�ړ����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(400)
	RETURN RESULT
SIF CFLAG:���ӂ� == 2
	RETURN 0
SIF CFLAG:MASTER:�C�^�Y��
	RETURN 0
SIF CFLAG:MASTER:�Y���Q��
	RETURN 0
SIF CHK_DATENOW(CFLAG:MASTER:�f�[�g��)
	RETURN 0
;����łȂ�
SIF AT_HOME(MASTER) == 0
	RETURN 0
RETURN 1

@SKIP_MOVE(ARG, �ŏI�ړI�n)
#DIM �b��ړI�n,10
#DIM �b��ړI�n�����
#DIM �ŏI�ړI�n
#DIM ���O�ʒu
#DIM �o���n�_
#DIM �o�ߎ���
#DIM ���p�n�_,20
#DIM ���p��
#DIM RELAY_COUNT

;ARG:0	�o���ʒu
;ARG:1	�ŏI�ړI�n
VARSET LOCAL
VARSET ���p�n�_
�b��ړI�n = �ŏI�ړI�n
�o�ߎ��� = 0
���p�� = 0
TFLAG:�}�b�v�؂�ւ� = 0
IF (CAN_MOVE(CFLAG:MASTER:���݈ʒu, �b��ړI�n) & 1)
	���O�ʒu = ARG
	�o�ߎ��� = 1
	CFLAG:MASTER:���݈ʒu = �ŏI�ړI�n
	GOTO STOP
ELSE
	TRYCALLFORM SKIP_MOVE_{MAIN_MAP}(�ŏI�ړI�n)
	���O�ʒu = RESULT
ENDIF

�o���n�_ = CFLAG:MASTER:���݈ʒu

FOR ���p��,0,20
	WHILE !(CAN_MOVE(�o���n�_, �b��ړI�n) & 1)
		TRYCALLFORM SKIP_MOVE_{MAIN_MAP}(�b��ړI�n,�o���n�_)
		[IF_DEBUG]
		PRINTFORML {�b��ړI�n}�ɒ��ڍs���Ȃ�����{RESULT}��ڎw����
		[ENDIF]
		�b��ړI�n = RESULT
	WEND
	[IF_DEBUG]
	SETCOLOR C_YELLOW
	PRINTFORML {���p��+1}�߂̎b��ړI�n��%NAME_FROM_PLACE(�b��ړI�n)%�Ɍ���
	RESETCOLOR
	[ENDIF]
	�o�ߎ��� += 1
	���p�n�_:���p�� = �b��ړI�n
	SIF CAN_MOVE(�b��ړI�n,�ŏI�ړI�n) & 1
		BREAK
	�o���n�_ = �b��ړI�n
	�b��ړI�n = �ŏI�ړI�n
NEXT

FOR RELAY_COUNT,1,���p�� + 1
	LOCAL:3 = 0
	FOR LOCAL,1,CHARANUM
		IF CFLAG:LOCAL:���݈ʒu == ���p�n�_:(RELAY_COUNT-1)
			LOCAL:3 = LOCAL
			BREAK
		ENDIF
	NEXT
	PRINTFORM {RELAY_COUNT}�Ԗڂ̒��p�n��%NAME_FROM_PLACE(���p�n�_:(RELAY_COUNT-1))%
	IF LOCAL:3
		RESULT = 0
		TRYCALLFORM M_KOJO_K{(LOCAL:3)}
		PRINTFORML ��%CALLNAME:(LOCAL:3)%���݂�����
		IF FLAG:�����~�܂� == 2
			;�����~�܂�Ȃ�
		ELSEIF FLAG:�����~�܂� == 1 && !RESULT
			;���オ����ꍇ�̂�
		ELSE
			CALL ASK_M("��߂��Ĉړ�����",!FLAG:70,"�������Ĉړ�����",1,"�����~�܂�",1)
			IF RESULT == 2
				CALL KOJO_MESSAGE_SEND("EVENT",4,LOCAL:3,1,0)
				�o�ߎ��� = RELAY_COUNT
				CFLAG:MASTER:���݈ʒu = ���p�n�_:(RELAY_COUNT - 1)
				RESULT = ���p�n�_:RELAY_COUNT
				GOTO STOP
			ELSEIF RESULT == 1
				CALL KOJO_MESSAGE_SEND("EVENT",4,LOCAL:3,3,0)
			ELSE
				CALL KOJO_MESSAGE_SEND("EVENT",4,LOCAL:3,2,0)
			ENDIF
		ENDIF
	ELSE
		PRINTFORML �ɂ͒N�����Ȃ�����
	ENDIF
NEXT

�o�ߎ��� = ���p�� + 1
CFLAG:MASTER:���݈ʒu = �ŏI�ړI�n
RESULT = �ŏI�ړI�n
$STOP
IF IN_TOILET(RESULT)
	CALL �g�C���N��(RESULT)
	SIF RESULT == -1
		CFLAG:MASTER:���݈ʒu = ���O�ʒu
ELSEIF BATHCHECK(RESULT)
	LOCAL:1 = IN_ROOM_MEMBER("MIN", RESULT, "CFLAG", 6)
	IF !LOCAL:1 && !CFLAG:MASTER:���s
		PRINTFORMW ����ɓ�������%CALLNAME:MASTER%�͕��C�ɐZ������
	ELSEIF LOCAL:1 && ���C�ǂ��o������(LOCAL:1) && !CFLAG:MASTER:���s
		PRINTFORMW ����ɋ���%CALLNAME:(LOCAL:1)%�ɒǂ��o����Ă��܂����c
		CALL KOJO_MESSAGE_SEND("EVENT",11,LOCAL:1,1,0)
		CFLAG:MASTER:���݈ʒu = ���O�ʒu
	ELSEIF LOCAL:1 && !CFLAG:MASTER:���s
		IF FLAG:70 == 1
			PRINTFORMW %CALLNAME:(LOCAL:1)%���������������悤���c
		ELSE
			PRINTFORMW ����ɋ���%CALLNAME:(LOCAL:1)%�Ɩڂ��������c
			CALL KOJO_MESSAGE_SEND("EVENT",11,LOCAL:1,2,0)
		ENDIF
		CFLAG:MASTER:���݈ʒu = �ŏI�ړI�n
	ELSE
		FOR LOCAL, 1, CHARANUM
			IF ���C�ǂ��o������(LOCAL) && CFLAG:LOCAL:���s
				PRINTFORMW %CALLNAME:LOCAL%�Ƃ����C�ɓ��낤�Ƃ������f��ꂽ
				CALL KOJO_MESSAGE_SEND("EVENT",23,LOCAL,1,0)
				CFLAG:MASTER:���݈ʒu = ���O�ʒu
				GOTO END
			ELSEIF LOCAL:1 && ���C�ǂ��o������(LOCAL:1)
				PRINTFORMW ����ɋ���%CALLNAME:(LOCAL:1)%�ɒǂ��o����Ă��܂����c
				CALL KOJO_MESSAGE_SEND("EVENT",11,LOCAL:1,1,0)
				CFLAG:MASTER:���݈ʒu = ���O�ʒu
				GOTO END
			ENDIF
		NEXT
		FOR LOCAL, 1, CHARANUM
			IF CFLAG:LOCAL:���s
				PRINTFORMW %CALLNAME:LOCAL%�͈ꏏ�ɂ����C�ɓ����Ă��ꂻ����
				CALL KOJO_MESSAGE_SEND("EVENT",23,LOCAL,2,0)
				BREAK
			ENDIF
		NEXT
		CFLAG:MASTER:���݈ʒu = �ŏI�ړI�n
	ENDIF
ELSEIF RESULT == 54
	CALL �������N��(RESULT)
	SIF RESULT == -1
		CFLAG:MASTER:���݈ʒu = ���O�ʒu
ELSEIF LOCK:(RESULT)
	LOCAL:4 = RESULT
	IF FLAG:70 == 1
		FOR LOCAL, 1, CHARANUM
			IF CFLAG:LOCAL:311 == RESULT && CFLAG:LOCAL:���� && !CFLAG:LOCAL:�o��
				PRINTFORMW �ǂ����%CALLNAME:LOCAL%�͖����Ă���悤��
			ENDIF
		NEXT
		;�ړ�����
		CFLAG:MASTER:���݈ʒu = �ŏI�ړI�n
	ELSEIF FLAG:70 == 0
		FOR LOCAL, 1, CHARANUM
			IF CFLAG:LOCAL:311 == RESULT && CFLAG:LOCAL:���� && !CFLAG:LOCAL:�o��
				PRINTFORMW �ǂ����%CALLNAME:LOCAL%�͖����Ă���悤��
			ELSEIF CFLAG:LOCAL:311 == RESULT && !CFLAG:LOCAL:���� && !CFLAG:LOCAL:�o��
				PRINTFORML �ǂ����%CALLNAME:LOCAL%�͖����Ă���悤��
				PRINTFORMW ������������������c
			ENDIF
			IF CFLAG:LOCAL:���s
				LOCAL:2 = 1
			ELSE
				LOCAL:2 = 0
			ENDIF
		NEXT
		IF LOCAL:2
			CFLAG:MASTER:���݈ʒu = ���O�ʒu
		ELSEIF LOCAL:4 != CFLAG:MASTER:�����ʒu
			CALL ASK_YN("�����ɔE�э���","��߂Ă���")
			IF RESULT == 0
				CALL �����ɔE�э���(LOCAL:4)
				GOTO END
			ELSEIF RESULT == 1
				CFLAG:MASTER:���݈ʒu = ���O�ʒu
			ENDIF
		ENDIF
	ENDIF
ENDIF
$END
[IF_DEBUG]
PRINTFORML {�o�ߎ���}��ړ�������
[ENDIF]

IF FLAG:70 == 1
	SIF TALENT:MASTER:100 < -4
		BASE:MASTER:TSP -= 15 * �o�ߎ���
	BASE:MASTER:TSP -= 5 * �o�ߎ���
	IF TFLAG:�^��
		BASE:MASTER:TSP -= 3 * �o�ߎ���
		CFLAG:(TFLAG:�^��):���݈ʒu = CFLAG:MASTER:���݈ʒu
	ENDIF
ELSE
	SIF TALENT:MASTER:100 < -4 && !CFLAG:MASTER:���s
		TIME += 7 * �o�ߎ���
	TIME += 3 * �o�ߎ���
	IF CFLAG:93:���s && !GETBIT (FLAG:�v�[��, 0)
		TIME += 2 * �o�ߎ���
		BASE:MASTER:�̗� = MAX(BASE:MASTER:�̗� - (5 * �o�ߎ���), 500)
	ENDIF
ENDIF

PREVCOM = 400
STR:0 = �ړ�
;NEXTCOM�ɉ�������̒l�������Ă���ꍇ�͂�������������Ȃ�
;�����łȂ��΂���-1�Ń��Z�b�g
SIF NEXTCOM == 0
	NEXTCOM = -1

path: 原版+前人整合等各种readme/パッチ/eraTW4.571用 ダウジング等修正/ERB/コマンド関連/COMF/日常系/COMF400 移動.ERB


code:
@COM443
TRYCALLFORM UNIQUE_COM_%NAME_UNIQUE_COM(TARGET)%
SIF RESULT == -1
	RETURN -1
TIME += 3
RETURN 1

@COM_ABLE443
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;���s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(443)
	RETURN RESULT
SIF TARGET <= 0
	RETURN 0
SIF !SHIRAHU(TARGET)
	RETURN 0
SIF CFLAG:���ӂ�
	RETURN 0
SIF !ABLE_UNIQUE_COM(TARGET)
	RETURN 0
RETURN 1

@NAME_UNIQUE_COM(CHARA)
#FUNCTIONS
#DIM CHARA
RETURNF GET_STR(0, "�L�����f�[�^", CHARA, "�ŗL�R�}���h")

@ABLE_UNIQUE_COM(CHARA)
#FUNCTION
#DIM CHARA
RETURNF GET_INT(0, "�L�����f�[�^", CHARA, "�ŗL�R�}���h���s�\")

;-------------------------------------------------
;�얲�p
;-------------------------------------------------
@UNIQUE_COM_���݂����_��
#DIM ���݂�����
IF FLAG:���݂����_��
	PRINTFORML �u�����_�񂵂Ă邶��Ȃ��v
	RETURN -1
ENDIF
IF !MAIN_MAP
	���݂����� = 30
ELSE
	���݂����� = 50
ENDIF
PRINTFORML �u�y���̑f�G�țޏ����������񂽂ׂ̈ɂ��݂����������Ă������v
PRINTFORML �u��50�J���X�}��A�������̂ł���H�v
SIF !MAIN_MAP
	PRINTFORML �u�_�ЂɏZ�ݍ��݂��Ă邤����30�ł�����v
CALL ASK_M("����",MONEY:2 >= ���݂�����,"��߂Ƃ�",1)
SIF RESULT
	RETURN -1
PRINTFORMW �u�܂��ǂ���I�����z������Č_�񂾂���ˁv
MONEY:2 -= ���݂�����
FLAG:���݂����_�� = 1

;-------------------------------------------------
;���p
;-------------------------------------------------
@UNIQUE_COM_�V���w��
IF FLAG:�V���w��
	PRINTFORML �u�����Ƃ��Ă邶��Ȃ��ł����v
	RETURN -1
ENDIF
PRINTFORML �u��\\3000�Ō��z���́u���v���킩��I�@���X�B�V�����Ƃ�܂��񂩁H�v
CALL ASK_M("����Ȃ�",1,"�w�ǂ���",MONEY >= 3000,"�J���X�}�ōw�ǂ���",MONEY:2 >= 10)
SELECTCASE RESULT
	CASE 0
		RETURN -1
	CASE 1
		MONEY -= 3000
	CASE 2
		MONEY:2 -= 10
ENDSELECT
PRINTFORMW ���X�B�V�����w�ǂ��邱�Ƃɂ��܂����B
PRINTFORMW ���������Ɍ_��̍X�V���s���܂��B
FLAG:�V���w�� = 1

;-------------------------------------------------
;�V�q�p
;-------------------------------------------------
@UNIQUE_COM_�V�󑀍�
IF CFLAG:MASTER:���݈ʒu == �V�E
	PRINTFORML �u�������ᖳ���ˁv
	RETURN -1
ENDIF
IF FLAG:�ُ�C��
	PRINTFORML �u���̓V�C�͕ς����Ȃ���v
	RETURN -1
ENDIF
IF GETBIT(TFLAG:������,6)
	PRINTFORML �u�����͂������Ȃ����v
	RETURN -1
ENDIF
PRINTFORML �u��G�c�ɂ������Ȃ����A�ʓ|����������v
$LOOP
CALL ASK_M("����",1,"�܂�",1,"�J",1, "��", DAY:2 == 4, "�p���c", 1)
SELECTCASE RESULT
	CASE 0
		;�J�Ȃ��m���œ�
		SIF INRANGE(TIME:5,4,7) && !RAND:7
			TIME:7 = 1
		;��Ȃ��m���Ń_�C�������h�_�X�g
		SIF INRANGE(TIME:5,8,13) && !RAND:7
			TIME:7 = 2
		TIME:5 = RAND:2
	CASE 1
		TIME:5 = RAND:2 + 2
	CASE 2
		;�����ς��悤�Ƃ���Ɠ�
		IF TIME:5 < 2 && !RAND:4
			TIME:7 = 1
		ELSE
			TIME:5 = 4 + RAND:4
		ENDIF
	CASE 3
		;�����ς��悤�Ƃ���ƃ_�C�������h�_�X�g
		IF TIME:5 < 2 && !RAND:4
			TIME:7 = 2
		ELSE
			TIME:5 = 8 + RAND:6
		ENDIF
	CASE 4
		PRINTFORML �u�o�J����Ȃ��́H�v
		RETURN -1
ENDSELECT

DOWNBASE:�C�� = 300
SETBIT TFLAG:������,6

;-------------------------------------------------
;���p
;-------------------------------------------------
@UNIQUE_COM_�痢��
PRINTFORML �u�ǂ������܂����H�v
CALL BROAD_HITOSAGASI

;-------------------------------------------------
;�`���m�p
;-------------------------------------------------
;�A�C�X�̒l�i�͋G�߂ɂ��ϓ�����i�Ă���ԍ����j
@UNIQUE_COM_�A�C�X�𔃂�
#DIM �A�C�X�˂���
#DIM �p�b�N�˂���
�A�C�X�˂��� = ICE_PRICE()
�p�b�N�˂��� = ICE_PRICE() * 9
PRINTL �u�A�C�X�ق����́H�v
PRINTFORML
PRINTFORML ������:\\%TOSTR(MONEY,"#,###")%
PRINTFORML
CALL EX_SHOPPING("�A�C�X", "���܂��Ă��������A�C�X", 0, �A�C�X�˂���)
CALL EX_SHOPPING("�A�C�X�߂��킹", "�݂�ȂŐH�ׂ悤", 1, �p�b�N�˂���)
PRINTFORML
PRINTL [100] ��߂�
INPUT
SELECTCASE RESULT
	CASE 0
		CALL BUY_ABLE(213, �A�C�X�˂���, 1)
	CASE 1
		CALL BUY_ABLE(213, �p�b�N�˂���, 10)
	CASE 100
		RETURN -1
	CASEELSE
ENDSELECT
RESTART

@ICE_PRICE
#FUNCTION
SELECTCASE DAY:2
CASE 1
	RETURNF 400
CASE 2
	RETURNF 500
CASE 3
	RETURNF 300
CASE 4
	RETURNF 200
ENDSELECT

;-------------------------------------------------
;���p
;-------------------------------------------------
@UNIQUE_COM_�g���ُo���T�[�r�X
PRINTFORML �u����A���������肩����H�v
PRINTFORML
CALL ASK_M("���܂Ȃ�", 1, "�|����s", !TFLAG:�o�����|��, "������s", ITEM:150)
SELECTCASE RESULT
CASE 0
	RETURN -1
CASE 1
	PRINTFORML �z�t�S�u������%GET_MAPNAME(MAIN_MAP)%�̑|���𗊂݂܂����H
	CALL PAY_YEN_OR_CM(3000,10)
	SIF !RESULT
		RETURN -1
	PRINTFORML �o�����|���T�[�r�X���˗����܂����B
	TFLAG:�o�����|�� = 1
CASE 2
	PRINTFORML �z�t�S�u�����ɉƒ�؉��̐����𗊂݂܂����H�i���������ς��j
	CALL PAY_YEN_OR_CM(15000,70)
	SIF !RESULT
		RETURN -1
	PRINTFORML ������s���˗����܂����B
	FLAG:������s = 1
ENDSELECT
RETURN 1

;-------------------------------------------------
;�i�Y�[�����p
;-------------------------------------------------
@UNIQUE_COM_�_�E�W���O
#DIM DYNAMIC CNT_TALK
#DIM DYNAMIC CNT_DOWSING
#DIM CAN_SLOT
#DIM CHK_SLOT
#DIM TMP_ID
IF !CNT_TALK
	PRINTFORML �u�ӂށB�T�����̑��k���v
	PRINTFORML �u�m���ɂ���͎��̐�啪�삾�ˁv
	PRINTFORMW �u����ł́A�ڂ����b�𕷂����Ă��炨�����v
	CNT_TALK ++
	CAN_SLOT = CAN_DOWSING()
	IF !CAN_SLOT
		PRINTFORML �u���������A���ɒT���������̂��Ȃ��̂Ƀ_�E�W���O���Ă�����Č������̂����H�v
		PRINTFORMW �u�������ł͖����񂾂�H�܂������c�v
		RETURN
	ENDIF
ELSE
	PRINTFORMW �u�܂��������邩�ȁH�v
ENDIF

FOR CHK_SLOT, 1, 6
	SIF !GETBIT(CAN_SLOT, CHK_SLOT)
		CONTINUE
	PRINTFORML [{CHK_SLOT}] - �˗�{CHK_SLOT}�@��%STR_DATA_IRAI(IRAI_SLOT:CHK_SLOT, "�˗���", IRAI_SLOT_TO_CLIENT(CHK_SLOT))%��
NEXT
PRINTFORML
PRINTFORML [0] - ��߂�
DO
	INPUT
	CHK_SLOT = RESULT
	SELECTCASE CHK_SLOT
	CASE 1 TO 5
		SIF !GETBIT(CAN_SLOT, CHK_SLOT)
			CONTINUE
		PRINTFORML �u�Ȃ�قǁv
		PRINTFORML �u�_�E�W���O�ɂ͑����̂��z�{�𒸂�����ǁA�\��Ȃ����ȁH�v
		CALL ASK_M("��߂Ă���", 1, "\\1000����̂���", MONEY >= 1000, "5CM����̂���", MONEY:2 >= 5)
		SELECTCASE RESULT
		CASE 0
			PRINTFORMW �u����A����͎c�O���v
			BREAK
		CASE 1
			MONEY -= 1000
		CASE 2
			MONEY:2 -= 5
		ENDSELECT
		CNT_DOWSING ++
		SELECTCASE IRAI_SLOT_TO_TASKNAME(CHK_SLOT)
		CASE "�{���i�l���j"
			CNT_DOWSING ++
			TMP_ID = IRAI_SLOT_TO_PERSON(CHK_SLOT)
			IF CALLNAME:TMP_ID == "�i�Y�[����"
			;�i�Y����͐l���ɑ΂��锽�����򂪑���������Ȃ�
			;���΂Ɏ���������Ȃ炱��Ȋ����ɂȂ邾�낤
				PRINTFORML �u����������y���f�������������Ɣ������Ă�񂾂��v
				PRINTFORML �u���̈˗��͎��Ɋ֘A������̂���Ȃ��̂��ȁH�v
				PRINTFORMW �u�Ȃ񂾂�����ȋC�������v
				BREAK
			ENDIF
			CALL DOWSING_TSUBUYAKI
			PRINTFORML �u���_���o����v
			PRINTFORML �u%CALLNAME:TMP_ID%���L�[�p�[�\�����v
			PRINTFORML �u���łɋ��ꏊ������o���Ă��������H�v
			CALL ASK_M("��߂Ă���", 1, "\\500����̂���", MONEY >= 500, "3CM����̂���", MONEY:2 >= 3)
			SELECTCASE RESULT
			CASE 0
				PRINTFORMW �u����A����͎c�O���v
				BREAK
			CASE 1
				MONEY -= 500
			CASE 2
				MONEY:2 -= 3
			ENDSELECT
			IF CFLAG:TMP_ID:���݈ʒu == SUKIMA()
				PRINTFORML �u���[��A���������肵�Ȃ��ȁv
				PRINTFORMW �u�������ɉ�͓̂���݂������ˁv
			ELSE
				PRINTFORMW �u�ޏ��͌��݁A%GET_MAPNAME(GET_MAPID(CFLAG:TMP_ID:���݈ʒu))%�̎��ӂɂ���悤���v
			ENDIF
		CASE "�{���i�ꏊ�j"
			CNT_DOWSING ++
			TMP_ID = IRAI_SLOT_TO_PLACE(CHK_SLOT)
			CALL DOWSING_TSUBUYAKI
			PRINTFORML �u���_���o����v
			PRINTFORML �u�N���ڎw���ׂ��ꏊ��%GET_MAPNAME(GET_MAPID(TMP_ID))%���v
			PRINTFORML �u�����Əڍׂȏ�񂪕K�v���ȁH�v

			CALL ASK_M("��߂Ă���", 1, "\\2000����̂���", MONEY >= 2000, "10CM����̂���", MONEY:2 >= 10)
			SELECTCASE RESULT
			CASE 0
				PRINTFORMW �u����A����͎c�O���v
				BREAK
			CASE 1
				MONEY -= 2000
			CASE 2
				MONEY:2 -= 10
			ENDSELECT
			PRINTFORMW �u%GET_MAPNAME(GET_MAPID(TMP_ID))%���ӁA���Ɂg%GET_PLACENAME(TMP_ID)%�h�̔����������ˁv
		CASEELSE
			PRINTFORMW �u����H�c�c���[��A���b�h�̒��q�����������ȁv
			PRINTFORML
			PRINTFORML �@�G���[�������i���O�̒񋟂����肢���܂��j
			PRINTFORML �@�N���b�N�ŃG���[���O����
			PRINTFORMW ����������
			PRINTFORML IRAI_SLOT:CHK_SLOT�@{IRAI_SLOT:CHK_SLOT}
			PRINTFORML IRAI_DATA:CHK_SLOT�@{IRAI_DATA:CHK_SLOT}
			CALL SHOW_IRAI_DATA(IRAI_SLOT:CHK_SLOT, CHK_SLOT)
			PRINTFORML
			PRINTFORML �������܂�
			PRINTFORMW �@�R�s�y�҂�
		ENDSELECT

	CASE 0
		IF CNT_DOWSING
			PRINTDATAL
				DATA �u�����ɗ��Ă����ȁH�v
				DATA �u�K�^���F���Ă�����v
				DATA �u���������̂����H�v
			ENDDATA
			PRINTFORMW �u�܁A�C���ɒT�����Ƃ��ˁv
		ELSE
			PRINTFORMW �u��₩���͂�߂Ă��炦�Ȃ����ȁv
		ENDIF
		RETURN
	CASEELSE
		$RETRY
		PRINTFORMW �u��A�������āH�v
		CONTINUE
	ENDSELECT
	BREAK
LOOP 1
RESTART

;����ς݈˗��̃_�E�W���O�۔���
;�߂�l��BIT�Ŋe�˗��̃_�E�W���O��
@CAN_DOWSING()
#FUNCTION
#DIM CHK_SLOT
#DIM DYNAMIC CAN_SLOT
FOR CHK_SLOT, 1, 6
	SIF !IRAI_SLOT_CAN_DOWSING(CHK_SLOT)
		CONTINUE
	SETBIT CAN_SLOT, CHK_SLOT
NEXT
RETURNF CAN_SLOT

;�X�̈˗��X���b�g�̃_�E�W���O�۔���
@IRAI_SLOT_CAN_DOWSING(CHK_SLOT)
#FUNCTION
#DIM CHK_SLOT
SIF IRAI_SLOT_TO_PROGRESS(CHK_SLOT) != "�˗���"
	RETURNF 0
SIF !GROUPMATCH(IRAI_SLOT_TO_TASKNAME(CHK_SLOT), "�{���i�l���j", "�{���i�ꏊ�j")
	RETURNF 0
RETURNF CHK_SLOT

;�_�E�W���O���̓Ƃ茾
@DOWSING_TSUBUYAKI
#DIMS COMMENT, 3
COMMENT:0 '= "�u�ق��c�c����́v"
STRDATA COMMENT:1
	DATA �u�c�c�����ԍi�荞�߂Ă������v
	DATA �u�ށA����ł͒��낪����Ȃ��ȁv
	DATA �u����A�����Ȃ�̂��v
	DATA �u�ł́A��������΁c�c�c�c�v
ENDDATA
STRDATA COMMENT:2
	DATA �u�c�c�����������Ƃ��v
	DATA �u�Ȃ񂾁A�ȒP�Ȃ��Ƃ���Ȃ����v
	DATA �u�悵�A���ꂾ�v
	DATA �u����ȂƂ��납�ȁv
ENDDATA
CALL PRINT_GROUP(COMMENT, 3)

;-------------------------------------------------
;�X�^�[�p
;-------------------------------------------------
@UNIQUE_COM_�C�z��T��
PRINTFORML �u�Ӂ[��A�N���T���Ă�́H�v
PRINTFORML �u�����˂��c�c�����Â������傤�����H�v
CALL ASK_M("����ς��", 1, "\\500������", MONEY >= 500, "3CM������", MONEY:2 >= 3)
SELECTCASE RESULT
CASE 0
	PRINTDATAW
		DATAFORM �u�ށ[�A%CALLNAME:MASTER%�̃P�`�v
		DATAFORM �u�c�c�͂��v
		DATAFORM �X�^�[�T�t�@�C�A�͖����ł�������ɂ݂��Ă���
	ENDDATA
	RETURN
CASE 1
	MONEY -= 500
CASE 2
	MONEY:2 -= 3
ENDSELECT
PRINTDATAW
	DATAFORM �u��[���v
	DATAFORM �u������[�v
	DATAFORM �u�����Â������[�v
	DATAFORM �u�b���킩��l���čD����v
	DATAFORM �X�^�[�T�t�@�C�A�͂����x��
ENDDATA
PRINTFORML �u���ꂶ��n�߂��ˁ�v
PRINTFORMW �u���[�Ɓc�c�v
PRINTFORML
CALL HITOSAGASI
PRINTFORMW

;-------------------------------------------------
;�������p
;��F�֌W�L���������A���͑����낤
;-------------------------------------------------
@UNIQUE_COM_�l����
#DIM PREV_DAY
#DIM IRAI_ABLE
#DIM CLIENT_ID
IF PREV_DAY == DAY
	PRINTFORMW �u�����͂��������Ă������H�v
	RETURN
ENDIF
PREV_DAY = DAY
PRINTFORMW �u���H�g�����Ă鏗�̎q��m��Ȃ����h�H�v

CALL CAN_IRAI_START
IRAI_ABLE = RESULT
IF IRAI_ABLE && IRAI_CHARA_TO_PROGRESS(TARGET) == "�˗������"
	PRINTFORML �u���邳�A�����Ɉ�l�ȁI�v
	CALL IRAI_START(TARGET)
	SIF IRAI_CHARA_TO_PROGRESS(TARGET) != "�˗���"
		PRINTFORMW �u������A���ʂ��̗���Œf�邩�H�v
	RETURN
ENDIF

CLIENT_ID = SEARCH_UNIQUE_COM_�l����()
SELECTCASE CLIENT_ID
CASE 0
	PRINTFORML �u���[��v
	PRINTFORMW �u���̒m�����ł͂��Ȃ��݂������ȁv
CASEELSE
	PRINTDATAL
		DATAFORM �u���[��v
		DATAFORM �u���[�Ɓv
		DATAFORM �u�������c�c�v
	ENDDATA
	PRINTDATAW
		DATAFORM �u%CALLNAME:CLIENT_ID%������Șb�����Ă��Ǝv���v
		DATAFORM �u%CALLNAME:CLIENT_ID%�����������Ă������ȁv
		DATAFORM �u%CALLNAME:CLIENT_ID%�������Ă�Ƃ��\�ŕ��������v
		DATAFORM �u%CALLNAME:CLIENT_ID%�̏��ɂł��s���Ă݂�΂����񂶂�Ȃ����H�v
		DATAFORM �u%CALLNAME:CLIENT_ID%�ɉ�ɍs���Ƃ����Ǝv�����v
	ENDDATA
ENDSELECT

@SEARCH_UNIQUE_COM_�l����
#FUNCTION
#DIM DYNAMIC CLIENT_ID, �L�����N�^�����
#DIM DYNAMIC CLIENT_CNT
FOR LOCAL:0, 1, CHARANUM
	SIF IRAI_CHARA_TO_PROGRESS(LOCAL:0) != "�˗������"
		CONTINUE
	CLIENT_ID:CLIENT_CNT = LOCAL:0
	CLIENT_CNT ++
NEXT
SIF !CLIENT_CNT
	RETURNF 0
RETURNF CLIENT_ID:(RAND:CLIENT_CNT)

;-------------------------------------------------
;�ɂƂ�p
;-------------------------------------------------
@UNIQUE_COM_����𔃂�
TFLAG:194 = 1
CALL ITEM_SALES
DRAWLINE
CALL LIST_ITEM("�͓�����")
DRAWLINE
PRINTL �u���Ȃ�������Ƃ���v
PRINTFORML �w������A�C�e����I��ł������� ������:\\%TOSTR(MONEY,"#,###")%
CALL SHOW_ITEM, "�͓�����", 3
PRINTL
DRAWLINE
PRINT [100] - �߂�@�@�@�@�@[101] - ����̉����@[102] - ����̊J��
INPUT
LOCAL = RESULT
SELECTCASE LOCAL
CASE 100
	RETURN -1
CASE 101
	CALL TOOL_CUSTOM
	SIF RESULT
		RETURN RESULT
CASE 102
	PRINTL �u�J���ɂ�git���K�v�Ȃ񂾁v
	PRINTW git�Ƃ͈�́c
	RETURN -1
CASEELSE
	SELECTCASE ITEMSTOCK(LOCAL)
	CASE 1, 4
		RETURN -1
	CASE 2
		PRINTW ���؂ł�
		RETURN -1
	CASE 3
		PRINTW ������������܂���
		RETURN -1
	CASE 5
		PRINTW ���ɏ\�������Ă��܂�
		RETURN -1
	CASEELSE
		SIF !INRANGE(LOCAL, 0, 100)
			RETURN -1
	ENDSELECT
	PRINTFORML %ITEMNAME:LOCAL%���w�����܂����H
	PRINTL [0] - �͂�  [1] - ������
	INPUT
	SIF RESULT
		RETURN -1
	ITEM:LOCAL ++
	MONEY -= ITEMPRICE:LOCAL / 3
	SIF INRANGE(LOCAL, 0, 39)
		SETBIT FLAG:�A�C�e���w���ς�, LOCAL
ENDSELECT
RESTART

;��������֐�
;����ł̓v�[����������
;�����A�C�e����������Ƃ���ɔ�剻����̂��ڂɌ�����̂œƗ�
;�w����RETURN -1�A�w�����Ȃ�����RETURN 0
;���������ɖ����ɓ��B����ƍw�����������ɂȂ�܂�
@TOOL_CUSTOM
#DIM �ԍ�_�ȈՃv�[��
GETNUM ITEM, "�ȈՃv�[��"
�ԍ�_�ȈՃv�[�� = RESULT

PRINTFORML ��������A�C�e����I��ł������� ������:\\%TOSTR(MONEY,"#,###")%
IF ITEM:�ȈՃv�[��
	LOCALS = [{�ԍ�_�ȈՃv�[��}] �ȈՃv�[��
	PRINTBUTTONLC LOCALS, �ԍ�_�ȈՃv�[��
ENDIF
PRINT [100] - ����ς��߂�
INPUT
SELECTCASE RESULT
CASE 100
	RETURN
CASE �ԍ�_�ȈՃv�[��
	SIF !ITEM:�ȈՃv�[��
		RETURN
	PRINTL �u�ǂ���������H�v
	PRINT ���݂̏�ԁF
	SIF GETBIT (FLAG:�v�[��, 0)
		PRINT [�������[�^�[]
	SIF GETBIT (FLAG:�v�[��, 1)
		PRINT [�����@�\]
	SIF GETBIT (FLAG:�v�[��, 2)
		PRINT [�V�����[]
	SIF GETBIT (FLAG:�v�[��, 3)
		PRINT [�s�v�c�ȖA]
	PRINTL

	IF !GETBIT (FLAG:�v�[��, 0)
		PRINTL [1] - ���[�^�[�i\5000�j�F�ړ��̕��S���Ȃ��Ȃ�
	ELSE
		SETCOLOR 150,150,150
		PRINTL [��] - ���[�^�[�F�ړ��̕��S���Ȃ��Ȃ�
		RESETCOLOR
	ENDIF
	IF !GETBIT (FLAG:�v�[��, 1)
		PRINTL [2] - �����@�\�i\5000�j�F�L���ꏊ�ł��낰��
	ELSE
		SETCOLOR 150,150,150
		PRINTL [��] - �����@�\�F�L���ꏊ�ł��낰��E�����C��v���C���ł���
		RESETCOLOR
	ENDIF
	IF !GETBIT (FLAG:�v�[��, 2)
		PRINTL [3] - �V�����[�i\5000�j�F�V�����[�Ő􂦂�E�������ł���
	ELSE
		SETCOLOR 150,150,150
		PRINTL [��] - �V�����[�F�V�����[�Ő􂦂�E�������ł���
		RESETCOLOR
	ENDIF
	SIF FLAG:�v�[�� < 7
		PRINTFORML [4] - �R�Ƃ������i�P�ɂ�\\5000�j
	IF FLAG:�v�[�� < 7
		PRINTL [?] - �H�H�H�H�H
	ELSEIF !GETBIT (FLAG:�v�[��, 3) && FLAG:�v�[�� < 8
		PRINTL [5] - �s�v�c�ȖA�i\5000�j�F�킩�����P�����R�Ɉړ��ł���悤�ɂȂ�
	ELSE
		SETCOLOR 150,150,150
		PRINTL [��] - �s�v�c�ȖA�F�킩�����P�����R�Ɉړ��ł���悤�ɂȂ�
		RESETCOLOR
		PRINTL ����ȏ�����ł��Ȃ�
	ENDIF

	PRINTL [100]����ς��߂�
	INPUT
	SELECTCASE RESULT
	CASE 100
		RETURN
	CASE 1
		IF !GETBIT (FLAG:�v�[��, 0)
			PRINTL �ړ��̕��S���Ȃ��Ȃ����I
			SETBIT FLAG:�v�[��, 0
			MONEY -= 5000
		ELSE
			RETURN
		ENDIF
	CASE 2
		IF !GETBIT (FLAG:�v�[��, 1)
			PRINTL �L���ꏊ�ł��낰��悤�ɂȂ����I
			PRINTL �����C��v���C���ł���悤�ɂȂ����I
			SETBIT FLAG:�v�[��, 1
			MONEY -= 5000
		ELSE
			RETURN
		ENDIF
	CASE 3
		IF !GETBIT (FLAG:�v�[��, 2)
			PRINTL �V�����[���g����悤�ɂȂ����I
			PRINTL ����肪�y�ɂȂ����I
			SETBIT FLAG:�v�[��, 2
			MONEY -= 5000
		ELSE
			RETURN
		ENDIF
	CASE 4
		IF FLAG:�v�[�� < 7
			PRINTL �F�X�@�\���ǉ����ꂽ�I
			MONEY -= 5000 * (!GETBIT (FLAG:�v�[��, 0) + !GETBIT (FLAG:�v�[��, 1) + !GETBIT (FLAG:�v�[��, 2))
			FLAG:�v�[�� = 7
		ELSE
			RETURN
		ENDIF
	CASE 5
		IF !GETBIT (FLAG:�v�[��, 3) && FLAG:�v�[�� < 8
			PRINTL �킩�����P�ɕs�v�c�ȖA�𔃂��Ă������I
			FLAG:�v�[�� = 15
			MONEY -= 5000
		ELSE
			RETURN
		ENDIF
	ENDSELECT
CASEELSE
	RETURN
ENDSELECT
RETURN -1

;-------------------------------------------------
;���ƂĂ�p
;-------------------------------------------------
@UNIQUE_COM_��𔃂�
DRAWLINE
CALL LIST_ITEM("��������i")
DRAWLINE
PRINTFORML �w������A�C�e����I��ł������� ������:\\%TOSTR(MONEY,"#,###")%
PRINTL
VARSET LOCALS
CALL EX_SHOPPING("���[�V�����{�g��", "���[�V��������̑�r�B5�񕪂͂��肻�����B",0,1000)
CALL EX_SHOPPING("�R���h�[�������p�p�b�N", "50�������Ă�B",1,1000)
CALL EX_SHOPPING("�s���i5������j", "���邢�Ƒ��v��",2,5000)
CALL EX_SHOPPING("�����", "�D�ӂ�����₷���Ȃ�",250)
CALL EX_SHOPPING("������", "���p�̓_���ł���H",252)
CALL EX_SHOPPING("�h�{�h�����N", "�^�E����1000mg�z��",501)
CALL EX_SHOPPING("���͍�", "������������p�B",502)
CALL EX_SHOPPING("�E�R���h�����N", "���������ޑO��",510)
CALL EX_SHOPPING("���", "�P�K�����Ƃ����B�������ꏊ�Ɋ�����",520)
SIF TARGET == 53 && !ITEM:130
	CALL EX_SHOPPING("�e���u�J�^���v","���b�L�[�X�P�x���N���閲�̃A�C�e��",130)
DRAWLINE
PRINTL [100] ��߂�
INPUT
SELECTCASE RESULT
	CASE 0
		CALL BUY_ABLE(40,1000,5)
	CASE 1
		CALL BUY_ABLE(45,1000,50)
	CASE 2
		CALL BUY_ABLE(49,5000,5)
	CASE 130
		SIF TARGET == 53 && !ITEM:130
			CALL BOTTAKURI
	;�܂Ƃߔ����֐��ł������グ
	;�����̃A�C�e���͓��Ɋ����͂Ȃ��̂�@BUY_ABLE���g�p����K�R��������
	CASE 250, 252, 501, 502, 510, 520
		SELECTCASE ITEMSTOCK(RESULT)
		CASE 1, 4
		CASE 2
			PRINTW ���؂ł�
		CASE 3
			PRINTW ������������܂���
		CASE 5
			PRINTW ���ɏ\�������Ă��܂�
		CASEELSE
			CALL ITEM_MATOMEGAI(RESULT)
		ENDSELECT
	CASE 100
		RETURN -1
	CASEELSE
ENDSELECT
RESTART

@BOTTAKURI
SELECTCASE FLAG:�J�^���w����
CASE 0
	LOCAL = 1000
CASE 1 TO 3
	LOCAL = 10000
CASE 3 TO 10
	LOCAL = 20000
CASE 11 TO 20
	LOCAL = 30000
CASEELSE
	LOCAL = 50000
ENDSELECT
SIF TALENT:TARGET:���� && LOCAL >= 20000
	LOCAL /= 2

SIF !FLAG:�J�^���w����
	PRINTFORML �u���Ȃ炨�������i��\\{LOCAL}�I�����Ă��h���{�[�I�v
IF LOCAL <= 10000
ELSE
	IF TALENT:TARGET:����
		PRINTFORML �u%CALLNAME:MASTER%�Ȃ�\\{LOCAL}�ł�����v
	ELSE
		PRINTFORML �u����Ȃ�\\{LOCAL}�ɂȂ�����v
	ENDIF
	CALL ASK_M("�ӂ������",1, "�����܂�", MONEY >= LOCAL, "����Ȏ������闧��Ȃ́H", CFLAG:TARGET:��݈���� && !CFLAG:TARGET:��݈���)
	SELECTCASE RESULT
		CASE 0
			RETURN
		CASE 1
		CASE 2
			PRINTFORMW ��݂ƈ��������Ƀ^�_�ŃQ�b�g����
			ITEM:130 ++
			CFLAG:TARGET:��݈���� = 0
			RETURN
	ENDSELECT
ENDIF

IF MONEY >= LOCAL
	ITEM:130 ++
	MONEY -= LOCAL
	FLAG:�J�^���w���� ++
	PRINTFORMW \\{LOCAL}���x�����ēe���u�J�^���v���w������
ENDIF

;-------------------------------------------------
;�݂����[�p
;-------------------------------------------------
@UNIQUE_COM_����ŐH��
#DIM ���s�l���J�E���g
#DIM �����\�l��
#DIM ATSUKAN
#DIM OOMORI
#DIM KAIKEI
#DIM KAKAKU,2

���s�l���J�E���g = 1
�����\�l�� = 0
ATSUKAN = 0
KAIKEI = 0
OOMORI = 0
VARSET KAKAKU
SIF CAN_DRINK(MASTER)
	�����\�l�� = 1
FOR LOCAL,1,CHARANUM
	SIF !CFLAG:LOCAL:���s
		CONTINUE
	 SIF !TIME_PROGRESS(TCVAR:LOCAL:�󕠎���)
	 	CONTINUE
	���s�l���J�E���g ++
	SIF CAN_DRINK(LOCAL)
		�����\�l�� ++
NEXT
PRINTFORML �u��������Ⴂ�A{���s�l���J�E���g}���l�ˁv
KAKAKU:0 = 3 * ���s�l���J�E���g
KAKAKU:1 = 5 * ���s�l���J�E���g
CALL ASK_M("���Ă����荇�킹�@��l�O3CM",MONEY:2 >= KAKAKU:0 && TIME_PROGRESS(TCVAR:MASTER:�󕠎���),"���Ă����荇�킹�i��j�@��l�O5CM", MONEY:2 >= KAKAKU:1 && TIME_PROGRESS(TCVAR:MASTER:�󕠎���),"�e�C�N�A�E�g�@5CM",MONEY:2 >= 5 && !ITEM:���c����,"��߂�",1)
IF RESULT == 3
	PRINTFORML �u�܂����Ăˁv
	RETURN -1
ENDIF
IF RESULT == 2
	ITEM:���c���� ++
	MONEY:2 -= 5
	PRINTFORML �u��߂Ȃ������ɐH�ׂĂˁv
	SOURCE:���y += 200
	TFLAG:98 = 1
	TIME += 5
	RETURN 1
ENDIF
MONEY:2 -= KAKAKU:RESULT
KAIKEI = KAKAKU:RESULT

SIF RESULT == 1
	OOMORI = 1

IF MONEY:2 >= 2 * �����\�l��
	PRINTFORML �u��l2�J���X�}�ŔM��������H�v�i���C�E�C�͉񕜗ʃA�b�v�j
	CALL ASK_YN
	IF !RESULT
		ATSUKAN = 1
		KAIKEI += 2 * �����\�l��
		MONEY:2 -= 2 * �����\�l��
	ENDIF
ENDIF
;�M��
TFLAG:98 += 3
;���s���S���ŉ�

FOR LOCAL,0,CHARANUM
	SIF !CFLAG:LOCAL:���s && LOCAL
		CONTINUE
	 SIF !TIME_PROGRESS(TCVAR:LOCAL:�󕠎���)
	 	CONTINUE
	CALL EAT_YATSUME(LOCAL,OOMORI,ATSUKAN)
NEXT

SOURCE:���y += KAIKEI * 100
PRINTFORML �u���߂�{KAIKEI}�J���X�}�ɂȂ�܂��v
PRINTFORML �u�܂����Ăˁv
TIME += 30

@EAT_YATSUME(�Ώ�,ARG,ARG:1)
#DIM �񕜑O�̗�
#DIM �񕜑O�C��
#DIM �񕜑O����
#DIM �񕜌�̗�
#DIM �񕜌�C��
#DIM �񕜌㐸��
#DIM �Ώ�

�񕜑O�̗� = BASE:�Ώ�:�̗�
�񕜑O�C�� = BASE:�Ώ�:�C��
�񕜑O���� = BASE:�Ώ�:����

;�吷��̏ꍇ
IF ARG == 1
	CALL �����x�㏸(�Ώ�,"��H")
	CALL RECOVER_PERMIL(�Ώ�,100,"�̗�")
	CALL RECOVER_PERMIL(�Ώ�,200,"�C��")
	CALL RECOVER_PERMIL(�Ώ�,100,"����")
ELSE
	CALL �����x�㏸(�Ώ�,"�y�H")
	CALL RECOVER_PERMIL(�Ώ�,50,"�̗�")
	CALL RECOVER_PERMIL(�Ώ�,100,"�C��")
	CALL RECOVER_PERMIL(�Ώ�,50,"����")
ENDIF
IF �Ώ�
;�Œ�Ŋl������\�[�X
SOURCE:�Ώ�:���y = 1000
SOURCE:�Ώ�:� = 300

;ABL:�~�]���݂�
IF ABL:�Ώ�:�~�] <= 1
	SOURCE:�Ώ�:���y += (ABL:�Ώ�:�~�] * 60)
ELSEIF ABL:�Ώ�:�~�] <= 3
	SOURCE:�Ώ�:���y += 400 + (ABL:�Ώ�:�~�] * 60)
ELSEIF ABL:�Ώ�:�~�] <= 5
	SOURCE:�Ώ�:���y += 800 + (ABL:�Ώ�:�~�] * 60)
ELSEIF ABL:�Ώ�:�~�] <= 8
	SOURCE:�Ώ�:���y += 1000 + (ABL:�Ώ�:�~�] * 75)
ELSEIF ABL:�Ώ�:�~�] <= 11
	SOURCE:�Ώ�:���y += 1700 + (ABL:�Ώ�:�~�] * 75)
ELSE
	SOURCE:�Ώ�:���y += 2500 + (ABL:�Ώ�:�~�] * 35)
ENDIF

;ABL:�Ώ�:��d���_���݂�
IF ABL:�Ώ�:��d���_ <= 1
	SOURCE:�Ώ�:� += (ABL:�Ώ�:��d���_ * 30)
ELSEIF ABL:�Ώ�:��d���_ <= 3
	SOURCE:�Ώ�:� += 200 + (ABL:�Ώ�:��d���_ * 30)
ELSEIF ABL:�Ώ�:��d���_ <= 5
	SOURCE:�Ώ�:� += 500 + (ABL:�Ώ�:��d���_ * 30)
ELSEIF ABL:�Ώ�:��d���_ <= 8
	SOURCE:�Ώ�:� += 700 + (ABL:�Ώ�:��d���_ * 45)
ELSEIF ABL:�Ώ�:��d���_ <= 11
	SOURCE:�Ώ�:� += 1200 + (ABL:�Ώ�:��d���_ * 45)
ELSE
	SOURCE:�Ώ�:� += 1800 + (ABL:�Ώ�:��d���_ * 20)
ENDIF

;�D���x���݂�
IF CFLAG:�Ώ�:2 <= 500
	SOURCE:�Ώ�:���y += CFLAG:�Ώ�:2
ELSEIF CFLAG:�Ώ�:2 <= 5000
	SOURCE:�Ώ�:���y += 750 + (CFLAG:�Ώ�:2 - 500) / 3
ELSE
	SOURCE:�Ώ�:���y += 2000 + (CFLAG:�Ώ�:2 - 5000) / 4
ENDIF
SIF SOURCE:�Ώ�:���y < 0
	SOURCE:�Ώ�:���y = 0
SOURCE:�Ώ�:�� = 200 + 110 * ABL:�Ώ�:�]��
SOURCE:�Ώ�:���� = 200 + 110 * ABL:�Ώ�:�T�h���C

SIF TALENT:���V
	TIMES SOURCE:�Ώ�:���y , 1.50
ENDIF
;�M�����񂾏ꍇ
IF ARG:1 && CAN_DRINK(�Ώ�)
	TIMES SOURCE:�Ώ�:���y , 1.10
	CALL RECOVER_PERMIL(�Ώ�,50,"�C��")
	SIF �Ώ� != MASTER
		CALL KIGEN_CHANGE(�Ώ�,50,1)
	CALL DRUNKEN(�Ώ�,52)
ENDIF

�񕜌�̗� = BASE:�Ώ�:�̗�
�񕜌�C�� = BASE:�Ώ�:�C��
�񕜌㐸�� = BASE:�Ώ�:����

PRINTFORML �̗�+{ABS(�񕜌�̗� - �񕜑O�̗�)}�i%CALLNAME:�Ώ�%�j
PRINTFORML �C��+{ABS(�񕜌�C�� - �񕜑O�C��)}�i%CALLNAME:�Ώ�%�j
SIF ABS(�񕜌㐸�� - �񕜑O����) > 0
	PRINTFORML ����+{ABS(�񕜌㐸�� - �񕜑O����)}�i%CALLNAME:�Ώ�%�j
PRINTFORMW
TIME += 20
SIF ARG == 1
	TIME += 10

;-------------------------------------------------
;���P�p
;-------------------------------------------------
@UNIQUE_COM_�P�̏C��
PRINTFORML ���P�ɐ܂��ݎP�𒼂��Ă������
PRINTFORMW �u�厖�Ɏg���Ă����Ăˁv

DOWNBASE:�C�� = 100

SOURCE:���y += 1000 + ABL:�e�� * 50
TFLAG:�D���x�{�[�i�X = FLAG:�P�ϋv�x / 10
TFLAG:98 = FLAG:�P�ϋv�x / 1000
FLAG:�P�ϋv�x = 0
TIME += 30

;-------------------------------------------------
;�H���p
;-------------------------------------------------
;�Ȃ�ׂ��ŗL�R�}���h����Ȃ��ĕ��ʂ̃R�}���h�ɂł���悤�ɍ���Ă݂���
;�H������Ԃ��������Ă�����
@UNIQUE_COM_�e������
#DIM �q��������

IF GETBIT(TFLAG:������,7)
	PRINTFORML �����͂�����ꂽ�B�܂������ɂ��悤
	RETURN -1
ENDIF

IF BASE:MASTER:�C�� < 500
	PRINTFORML ����ȋC�͂͂Ȃ��c�c
	RETURN -1
ENDIF

$INPUT_LOOP
;�퓬�\�͂̍��Ń��b�Z�[�W����i�\�������̂�-1~5�j
SELECTCASE ABL:TARGET:�퓬�\�� - ABL:MASTER:�퓬�\��
	CASE -6 TO -4
		PRINTFORML �ډB�����č����Ă��Ă����Ă�B
	CASE -4 TO -2
		PRINTFORML �ډB�����Ă��Ă����Ă������B
	CASE -1
		PRINTFORML ������C�͂��Ȃ��B
	CASE 0
		PRINTFORML ���Ԃ񏟂Ă������B
	CASE 1
		PRINTFORML ���ĂȂ�����ł͂Ȃ��B
	CASE 2
		PRINTFORML ����͂��Ȃ苭�������B
	CASE 3
		PRINTFORML ���Ȃ��Ƃ��A���Ȃ��̔{�͋��������B
	CASE 4
		PRINTFORML ��Ղ��N���Ȃ���ΎE����邾�낤�B
	CASE 5,6
		PRINTFORML ���肪���l���Ƃ���΁A���Ȃ��͋a�̃t���ȉ����B
	CASEELSE

ENDSELECT
PRINTFORML %CALLNAME:TARGET%�ɒe�������𒧂ށH
CALL ASK_M("����ς�߂�", 1, "����", 1, "���[������", 1)
SELECTCASE RESULT
	CASE 0
		RETURN -1
	CASE 1

	CASE 2
		PRINTFORML �݂��Ƀ_�C�X��U��A�o���ڂ̑傫���������Ƃ����̂���{�̃��[���ł��B
		PRINTFORMW �ŏ��݂͌��Ɏc�@��3�������Ă��āA�퓬�\�͂��傫���قǃ_�C�X�̐��Ɩʂ������܂��B
		PRINTFORMW �v���C���[�̂݁A�����̏o�ڂ�������A����ɐ�O���邩�������邩��I�Ԃ��Ƃ��ł��܂��i���̂Ƃ��A����̏o�ڂ͌����܂���j�B
		PRINTFORMW ����ɐ�O���邱�Ƃ�I�񂾏ꍇ�́A�c�@������Ȃ�����ɁA�o�ڂ̍��ɉ�����HP�Ƀ_���[�W���󂯂܂��B
		PRINTFORMW HP��0�ɂȂ�ƁA�v���C���[�̎c�@��1����܂��B�c�@��0�ɂȂ�΁A�v���C���[�̔s�k�ł��B
		PRINTFORMW �������邱�Ƃ�I�сA�����菬�����o�ڂ������ꍇ�́A�������Ńv���C���[�̎c�@��1����܂��B
		PRINTFORMW �������邱�Ƃ�I�сA������傫���o�ڂ��o�����Ƃ��Ɍ���A����̎c�@��1���炷���Ƃ��o���܂��B
		;�c�@0�Ȃ�܂��v���C�ł��邶���Ƃ�����Ȃ�
		PRINTFORMW �v���C���[�̎c�@��0�ɂȂ�O�ɁA����̎c�@��0�ɂ��邱�Ƃ��ł���΁A�v���C���[�̏����ƂȂ�܂��B
		PRINTFORMW �܂��A�v���C���[��2��܂Ń{�����g�����Ƃ��ł��܂��B�_�C�X�̏o�ڂ��v���X�ł���̂ŁA�������Ƃ�����ʂŎg���܂��傤�B
		GOTO INPUT_LOOP
ENDSELECT

;�䎌�E�I�����͗H��������ɋL�q�A���オ�Ȃ��ꍇ�͓q���⏟����V�͖���
;�Ԃ�l�͓q��������(==0 �L�����Z��, ==1 ����, ==2 ���肷��)
TRYCALLFORM M_KOJO_MESSAGE_COM_K{TARGET}_DANMAKU("�퓬�O", 0)
�q�������� = RESULT
SIF �q�������� == 0
	RETURN -1

IF !�퓬�P����(CFLAG:MASTER:���݈ʒu)
	PRINTFORML %CALLNAME:MASTER%�����͒e�������ł���ꏊ�Ɉړ�����
ENDIF

PRINTFORMW �����J�n�I�I
CALL DANMAKU_BATTLE()
LOCAL = RESULT

TRYCALLFORM M_KOJO_MESSAGE_COM_K{TARGET}_DANMAKU("�퓬��", LOCAL)
PRINTL

;�Ԃ�l�I�����̑���c�@�A0�Ȃ�v���C���[�̏����A2�ȏ�c���Ă���Ȃ�y�i���e�B�i���㑶�ݎ��̂݁j
IF LOCAL > 1
	;MASTER����or�V���^�Ȃ�G���C�x
	IF (TALENT:MASTER:���� != 2) || ((TALENT:MASTER:�N�� == -1 || TALENT:MASTER:�c�t) && (TALENT:MASTER:�̌^ == -2 || TALENT:MASTER:�̌^ == -1))
		TRYCALLFORM M_KOJO_MESSAGE_COM_K{TARGET}_DANMAKU("�g��", 0)
	;���lor���炾�ƃy�i���e�B����
	ELSEIF TALENT:68:���l || TALENT:68:����

	ELSEIF �q�������� == 1
		TRYCALLFORM M_KOJO_MESSAGE_COM_K{TARGET}_DANMAKU("����", 0)
		SETCOLOR C_RED
		PRINTFORMW ������\\{MONEY / 2}�������c�c
		RESETCOLOR
		MONEY -= MONEY / 2
	ELSEIF �q�������� == 2
		TRYCALLFORM M_KOJO_MESSAGE_COM_K{TARGET}_DANMAKU("�J���X�}", 0)
		SETCOLOR C_RED
		PRINTFORMW �J���X�}��{MONEY:2 / 2}CM�������c�c
		RESETCOLOR
		MONEY:2 -= MONEY:2 / 2
	ENDIF
	PRINTL
	TRYCALLFORM M_KOJO_MESSAGE_COM_K{TARGET}_DANMAKU("�s�k��", 0)
ELSEIF LOCAL > 0
	;�y�i���e�B����
ELSEIF LOCAL == 0
	;������V�̑I�����͌������
	TRYCALLFORM M_KOJO_MESSAGE_COM_K{TARGET}_DANMAKU("������", 0)
ENDIF

;source���쑼
SETBIT TFLAG:������,7
DOWNBASE:�C�� = 500
DOWNBASE:MASTER:�C�� = 500
SOURCE:���y += (1000 + ABL:�e�� * 75) / (LOCAL + 1)
TFLAG:�D���x�{�[�i�X = 1000 / (LOCAL + 1)
TFLAG:�M���x�Ǘ� = 10 - (LOCAL + 5)
EXP:MASTER:�퓬�o�� += 5
TIME += 60

;�퓬���̏���
@DANMAKU_BATTLE
#DIM �v���C���[�c�@
#DIM ����c�@
#DIM �c��HP
#DIM �c��{����
#DIM �^�[����
#DIM �v���C���[�_�C�X��
#DIM ����_�C�X��
#DIM �v���C���[�_�C�X��
#DIM ����_�C�X��
#DIM �v���C���[�_�C�X�l
#DIM ����_�C�X�l

�v���C���[�c�@ = 3
����c�@ = 3
�c��HP = MAXBASE:MASTER:�̗�
�c��{���� = 2
�^�[���� = 1

WHILE �v���C���[�c�@ > 0 && ����c�@ > 0
	;�_�C�X���v�Z
	�v���C���[�_�C�X�� = ABL:MASTER:�퓬�\�� - 1 + RAND:5
	����_�C�X�� = ABL:TARGET:�퓬�\�� + RAND:4
	SIF �v���C���[�_�C�X�� <= 0
		�v���C���[�_�C�X�� = 1
	SIF ����_�C�X�� <= 0
		����_�C�X�� = 1
	SIF ����c�@ == 1
		����_�C�X�� ++
	;�_�C�X�ʌv�Z
	�v���C���[�_�C�X�� = (ABL:MASTER:�퓬�\�� + 1) * (5 + RAND:9) + RAND:17
	����_�C�X�� = (ABL:TARGET:�퓬�\�� + 1) * (8 + RAND:4) + RAND:7 - (����c�@ - 1) * ABL:TARGET:�퓬�\��
	PRINTL
	PRINTFORML -----------------------------------------------------
	PRINTFORML TURN:{�^�[����}
	PRINTFORML -----------------------------------------------------
	PRINTL

	CALL DICE_PRINT(�v���C���[�_�C�X��, �v���C���[�_�C�X��, ����_�C�X��, ����_�C�X��, "�m��O")
	PRINTFORMW �^���̃_�C�X���[���I�I
	;�_�C�X�l�v�Z
	�v���C���[�_�C�X�l = DICE_VALUE(�v���C���[�_�C�X��, �v���C���[�_�C�X��)
	����_�C�X�l = DICE_VALUE(����_�C�X��, ����_�C�X��)
	LOCAL = ����_�C�X�l - �v���C���[�_�C�X�l

	CALL DICE_PRINT(�v���C���[�_�C�X�l, 0, ����_�C�X��, ����_�C�X��, "�m���")
	PRINTL
	PRINTFORML �c��HP: {�c��HP}    �c��{���g�p��: {�c��{����}    �c��c�@: {�v���C���[�c�@}

	CALL ASK_M("����ɐ�O����", 1, "��������", 1)
	SELECTCASE RESULT
		CASE 0
			PRINTFORML �e���̉���ɐ�O���邱�Ƃɂ���
			PRINTFORMW �E�E�E
			PRINTL
			CALL DICE_PRINT(�v���C���[�_�C�X�l, ����_�C�X�l, 0, 0, "����")
			PRINTW
			IF LOCAL <= 20
				PRINTFORML �قƂ�ǃ_���[�W���󂯂Ȃ�����
				SIF LOCAL > 0
					�c��HP -= LOCAL * 5
			ELSEIF LOCAL <= 50
				PRINTFORML �����_���[�W���󂯂�
				�c��HP -= LOCAL * 6
			ELSEIF LOCAL <= 150
				PRINTFORML ���\�_���[�W���󂯂�
				�c��HP -= LOCAL * 7
			ELSE
				PRINTFORML ���Ȃ�̃_���[�W���󂯂�
				�c��HP = �c��HP - MAXBASE:MASTER:�̗� / 2 + 1
			ENDIF
			PRINTFORMW �c��HP: {�c��HP}
			IF �c��HP <= 0
				PRINTFORML �_�s�`���[���^
				PRINTFORML ��e���Ă��܂����c�c
				�v���C���[�c�@ --
				�c��HP = MAXBASE:MASTER:�̗�
				PRINTFORMW �v���C���[�c�@: {�v���C���[�c�@}
			ENDIF
		CASE 1
			IF �c��{���� >= 1
				PRINTFORML �{�����g���H
				CALL ASK_M("�g��", 1, "�g��Ȃ�", 1)
				SELECTCASE RESULT
					CASE 0
						�v���C���[�_�C�X�l += (ABL:MASTER:�퓬�\�� + 1) * 6 + RAND:20
						PRINTFORMW �_�C�X�l��{�v���C���[�_�C�X�l}�ɂȂ����I
						�c��{���� --
						LOCAL = ����_�C�X�l - �v���C���[�_�C�X�l
					CASE 1

				ENDSELECT
			ENDIF
			PRINTFORML �������邱�Ƃɂ����I
			PRINTFORMW �E�E�E
			PRINTL
			CALL DICE_PRINT(�v���C���[�_�C�X�l, ����_�C�X�l, 0, 0, "����")
			PRINTW
			IF LOCAL < 0
				PRINTFORML ���j�����I�@��������I
				����c�@ --
				TRYCALLFORM M_KOJO_MESSAGE_COM_K{TARGET}_DANMAKU("�퓬��", ����c�@)
				PRINTFORMW ����c�@: {����c�@}
			ELSEIF LOCAL == 0
				PRINTFORMW ���݂�����ł�^�����Ȃ������̂ŁA�d�؂蒼����
			ELSE
				PRINTFORML �_�s�`���[���^
				PRINTFORML ��e���Ă��܂����c�c
				�v���C���[�c�@ --
				�c��HP = MAXBASE:MASTER:�̗�
				PRINTFORMW �v���C���[�c�@: {�v���C���[�c�@}
			ENDIF
	ENDSELECT

	�^�[���� ++
WEND

PRINTL
IF �v���C���[�c�@ <= 0
	PRINTFORMW %CALLNAME:MASTER%�͕����Ă��܂����c�c
ELSEIF ����c�@ <= 0
	PRINTFORML %CALLNAME:MASTER%��%CALLNAME:TARGET%�Ƃ̏����ɏ������I
	PRINTFORMW �l���̏����ҁI
ENDIF
PRINTL

RETURN ����c�@

@DICE_PRINT(ARG:0, ARG:1, ARG:2, ARG:3, ARGS)
IF ARGS == "�m��O"
	PRINTFORM %CALLNAME:MASTER%:
	SETCOLOR C_RED
	PRINTFORM {ARG:0}d{ARG:1}
	RESETCOLOR
	PRINTFORM (Min:{ARG:0}, Max:{ARG:0 * ARG:1})  VS
	SETCOLOR C_RED
	PRINTFORM {ARG:2}d{ARG:3}
	RESETCOLOR
	PRINTFORM (Min:{ARG:2}, Max:{ARG:2 * ARG:3})
	PRINTFORML :%CALLNAME:TARGET%
;ARG:1�͎g��Ȃ�
ELSEIF ARGS == "�m���"
	PRINTFORM %CALLNAME:MASTER%:
	SETCOLOR C_RED
	PRINTFORM {ARG:0}
	RESETCOLOR
	PRINTFORM VS
	SETCOLOR C_RED
	PRINTFORM {ARG:2}d{ARG:3}
	RESETCOLOR
	PRINTFORM (Min:{ARG:2}, Max:{ARG:2 * ARG:3})
	PRINTFORML :%CALLNAME:TARGET%
;ARG:2,3�͎g��Ȃ�
ELSEIF ARGS == "����"
	PRINTFORM %CALLNAME:MASTER%:
	SETCOLOR C_RED
	PRINTFORM {ARG:0}
	RESETCOLOR
	PRINTFORM VS
	SETCOLOR C_RED
	PRINTFORM {ARG:1}
	RESETCOLOR
	PRINTFORML :%CALLNAME:TARGET%
ENDIF

@DICE_VALUE(ARG:0, ARG:1)
#FUNCTION
;���������Ȃ��ƃ_��
LOCAL:1 = 0
FOR LOCAL, 0, ARG:0
	LOCAL:1 += RAND:(ARG:1) + 1
NEXT

RETURNF LOCAL:1

repo_name: akadiya/eratw

path: 原版+前人整合等各种readme/パッチ/eraTW4.571用 ダウジング等修正/ERB/コマンド関連/COMF/日常系/COMF443 固有コマンド.ERB

license: unknown