code:
;-------------------------------------------------
;���Ƃ��g��
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM428
SIF FLAG:�Ȃ肫�� != 71
	PRINTL �j���ہu�����p�͌v��I�ɂˁv
PRINTL �����肢�܂����H
SIF TALENT:71:�̌^ != 0
	PRINTL [2] - �j���ۂ𕁒ʂ̑傫����
IF GETBIT(TALENT:MASTER:����,1)
	PRINTL [3] - ���ق̈ꕨ�ɁI
	PRINTL [4] - ���͂�l�̃��m����Ȃ���ɁI
ENDIF
SIF TALENT:MASTER:100 >= -4
	PRINTL [5] - ���l�ɂ��āI
SIF TALENT:MASTER:100 < -4 && CFLAG:MASTER:���� == 6
	PRINTL [6] - ���̑傫���ɖ߂��āc�c
PRINTL
PRINTL [100] - �߂�
$LOOP
INPUT
IF RESULT == 2
	PRINTFORMW �肢�����߂ď��Ƃ�U���Ă݂�
	PRINTFORMW �j���ۂ̐g�͕̂��ʂ̏����T�C�Y�ɂȂ����B
	CFLAG:MASTER:���� = 8
	TALENT:71:�̌^ = 0
ELSEIF RESULT ==  3
	PRINTW �肢�����߂ď��Ƃ�U���Ă݂�
	PRINTW �ƂĂ��B���؂ꂻ���ɂȂ����炢�Ɉꕨ���傫���Ȃ���
	CFLAG:MASTER:���� = 4
	CFLAG:MASTER:382 = TALENT:MASTER:�`��
	TALENT:MASTER:�`�� = 10
	CFLAG:MASTER:���͉�� = 6
ELSEIF RESULT == 4
	PRINTW �肢�����߂ď��Ƃ�U���Ă݂�
	PRINTW �Ȃ�Ǝ����̂��̂��{���ɂ�����{������
	CFLAG:MASTER:382 = TALENT:MASTER:�`��
	CFLAG:MASTER:���� = 5
	TALENT:MASTER:183 = 1
	CFLAG:MASTER:���͉�� = 6
ELSEIF RESULT == 5 && TALENT:MASTER:100 >= -4
	PRINTFORMW �肢�����߂ď��Ƃ�U���Ă݂�
	PRINTFORMW %CALLNAME:MASTER%�̐g�݂̂͂�݂�k��ł�����
	CFLAG:MASTER:���͉�� = 3
	CFLAG:MASTER:���� = 6
	FLAG:���̑̊i = TALENT:MASTER:100
	TALENT:MASTER:100 = -5
ELSEIF RESULT == 6 && TALENT:MASTER:100 < -4 && CFLAG:MASTER:���݈ʒu == 54
	PRINTFORMW �u�����ł��Ȃ��ł�I�v
	RETURN -1
ELSEIF RESULT == 6 && TALENT:MASTER:100 < -4
	PRINTFORMW �肢�����߂ď��Ƃ�U���Ă݂�
	PRINTFORMW %CALLNAME:MASTER%�̐g�̂͌��ɖ߂���
	TALENT:MASTER:100 = FLAG:���̑̊i
	CFLAG:MASTER:���͉�� = 3
	CFLAG:MASTER:���� = 7
ELSEIF RESULT == 100
SIF FLAG:�Ȃ肫�� != 71
	PRINTL �j���ہu���ꂪ�����ł���v
	RETURN -1
ELSE
	GOTO LOOP
ENDIF
TIME += 5

RETURN 1

;���Ƃ��g��
@COM_ABLE428
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;�ړ����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(428)
	RETURN RESULT
;�j���ۂ��Q�Ă�����_��
SIF CFLAG:71:����
	RETURN 0
;�j���ۂ̋��鏊�B�j���ۂ��������ɂ��鎞�͋��Ԃ������ɂ���΃Z�[�t
IF CFLAG:MASTER:���݈ʒu != CFLAG:71:���݈ʒu && FLAG:�Ȃ肫�� != 71
	IF CFLAG:71:���݈ʒu == 54 && (CFLAG:MASTER:���݈ʒu == 9 || CFLAG:MASTER:���݈ʒu == 10) && AT_HOME(MASTER)
	ELSE
	RETURN 0
	ENDIF
ENDIF
;SIF CFLAG:MASTER:���݈ʒu != CFLAG:71:���݈ʒu
;	RETURN 0
SIF CFLAG:���ӂ� == 2
	RETURN 0
;���͉�����͎g�p�ł��Ȃ�
SIF CFLAG:MASTER:���͉�� > 0
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�����ւ�
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM429
#DIM C_ID
#DIM ID_�����ւ��Ώ�, �L�����N�^�����
#DIM �����ւ��\�l��
#DIM L_ID ;�g�p���X�g��ID
CALL MAKE_CHARA_LIST("�����ւ��\�L�������X�g", L_ID, ID_�����ւ��Ώ�, �����ւ��\�l��)
IF �����ւ��\�l�� <= 1
	PRINTFORMW %CALLNAME:(MASTER)%�͒��ւ��邱�Ƃɂ���
	CALL ���������ւ�(MASTER)
	CALL CLOTHES_SETTING_TRAIN(MASTER)
	RETURN -1
ENDIF

;���ւ��Ώۂ̑I��
;���X�g�쐬���ɉ۔������Ă�̂ł����ł͕K�v�Ȃ��ł�
PRINTFORML ���𒅑ւ��鎖���ł��܂�
PRINTFORML �N�̒��ւ������܂���?
PRINTFORML
CALL SIMPLE_CHARA_LIST(ID_�����ւ��Ώ�, �����ւ��\�l��)
;�L�����Z������
SIF RESULT == 999
	RETURN -1

;RESULT�͂�������̂�
C_ID = ID_�����ւ��Ώ�:(RESULT)
SIF FLAG:���Ԓ�~ == 1 && !(C_ID == MASTER)
	CFLAG:C_ID:���Ԓ�~�����ւ� = 1
CALL ���������ւ�(C_ID)
CALL CLOTHES_SETTING_TRAIN(C_ID)
RETURN 0

;CLOTHES_SETTING_TRAIN�ɌC�E���������ړ��������̂�
;������CLOTHES_SETTING_TRAIN����ƌC��E���ł��܂��A�C�ݒ�̕ۑ����ł��܂���
;�Ăяo������CLOTHES_SETTING_TRAIN���邱��
@���������ւ�(C_ID)
#DIM C_ID
CALL SHOW_CLOTHES(C_ID, "���݂̈ߑ�")
PRINTFORML %CALLNAME:C_ID%�̂����ւ���
PRINTFORML
PRINTFORML [6] - �ߑ��m�F
PRINTFORML [5] - �ߑ��̂����ɂ���w��
PRINTFORML [4] - �p�W���}�̕ύX
PRINTFORML [3] - �����̈ߑ��̕ύX
PRINTFORML [2] - �ߑ��̈ꎞ�ύX
PRINTFORML [1] - ���ς��
PRINTFORML
PRINTFORML [0] - �߂�
DO
	INPUT
	SELECTCASE RESULT
	CASE 6
		CALL SHOW_CHARA_CLOTHES(C_ID, 0)
	CASE 5
		CALL SHOW_CLOTHES(C_ID, "�����ɂ���ߑ�")
		PRINTFORML %CALLNAME:C_ID%�̂����ɂ���ߑ���ݒ蒆
		PRINTFORML
		PRINTFORML [4] - ���݂̈ߑ����w�肷��
		PRINTFORML [3] - �ߑ��Z�b�g���w�肷��
		PRINTFORML [2] - ����L�����̕��i���̐^��
		PRINTFORML [1] - �����ɂ���w��̃��Z�b�g
		PRINTFORML
		PRINTFORML [0] - ��߂�
		DO
			INPUT
			SELECTCASE RESULT
			CASE 4
				CALL DECIDE_CLOTHES(C_ID, "�����ɂ���ߑ�", "���݂̈ߑ�")
			CASE 3
				CALL COSPLAY_SET(C_ID, "�����ɂ���ߑ�")
			CASE 2
				CALL COSPLAY_CHARA(C_ID, "�����ɂ���ߑ�")
			CASE 1
				PRINTFORML �{���Ƀ��Z�b�g���܂����H
				PRINTFORML
				PRINTFORML [1] - ���Z�b�g����
				PRINTFORML [0] - ��߂�
				DO
					INPUT
					SELECTCASE RESULT
					CASE 1
						CALL CTRL_CLOTHES_SET(C_ID, "�����ɂ���ߑ��̃��Z�b�g")
					CASE 0
					CASEELSE
						REUSELASTLINE �����ȓ��͂ł�
						CONTINUE
					ENDSELECT
					RESTART
				LOOP 1
			CASE 0
				RESTART
			CASEELSE
			ENDSELECT
			RESTART
		LOOP 1
	CASE 4
		SIF C_ID == MASTER
			RESTART
		CALL SHOW_CLOTHES(C_ID, "�����̃p�W���}")
		PRINTFORML %CALLNAME:C_ID%�̃p�W���}��ݒ蒆
		PRINTFORML
		PRINTFORML [5] - �D���Ȃ悤�ɂ�����
		PRINTFORML [4] - �����ɂ���ߑ��ŐQ�Ă��炤
		PRINTFORML [3] - �p�W���}���w�肷��
		PRINTFORML [2] - �S���ŐQ�Ă��炤
		PRINTFORML [1] - �p���c�����ŐQ�Ă��炤
		PRINTFORML
		PRINTFORML [0] - ��߂�
		DO
			INPUT
			SELECTCASE RESULT
			CASE 5
				CFLAG:C_ID:�p�W���}�w�� = 0
			CASE 4
				SIF CFLAG:C_ID:�����ɂ���ߑ�
					CALL CTRL_CLOTHES_SET(C_ID, "�p�W���}�̕ύX_�����ɂ���ߑ�")
			CASE 3
				CALL COSPLAY_SELECT(C_ID, "�p�W���}", "�p�W���}�Z�b�g")
			CASE 2
				CALL CTRL_CLOTHES_SET(C_ID, "�p�W���}�̕ύX_�S��")
			CASE 1
				CALL CTRL_CLOTHES_SET(C_ID, "�p�W���}�̕ύX_�p���C�`")
			CASE 0
			CASEELSE
				REUSELASTLINE �����ȓ��͂ł�
				CONTINUE
			ENDSELECT
			RESTART
		LOOP 1
	CASE 3
		CALL SHOW_CLOTHES(C_ID, "�����̈ߑ�")
		PRINTFORML %CALLNAME:C_ID%�̕��i����ݒ蒆
		PRINTFORML
		PRINTFORML [4] - ���݂̈ߑ����w�肷��i�����ɂ���ɏ㏑������܂��j
		PRINTFORML [3] - �ߑ��Z�b�g���w�肷��
		PRINTFORML [2] - ����L�����̕��i���̐^��
		PRINTFORML [1] - �{�l�܂���
		PRINTFORML
		PRINTFORML [0] - ��߂�
		DO
			INPUT
			SELECTCASE RESULT
			CASE 4
				CALL DECIDE_CLOTHES(C_ID, "���i��", "���݂̈ߑ�")
			CASE 3
				CALL COSPLAY_SET(C_ID, "���i��")
			CASE 2
				CALL COSPLAY_CHARA(C_ID, "���i��")
			CASE 1
				PRINTFORMW ���i���̐ݒ�͖{�l�̋C���ɔC���܂�
				CFLAG:C_ID:��{�����Z�b�g = 0
			CASE 0
			ENDSELECT
			RESTART
		LOOP 1
	CASE 2
		;#;PRINTFORML CFLAG:C_ID:�ߑ��ꎞ�ύX{CFLAG:C_ID:�ߑ��ꎞ�ύX}
		CALL SHOW_CLOTHES(C_ID, "���݂̈ߑ�")
		PRINTFORML %CALLNAME:C_ID%�̌��݂̈ߑ��𒅂��ւ���
		PRINTFORML
		PRINTFORML [4] - �����ɂ���ߑ��ɒ����ւ�
		PRINTFORML [3] - �ߑ��Z�b�g���w�肷��
		PRINTFORML [2] - ����L�����̕��i���̐^��
		PRINTFORML [1] - �����̃f�t�H���g�ɖ߂�
		PRINTFORML
		PRINTFORML [0] - ��߂�
		DO
			INPUT
			SELECTCASE RESULT
			CASE 4
				SIF !CFLAG:C_ID:�����ɂ���ߑ�
					RESTART
				CALL DECIDE_CLOTHES(C_ID, "���݂̈ߑ�", "�����ɂ���ߑ�")
			CASE 3
				CALL COSPLAY_SET(C_ID, "���݂̈ߑ�")
			CASE 2
				CALL COSPLAY_CHARA(C_ID, "���݂̈ߑ�")
			CASE 1
				PRINTFORMW �����̈ߑ��𒅂�������
				CALL CTRL_CLOTHES_SET(C_ID, "���݈ߑ��̕ύX_���i��")
			CASE 0
			ENDSELECT
			RESTART
		LOOP 1
	CASE 1
		PRINTFORML %CALLNAME:C_ID%�̂��ς���ᖡ��
		PRINTFORML ���ݒ��p���̂��ς�F%GET_STR(C_ID, "�����g����_���炵�\", EQUIP:C_ID:�����g�����Q, "���O")%
		SELECTCASE CFLAG:C_ID:�w��p���c
		CASE 0
			PRINTFORML �@���݂̂��ς�ݒ�F�w��Ȃ�
		CASE 100
			PRINTFORML �@���݂̂��ς�ݒ�F�m�[�p���w��
		CASEELSE
			PRINTFORML �@���݂̂��ς�ݒ�F%GET_STR(C_ID, "�����g����_���炵�\", CFLAG:C_ID:�w��p���c, "���O")%
		ENDSELECT
		PRINTFORML
		PRINTFORML
		PRINTFORML [2] - ���݂̂��ς�������ɂ���w��
		PRINTFORML [1] - ���ς�̂����ɂ���w�����������
		PRINTFORML
		PRINTFORML [0] - ��߂�
		DO
			INPUT
			SELECTCASE RESULT
			CASE 2
				PRINTFORMW ���݂̂��ς�������ɂ���Ɏw�肵�܂���
				CFLAG:C_ID:�w��p���c = EQUIP:C_ID:�����g�����Q
				SIF !CFLAG:C_ID:�w��p���c
					CFLAG:C_ID:�w��p���c = 100
			CASE 1
				PRINTFORMW ���ς�̂����ɂ���w����������܂���
				CFLAG:C_ID:�w��p���c = 0
			CASE 0
			ENDSELECT
			RESTART
		LOOP 1
	CASE 0
		RETURN
	CASEELSE
		REUSELASTLINE �����ȓ��͂ł�
		CONTINUE
	ENDSELECT
	RESTART
LOOP 1

;�͕킳����ΏۃL�����̑I��
@COSPLAY_CHARA(C_ID, TYPE)
#DIM  C_ID
#DIMS TYPE
#DIM  COS_CHARA
PRINTFORML %CALLNAME:C_ID%��%TYPE%��ݒ蒆
PRINTFORML �N�̈ߑ���^�������܂����H
CALL SHOW_CHARA_LIST("���i���͕�\�L�������X�g", "�̗͋C��")
COS_CHARA = RESULT
IF GROUPMATCH(COS_CHARA, 0, 999)
	PRINTFORMW �ߑ��̐ݒ�𒆒f����
	RETURN
ELSEIF COS_CHARA == C_ID
	SELECTCASE TYPE
	CASE "�����ɂ���ߑ�"
		PRINTFORMW �ߑ��̐ݒ�𒆒f����
	CASE "���i��"
		PRINTFORMW ���i���̐ݒ�͖{�l�̋C���ɔC���܂�
		CFLAG:C_ID:��{�����Z�b�g = 0
	CASE "���݂̈ߑ�"
		PRINTFORMW �����̈ߑ��𒅂�������
		CALL CTRL_CLOTHES_SET(C_ID, "���݈ߑ��̕ύX_���i��")
	ENDSELECT
	RETURN
ENDIF
CALL DECIDE_CLOTHES(C_ID, TYPE, "�L�������i��", COS_CHARA)
SIF RESULT
	RESTART

;�ߑ��Z�b�g�̃J�e�S���I��
@COSPLAY_SET(C_ID, TYPE)
#DIM  C_ID
#DIM  SET_ID
#DIMS TYPE
#DIMS CATEGORY
CALL SHOW_CLOTHES(C_ID, TYPE)
PRINTFORML %CALLNAME:C_ID%��%TYPE%��ݒ蒆
PRINTFORML �ߑ��̎�ނ̑I��
PRINTFORML
PRINTFORML [3] - ��{�ߑ��Z�b�g
PRINTFORML [2] - �R�X�v���ߑ��Z�b�g
PRINTFORML [1] - �L��������ߑ��Z�b�g
PRINTFORML
PRINTFORML [0] - ��߂�
DO
	INPUT
	SELECTCASE RESULT
	CASE 3
		CATEGORY '= "��{�ߑ��Z�b�g"
	CASE 2
		CATEGORY '= "�R�X�v���ߑ��Z�b�g"
	CASE 1
		CATEGORY '= "�L��������ߑ��Z�b�g"
	CASE 0
		RETURN
	CASEELSE
		REUSELASTLINE �����ȓ��͂ł�
		CONTINUE
	ENDSELECT
	BREAK
LOOP 1
CALL COSPLAY_SELECT(C_ID, TYPE, CATEGORY)

;�X�̈ߑ��Z�b�g�̑I��
@COSPLAY_SELECT(C_ID, TYPE, CATEGORY)
#DIM  C_ID
#DIM  SET_ID
#DIMS TYPE
#DIMS CATEGORY
PRINTFORML %CALLNAME:C_ID%��%TYPE%��ݒ蒆�i%CATEGORY%�j
PRINTFORML �g�p����ߑ��Z�b�g��I�����ĉ�����
PRINTFORML
CALL CLASS_LIST("�ߑ��Z�b�g", CATEGORY)
PRINTFORML
PRINTFORML [0] - ��߂�
DO
	INPUT
	SET_ID = RESULT
	SELECTCASE SET_ID
	CASE 0
		RETURN
	CASEELSE
		SIF GET_INT(0, "�ߑ��Z�b�g" , SET_ID, CATEGORY)
			BREAK
		REUSELASTLINE �����ȓ��͂ł�
		CONTINUE
	ENDSELECT
LOOP 1
CALL DECIDE_CLOTHES(C_ID, TYPE, "�ߑ��Z�b�g", SET_ID)
SIF RESULT
	RESTART

;�ߑ�����̍ŏI�m�F
@DECIDE_CLOTHES(C_ID, COS_SAVE, COS_LOAD, SET_ID)
#DIM  C_ID     ;�ݒ肷��L����
#DIMS COS_SAVE ;�ߑ��̕ۑ���
#DIMS COS_LOAD ;�ߑ��̎Q�ƌ�
#DIM  SET_ID   ;�Q�ƈߑ�����ID
;#; PRINTFORML C_ID{C_ID}, COS_SAVE%COS_SAVE%, COS_LOAD%COS_LOAD%, SET_ID{SET_ID}
PRINTFORMW �ŏI�m�F
CALL SHOW_CLOTHES(C_ID, COS_LOAD, SET_ID)
PRINTFORML
PRINTFORML ���̈ߑ��ł悢�ł����H
PRINTFORML
PRINTFORML [1] - ����
PRINTFORML [0] - �l���Ȃ���
PRINTFORML
PRINTFORML [9] - ��߂�
DO
	INPUT
	SELECTCASE RESULT
	CASE 1
		BREAK
	CASE 0
		RETURN 1
	CASE 9
		RETURN
	CASEELSE
		REUSELASTLINE �����ȓ��͂ł�
		CONTINUE
	ENDSELECT
LOOP 1

SELECTCASE COS_LOAD
CASE "���݂̈ߑ�"
	SELECTCASE COS_SAVE
	CASE "���i��"
		PRINTFORMW ���ܒ��p���Ă���ߑ��𖈓����Ă��炤���Ƃɂ���
		CFLAG:C_ID:��{�����Z�b�g = 100
		CALL CTRL_CLOTHES_SET(C_ID, "���݈ߑ��̕ۑ�_�����ɂ���")
	CASE "�����ɂ���ߑ�"
		PRINTFORMW ���ܒ��p���Ă���ߑ��������ɂ���Ɏw�肵��
		CALL CTRL_CLOTHES_SET(C_ID, "���݈ߑ��̕ۑ�_�����ɂ���")
	ENDSELECT

CASE "�ߑ��Z�b�g"
	PRINTFORMW %CALLNAME:C_ID%��%COS_SAVE%��%GET_STR(C_ID, "�ߑ��Z�b�g", SET_ID, "���O")%���w�肵�܂���
	SELECTCASE COS_SAVE
	CASE "���݂̈ߑ�"
		CALL CTRL_CLOTHES_SET(C_ID, "���݈ߑ��̕ύX_�ߑ��Z�b�g", SET_ID)
	CASE "���i��"
		CALL CTRL_CLOTHES_SET(C_ID, "���i���̕ύX_�ߑ��Z�b�g", SET_ID)
	CASE "�����ɂ���ߑ�"
		CALL CTRL_CLOTHES_SET(C_ID, "�����ɂ���ߑ��̕ύX_�ߑ��Z�b�g", SET_ID)
	CASE "�p�W���}"
		CALL CTRL_CLOTHES_SET(C_ID, "�p�W���}�̕ύX_�ߑ��Z�b�g", SET_ID)
	ENDSELECT

CASE "�L�������i��"
	PRINTFORMW %CALLNAME:C_ID%��%CALLNAME:SET_ID%�̊i�D��^�������邱�Ƃɂ���
	SELECTCASE COS_SAVE
	CASE "���݂̈ߑ�"
		CALL CTRL_CLOTHES_SET(C_ID, "���݈ߑ��̕ύX_�L�����ߑ�", SET_ID, "���i��")
	CASE "���i��"
		CALL CTRL_CLOTHES_SET(C_ID, "���i���̕ύX_�L�����ߑ�", SET_ID, "���i��")
	CASE "�����ɂ���ߑ�"
		CALL CTRL_CLOTHES_SET(C_ID, "�����ɂ���ߑ��̕ύX_�L�����ߑ�", SET_ID, "���i��")
	ENDSELECT

ENDSELECT

;�����ւ�
@COM_ABLE429
;�ړ����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(429)
	RETURN RESULT
;�����ݒ�
SIF (CFLAG:MASTER:���݈ʒu != CFLAG:MASTER:311) && (CFLAG:���݈ʒu != CFLAG:311)
	RETURN 0
SIF !GETBIT(CFLAG:TARGET:��������, 1) && TARGET
	RETURN 0
SIF CFLAG:���ӂ�
	RETURN 0
RETURN 1

repo_name: akadiya/eratw

license: unknown


code:
;-------------------------------------------------
;���ւ���
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM430
#DIM �Ώ�
#DIM ���
PRINTW �����˂��p���e�B�ɂ͂������܂����H
DRAWLINE
CALL DISPLAY_ALL_COLLECTION(1,1)
DRAWLINE
PRINTFORML [0] �͂��ւ��Ȃ�
$INPUT_LOOP
INPUT
IF RESULT == 0
	RETURN 0
ELSE
	�Ώ� = RESULT / 100
	��� = RESULT % 100
	CALL SPEND_HAVE_COLLECTION(RESULT)
	IF RESULT != 0
		CFLAG:MASTER:206 = ���
		CFLAG:MASTER:246 = ���
		CFLAG:MASTER:���傤�̂ς�� = ���
		CFLAG:MASTER:�p�W���}�p���c = ���
		PRINTFORM %CALLNAME:MASTER%��
		IF EQUIP:MASTER:�����g�����Q == 0
			PRINTFORML %CALLNAME:(�Ώ�)%��%PANTSNAME(���)%���͂���
		ELSE
			PRINTFORM %PANTSNAME(EQUIP:MASTER:�����g�����Q)%����
			PRINTFORML %CALLNAME:(�Ώ�)%��%PANTSNAME(���)%�ɂ͂��ւ���
		ENDIF
		EQUIP:MASTER:�����g�����Q = ���
	ELSE
		GOTO INPUT_LOOP
	ENDIF
ENDIF
IF !FLAG:���Ԓ�~
	TIME += 3
ELSE
	BASE:MASTER:TSP -= 5
ENDIF
RETURN 1

;���ւ���
@COM_ABLE430
;�ړ����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(430)
	RETURN RESULT
;�����ݒ�
SIF (CFLAG:MASTER:���݈ʒu != CFLAG:MASTER:311) && (CFLAG:���݈ʒu != CFLAG:311)
	RETURN 0
;SIF CSTR:MASTER:12 == ""
SIF !FLAG:�p���c�A��
	RETURN 0
SIF !FLAG:���Ԓ�~ && (!GETBIT(CFLAG:TARGET:��������, 1) && TARGET)
	RETURN 0
SIF CFLAG:���ӂ�
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�����C�ł��낮
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM431
#DIM �񕜑O�̗͂P
#DIM �񕜑O�C�͂P
#DIM �񕜌�̗͂P
#DIM �񕜌�C�͂P
#DIM �񕜑O�̗͂Q
#DIM �񕜑O�C�͂Q
#DIM �񕜌�̗͂Q
#DIM �񕜌�C�͂Q

�񕜑O�̗͂P = BASE:MASTER:�̗�
�񕜑O�C�͂P = BASE:MASTER:�C��
IF DAY * 1440 + TIME - EX:MASTER:�O��̓������� < 360
	TFLAG:194 = 1
	PRINTFORML �������������΂��肾
	RETURN -1
ELSE
	IF BATHCHECK(CFLAG:MASTER:���݈ʒu)
		IF TARGET > 0 && CFLAG:TARGET:6 > 0 && !CFLAG:TARGET:����
			�񕜑O�̗͂Q = BASE:TARGET:�̗�
			�񕜑O�C�͂Q = BASE:TARGET:�C��
			CALL ODEKAKE_OFURO(TARGET,1)
			�񕜌�̗͂Q = BASE:TARGET:�̗�
			�񕜌�C�͂Q = BASE:TARGET:�C��
		ENDIF
		CALL ODEKAKE_OFURO(MASTER,1)
		CFLAG:MASTER:���C = 0
	;�v�[���ł��낮�ꍇ�i�x�e�̂���Ɏ�̉��Łj
	ELSE
		CALL ODEKAKE_OFURO(MASTER,3)
		IF GETBIT (FLAG:�v�[��, 2)
			STAIN:MASTER:0 = 0
			STAIN:MASTER:1 = 0
			STAIN:MASTER:2 = 2
			STAIN:MASTER:3 = 1
			STAIN:MASTER:4 = 8
			STAIN:MASTER:5 = 0
		ENDIF
		IF TARGET > 0 && CFLAG:TARGET:6 > 0 && !CFLAG:TARGET:����
			�񕜑O�̗͂Q = BASE:TARGET:�̗�
			�񕜑O�C�͂Q = BASE:TARGET:�C��
			CALL ODEKAKE_OFURO(TARGET,3)
			�񕜌�̗͂Q = BASE:TARGET:�̗�
			�񕜌�C�͂Q = BASE:TARGET:�C��
		ENDIF
	ENDIF
	�񕜌�̗͂P = BASE:MASTER:�̗�
	�񕜌�C�͂P = BASE:MASTER:�C��
	DRAWLINE
	PRINTFORML �̗�+{ABS(�񕜌�̗͂P - �񕜑O�̗͂P)}�i%CALLNAME:MASTER%�j
	PRINTFORML �C��+{ABS(�񕜌�C�͂P - �񕜑O�C�͂P)}�i%CALLNAME:MASTER%�j
	IF TARGET
		PRINTFORML �̗�+{ABS(�񕜌�̗͂Q - �񕜑O�̗͂Q)}�i%CALLNAME:TARGET%�j
		PRINTFORML �C��+{ABS(�񕜌�C�͂Q - �񕜑O�C�͂Q)}�i%CALLNAME:TARGET%�j
	ENDIF
	TIME += 30
ENDIF

;�����C�ł��낮
@COM_ABLE431
;�ړ����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(431)
	RETURN RESULT
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;������
SIF CFLAG:����
	RETURN 0
;�Y���Q��
SIF CFLAG:�Y���Q��
	RETURN 0
;�����C�̂���ꏊ�ȊO�͕s��
IF !BATHCHECK(CFLAG:MASTER:���݈ʒu)
	SIF !GETBIT (FLAG:�v�[��, 2)
		RETURN 0
	SIF SMALL_PLACE(CFLAG:MASTER:���݈ʒu) || AT_HOME(MASTER) == 0
		RETURN 0
ENDIF
SIF PLACE_SENTO()
	RETURN 0
SIF CFLAG:���ӂ� == 2
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�K��
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM432
#DIM �񕜑O�̗͂P
#DIM �񕜑O�C�͂P
#DIM �񕜌�̗͂P
#DIM �񕜌�C�͂P
#DIM �񕜑O�̗͂Q
#DIM �񕜑O�C�͂Q
#DIM �񕜌�̗͂Q
#DIM �񕜌�C�͂Q

�񕜑O�̗͂P = BASE:MASTER:�̗�
�񕜑O�C�͂P = BASE:MASTER:�C��
IF DAY * 1440 + TIME - EX:MASTER:�O��̓������� < 360
	TFLAG:194 = 1
	PRINTFORML �������������΂��肾
	RETURN -1
ELSEIF PLACE_SENTO() == 2
	;�ԑ䂿����{�点�Ă��܂����ꍇ
	IF TFLAG:209 == 4
		PRINTFORML �ԑ�̕�����s�����������ł��Ă���c�c
		PRINTFORML �܂��������߂ė����ق����ǂ��������c�c
		RETURN -1
	;�ԑ䂿���ʏ�^�s
	ELSE
		;��������Ȃ������C�x���g�����Ă���
		IF TFLAG:209 == 3
			PRINTL �u�c�c����A�ǂ����́H ���������� ���㎝���Ă����Ƃ��H�v
		;��߂��I�񂾂��ǂ���ς���肽���Ȃ���
		ELSEIF TFLAG:209 == 2
			PRINTL �u�c�c�ȂɁA���������ċC���ς�����H�v
		;����ȊO
		ELSE
			;��������ł��܂���C���Ȃ��ԑ䂿���
			PRINTL �u�c�c��������႟���[�v
		ENDIF
		PRINTL �u�����\400�ł��[��v
		DRAWLINE
		PRINTL [1] \400�����ē�������
		PRINTL [0] ��߂�
		$LOOP_hitozato
		INPUT
		IF RESULT == 1
			IF MONEY < 400
				PRINTW �u�c�c��A�ǁ[���A���������v
				PRINTW �u���āA�_������񑫂�ĂȂ������I�v
				PRINTW �u�c�c�c�c�v
					;����ϐ������ԑ䂿���u�`�M��
					IF TFLAG:209 >= 2
						PRINTL �u�c�c�c�c���̂��A�A�^�V�����������ĉɂ���Ȃ�����v
						PRINTL �u�c�c���܂��ɂ�A�{���H�v
						TFLAG:209 = 4
					ELSE
						PRINTL �u�c�c�c�c���̂��A�]�v�Ȃ����b��������Ȃ����ǁv
						PRINTL �u�c�c�����A�����������č����Ă�Ƃ���������A�������猋�\�������ǉ��򂪂��邩�� �����s���Ă݂�΁H�v
						TFLAG:209 = 3
					ENDIF
				RETURN -1
			ELSE
				MONEY -= 400
				PRINTL �u�c�c��A�ǁ[���A���������v
				IF TARGET > 0 && CFLAG:TARGET:6 > 0 && !CFLAG:TARGET:����
					PRINTL �u�c�c���A�����Ƃ����ǃA�^�V�������Ă邩��ςȂ��Ƃ��Ȃ��ł�v
					PRINTL
					PRINTFORMW %CALLNAME:PLAYER%��%CALLNAME:TARGET%�ƒE�ߏ��̑O�ň�悸�ʂ�A����Ɍ�����
					�񕜑O�̗͂Q = BASE:TARGET:�̗�
					�񕜑O�C�͂Q = BASE:TARGET:�C��
					CALL ODEKAKE_OFURO(TARGET,1)
					�񕜌�̗͂Q = BASE:TARGET:�̗�
					�񕜌�C�͂Q = BASE:TARGET:�C��
				ENDIF

				CALL ODEKAKE_OFURO(MASTER,1)

				DRAWLINE
				PRINTW �c
				PRINTW �c�c
				PRINTW �c�c�c�c
				PRINTFORMW %CALLNAME:PLAYER%�͗���ɐZ������
				PRINTW �c�c�c�c
				PRINTW �c�c
				PRINTW �c
				;��O�����30���Œ�
				TIME += 30
				;��O���ꑍ������+1
				CFLAG:400 += 1
				;��O���ꎞ��������+1
				TFLAG:210 += 1
				;��O����t���O��1�ɐݒ�
				TFLAG:209 = 1
				RETURN 1
			ENDIF
		ELSEIF RESULT == 0
			;����ϐ������ԑ䂿���u�`�M��
			IF TFLAG:209 >= 2
				PRINTL �u�c�c�c�c���̂��A�A�^�V�����������ĉɂ���Ȃ�����v
				PRINTL �u�c�c���܂��ɂ�A�{���H�v
				TFLAG:209 = 4
			ELSE
				PRINTL �u��߂�́H�c�c�܂��A�������ǂ��v
				PRINTL �u�c�c�c�c���̂��A�]�v�Ȃ����b��������Ȃ����ǁv
				PRINTL �u�c�c�����A�������ܑ̂Ȃ��Ƃ���������A�������猋�\�������ǉ��򂪂��邩�� �����s���Ă݂�΁H�v
				TFLAG:209 = 2
			ENDIF
			RETURN -1
		ELSE
			GOTO LOOP_hitozato
		ENDIF
	ENDIF
ELSEIF PLACE_SENTO() == 9
	;�ԑ��{�点�Ă��܂����ꍇ
	IF TFLAG:211 == 4
		PRINTFORML �ԑ�̕�����s�����������ł��Ă���c�c
		PRINTFORML �܂��������߂ė����ق����ǂ��������c�c
		RETURN -1
	;�ԑ�d���ʏ�^�s
	ELSE
		;��������Ȃ������C�x���g�����Ă���
		IF TFLAG:211 == 3
			PRINTL �u���̂ɂ�[�z�͑���ɂ������ɂ�[�ŁB��������[�ɗ��Ƃ��΂��q����܂Ƃ��Ĉ�������I�v
		;��߂��I�񂾂��ǂ���ς���肽���Ȃ���
		ELSEIF TFLAG:211 == 2
			PRINTL �u���[�������A������ȏ��܂ŗ��ĉ�������ˁ[�ɂ��āA�ꐶ�̘Z���͑����Ă邬��I�v
		;����ȊO
		ELSE
			;���u�d��
			PRINTL �u��������Ⴂ�܂���������[�I�v
			;���߂ċ��n������œ����R�}���h��I�������ꍇ
			IF TFLAG:211 == 0 && TFLAG:212 == 0 && CFLAG:401 == 0
				PRINTL �u����₟�[�I����������A�l�Ԃ�������ɂᏊ�ɂɂ�[�̗p������H�v
				PRINTFORMW  %CALLNAME:PLAYER%�͔ԑ�̗d���ɓ������������Ƃ�������
				PRINTL �u�ɂ�[����āH�c�c�ӂ�c�c�ӂ�v
				PRINTL �u�c�c�ɂ�[�̂ɂ�[�́A���q����܂���������I�v
				PRINTL �u�₯��ǁA�您�[������ȏ��܂ŗ���������I���񂵂��A�ς�胂��������ˁ[�v
			ENDIF
		ENDIF
		PRINTL �u��[����A��Ⴄ�����������Ƃ�������[�v
		;���n�����򑍓����񐔂��ʎZ15��ȏ�ł܂� �ɂ�[�Ղ�����x���I�����Ă��Ȃ�
		IF CFLAG:401 >= 15 && CFLAG:402 == 0
			PRINTL �u���񂵂��ɂ́A���[��܂�ׂ����Ⴙ�Ă�����������I�v
			PRINTL �u���[���Ɖ҂��܂��邬��I���I���I�I���I�I�I�����~��������[�I�v
			PRINTL �u�₯��A���ق��[����A����[���l�M���[�� �ɂ�[�Ղ�񂪂��邬��I�v
			PRINTFORMW  �ԑ�̗d����%CALLNAME:PLAYER%�ɂ��������ƁA�����ւ��ւƉ}�炵���΂݂𕂂��ׁA�͂�I�͂�I��%CALLNAME:PLAYER%���}�����ĂĂ���c�c
		ELSE
			PRINTL �u���񂾂��`���[�����I�v
			PRINTFORML  �ԑ�̗d���́A�������ɒu����Ă��������̂悤�Ȃ��̂��w�����A�͂�I�͂�I��%CALLNAME:PLAYER%���}�����ĂĂ���c�c
		ENDIF
		DRAWLINE
		PRINTL [1] \1000�����ē�������
		;���n�����򑍓����񐔂��ʎZ15��ɂȂ������o��
		SIF CFLAG:401 >= 15
			PRINTL [2] \5000�����ē�������
		PRINTL [0] ��߂�
		$LOOP_titei
		INPUT
		SELECTCASE RESULT
			CASE 1
				IF MONEY < 1000
					PRINTW  �ԑ�̗d���͈ꐶ�����A���z�������Ă��邩�ǂ��������Ȃ���m���߂Ă���c�c
					PRINTW �u�c�c�c�c�v
					PRINTW �u���݂�[�����A�q�h���M���[�I������ˁ[�̂ɂ悭���݂�[�}�X���������ɂ��Č��������񂾂���I�v
					;�ԑ�u�`�M��
					IF TFLAG:211 >= 2
						PRINTL �u�񂪁[�I�I�񂪁[�I�I�񂪁[�I�I�v
						PRINTL �u���𗎂Ƃ����z�ɍ\���Ă�q�}�͂ɂ�[������[�I�I�v
						TFLAG:211 = 4
					ELSE
						PRINTL �u���݂�[�����A������ȏ��܂ŗ��āA�����ā[�ɂ�ɂ��ɗ���������[�I�v
						PRINTL �u����[�����炩���ɗ���������[�H�I�v
						TFLAG:211 = 3
					ENDIF
					RETURN -1
				ELSE
					MONEY -= 1000
					PRINTW  �ԑ�̗d���͈ꐶ�����A���z�������Ă��邩�ǂ��������Ȃ���m���߂Ă���c�c
					PRINTL �u���񂬂�A��[�����肵�Ă��Ƃ�������[�I�v
					IF TARGET > 0 && CFLAG:TARGET:6 > 0 && !CFLAG:TARGET:���� && TALENT:TARGET:���� != 2
						PRINTL �i�����ւ��ցA���X�������ꏏ�ɘA��ė���ɂ��āA�����z������[�j
						PRINTL �i������ ����[�̂��[�ρ[�Ă��ɂ������g���āA�v���������̃��X���������������Ă��炤����[�I�j
						PRINTFORMW %CALLNAME:PLAYER%��%CALLNAME:TARGET%�ƈꏏ�ɒE�ߏ��Ɍ�������
						PRINTFORMW %CALLNAME:TARGET%��%CALLNAME:PLAYER%���瑗���鎋���ɒp�����������ɂ��Ă���c�c
						�񕜑O�̗͂Q = BASE:TARGET:�̗�
						�񕜑O�C�͂Q = BASE:TARGET:�C��
						CALL ODEKAKE_OFURO(TARGET,2)
						IF CHK_DATENOW(CFLAG:TARGET:�f�[�g��)
							EXP:MASTER:�f�[�g�o�� ++
							EXP:TARGET:�f�[�g�o�� ++
						ENDIF
							CALL DATE_GOES_ON(1)
						SOURCE:TARGET:�I�o += 300 + (ABL:TARGET:�e�� * 15)
						�񕜌�̗͂Q = BASE:TARGET:�̗�
						�񕜌�C�͂Q = BASE:TARGET:�C��
					ENDIF
					CALL ODEKAKE_OFURO(MASTER,2)
					DRAWLINE
					PRINTW �c
					PRINTW �c�c
					PRINTW �c�c�c�c
					IF TARGET > 0 && CFLAG:TARGET:6 > 0 && !CFLAG:TARGET:����
						PRINTFORMW %CALLNAME:PLAYER%��%CALLNAME:TARGET%�͓�l���ǂ�����ł��낢��
					ELSE
						PRINTFORMW %CALLNAME:PLAYER%�͉���ł��낢��
					ENDIF
					PRINTW �c�c�c�c
					PRINTW �c�c
					PRINTW �c
					;���n�������30���Œ�
					TIME += 30
					;���n�����򑍓�����+1
					CFLAG:401 += 1
					;���n�����򎞌�������+1
					TFLAG:212 += 1
					;���n������t���O��1�ɐݒ�
					TFLAG:211 = 1
					PRINTL �����̂������������������邩������Ȃ��c�c
					PRINTL ����ŋA��܂����H
					PRINTL [0] �������@[1] �͂�
					INPUT
					IF RESULT
						TFLAG:������ = 3
						PRINTFORML %STR:(7000 + TFLAG:������)%������
						IF MAIN_MAP != 9
							PRINTL �������܂ܕ����̂͂���ǂ��̂ŋA��܂�
							CALL �O�o�悩��A��
						ENDIF
					ENDIF
						RETURN 1
				ENDIF
			CASE 2
				PRINTL �u���݂�񂬂�[�I�����X�����B������[����������[�I�v
				PRINTL  ���݃C�x���g�쐬���Ȃ̂ł��҂�������
				GOTO LOOP_titei
			CASE 0
				;�ԑ�u�`�M��
				IF TFLAG:211 >= 2
					PRINTL �u�񂪁[�I�I�񂪁[�I�I�񂪁[�I�I�v
					PRINTL �u���𗎂Ƃ����z�ɍ\���Ă�q�}�͂ɂ�[������[�I�I�v
					TFLAG:211 = 4
				ELSE
					PRINTL �u�񂠁[�A����Ȃ��񂾂����炳�����Ƃǂ����s������[�I�v
					PRINTL �u���ɂȂ��z�͂��q����܂ł��Ȃ�ł��ɂႢ����[�I�v
					TFLAG:211 = 2
				ENDIF
				RETURN -1
			CASEELSE
				GOTO LOOP_titei
		ENDSELECT
	ENDIF
ENDIF
�񕜌�̗͂P = BASE:MASTER:�̗�
�񕜌�C�͂P = BASE:MASTER:�C��
DRAWLINE
PRINTFORML �̗�+{ABS(�񕜌�̗͂P - �񕜑O�̗͂P)}�i%CALLNAME:MASTER%�j
PRINTFORML �C��+{ABS(�񕜌�C�͂P - �񕜑O�C�͂P)}�i%CALLNAME:MASTER%�j
IF TARGET
	PRINTFORML �̗�+{ABS(�񕜌�̗͂Q - �񕜑O�̗͂Q)}�i%CALLNAME:TARGET%�j
	PRINTFORML �C��+{ABS(�񕜌�C�͂Q - �񕜑O�C�͂Q)}�i%CALLNAME:TARGET%�j
ENDIF

;�K��
@COM_ABLE432
;�ړ����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(432)
	RETURN RESULT
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;������
SIF CFLAG:����
	RETURN 0
;�Y���Q��
SIF CFLAG:�Y���Q��
	RETURN 0
;�����C�̂���ꏊ�ȊO�͕s��
SIF !PLACE_SENTO()
	RETURN 0
SIF CFLAG:���ӂ� == 2
	RETURN 0
RETURN 1

@PLACE_SENTO()
#FUNCTION
IF CFLAG:MASTER:���݈ʒu == GET_MAP_REPLACEMENT(223)
	RETURNF 2
ELSEIF CFLAG:MASTER:���݈ʒu == GET_MAP_REPLACEMENT(934)
	RETURNF 9
ELSE
	RETURNF 0
ENDIF

@ODEKAKE_OFURO(ARG,ARG:1)
;ARG=1�l���@ARG=2�n�� =3�v�[��
RESET_STAIN ARG
STAIN:ARG:4 = 0
CFLAG:ARG:�S���ː� = 0
CFLAG:ARG:�A�i���ː� = 0
CFLAG:ARG:���ɐ��t = 0
CFLAG:ARG:��ɐ��t = 0
CFLAG:ARG:��ɐ��t = 0
CFLAG:ARG:���C = MIN(CFLAG:ARG:���C - 1000,0)
SELECTCASE ARG:1
	CASE 1
		CALL RECOVER_PERMIL(ARG,100,"�̗�",1)
		CALL RECOVER_PERMIL(ARG,250,"�C��",1)
	CASE 2
		CALL RECOVER_PERMIL(ARG,150,"�̗�",1)
		CALL RECOVER_PERMIL(ARG,400,"�C��",1)
	CASE 3
		CALL RECOVER_PERMIL(ARG,60,"�̗�",1)
		CALL RECOVER_PERMIL(ARG,150,"�C��",1)
ENDSELECT
SIF ARG == MASTER
	EX:MASTER:�O��̓������� = DAY * 1440 + TIME


code:
;-------------------------------------------------
;���݂���
;����n�R�}���h�A���x��1
;-------------------------------------------------
;LOCAL
@COM434
VARSET LOCAL

IF !GETBIT(FLAG:999, 0)

	PRINTFORML �ΑK���̋��ɒ��莆������
	PRINTFORML ����������������������
	PRINTFORML �b�@�@�@�@�@�@�@�@�@�b
	PRINTFORML �b�@���݂����@�@�@�@�b
	PRINTFORML �b�@�@�͂��߂܂����@�b
	PRINTFORML �b�@�@�@�@�@�@�@�@�@�b
	PRINTFORML �b�@�@�@�@�@�@�@�@�@�b
	PRINTFORML �b�@�@1��1�� 200�~�@�b
	PRINTFORML �b�@�@����͂�����@�b
	PRINTFORML �b�@�@�@�@�@�@�@�@�@�b
	PRINTFORML ����������������������
	PRINTFORMW
	PRINTFORMW �c
	PRINTFORMW �ΑK���ɓ����΂����炵�����A��̂ǂ�����o�Ă���̂��H

	SETBIT FLAG:999, 0

ENDIF

IF GETBIT(FLAG:999, 1)
	PRINTFORML ���݂�����1��1��ł��B
	RETURN -1
ENDIF

IF MONEY < 200
	PRINTFORML ���z���m�F�����炨��������Ȃ������B
	RETURN -1
ENDIF

PRINTFORML ���݂�����1��200�~�A�ǂ�����H
PRINTFORML [1] �����Ă݂�
PRINTFORML [0] ��߂Ă���
PRINTFORML
INPUT
SIF !RESULT
	RETURN -1

MONEY -= 200
TIME += 2
SETBIT FLAG:999, 1

SELECTCASE RAND:15
	CASE 0 TO 6
		PRINTL �p���b�A�p���b
		PRINTL ���������Ĕ����ł�
		PRINTW �c�c
		PRINTL �q���q���Ɖ����������Ă���
		PRINTW ��Ɏ���Č����Ƃ���A�ǂ���炱�ꂪ���݂����炵��
	CASE 7 TO 11
		PRINTL �`�������`������
		PRINTW �������ΑK���ɕ��荞�ނƁc�c
		PRINTW �ΑK�����炨�݂�������яo���Ă���
	CASE 12 TO 13
		PRINTW �c�c
		PRINTW �c
		PRINTW ���c����̂܂� �� �N����������b�����I
		PRINTW �w���݂����̂��߂ɂ��ΑK����ꂽ�炻�̎�ɂ��݂����������Ă����x
		PRINTW �ȁc ���������Ă�̂� �킩��ˁ[�Ǝv����������������ꂽ�̂��킩��Ȃ������c
		PRINTW �����ǂ��ɂ��Ȃ肻���������c
		PRINTW �Ö��p���Ƃ����X�s�[�h���Ƃ����Ԓ�~���Ƃ��A����ȃ`���`�Ȃ��񂶂Ⴀ�f���Ă˂�
		PRINTW �����Ƌ��낵�����̂̕З؂𖡂�������c
	CASE 14
		PRINTW �i�S���b�j
		PRINTL �㓪���ɉ������Ԃ�����
		PRINTL �U��Ԃ��ƁA�����ɉ������񂾎��������Ă���
		PRINTW �J���Ă݂�ƁA���͂��݂����Łc�c
		PRINTW �c�c���݂����Ő΂��Ȃ��ł�������
ENDSELECT

PRINTW �󂯎�����i�H�j���݂����̒��g�����Ă݂��B
PRINTW �c
CALL FORTUNE

;������A�L���b�V���o�b�N�ɂ��ԋ�����
IF GETBIT(FLAG:999, 10)
	PRINTL �c�c
	PRINTW �c

	SELECTCASE RAND:15
		CASE 0 TO 4
			PRINTW ���݂����̍Ō�Ɋ�ȕ�����������
			PRINTL �����E�����ؾ݄��E����
			PRINTL �b�@�@�@�@�@�@�@�@�@�b
			PRINTL �b�@���z�����ʁ@�@�@�b
			PRINTL �b�@�@�@�@�@���i���@�b
			PRINTL �b�@�@�@�@�@�@�@�@�@�b
			PRINTL �b�@�@�@�@�@ 200�~�@�b
			PRINTL �b�@�@�@�@�@�@�@�@�@�b
			PRINTL �b�@���ނ���ł܂��@�b
			PRINTL �b�@�@�g�p�����Ȃ��@�b
			PRINTL ����������������������
			PRINTW ����͂�����ЂƂ̋����ƍl���Ă����̂��낤���H
		CASE 5 TO 6
			PRINTL ˭�
			PRINTW ���؂艹�𕷂������Ȃ��͂Ƃ����ɐg�𕚂���
			PRINTL ĽĽ�
			PRINTW �������h�������悤�ȉ��������ǂ�����ƁA�����ɂ͐�قǓ��ꂽ�͂��̂��ΑK���h�����Ă���
			PRINTL ����A�C�Â��ĂȂ�������h�����Ă����H
		CASE 7 TO 11
			PRINTL �`�������`��������    ���c
			PRINTW �ΑK�����炳�����������ꂽ�͂��̂��ΑK����яo���Ă���
		CASE 12 TO 13
			PRINTW �c�c
			PRINTW �c
			PRINTW ���c����̂܂� �� �N����������b�����I
			PRINTW �w���݂�����ǂݏI�����Ǝv������ ���������ꂽ�͂��̂��ΑK����̂Ȃ��ɖ߂��Ă����x
			PRINTW �ȁc ���������Ă�̂� �킩��ˁ[�Ǝv����������������ꂽ�̂��킩��Ȃ������c
			PRINTW �����ǂ��ɂ��Ȃ肻���������c
			PRINTW �u�Ԉړ����Ƃ����ʋt�]���Ƃ����Ԓ�~���Ƃ��A����ȃ`���`�Ȃ��񂶂Ⴀ�f���Ă˂�
			PRINTW �����Ƌ��낵�����̂̕З؂𖡂�������c
		CASE 14
			PRINTW �i�R�c�R�c�b�j
			PRINTL �㓪���ɉ������Ԃ�����
			PRINTL �U��Ԃ��ƁA�����ɂ��������ꂽ�͂��̂��ΑK�������Ă���
			PRINTW ���̂����Ŗ����������ɗ����Ƃ������ƂȂ̂��낤���H
	ENDSELECT

	MONEY += 200
	CLEARBIT FLAG:999, 10
ENDIF

RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------
;���݂���
@COM_ABLE434
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(434)
	RETURN RESULT
SIF !TFLAG:100
	RETURN 0
;�C��0�ł͕s��
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
;�ΑK���i���݂����̑����������˂Ă���j�łȂ��ƈ����Ȃ�
SIF CFLAG:MASTER:���݈ʒu != �ΑK��
	RETURN 0
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;����
;����n�R�}���h�A���x��1
;-------------------------------------------------
;���K���c�c����
;LOCAL
@COM435
#DIM �K�`����
#DIM �J���X�}����
VARSET LOCAL
�K�`���� = 0
IF !BETWEENTIME(600,1200)
	PRINTFORML �܂��Ă���c�c
	PRINTFORMW �c�Ǝ��ԊO�̂悤��
	RETURN -1
ENDIF
IF !GETBIT(FLAG:999, 2)
	PRINTFORMW �����̕Ћ��ɒ��莆��������
	PRINTFORML ������������������������������
	PRINTFORML �b�@�@�@�@�@�@�@�@�@�@�@�@�@�b
	PRINTFORML �b�@�@�����@�@�@�@�@�@�@�b
	PRINTFORML �b�@�@�@�@�@��^�̔����I�@�@�b
	PRINTFORML �b�@�@�@�@�@�@�@�@�@�@�@�@�@�b
	PRINTFORML �b�@�@�@�@�@�@�@�@�@�@�@�@�@�b
	PRINTFORML �b�@�@�@�@�@�@�@�@�@�@�@�@�@�b
	PRINTFORML �b�@�@�����v�͕ۏ؂��܂��@�@�b
	PRINTFORML �b�@�@�@�@�@�@�@�@�@�@�@�@�@�b
	PRINTFORML �b�@�@�@�@�@�@�@�@���_�Ё@�b
	PRINTFORML ������������������������������
	PRINTFORMW
	PRINTFORML ��`���ɗ��Ă���ł��낤�A�ޏ������i�т͗΁A���R�ł��ȁj�̏������ɂ��₩�ȏΊ�ł���������Ă���
	PRINTFORMW �����āA�����̉��ɂ́u���z�{���v�Ə����ꂽ�����u����Ă���
	PRINTFORML �c
	PRINTFORML �c�c
	PRINTFORMW �Ȃ񂾁A���̌��ȗ\���������Ȃ��قǂɌ��ȗ\���́c

	SETBIT FLAG:999, 2
	;�ŏ��̂����̃Z�b�g���쐬
	CALL FISHER_YATES_SHAFFLE(300)
	ARRAYCOPY "SHAFFLE_ARRAY", "MORIYA_BOX"
ENDIF

IF FLAG:�����f�[�g����
	PRINTFORML �u�����Ȃ�Ĉ����Ă�ꍇ����Ȃ��ł��傤�v
	PRINTFORML �u�_�l�Ƃ̃f�[�g���ł���A�ꕪ��b�����Ė��ʂɂ����Ⴂ���܂����I�v
	RETURN -1
ENDIF

IF MONEY < 3000
	PRINTFORMW ���z���m�F�����炨��������Ȃ�����
	PRINTFORMW �����A���z�{�̂��߂ɂ������W�߂Ă���̂ł�
	RETURN -1
ENDIF

PRINTL ������1��3000�~��20�J���X�}�A�������͎��̎�D5���ł�
PRINTL �ǂ����܂����H
CALL ASK_M("�댯����Ȃ����Ȃ̂ł�߂Ă���",1,"\\3000�ň����Ă݂�", MONEY >= 3000, "20CM�ň����Ă݂�", MONEY:2 >= 20, "��D5���ň���", ITEM:131>= 5, "\\27000��10�A�K�`��", MONEY >= 27000, "180CM��10�A�K�`��", MONEY:2 >= 180)
SELECTCASE RESULT
	CASE 0
		RETURN -1
	CASE 1
		MONEY -= 3000
	CASE 2
		MONEY:2 -= 20
	CASE 3
		ITEM:131 -= 5
	CASE 4
		�K�`���� = 9
		MONEY -= 27000
	CASE 5
		�K�`���� = 9
		MONEY:2 -= 180
ENDSELECT

IF (RESULT == 1 || RESULT == 2) && ITEM:�e���u�J�^���v
	PRINTFORML �e���u�J�^���v���g���H
	CALL ASK_YN
	IF !RESULT
		ITEM:�e���u�J�^���v --
		TFLAG:194 = 5
	ENDIF
ENDIF

$RENZOKU

IF GETBIT(FLAG:999, 3)
	IF MORIYA_BOX:0 == -1
		PRINTFORMW ���݂̂������������������̂ŐV��������p�ӂ��܂�
		CALL FISHER_YATES_SHAFFLE(300)
		ARRAYCOPY "SHAFFLE_ARRAY", "MORIYA_BOX"
	ELSE
		PRINTFORML ���̂���������͊��ɓ��܂��o�Ă��܂�
		PRINTFORML ���̂�������p�����Ă��炢�V���������������܂����H
		PRINTFORML [1] ���̔����o���Ă��炤
		PRINTFORML [0] �܂����̔�������������
		$LOOP_INPUT_2
		INPUT
		SELECTCASE RESULT
			CASE 0
				PRINTW �ł́A���̔���������܂�
			CASE 1
				PRINTW �ł͌������܂���
				CLEARBIT FLAG:999, 3
				CALL FISHER_YATES_SHAFFLE(300)
				ARRAYCOPY "SHAFFLE_ARRAY", "MORIYA_BOX"
			CASEELSE
				GOTO LOOP_INPUT_2
		ENDSELECT
	ENDIF
ENDIF

PRINTL ���������z�{���Ɏ��߁A
PRINTL ���̂Ȃ����炭�����P�������A
PRINTW ��t�̎q�Ɏ�n�����B
PRINTL �c�c
PRINTL �c
CALL FOTUNE_MORIYA
TIME += 2
IF �K�`���� > 0
	PRINTFORMW
	�K�`���� --
	GOTO RENZOKU
ENDIF

RETURN 1

;��J����
@COM_ABLE435
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(435)
	RETURN RESULT
SIF !TFLAG:100
	RETURN 0
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;�C��0�ł͕s��
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
IF MAIN_MAP == 8
	SIF CFLAG:MASTER:���݈ʒu != 813
		RETURN 0
ELSE
	SIF CFLAG:MASTER:���݈ʒu != ���_�Ћ���
		RETURN 0
ENDIF
RETURN 1


code:
;-------------------------------------------------
;�Ǐ�
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM436

PRINTL ����ǂ����H
PRINTL [0]���w [1]���p�� [2]�������Ȗ{
$LOOP
INPUT
IF RESULT == 0
	SELECTCASE RAND:10
		;�E�E
		CASE 0
			TFLAG:193 = 1
		;���s
		CASE 1 TO 3
			TFLAG:193 = 2
		;���w
		CASEELSE
			TFLAG:193 = 3
	ENDSELECT
ELSEIF RESULT == 1
	SELECTCASE RAND:10
		;���s
		CASE 0 TO 2
			TFLAG:193 = 4
		;���p
		CASEELSE
			TFLAG:193 = 5
	ENDSELECT
ELSEIF RESULT == 2
	SELECTCASE RAND:9
		;��������
		CASE 0 TO 2
			TFLAG:193 = 6
		;�ی��̈�
		CASE 3 TO 5
			TFLAG:193 = 7
		;�J�[�}�X�[�g��
		CASE 6 TO 8
			TFLAG:193 = 8
		;��΂��{
;		CASEELSE
;		IF !TALENT:MASTER:�֒f�̒m��
;			TFLAG:193 = 9
;		ELSE
;			GOTO LOOP
;		ENDIF
	ENDSELECT
ELSE
	GOTO LOOP
ENDIF

IF TARGET == 54 && CFLAG:325 == 5
	IF TALENT:����
		PRINTFORM �p�`�����[�ƈꏏ�ɓǏ����y���ނ��Ƃɂ���
	ELSE
		PRINTFORM �p�`�����[�̓Ǐ����I���܂ł�������Ǐ��Ŏ��Ԃ�ׂ����Ƃɂ���
	ENDIF
ENDIF
PRINTFORM %CALLNAME:MASTER%�́A�{�I�ɂ�����
SELECTCASE TFLAG:193
	CASE 1
		PRINT �w�j���W���X���C���[�x
	CASE 2 TO 3
		PRINT ���|��
	CASE 4 TO 5
		PRINT ���p��
	CASE 6
		PRINT �����č����{
	CASE 7
		PRINT �ی��̈�̖{
	CASE 8
		PRINT �w�J�[�}�E�X�[�g���x
;	CASE 9
;		PRINT �^�C�g���̂Ȃ��瑕���̎���C��тт��{
ENDSELECT
PRINTFORML ��ǂ�ł݂�

;3����1�Œǉ��C�x���g
SIF !RAND:3 && TARGET == 54
	TFLAG:194 = 1
;TARGET�����m���g�Ȗ{�ǂ݂���MASTER��TARGET��苳�{������TARGET�̋��{��2�ȏォ�ܕ��̈�
SIF !RAND:5 && TALENT:TARGET:���m && TFLAG:193 >= 6 && TFLAG:193 <= 8 && ABL:MASTER:���{ > ABL:���{ && ABL:���{ >= 2
	TFLAG:194 = 2

SELECTCASE TFLAG:193
	CASE 1
		EXP:MASTER:74 += 5
	CASE 3
	;���w
		EXP:MASTER:75 ++
	CASE 5
	;���p
		SELECTCASE RAND:3
			CASE 0
				EXP:MASTER:71 ++
			CASE 1
				EXP:MASTER:72 ++
			CASE 2
				EXP:MASTER:76 ++
		ENDSELECT
	CASE 6
		CALL RECOVER(MASTER,100,"����")
		CALL RECOVER(MASTER,100,"�u�N")
ENDSELECT

IF TARGET > 0 && CFLAG:�s�� != 5
	;�Œ�Ŋl������\�[�X
	SOURCE:���y = 200
	;�M��
	TFLAG:98 = 3

	;ABL:�]�����݂�
	IF ABL:�]�� <= 1
		SOURCE:���y += (ABL:�]�� * 80)
	ELSEIF ABL:�]�� <= 3
		SOURCE:���y += 300 + (ABL:�]�� * 80)
	ELSEIF ABL:�]�� <= 5
		SOURCE:���y += 700 + (ABL:�]�� * 80)
	ELSEIF ABL:�]�� <= 8
		SOURCE:���y += 950 + (ABL:�]�� * 100)
	ELSEIF ABL:�]�� <= 11
		SOURCE:���y += 1200 + (ABL:�]�� * 90)
	ELSE
		SOURCE:���y += 2000 + (ABL:�]�� * 50)
	ENDIF

	;�D���x���݂�
	IF CFLAG:2 <= 500
		SOURCE:���y += CFLAG:2 * 2
	ELSEIF CFLAG:2 <= 5000
		SOURCE:���y += 1000 + (CFLAG:2 - 500) / 2
	ELSE
		SOURCE:���y += 5000 + (CFLAG:2 - 5000) / 3
	ENDIF
	SIF SOURCE:���y < 0
		SOURCE:���y = 0
ENDIF

DOWNBASE:MASTER:�̗� = 50
DOWNBASE:MASTER:�C�� = 200
TIME += 60
RETURN 1

;-------------------------------------------------
;���s�\����
;-------------------------------------------------
;�Ǐ�
@COM_ABLE436
;���s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(436)
	RETURN RESULT
;�f�[�g����
SIF (CFLAG:���݈ʒu % 100) % 10 && CFLAG:MASTER:���݈ʒu != OMANEKIBEYA()
	RETURN 0
;�Y���Q��
SIF CFLAG:MASTER:�Y���Q��
	RETURN 0
;���ӂӒ�������
SIF CFLAG:MASTER:���ӂ�
	RETURN 0
;�C��0�ł͕s��
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
;�}����
SIF !IS_LIBRARY(CFLAG:MASTER:���݈ʒu)
	RETURN 0
;������
SIF CFLAG:����
	RETURN 0
;���Ԓ�~��
SIF FLAG:70
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�҂�
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM440
DOWNBASE:MASTER:�C�� = 50
;SIF FLAG:70 == 1
	;BASE:MASTER:TSP -= 50
;SIF FLAG:70 != 1
TIME += 20
RETURN 1

;�҂�
@COM_ABLE440
;�V���b�v��ʂł͕s��
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(440)
	RETURN RESULT
;�C��0�ł͕s��
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
;�E�t�t���͕s��
SIF CFLAG:���ӂ�
	RETURN 0
;���_�O���A�����؂̒���(����10�Ŏw��)�A���n���ʂ�A�L��A���̌΁A�|�ѓ�����A�X�̓�����A���L�̓��A�[�̎��C�A��V�̑�A���z�����A���A���R��łȂ���Εs��
SIF !IN_HOME(CFLAG:MASTER:���݈ʒu) && NOSAMES(CFLAG:MASTER:���݈ʒu, 10, ���n���ʂ�, �L��, ���̌�, �|�ѓ����, �X�̓����, ���L�̓�, �[�̎��C, ��V�̑�, ���z����, �ň��ʘH)
	RETURN 0
;���_���͋��_������ȊO�͕s��
SIF IN_HOME(CFLAG:MASTER:���݈ʒu) && !CHK_ENTRANCE(CFLAG:MASTER:���݈ʒu, MAIN_MAP)
	RETURN 0
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;���Ƃ��󂯂�
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM441
DOWNBASE:MASTER:�̗� = 50
DOWNBASE:MASTER:�C�� = 200

IF TARGET > 0 && !CFLAG:����
	;�Œ�Ŋl������\�[�X
	SOURCE:���y = 200

	;�M��
	TFLAG:98 = 3
	SIF ABL:MASTER:���{ > 2
		TFLAG:98 ++
	IF ABL:MASTER:���{ > ABL:���{
		TFLAG:98 ++
		EXP:�w�K�o�� += 2
	ENDIF
	SIF ABL:MASTER:���{ < ABL:���{ - 2
		EXP:MASTER:�w�K�o�� ++
	;ABL:�]�����݂�
	IF ABL:�]�� <= 1
		SOURCE:���y += (ABL:�]�� * 60)
	ELSEIF ABL:�]�� <= 3
		SOURCE:���y += 200 + (ABL:�]�� * 60)
	ELSEIF ABL:�]�� <= 5
		SOURCE:���y += 500 + (ABL:�]�� * 60)
	ELSEIF ABL:�]�� <= 8
		SOURCE:���y += 750 + (ABL:�]�� * 75)
	ELSEIF ABL:�]�� <= 11
		SOURCE:���y += 1000 + (ABL:�]�� * 75)
	ELSE
		SOURCE:���y += 2000 + (ABL:�]�� * 30)
	ENDIF

;���Ƃ��󂯂���񐔂��J�E���g
SIF CFLAG:���݈ʒu == ���q�� && CFLAG:67:�s�� == 5
	TCVAR:67:����C�x���g ++

	;�D���x���݂�
	IF CFLAG:2 <= 500
		SOURCE:���y += CFLAG:2
	ELSEIF CFLAG:2 <= 5000
		SOURCE:���y += 500 + (CFLAG:2 - 500) / 3
	ELSE
		SOURCE:���y += 2000 + (CFLAG:2 - 5000) / 5
	ENDIF
	SIF SOURCE:���y < 0
		SOURCE:���y = 0
	EXP:MASTER:�w�K�o�� ++
	EXP:�w�K�o�� ++
ENDIF

TIME += 60
EXP:MASTER:�w�K�o�� ++
SIF ITEM:103 && !RAND:2
	EXP:MASTER:�w�K�o�� ++
RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------
;���Ƃ��󂯂�
@COM_ABLE441
;�|�����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(441)
	RETURN RESULT
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;���q���ȊO�s��
SIF CFLAG:MASTER:���݈ʒu != 240
	RETURN 0
;�d���̋��鏊
SIF CFLAG:MASTER:���݈ʒu != CFLAG:67:���݈ʒu
	RETURN 0
;�d�����ȊO�s��
SIF CFLAG:�s�� != 5
	RETURN 0
;�����x�ݒ��͕s��
SIF TIME >= 720 && TIME <= 780
	RETURN 0
;���Ǝ��Ԍ�͕s��
SIF TIME >= 840
	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
SIF CFLAG:���ӂ� == 2
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�ŗL�R�}���h
;����n�R�}���h�A���x��X
;-------------------------------------------------
@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�g%STR:(5000 + GET_MAPID(CFLAG:TMP_ID:���݈ʒu))%�h�̎��ӂɂ���悤���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���ׂ��ꏊ�́g%STR:(5000 + GET_MAPID(TMP_ID))%�h���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%STR:(5000 + 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�𒼂��Ă������
IF ITEM:��ꂽ�P
	PRINTFORMW �u�����Ƒ厖�Ɏg���Ă����Ă�v
	DOWNBASE:�C�� = 200
	SOURCE:���y += 1000
	ITEM:��ꂽ�P = 0
	ITEM:�܂��ݎP = 1
	TIME += 45
ELSE
	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
ENDIF
TIME += 30

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

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

IF BASE:MASTER:�C�� < 500 || BASE:TARGET:�C�� < 500
	PRINTFORML ����ȋC�͂͂Ȃ�\@ BASE:TARGET:�C�� < 500 ? �悤�� #  \@�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���[�̓{�����g���ă_�C�X�̏o�ڂ��v���X�ł���̂ŁA�������Ƃ�����ʂŎg���܂��傤�B
		PRINTFORMW �������A�c�@������ƃ{���g�p�񐔂�1�ɂȂ�̂ŁA�g��Ȃ��܂܎c�@�����炷�̂͑��ɂȂ�܂��B
		GOTO INPUT_LOOP
ENDSELECT

;�䎌�E�I�����͗H��������ɋL�q�A���オ�Ȃ��ꍇ�͓q���⏟����V�͖���
TRYCALLFORM M_KOJO_MESSAGE_COM_K{TARGET}_DANMAKU("�퓬�O", 0)
IF RESULT == 0
	RETURN -1
;����q����
ELSEIF RESULT == 1
	�C���l�␳ = 1
ELSE
	�C���l�␳ = 0
ENDIF

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

PRINTFORMW �����J�n�I�I
CALL DANMAKU_BATTLE(�C���l�␳)
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
	TRYCALLFORM M_KOJO_MESSAGE_COM_K{TARGET}_DANMAKU("�s�k��", 0)
	PRINTL
	TRYCALLFORM M_KOJO_MESSAGE_COM_K{TARGET}_DANMAKU("�s�k��", 1)
ELSEIF LOCAL > 0
	;����q�����̂݌��゠��
	TRYCALLFORM M_KOJO_MESSAGE_COM_K{TARGET}_DANMAKU("�s�k��", 2)
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(ARG:0)
#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
#DIM �v���C���[�C���l
#DIM ����C���l

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

WHILE �v���C���[�c�@ > 0 && ����c�@ > 0
	;�_�C�X���v�Z
	�v���C���[�_�C�X�� = ABL:MASTER:�퓬�\�� + RAND:5 - 1
	����_�C�X�� = ABL:TARGET:�퓬�\�� + RAND:4 + 1
	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) * (9 + RAND:4) + RAND:7 - (����c�@ - 1) * ABL:TARGET:�퓬�\��
	;�C���l�v�Z
	IF (ABL:TARGET:�퓬�\�� - ABL:MASTER:�퓬�\��) > 0
		�v���C���[�C���l = (ABL:TARGET:�퓬�\�� - ABL:MASTER:�퓬�\�� + RAND:3) * ABL:TARGET:�퓬�\�� + RAND:7
		����C���l = (ABL:MASTER:�퓬�\�� - ABL:TARGET:�퓬�\��) * ABL:TARGET:�퓬�\�� - RAND:7
	ELSEIF (ABL:TARGET:�퓬�\�� - ABL:MASTER:�퓬�\��) < 0
		�v���C���[�C���l = (ABL:TARGET:�퓬�\�� - ABL:MASTER:�퓬�\��) * ABL:MASTER:�퓬�\�� - RAND:7
		����C���l = (ABL:MASTER:�퓬�\�� - ABL:TARGET:�퓬�\�� + RAND:3) * ABL:MASTER:�퓬�\�� + RAND:7
	ELSE
		�v���C���[�C���l = 0
		����C���l = 0
	ENDIF
	;����q�����C���l��傫���}�C�i�X
	SIF ARG:0 == 1
		�v���C���[�C���l -= ABL:MASTER:�퓬�\�� * (5 + RAND:6)

	PRINTL
	PRINTFORML -----------------------------------------------------
	PRINTFORML TURN:{�^�[����}
	PRINTFORML -----------------------------------------------------
	PRINTL

	CALL DICE_PRINT(�v���C���[�_�C�X��, �v���C���[�_�C�X��, �v���C���[�C���l, ����_�C�X��, ����_�C�X��, ����C���l, "�m��O")
	PRINTFORMW �^���̃_�C�X���[���I�I
	IF ARG:0 == 1
		SETCOLOR C_RED
		PRINTDATAL
			DATAFORM �ꕨ�����̑��݂��咣���Ă��邹���œ����Â炢�c�c
			DATAFORM �H����������ɋ����������A�������Ă��邹���ŏW���ł��Ȃ��c�c
			DATAFORM �������C��邾���ŃC�������ɂȂ�c�c
		ENDDATA
		RESETCOLOR
	ENDIF

	;�_�C�X�l�v�Z
	�v���C���[�_�C�X�l = DICE_VALUE(�v���C���[�_�C�X��, �v���C���[�_�C�X��, �v���C���[�C���l)
	����_�C�X�l = DICE_VALUE(����_�C�X��, ����_�C�X��, ����C���l)
	LOCAL = ����_�C�X�l - �v���C���[�_�C�X�l

	CALL DICE_PRINT(�v���C���[�_�C�X�l, 0, 0, ����_�C�X��, ����_�C�X��, ����C���l, "�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, 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:�̗�
				�c��{���� = 1
				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:�퓬�\�� + RAND:3) * (5 + RAND:3)
						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, 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:�̗�
				�c��{���� = 1
				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, ARG:4, ARG:5, ARGS)
IF ARGS == "�m��O"
	PRINTFORM %CALLNAME:MASTER%:
	SETCOLOR C_GREEN
	PRINTFORM {ARG:0}d{ARG:1}
	IF ARG:2 > 0
		SETCOLOR C_RED
		PRINTFORM +{ARG:2}
	ELSEIF ARG:2 < 0
		SETCOLOR C_BLUE
		PRINTFORM {ARG:2}
	ENDIF
	RESETCOLOR
	PRINTFORM (Min:{ARG:0 + ARG:2}, Max:{ARG:0 * ARG:1 + ARG:2})  VS
	SETCOLOR C_GREEN
	PRINTFORM {ARG:3}d{ARG:4}
	IF ARG:5 > 0
		SETCOLOR C_RED
		PRINTFORM +{ARG:5}
	ELSEIF ARG:5 < 0
		SETCOLOR C_BLUE
		PRINTFORM {ARG:5}
	ENDIF
	RESETCOLOR
	PRINTFORM (Min:{ARG:3 + ARG:5}, Max:{ARG:3 * ARG:4 + ARG:5})
	PRINTFORML :%CALLNAME:TARGET%
;ARG:1,2�͎g��Ȃ�
ELSEIF ARGS == "�m���"
	PRINTFORM %CALLNAME:MASTER%:
	SETCOLOR C_GREEN
	PRINTFORM {ARG:0}
	RESETCOLOR
	PRINTFORM VS
	SETCOLOR C_GREEN
	PRINTFORM {ARG:3}d{ARG:4}
	IF ARG:5 > 0
		SETCOLOR C_RED
		PRINTFORM +{ARG:5}
	ELSEIF ARG:5 < 0
		SETCOLOR C_BLUE
		PRINTFORM {ARG:5}
	ENDIF
	RESETCOLOR
	PRINTFORM (Min:{ARG:3 + ARG:5}, Max:{ARG:3 * ARG:4 + ARG:5})
	PRINTFORML :%CALLNAME:TARGET%
;ARG:2,3,4,5�͎g��Ȃ�
ELSEIF ARGS == "����"
	PRINTFORM %CALLNAME:MASTER%:
	SETCOLOR C_GREEN
	PRINTFORM {ARG:0}
	RESETCOLOR
	PRINTFORM VS
	SETCOLOR C_GREEN
	PRINTFORM {ARG:1}
	RESETCOLOR
	PRINTFORML :%CALLNAME:TARGET%
ENDIF

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

RETURNF LOCAL:1 + ARG:2


code:
;-------------------------------------------------
;���̎q�𕨐F
;����n�R�}���h�A���x��1
;-------------------------------------------------

@COM444
#DIMS YUKIZURI_RACE  ;��������MOB���̎��
IF FLAG:�f�[�g����
	PRINTFORMW �������������������ׂɂ���
	RETURN -1
ENDIF

$BUSSYOKU
IF !FLAG:70
	TIME += 10
ELSE
	BASE:MASTER:TSP -= 10
ENDIF
PRINTFORML %CALLNAME:MASTER%�͉����������Ȃ������F����
PRINTFORMW �c�c���̎q�͂ǂ����낤�H
YUKIZURI_RACE '= TEXTR("����/�l��")
;PRINTFORMW %YUKIZURI_RACE%
CALL MAKE_YUKIZURI(RANDOM_CHARANUM, YUKIZURI_RACE)
CALL CHARA_STATE(RANDOM_CHARANUM)
CALL ASK_M("�C�ɂȂ�",1,"�ʂ̖���T��",1,"���F���~",1)
IF RESULT == 2
	CFLAG:RANDOM_CHARANUM:���݈ʒu = SUKIMA()
	CFLAG:RANDOM_CHARANUM:���ւ����s = 0
	CFLAG:RANDOM_CHARANUM:�o�� = 2
	SIF TARGET == RANDOM_CHARANUM
		TARGET = 0
	RETURN -1
ENDIF
SIF RESULT == 1
	GOTO BUSSYOKU
CFLAG:RANDOM_CHARANUM:���݈ʒu = CFLAG:MASTER:���݈ʒu
IF CFLAG:MASTER:���݈ʒu / 100 == MAIN_MAP
	CFLAG:RANDOM_CHARANUM:�f�[�g�� = CFLAG:MASTER:���݈ʒu / 100
	CFLAG:RANDOM_CHARANUM:���_���K = 1
ELSE
	CFLAG:RANDOM_CHARANUM:�����ʒu = CFLAG:MASTER:���݈ʒu
ENDIF

TARGET = RANDOM_CHARANUM
RETURN 1

@COM_ABLE444
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(622)
	RETURN RESULT
SIF !CAN_NANPA()
	RETURN 0
SIF !INRANGE(TIME,540,1140)
	RETURN 0
SIF !CFLAG:RANDOM_CHARANUM:�o��
	RETURN 0
RETURN 1

@MAKE_YUKIZURI(ARG, ARGS)
#DIM DBB

DELCHARA ARG
ADDCHARA ARG
CALL �����_���f���t�^(ARG, ARGS)

;�C�́A�̗�
CALLNAME:ARG = %�����_���L����_����()%
NAME:ARG = %CALLNAME:ARG%
MAXBASE:ARG:0 += RAND:(RANDOM_BASE:0) + RAND:(RANDOM_BASE:0)
MAXBASE:ARG:1 += RAND:(RANDOM_BASE:1) + RAND:(RANDOM_BASE:1)

FOR LOCAL,0,20
	BASE:ARG:LOCAL = MAXBASE:ARG:LOCAL
NEXT
BASE:ARG:���C = 0
BASE:ARG:���[�h = 0
BASE:ARG:�{�� = 0
BASE:ARG:�u�N = 0
IF TALENT:ARG:���� == 3
	MAXBASE:ARG:���� = 500
	BASE:ARG:���� = 500
	MAXBASE:ARG:�u�N = 1500
ENDIF

DBB = TFLAG:�K�^�␳ * 3
;DBB=Dosukebe Body Bonus
;�j�����Ȃǂ̖ʓ|�ȑf���������ꍇ�q�������₷���Ȃ�

SIF TALENT:ARG:���֐S
	DBB += 5
SIF TALENT:ARG:�v���C�h > 0
	DBB += 5
SIF TALENT:ARG:�����S
	DBB += 5
SIF TALENT:ARG:����z���Ȃ�
	DBB += 10
SIF TALENT:ARG:��R
	DBB += 15
SIF TALENT:ARG:���Ȉ� < 0
	DBB += 15
SIF OTOKOGIRAI(ARG)
	DBB += 20

;���x�ݒ�
FOR LOCAL,101,105
	LOCAL:1 = RAND:(100 + DBB)
	IF LOCAL:1 > 90
		TALENT:ARG:LOCAL = 1
	ELSEIF LOCAL:1 < 10
		TALENT:ARG:LOCAL = -1
	ENDIF
NEXT
CALL �����_���o���\�͕t�^(ARG, ARGS)
;�g�̑�������ꂽ�����ǂ߂�ǂ�����p�X

;�@���͕ʂɂ������Ȃ�

;�����Ńt���[�o�[�e�L�X�g��ǉ��ł��܂�
;�d��
;CSTR:ARG:1 = �h�g�Ƀ^���|�|���悹��
CSTR:ARG:1 '= TEXTR("�h�g�Ƀ^���|�|���悹��/�����t/���ٓ��̔���/�Ђ悱�Ӓ�m/�n���̃p���c�E�l/���[�^�[�͔|�_��/�d���̊����牖�����/�Ԃ̖��̗d�����獻�������")
SIF ARGS == "�l��" && !RAND:3
	CSTR:ARG:1 '= "��Ǝ�w"

;����Ɣ\��
;CSTR:ARG:10 = �@����X�p�Q�b�e�B��H�ׂ���x�̔\��
;���p�U�𐅂Ȃ��ň��ޒ��x�̔\��
;�݂�񊱂����ł������Ă����x�̔\��
;��Ɏh����Ă��~�����ɉ䖝������x�̔\��

;CSTR:10/11�̓V�X�e�����Ŏg�p���Ă��邽�ߑ�������͊댯
;CSTR:12���g�p�̍��Ղ��������i�d�l�ύX�Ŏg���Ă��Ȃ��j���ߔ������ق�������
;�ʏ�L�����̃L�����Љ��CSV�Q�Ƃ������͌���֐��Q�Ƃōs���Ă��܂�
;�Ƃ肠����CSTR:15���g����I
CSTR:ARG:15 '= TEXTR("�@����X�p�Q�b�e�B��H�ׂ�/�����������ƂȂ��Ă����؂�/10�b�Ŗ���ɗ�����/�]��ł������Ȃ�/���󕨂������������/�~�J��5���O�Ɏ@�m����/�����ď��������Ȃ�/����������ɐςݏグ��/�_�����łŖ{���J��/�f�˂����炽���ɕς���/�v�����܂܂ɗ܂𗬂�") + "���x�̔\��"
SIF TALENT:ARG:���g�I && !RAND:3
	CSTR:ARG:15 '= "���ꂽ����ɐs�������x�̔\��"

;�߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁�
; �L�����N�^�[�̑f���̕t�^�m���ݒ�
;�߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁߁�
@�����_���f���t�^(ARG,ARGS)
#DIM �ߑ��ύX
�ߑ��ύX = 0
;�^�C�v�ʂɎ擾�f���̌X�����ς��Ƃ����������ǂ߂�ǂ�
;�L�u�Ɋ���
SELECTCASE ARGS
	CASE "�l��"
	;�ł͎����ɁA�o���͖�����ł�
		;�C�̗͑�
		RANDOM_BASE:0 = 250
		RANDOM_BASE:1 = 250
		;RANDOM_TALENT_RATE��1�|�C���g0.1���̕t�^�m���ƍl����΂悵
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "����"))         = 1000
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "����"))         = 0
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "�L�X���o��"))   = 0
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "���m"))         = 0
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "�c���f��"))     = 80
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "���֐S"))       = 0
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "�����S"))       = 500
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "����R����"))   = 0
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "����z���Ȃ�")) = 300
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "�ڗ���������")) = 100
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "��R"))         = 100
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "���Ԃ��₷��")) = 200
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "���g�I"))       = 600
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "���ł��₷��")) = 300
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "�|���I"))       = 0
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "�T�h"))         = 0
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "�}�]"))         = 100
		;�v���}�C������n
		CALL SET_BIASED_TALENT(ARG, "�x��",       -1, 200, 1, 50)
		CALL SET_BIASED_TALENT(ARG, "�ԓx",       -1, 200, 1, 50)
		CALL SET_BIASED_TALENT(ARG, "����",       -1, 200, 1, 50)
		CALL SET_BIASED_TALENT(ARG, "���I����",   -1, 100, 1, 120)
		CALL SET_BIASED_TALENT(ARG, "�z�C�^�A�C", -1, 100, 1, 200)
		CALL SET_BIASED_TALENT(ARG, "�v���C�h",   -1, 200, 1, 50)
		CALL SET_BIASED_TALENT(ARG, "㵒p�S",     -1, 100, 1, 120)
		CALL SET_BIASED_TALENT(ARG, "�Ɋo",       -1, 100)
		CALL SET_BIASED_TALENT(ARG, "�G��₷��", -1, 0,   1, 200)
		CALL SET_BIASED_TALENT(ARG, "�K�����x",   -1, 0,   1, 100)
		CALL SET_BIASED_TALENT(ARG, "��������",   -1, 50,  1, 150)
		CALL SET_BIASED_TALENT(ARG, "�呀",       -1, 100, 1, 120)
		CALL SET_BIASED_TALENT(ARG, "���Ȉ�",     -1, 100, 1, 100)

		;�͈͂�;-1~1�𒴂���ʓ|�������z
		CALL SET_BIASED_TALENT(ARG, "���L�ϐ�",     -2,  50, -1, 100, 1, 100, 2, 50)
		CALL SET_BIASED_TALENT(ARG, "���ʚn�D",     -1, 100,  1,  50, 2,  50)
		CALL SET_BIASED_TALENT(ARG, "�̌^",         -2,  10, -1,  60, 0, 120, 1, 90, 2, 30)
		CALL SET_BIASED_TALENT(ARG, "�o�X�g�T�C�Y", -2,  60, -1,  90, 0, 120, 1, 90, 2, 30)

		TALENT:ARG:�l�� = 1
		;���������_�}�C�Y
		SELECTCASE RAND:10
			CASE 0
				;�����Z�b�g
				�ߑ��ύX = 4
			CASE 1,2
				;���w���Z�b�g
				�ߑ��ύX = 10
			CASE 3,4
				;�����Z�b�g
				�ߑ��ύX = 2
		ENDSELECT
	CASE "����"
	;����f���͂����S�̓I�ɂ����߂��R���Z�v�g
		;�C�̗͑�
		RANDOM_BASE:0 = 250
		RANDOM_BASE:1 = 250
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "����")) = 1000
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "����")) = 850
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "�L�X���o��")) = 700
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "���m")) = 50
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "�c���f��")) = 80
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "���֐S")) = 0
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "�����S")) = 80
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "����R����")) = 0
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "����z���Ȃ�")) = 0
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "�ڗ���������")) = 150
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "��R")) = 0
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "���Ԃ��₷��")) = 200
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "���g�I")) = 50
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "���ł��₷��")) = 0
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "�|���I")) = 0
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "�T�h")) = 0
		RANDOM_TALENT_RATE:(GETNUM(TALENT, "�}�]")) = 0
		;�v���}�C������n
		CALL SET_BIASED_TALENT(ARG, "�x��",       -1, 200, 1, 50)
		CALL SET_BIASED_TALENT(ARG, "�ԓx",       -1, 200, 1, 50)
		CALL SET_BIASED_TALENT(ARG, "����",       -1, 200, 1, 50)
		CALL SET_BIASED_TALENT(ARG, "���I����",   -1, 100, 1, 100)
		CALL SET_BIASED_TALENT(ARG, "�z�C�^�A�C", -1, 100, 1, 300)
		CALL SET_BIASED_TALENT(ARG, "�v���C�h",   -1, 200, 1, 50)
		CALL SET_BIASED_TALENT(ARG, "㵒p�S",     -1, 100, 1, 100)
		CALL SET_BIASED_TALENT(ARG, "�Ɋo",       -1, 100)
		CALL SET_BIASED_TALENT(ARG, "�G��₷��", -1, 0,   1, 200)
		CALL SET_BIASED_TALENT(ARG, "�K�����x",   -1, 0,   1, 100)
		CALL SET_BIASED_TALENT(ARG, "��������",   -1, 50,  1, 150)
		CALL SET_BIASED_TALENT(ARG, "�呀",       -1, 100, 1, 100)
		CALL SET_BIASED_TALENT(ARG, "���Ȉ�",     -1, 0,   1, 100)

		;�͈͂�;-1~1�𒴂���ʓ|�������z
		CALL SET_BIASED_TALENT(ARG, "���L�ϐ�",     -2, 50,  -1, 100, 1, 100, 2, 50)
		CALL SET_BIASED_TALENT(ARG, "���ʚn�D",     -1, 100,  1,  50, 2,  50)
		CALL SET_BIASED_TALENT(ARG, "�̌^",         -2, 100, -1, 250, 1, 100)
		CALL SET_BIASED_TALENT(ARG, "�o�X�g�T�C�Y", -2, 100, -1, 250, 1, 150)

		TALENT:ARG:�l�� = 1
		;���������_�}�C�Y
		SELECTCASE RAND:10
			CASE 0
				;�����Z�b�g
				�ߑ��ύX = 4
			CASE 1,2
				;���w���Z�b�g
				�ߑ��ύX = 10
			CASE 3,4
				;�����Z�b�g
				�ߑ��ύX = 2
		ENDSELECT
ENDSELECT

FOR LOCAL,0,180
	SIF !RANDOM_TALENT_RATE:LOCAL
		CONTINUE
	SIF RAND:1000 <= RANDOM_TALENT_RATE:LOCAL
		TALENT:ARG:LOCAL = 1
NEXT
;�����t���O
TEQUIP:ARG:50 = -1
TEQUIP:ARG:51 = -1
TCVAR:ARG:100 = -1
TCVAR:ARG:101 = -1
;���o���\���p�t���O
TCVAR:ARG:103 = -1
TCVAR:ARG:105 = -1
CFLAG:ARG:�o�� = 0

SIF !TALENT:ARG:�c�t
	CFLAG:ARG:�������� = RAND:9 + 1

CFLAG:ARG:���u��p�^�[�� = RAND:MOB_FACETYPES + 1

CALL SELECT_CLOTHES(ARG, "�����̈ߑ�")
SIF �ߑ��ύX
	CALL CTRL_CLOTHES_SET(ARG, "���i���̕ύX_�ߑ��Z�b�g", �ߑ��ύX)
CALL CTRL_CLOTHES_SET(ARG, "���݈ߑ��̕ύX_���i��")
CALL CLOTHES_SETTING_TRAIN(ARG)

SETBIT CFLAG:ARG:���ւ����s, 0

@�����_���o���\�͕t�^(ARG, ARGS)

ABL:ARG:�b���o = RAND:(2 + TALENT:ARG:���Ԃ��₷��)
ABL:ARG:�a���o = RAND:(2 + TALENT:ARG:���Ԃ��₷��)
ABL:ARG:�`���o = RAND:(1 + TALENT:ARG:���Ԃ��₷��)
ABL:ARG:�u���o = RAND:2
ABL:ARG:�l���o = RAND:(2 - TALENT:ARG:�L�X���o��)
ABL:ARG:�~�] = RAND:2
IF !TALENT:ARG:����
	ABL:ARG:�u���o += 1
	ABL:ARG:�~�] += 1
ENDIF
CFLAG:ARG:���܂��Ă�x = RAND:(ABL:ARG:�~�] * 50 + 100) + RAND:(ABL:ARG:�~�] * 50 + 100)

;----------------------------------------------------------------------------------------
;BIASED_RANDOM���g�p���ė��U�I�Ȑ��l��TALENT��ݒ肷���֐�
;----------------------------------------------------------------------------------------
@SET_BIASED_TALENT(C_ID, TAL_NAME, ���:1, �m��:1, ���:2, �m��:2, ���:3, �m��:3, ���:4, �m��:4, ���:5, �m��:5)
#DIM  C_ID
#DIMS TAL_NAME
#DIM  ���,6
#DIM  �m��,6
CALL BIASED_RANDOM(���:1, �m��:1, ���:2, �m��:2, ���:3, �m��:3, ���:4, �m��:4, ���:5, �m��:5)
TALENT:C_ID:TAL_NAME = RESULT

;----------------------------------------------------------------------------------------
;���Ɗm��������ƃ����_���Ő�����Ԃ���
;���Ƃ���BIASED_RANDOM(1, 100, 2, 50, 3, 200, 10, 10)����
;100/1000��1, 50/1000��2, 200/1000��3, 10/1000��10���Ԃ��Ă����
;----------------------------------------------------------------------------------------
@BIASED_RANDOM(���:1,�m��:1,���:2,�m��:2,���:3,�m��:3,���:4,�m��:4,���:5,�m��:5)

#DIM ���,6
#DIM �m��,6
CALL FISHER_YATES_SHAFFLE(6)
FOR LOCAL:1, 0 , 6
	LOCAL = SHAFFLE_ARRAY:(LOCAL:1)
	SIF !���:LOCAL
		CONTINUE
	SIF �m��:LOCAL > RAND:1000
		RETURN ���:LOCAL
NEXT
RETURN 0

@CAN_NANPA()
#FUNCTION

IF CFLAG:MASTER:���݈ʒu / 100 == MAIN_MAP
	SELECTCASE CFLAG:MASTER:���݈ʒu
		CASE 202
			RETURNF 1
	ENDSELECT
ELSE
	SELECTCASE CFLAG:MASTER:���݈ʒu
		CASE 210
			RETURNF 1
	ENDSELECT
ENDIF
RETURNF 0

[SKIPSTART]
�ϑz���Ă邾��������C�ɂ����
���Ԃ�MAKE_YUKIZURI(ARG,ARGS)�����z�肵�Ă邾�낤���A
ARGS�Ƃ���MOB���̎��ARGS��n�����ƂŊe��푰�����邱�Ƃ��ł���

@RAND_NAPNA_TARGET(SPOT_ID)
#FUNCTIONS
#DIM  P_ID
IF GET_MAPID(P_ID) == MAIN_MAP
	SELECTCASE P_ID
	CASE 202, 803
	;�l���͐l�Ԃ��d����瑽�푰���[���H
	;�����w�A�l�͑�����
		RETURNF TEXTR("����/�l��/�H��/�d����/�d�����C�h/���u�C�i�o/�d����/���@�g��/�V��/�͓�/�S")
	CASE 121
	;��n�A�H��Ɨd���A�����Ƃ����Ɩʔ������������Ԃ�ݒ肷��͖̂ʓ|�H�H�H
		RETURNF TEXTR("�H��/�d����")
	CASE 309, 323
	;�g����
		RETURNF "�d�����C�h"
	CASE 403
	;�i����
		RETURNF "���u�C�i�o"
	CASE 433
	;�|��
		RETURNF "�d����"
	CASE 438
	;���z��
		RETURNF "�d����"
	CASE 508
	;���@�̐X�L��A���@�g��
		RETURNF "���@�g��"
	;�d���̎R�֘A�͂��Ǝv������
	;�[�͗d���Ɖ͓����낤���H

	CASE 814
	;�ΔȁA�V��H
		RETURNF "�V��"
	CASE 931
	;���s��ʂ�A�S��d���Ȃ�
		RETURNF TEXTR("�S/�d����")

	;���Ƃ��Ȃ��͕̂t�r�_��V�l�A��l�A���_�A�_�Ȃ�
	ENDSELECT
ELSE
	SELECTCASE P_ID
	CASE 210
	ENDSELECT
ENDIF

[SKIPEND]


code:
;-------------------------------------------------
;�𒎂̗l�q������
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM450
#DIM ������
;FLAG:�� ���̎�ށA50������Ǝ��̃A�C�e���ԍ�

VARSET LOCAL

PRINTFORML %CALLNAME:MASTER%�͎𒎂̓����Ă���r��`������
PRINTFORML �r��%STR:(7000 + FLAG:��)%�Ŗ�������Ă���c
DRAWLINE
PRINTFORML [0] �������Ȃ�
IF TFLAG:������
	PRINTFORML [1] %STR:(TFLAG:������ + 7000)%�Ɠ���ւ���
ELSE
	PRINTPLAIN [1] �ւ��̐��������ɂ��ݏo���킯�ɂ͂����Ȃ�
	PRINTL
ENDIF
SIF ITEM:�ǂԂ낭 >= 5 && FLAG:�� == 1 && DAY:10 < 3
	PRINTFORML [2] �ǂԂ낭�𑫂��i�ǂԂ낭��5����j
;����ȏ��������Ă����g���ω����Ȃ��ꍇ�͕\�������Ȃ��悤��
SIF BASE:MASTER:8 >= 2400 && (FLAG:�� < 51 || FLAG:�� == 51)
	PRINTFORML [3] ���ԑ���𑢁iTSP2400����j
INPUT
IF RESULT == 1 && TFLAG:������
	PRINTFORML %CALLNAME:MASTER%��%STR:(7000 + FLAG:��)%�����ݏo����%STR:(TFLAG:������ + 7000)%�Ɠ���ւ���
	;�����ł��Ă��ꍇ
	IF FLAG:�� > 50
		������ = �����ł�����(FLAG:��)
		PRINTFORML %ITEMNAME:(FLAG:��)%��{������}��ɓ��ꂽ
		ITEM:(FLAG:��) += ������
	ENDIF
	DAY:10 = 0
	FLAG:�� = TFLAG:������
	TFLAG:������ = 0
ELSEIF RESULT == 2 && ITEM:�ǂԂ낭 >= 5 && FLAG:�� == 1 && DAY:10 < 3
	PRINTFORML %CALLNAME:MASTER%�͕r�ɂǂԂ낭�𒍂�����
	PRINTFORML ����ŏ��������ł���͂����c
	DAY:10 += 3
	ITEM:�ǂԂ낭-= 5
;����ȏ��������Ă����g���ω����Ȃ��ꍇ�͕\�������Ȃ��悤��
ELSEIF RESULT == 3 && BASE:MASTER:8 >= 2400 && (FLAG:�� < 51 || FLAG:�� == 51)
	PRINTFORML %CALLNAME:MASTER%�͎��Ԓ�~�\�͂����p���ċ����ɕr�̒��̎���i�߂�
	DAY:10 += 1
	BASE:MASTER:8 -= 2400
ELSE
	RETURN -1
ENDIF
TIME += 5
RETURN 1

;�𒎂̗l�q������
@COM_ABLE450
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;�ړ����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(450)
	RETURN RESULT
;�䏊
SIF CFLAG:MASTER:���݈ʒu != ���__��
	RETURN 0
SIF CFLAG:���ӂ�
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;���_�Ђֈړ�
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM464
#DIM FEE
VARSET LOCAL
FEE = 0
FOR LOCAL,1,CHARANUM
	IF CFLAG:(LOCAL):���s
		LOCAL:1 ++
		SIF CFLAG:LOCAL:���� || BASE:LOCAL:�C�� == 0
			LOCAL:2 ++
		SIF !CHARA_HOLIDAY(LOCAL) && BASE:LOCAL:�d����
			LOCAL:3 ++
	ENDIF
NEXT
IF NEMUKE() >= 720
	PRINTL ���C������̂ŁA�o�|���Ȃ������ǂ��ł��傤
	RETURN -1
ELSEIF LOCAL:1 > 1
	PRINTL ��l�ȏ�A��ďo�|���邱�Ƃo���܂���
	RETURN -1
ELSEIF LOCAL:2 || BASE:MASTER:�C�� == 0
	PRINTFORML �̒��s�ǂ̂��ߏo�|���邱�Ƃo���܂���\@ BASE:MASTER:�C�� == 0 ? �i�C�̓[���j # �i���s�҂��̒��s�ǁj\@
	RETURN -1
ELSEIF LOCAL:3 && FESTIVAL() == ""
	PRINTL ���s�҂��d�����̂��ߏo�|���邱�Ƃo���܂���
	RETURN -1
ELSEIF TIME:5 == 9 || TIME:5 == 5
	PRINTL ���V��̂��ߏo�|���邱�Ƃo���܂���
	RETURN -1
ELSEIF TALENT:MASTER:100 < -4
	PRINTL ���̐g�̂ŏo�|����̂͊댯��
	RETURN -1
ENDIF
SELECTCASE CFLAG:MASTER:���݈ʒu
	CASE 205, 803
		IF !INRANGE(TIME, 540, 1020)
			PRINTFORML �c�Ǝ��ԊO��
			RETURN -1
		ENDIF
		IF CFLAG:MASTER:���s
			FEE = 10
		ELSE
			FEE = 5
		ENDIF
		;���肪�S���V�炾�ƈ��z�΂�
		IF GROUPMATCH(TARGET, 10, 29, 42, 64, 65)
			PRINTFORML �u����͂����%CALLNAME:TARGET%����A�����p�ł����H�v
			PRINTFORML %CALLNAME:TARGET%�̎p��F�߂���t�͓��͈��z�΂��𕂂��ׂ�
		ELSE
			PRINTFORML �u�c�c���H������肽���́H�@{FEE}�J���X�}�B\\{FEE * 200}�ł�������v
		ENDIF
		CALL PAY_YEN_OR_CM(FEE * 200, FEE)
		SELECTCASE RESULT
			CASE 0
				RETURN -1
			CASE 1
				PRINTFORML �u�܂��ǁv
			CASE 2
				PRINTFORML �u�ց[�A���q����l�ԂȂ̂ɃJ���X�}�����Ă�񂾁H�����ˁv
		ENDSELECT
ENDSELECT
LOCAL:2 = 0
LOCALS = %STR:(6000 + SPECIAL_AREAMOVE() / 10)%
FOR LOCAL,1,CHARANUM
	IF CFLAG:(LOCAL):���s
		CFLAG:LOCAL:�f�[�g�� = SPECIAL_AREAMOVE() / 100
		CFLAG:LOCAL:���݈ʒu = SPECIAL_AREAMOVE()
		LOCAL:2 = LOCAL
		FLAG:�f�[�g���� = LOCAL
	ENDIF
NEXT
CFLAG:MASTER:�f�[�g�� = SPECIAL_AREAMOVE() / 100
CFLAG:MASTER:���݈ʒu = SPECIAL_AREAMOVE()

IF CFLAG:MASTER:�f�[�g�� == 2
	CALL EX_COSTUME(FLAG:�f�[�g����, "�l���f�[�g")
	SIF RESULT
		PRINTFORMW %CALLNAME:(FLAG:�f�[�g����)%�͐l�������̕��ɒ��ւ��܂���
ENDIF
PRINTFORML %LOCALS%�֏o�����܂�
TIME += SPECIAL_AREAMOVE_TIME()

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE464
;��~���͕s��
SIF FLAG:70
	RETURN 0
SIF !TFLAG:100
	RETURN 0
SIF HALFWAY()
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(464)
	RETURN RESULT
;������
SIF CFLAG:����
	RETURN 0
;�Y���Q��
SIF CFLAG:�Y���Q��
	RETURN 0
SIF !SPECIAL_AREAMOVE()
	RETURN 0
SIF CFLAG:���ӂ�
	RETURN 0
RETURN 1

;-------------------------------------------------
@SPECIAL_AREAMOVE()
#FUNCTION
SELECTCASE CFLAG:MASTER:���݈ʒu
;����_�Ў���
	CASE 21
	;���L�����Ɠ��s��
		SIF CFLAG:31:���s || CFLAG:32:���s || CFLAG:33:���s
			RETURNF 840
;�l���k�ʂ�
	CASE 205
		RETURNF 820
;������
	CASE 506
		RETURNF 610
;�Ԍ���n���Z���^�[
	CASE 712
		RETURNF 970
;�R���ւ̓�
	CASE 732
		RETURNF 810
;�����w
	CASE 803
		RETURNF 210
;�ܔM�n����
	CASE 928
		RETURNF 760
ENDSELECT
RETURNF 0
;-------------------------------------------------
@SPECIAL_AREAMOVE_TIME()
#FUNCTION
SELECTCASE CFLAG:MASTER:���݈ʒu
;����_�Ў���
	CASE 21
		RETURNF 1
;�l���k�ʂ�
	CASE 205
		RETURNF 15
;������
	CASE 506
		SIF SHORTCUT(3)
			RETURNF 3
		RETURNF 5
;�Ԍ���n���Z���^�[
	CASE 712
		RETURNF 10
;�R���ւ̓�
	CASE 732
		RETURNF 5
;�����w
	CASE 803
		RETURNF 15
;�ܔM�n����
	CASE 928
		RETURNF 5
ENDSELECT


code:
;-------------------------------------------------
;���d��������
;����n�R�}���h�A���x��1
;-------------------------------------------------
;COM�n�֐��AMESSAGE�͖{���͐؂蕪���ĕʃt�@�C��

;�{�\���낤�����d���ɂȂ邯�ǂ܂�������
@MESSAGE_COM470
#LOCALSIZE 1
#LOCALSSIZE 1
PRINTFORML ���Ȃ���%STR_NOUMIN(CALLNAME:(FLAG:�n��), "���̎��")%�ւƌ�������
SELECTCASE TFLAG:193
CASE 1
	PRINTFORML �����̔��d���͂܂�Ń_��������
CASE 2
	PRINTFORML �����̔��d���͂��܂蒻��Ȃ�����
CASE 3
	PRINTFORML ���d���͂Ƃ��ɉ����������I������
CASE 4
	PRINTFORML �����̔��d���͂Ȃ��Ȃ�������
CASE 5
	PRINTFORML �����̔��d���͎���悭�I�����
CASEELSE
	PRINTFORML �����̔��d���͉�Ȃ���_�����Ă���
ENDSELECT

;�V�X�e���I��1�L�����D������̂͂ǂ����Ǝv������
;�A�C�f���e�B�e�B�����̂������
@COM470
IF ITEM:���|�p�i�ꎮ
	TFLAG:���d�������x = RAND(2, 7)
ELSE
	TFLAG:���d�������x = RAND(1, 4)
ENDIF

;�_�̉���
SELECTCASE CFLAG:(FINDCHARA(CALLNAME, "���q", 1)):�D���x
	CASE IS < 1000
	CASE IS < 5000
		TFLAG:���d�������x += 1
	CASE IS < 10000
		TFLAG:���d�������x += 2
	CASE IS < 30000
		TFLAG:���d�������x += 3
	CASEELSE
		TFLAG:���d�������x += 4
ENDSELECT
FLAG:���d���̐��� += TFLAG:���d�������x
TFLAG:193 = TFLAG:���d�������x
IF FLAG:70
	BASE:MASTER:TSP -= 500
ELSE
	TIME += 180
	DOWNBASE:MASTER:�̗� += 300
	DOWNBASE:MASTER:�C�� += 300
ENDIF

RETURN 1
;-------------------------------------------------
;���s�\����
;-------------------------------------------------
;���d��������
@COM_ABLE470
SIF !TFLAG:100
	RETURN 0
SIF TFLAG:�ϑz��
	RETURN 0
;���Ȃ��͔_���ł͂Ȃ�
SIF !FLAG:�n��
	RETURN 0
;���݈ʒu�����̏ꏊ�ł͂Ȃ��ALOCAL�ɔ��̈ʒu���ꎟ�擾���Ďg�p
LOCAL = TOINT(STR_NOUMIN(CALLNAME:(FLAG:�n��), "�ꏊID"))
SIF GET_MAPID(LOCAL) != MAIN_MAP
	LOCAL = GET_MAP_REPLACEMENT(LOCAL)
SIF CFLAG:MASTER:���݈ʒu != LOCAL
	RETURN 0
;�ۂ�ł�
SIF BASE:MASTER:���C
	RETURN 0
SIF CFLAG:���ӂ�
	RETURN 0
;�̗́E�C�͕s��
SIF BASE:MASTER:�C�� < 300 || BASE:MASTER:�̗� < 300
	RETURN 0
;�V�C������
SIF !GROUPMATCH(TIME:5, 0, 1, 2, 3, 4, 6, 7)
	RETURN 0
;�����͂����d��������
SIF TFLAG:���d�������x
	RETURN 0
;���Ԃɗ]�T�������ƃ_��
IF FLAG:70
	;TSP����Ȃ�
	SIF BASE:MASTER:TSP < 300
		RETURN 0
ELSE
	;�������E��720�Ƃ��Ă���3���ԑO
	SIF NEMUKE() >= 540
		RETURN 0
ENDIF
RETURN 1


code:
@SYUGO
#DIM �W��, �L�����N�^�����, 3 ;�W��:X:Y
                               ;Y=0�F�L�����o�^�ԍ�
                               ;  1�F�ݒ�A�ړ���(1p0:�ړ��s��,1p3:�ړ��Ώ�)
                               ;  2�F�ړ��R�X�g
#DIM �l��                      ;����}�b�v�ɂ���l���A�ړ��ł��Ȃ��L�������\������A�l���ɉ��Z����Ă���
#DIM ���͒l                    ;RESULT�擾�p
CALL SYUGOS_GETDATA(�l��, �W��)
IF �l�� == 0
	PRINTW �N�����Ȃ�
	RETURN
ENDIF
;�S�����̃R�X�g�v�Z���ɍs���i���Ԃ�S���W���̕p�x�������̂Łj
CALL SYUGOS_COST(�l��, �W��)

PRINTL �N���Ăъ񂹂܂����H
DO
	CALL SYUGOS_DISPDATA(�l��, �W��)
	PRINTBUTTON "[444:�S���ݒ�]", 444
	PRINTBUTTON "[555:�S������]", 555
	PRINTBUTTON "[666:���s�J�n]", 666
	PRINTFORML
	PRINTBUTTON "[999:�L�����Z��]", 999
	INPUT
	���͒l = RESULT
	SELECTCASE ���͒l
	;�l�I��
	CASE 0 TO �l�� - 1
		SIF !GETBIT(�W��:���͒l:1, 0)
			INVERTBIT �W��:���͒l:1, 3
	;�S�̐ݒ�
	CASE 444
		FOR LOCAL, 0, �l��
			SIF GETBIT(�W��:LOCAL:1, 0)
				CONTINUE
			SETBIT �W��:LOCAL:1, 3
		NEXT
	;�S�̉���
	CASE 555
		FOR LOCAL, 0, �l��
			CLEARBIT �W��:LOCAL:1, 3
		NEXT
	;���s����
	CASE 666
		IF TFLAG:�^��
			PRINTFORMW %CALLNAME:MASTER%��%CALLNAME:(TFLAG:�^��)%���~�낵��
			TFLAG:�^�� = 0
		ENDIF
		FOR LOCAL, 0, �l��
			SIF !GETBIT(�W��:LOCAL:1, 3)
				CONTINUE

			;���H����
			SIF TALENT:MASTER:�̌^ < -4
				BASE:MASTER:TSP -= (15 * �W��:LOCAL:2)
			BASE:MASTER:TSP -= (5 * �W��:LOCAL:2)
			SIF BASE:MASTER:TSP <= 0
				BREAK
			;���H����
			SIF TALENT:MASTER:�̌^ < -4
				BASE:MASTER:TSP -= (15 * �W��:LOCAL:2)
			BASE:MASTER:TSP -= (5 * �W��:LOCAL:2)
			BASE:MASTER:TSP -= (3 * �W��:LOCAL:2)
			CFLAG:(�W��:LOCAL:0):���݈ʒu = CFLAG:MASTER:���݈ʒu
			PRINTFORMW %CALLNAME:(�W��:LOCAL:0)%��%NAME_FROM_PLACE(CFLAG:MASTER:���݈ʒu)%�ɔw�����Ă��č~�낵��
			SIF BASE:MASTER:TSP <= 0
				BREAK
		NEXT
		RETURN
	CASE 999
		RETURN
	ENDSELECT
	CLEARLINE �l�� + 3
LOOP 1

@SYUGOS_GETDATA(�l��, �W��)
#DIM REF �W��, ,
#DIM REF �l��
VARSET �W��
VARSET �l��
FOR LOCAL, 1, CHARANUM
	SIF AT_HOME(LOCAL) == 0
		CONTINUE
	SIF TALENT:MASTER:���ꏊ�@�m == 0 && CFLAG:MASTER:���݈ʒu != CFLAG:LOCAL:���݈ʒu && CAN_MOVE(CFLAG:MASTER:���݈ʒu, CFLAG:LOCAL:���݈ʒu) == 0
		CONTINUE
	SIF CFLAG:LOCAL:���݈ʒu == MAXROOM && CFLAG:LOCAL:����
		CONTINUE
	�W��:�l��:0 = LOCAL
	;�I���
	IF CFLAG:(�W��:�l��:0):���݈ʒu == CFLAG:MASTER:���݈ʒu
		SETBIT �W��:�l��:1, 0
	ELSEIF CFLAG:(�W��:�l��:0):����
		SETBIT �W��:�l��:1, 0
	ELSEIF !MAP_CAN_MOVE(CFLAG:(�W��:�l��:0):���݈ʒu)
		SETBIT �W��:�l��:1, 0
	ELSEIF BATHCHECK(CFLAG:(�W��:�l��:0):���݈ʒu) || IN_TOILET(CFLAG:(�W��:�l��:0):���݈ʒu)
		SETBIT �W��:�l��:1, 0
	ELSEIF CFLAG:(�W��:�l��:0):���݈ʒu == MAXROOM
		SETBIT �W��:�l��:1, 0
	ENDIF
	�l�� ++
NEXT

@SYUGOS_DISPDATA(�l��,�W��)
#DIM REF �W��,,
#DIM �l��
FOR LOCAL, 0, �l��
	LOCALS = {LOCAL}
	LOCALS = [%LOCALS,3,RIGHT%] - %CALLNAME:(�W��:LOCAL:0),15,LEFT%
	IF CFLAG:(�W��:LOCAL:0):���݈ʒu == CFLAG:MASTER:�����ʒu
		LOCALS = %LOCALS%%CALLNAME:MASTER%����
	ELSE
		LOCALS = %LOCALS%%NAME_FROM_PLACE(CFLAG:(�W��:LOCAL:0):���݈ʒu)%
	ENDIF
	IF !MAP_CAN_MOVE(CFLAG:(�W��:LOCAL:0):���݈ʒu)
		LOCALS = %LOCALS%%" "*(48-STRLENS(LOCALS))%�N���s��
	ELSEIF CFLAG:(�W��:LOCAL:0):����
		LOCALS = %LOCALS%%" "*(48-STRLENS(LOCALS))%�A�Q��
	ELSEIF �W��:LOCAL:2 > 0
		LOCALS = %LOCALS%%" "*(48-STRLENS(LOCALS))%�ړ�����{�W��:LOCAL:2}
	ENDIF
	IF GETBIT(�W��:LOCAL:1, 0)
		SETCOLOR C_GRAY
		PRINTPLAINFORM %LOCALS%
	ELSEIF GETBIT(�W��:LOCAL:1, 3)
		SETCOLOR C_AQUA
		PRINTFORM %LOCALS%
	ELSE
		PRINTFORM %LOCALS%
	ENDIF
	PRINTL
	RESETCOLOR
NEXT

;�S�L������ΏۂɈړ��R�X�g�̎Z�o���s��
;�Ăяo�����őS�L�������[�v����Ă��Ȃ�R�X�g�Z�o���ōX�ɑS�L�������[�v������
;�Z�o�ς݂̒n�_���L�����Ă��������������̂ł́H
@SYUGOS_COST(�l��, �W��)
#DIM �l��
#DIM REF �W��,,
#DIM LIST_ID                 ;�Q�Ƃ��Ă���LIST��ID
#DIM DYNAMIC DONE_CNT        ;�Z�o�ςݒn�_�̐�
#DIM DYNAMIC DONE_PLACE, 100 ;�Z�o�ςݒn�_��PLACE_ID
#DIM DYNAMIC DONE_COST,  100 ;�Z�o�ςݒn�_�̃R�X�g
#DIM TEMP_PLACE              ;�Q�Ɨp�̈ꎞ�ϐ�
FOR LIST_ID, 0, �l��
	;NG�����͐�ɂ���Ă����܂��傤
	IF GETBIT(�W��:LIST_ID:1, 0)
		�W��:LIST_ID:2 = -1
		CONTINUE
	ENDIF

	TEMP_PLACE = FINDELEMENT(DONE_PLACE, CFLAG:(�W��:LIST_ID:0):���݈ʒu, 0, DONE_CNT)
	;�Z�o�ς�
	IF TEMP_PLACE >= 0
		�W��:LIST_ID:2 = DONE_COST:TEMP_PLACE
	;�Z�o�܂�
	ELSE
		CALL CALC_SYUGOS_COST(�W��, LIST_ID)
		DONE_PLACE:DONE_CNT   = CFLAG:(�W��:LIST_ID:0):���݈ʒu
		DONE_COST:DONE_CNT    = �W��:LIST_ID:2
		DONE_CNT ++
	ENDIF
NEXT

;�W���R�X�g�̎Z�o
;F�֐���������������SKIPMOVE�g���Ă邩��f�O�A�c�O
@CALC_SYUGOS_COST(�W��, �Ώ�)
#LOCALSIZE 1
#LOCALSSIZE 1
#DIM REF �W��,,
#DIM �Ώ�
#DIM �ړ��R�X�g
#DIM �b��ړI�n
#DIM �ŏI�ړI�n
#DIM TEMP_���݈ʒu
TEMP_���݈ʒu = CFLAG:MASTER:���݈ʒu
�ŏI�ړI�n = CFLAG:(�W��:�Ώ�:0):���݈ʒu
�b��ړI�n = �ŏI�ړI�n
[IF_DEBUG]
PRINTFORML %CALLNAME:(�W��:�Ώ�:0)%�̈ړ��R�X�g���v�Z
[ENDIF]
IF CAN_MOVE(TEMP_���݈ʒu, �b��ړI�n) & 1
	�ړ��R�X�g = 1
ELSE
	FOR �ړ��R�X�g, 1, 20
		WHILE !(CAN_MOVE(TEMP_���݈ʒu, �b��ړI�n) & 1)
			TRYCALLFORM SKIP_MOVE_{MAIN_MAP}(�b��ړI�n, TEMP_���݈ʒu)
			SIF !�b��ړI�n
				THROW �b��ړI�n���ُ�ł�
			[IF_DEBUG]
			PRINTFORML {TEMP_���݈ʒu}����{�b��ړI�n}�ɒ��ڍs���Ȃ�����{RESULT}��ڎw����
			[ENDIF]
			�b��ړI�n = RESULT
		WEND
		SIF CAN_MOVE(�b��ړI�n, �ŏI�ړI�n) & 1
			BREAK
		TEMP_���݈ʒu = �b��ړI�n
		�b��ړI�n = �ŏI�ړI�n
	NEXT
ENDIF
�W��:�Ώ�:2 = �ړ��R�X�g
[IF_DEBUG]
PRINTFORML %CALLNAME:(�W��:�Ώ�:0)%�̈ړ��R�X�g��{�ړ��R�X�g}
[ENDIF]