code:
;-------------------------------------------------
;�t�����킷
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM334
;���ۂ̔���
LOCAL = RAND:100
LOCAL:1 = 90 + GET_SUCCESS_RATE() / 5
SIF LOCAL:1 > 99
	LOCAL:1 = 99
IF LOCAL <= 9
	;10���ő听��
	TFLAG:193 = 1
	TFLAG:98 = 2
	LOCAL:2 = 80
	EXP:MASTER:��b�o�� ++
ELSEIF LOCAL >= LOCAL:1
	;10�`1���Ŏ��s
	TFLAG:193 = -1
	TFLAG:98 = -1
	LOCAL:2 = 20
ELSE
	;�c��͐���
	TFLAG:193 = 0
	TFLAG:98 = 0
	LOCAL:2 = 60
ENDIF

EXP:MASTER:��b�o�� ++

IF !(TALENT:��ϐ� == -2 || CFLAG:�D�P���o��� == 1)
	LOCAL:3 = (MAXBASE:���C + MAXBASE:MASTER:���C) * (LOCAL:2 + RAND:41) / 2000
	LOCAL:4 = (MAXBASE:���C + MAXBASE:MASTER:���C) * (LOCAL:2 + RAND:41) / 2000
	BASE:���C += LOCAL:3
	BASE:MASTER:���C += LOCAL:4

	;�������߂�قǑ����������ċ����čs�����Ⴄ�͎̂₵���̂ŃR�����g�A�E�g
	;BASE:�d���� = BASE:�d���� - LOCAL:3
ENDIF

DOWNBASE:MASTER:�̗� += 20
DOWNBASE:MASTER:�C�� += 100

;���v����
TIME += 30

DOWNBASE:�C�� += 10

;�M��
TFLAG:98 += 4

;�Œ�Ŋl������\�[�X
SOURCE:���y = 700

;ABL:�]�����݂�
IF ABL:�]�� <= 1
	SOURCE:���y += (ABL:�]�� * 50)
ELSEIF ABL:�]�� <= 3
	SOURCE:���y += 100 + (ABL:�]�� * 40)
ELSEIF ABL:�]�� <= 5
	SOURCE:���y += 200 + (ABL:�]�� * 50)
ELSEIF ABL:�]�� <= 8
	SOURCE:���y += 400 + (ABL:�]�� * 70)
ELSEIF ABL:�]�� <= 11
	SOURCE:���y += 500 + (ABL:�]�� * 60)
ELSE
	SOURCE:���y += 800 + (ABL:�]�� * 40)
ENDIF

;ABL:�e���`�F�b�N
IF ABL:�e�� <= 1
	SOURCE:���y += (ABL:�e�� * 60)
ELSEIF ABL:�e�� <= 3
	SOURCE:���y += 120 + (ABL:�e�� * 60)
ELSEIF ABL:�e�� <= 5
	SOURCE:���y += 300 + (ABL:�e�� * 60)
ELSEIF ABL:�e�� <= 8
	SOURCE:���y += 600 + (ABL:�e�� * 50)
ELSEIF ABL:�e�� <= 11
	SOURCE:���y += 900 + (ABL:�e�� * 50)
ELSE
	SOURCE:���y += 1400 + (ABL:�e�� * 30)
ENDIF

;�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

SOURCE:�� = 150 + 150 * ABL:�]��
SOURCE:���� = 150 + 150 * ABL:�T�h���C

SELECTCASE ABL:MASTER:�b�p�Z�\
	CASE 0
		TIMES SOURCE:���y , 0.60
		TIMES SOURCE:���� , 0.60
		TIMES SOURCE:�� , 0.60
	CASE 1
		TIMES SOURCE:���y , 0.70
		TIMES SOURCE:���� , 0.70
		TIMES SOURCE:�� , 0.70
	CASE 2
		TIMES SOURCE:���y , 0.85
		TIMES SOURCE:���� , 0.85
		TIMES SOURCE:�� , 0.85
	CASE 3
		TIMES SOURCE:���y , 1.00
		TIMES SOURCE:���� , 1.00
		TIMES SOURCE:�� , 1.00
	CASE 4
		TIMES SOURCE:���y , 1.10
		TIMES SOURCE:���� , 1.10
		TIMES SOURCE:�� , 1.10
	CASEELSE
		TIMES SOURCE:���y , 1.20
		TIMES SOURCE:���� , 1.20
		TIMES SOURCE:�� , 1.20
ENDSELECT
RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE334
;�t�����킷���s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(334)
	RETURN RESULT
;�d�����e������ȊO
SIF CFLAG:�E�� != ENKAI_SANKA
	RETURN 0
;�d����(����ň��ގc���)���[��
SIF BASE:�d���� <= 0
	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
;���Ԓ�~��
SIF FLAG:70
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�������
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM335
;���ۂ̔���
LOCAL = RAND:100
LOCAL:1 = 90 + GET_SUCCESS_RATE() / 5
SIF LOCAL:1 > 99
	LOCAL:1 = 99
IF LOCAL <= 9
	;10���ő听��
	TFLAG:193 = 1
	TFLAG:98 = 2
	LOCAL:2 = 6
	EXP:MASTER:��b�o�� ++
ELSEIF LOCAL >= LOCAL:1
	;10�`1���Ŏ��s
	TFLAG:193 = -1
	TFLAG:98 = -1
	LOCAL:2 = -1
ELSE
	;�c��͐���
	TFLAG:193 = 0
	TFLAG:98 = 0
	LOCAL:2 = 2
ENDIF

SIF RAND:2
	EXP:MASTER:��b�o�� ++

;�����_����(0�`2)+(�����␳)%�̎��C����
LOCAL:3 = MAX(MAXBASE:���C * (RAND:3 + LOCAL:2) / 100, 0)
BASE:���C = MAX(BASE:���C - LOCAL:3, 0)

DOWNBASE:MASTER:�̗� += 20
DOWNBASE:MASTER:�C�� += 100

;���v����
TIME += 30

DOWNBASE:�C�� += 10

;�M��
TFLAG:98 += 10

;�Œ�Ŋl������\�[�X
SOURCE:���y = 400

;ABL:�]�����݂�
IF ABL:�]�� <= 1
	SOURCE:���y += (ABL:�]�� * 50)
ELSEIF ABL:�]�� <= 3
	SOURCE:���y += 100 + (ABL:�]�� * 40)
ELSEIF ABL:�]�� <= 5
	SOURCE:���y += 200 + (ABL:�]�� * 50)
ELSEIF ABL:�]�� <= 8
	SOURCE:���y += 400 + (ABL:�]�� * 70)
ELSEIF ABL:�]�� <= 11
	SOURCE:���y += 500 + (ABL:�]�� * 60)
ELSE
	SOURCE:���y += 800 + (ABL:�]�� * 40)
ENDIF

;ABL:�e���`�F�b�N
IF ABL:�e�� <= 1
	SOURCE:���y += (ABL:�e�� * 50)
ELSEIF ABL:�e�� <= 3
	SOURCE:���y += 80 + (ABL:�e�� * 50)
ELSEIF ABL:�e�� <= 5
	SOURCE:���y += 200 + (ABL:�e�� * 50)
ELSEIF ABL:�e�� <= 8
	SOURCE:���y += 500 + (ABL:�e�� * 40)
ELSEIF ABL:�e�� <= 11
	SOURCE:���y += 800 + (ABL:�e�� * 40)
ELSE
	SOURCE:���y += 1200 + (ABL:�e�� * 30)
ENDIF

;�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

SOURCE:�� = 200 + 200 * ABL:�]��
SOURCE:���� = 40 + 40 * ABL:�T�h���C
RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE335
;���������s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(335)
	RETURN RESULT
;�d�����e�������Ԃ�ȊO
SIF CFLAG:�E�� != �����Ԃ��
	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
;���Ԓ�~��
SIF FLAG:70
	RETURN 0
RETURN 1

repo_name: akadiya/eratw

license: unknown


code:
;-------------------------------------------------
;�G������
;����n�R�}���h�A���x��2
;-------------------------------------------------
@COM336
#DIM �񕜑O�̗�
#DIM �񕜑O�C��
#DIM �񕜌�̗�
#DIM �񕜌�C��
;�G������
IF TIME_PROGRESS(TFLAG:�G������) < 45
	PRINTFORMW ���΂炭���Ԃ������Ȃ��Ƒ���Ⴢ��
	RETURN -1
ENDIF
IF TALENT:MASTER:�̌^ < TALENT:�̌^ - 1
	PRINTFORMW �̊i���I�ɂ���ǂ�
	RETURN -1
ENDIF

DOWNBASE:�C�� += 50

DOWNBASE:MASTER:�C�� += 100

LOCAL = ABL:�e�� * 10 + TALENT:���� * 50 + TALENT:�c�t * 30 - TALENT:㵒p�S * 20 - TALENT:�v���C�h * 20
SIF BASE:�̗� > MAXBASE:�̗� * 4 / 5
	LOCAL -= 30
SIF BASE:�̗� < MAXBASE:�̗� * 2 / 5
	LOCAL += 30
LOCAL = MAX(LOCAL,10)
IF RAND:LOCAL > 120
	TFLAG:193 = 1
ELSEIF RAND:LOCAL < 30
	TFLAG:193 = -1
ELSE
	TFLAG:193 = 0
ENDIF

;�Œ�Ŋl������\�[�X
SOURCE:� = 250
SOURCE:�� = 70
SOURCE:���� = 150
SIF TFLAG:193 == -1
	SOURCE:���� += 150

;ABL:�e�����݂�
IF ABL:�e�� <= 5
	SOURCE:� += (ABL:�e�� * 25)
ELSEIF ABL:�e�� <= 8
	SOURCE:� += 600 + (ABL:�e�� * 30)
	SOURCE:�I�o += 200 + (ABL:�~�] * 15)
ELSEIF ABL:�e�� <= 11
	SOURCE:� += 800 + (ABL:�e�� * 30)
	SOURCE:���� += ABL:�e�� * 40
	SOURCE:�I�o += 300 + (ABL:�~�] * 20)
ELSE
	SOURCE:� += 1000 + (ABL:�e�� * 40)
	SOURCE:���� += ABL:�e�� * 50
	SOURCE:�I�o += 700 + (ABL:�~�] * 25)
ENDIF

SOURCE:�� = 150 + 300 * ABL:�]��

IF TFLAG:193 == -1
	TIMES SOURCE:� , 0.50
	TIMES SOURCE:�� , 0.50
	TIMES SOURCE:�I�o , 0.40
ELSEIF TFLAG:193 == 0
	TIMES SOURCE:� , 1.00
	TIMES SOURCE:�� , 1.00
	TIMES SOURCE:�I�o , 0.90
ELSE
	TIMES SOURCE:� , 1.50
	TIMES SOURCE:�� , 2.00
	TIMES SOURCE:�I�o , 1.80
	TIME += 20
	DOWNBASE:�̗� -= 150
	DOWNBASE:�C�� -= 300
	DOWNBASE:MASTER:�C�� -= 50
ENDIF
TIME += 20
CALL SET_DERAY(6,TARGET)
;�G���t���O
TFLAG:�G������ = 1440 * DAY + TIME
RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE336
;�G�����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(336)
	RETURN RESULT
;��ꍇ�����x2
SIF TCVAR:MASTER:��ꍇ�� < 2
	RETURN 0
;�����̂�
SIF !(INROOM(CFLAG:MASTER:���݈ʒu))
	RETURN 0
;���C��
SIF BATHROOM()
	RETURN 0
;������
SIF CFLAG:����
	RETURN 0
;�d����
SIF CFLAG:�s�� == 5
	RETURN 0
;�C�^�Y�����A�Y���Q���͖���
SIF CFLAG:�C�^�Y�� || CFLAG:�Y���Q��
	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
;�V�b�N�X�i�C���̐�
SIF TEQUIP:�V�b�N�X�i�C��
	RETURN 0
;��~���͕s��
SIF FLAG:70
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�����|��
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM350
#DIM NUM_TARGET
;�����|��
NUM_TARGET = GET_TARGETNUM()
IF FLAG:�b�㐫��
	PRINTFORMW %CALLNAME:MASTER%�ɂ͂���ȓx���͂Ȃ�
	RETURN -1
ENDIF

IF FLAG:70
	;���Ԓ�~�͖������˔j
	FOR LOCAL,1, NUM_TARGET + 1
		CFLAG:(TARGET:LOCAL):���ӂ� = 1
	NEXT
ELSE
	;�����ɂ�钆�f����
	IF EYEWITNESS() == 1
		TFLAG:194 = 1
		TFLAG:�����|���Ȃ� ++
	ENDIF
	;MASTER�I�ɑ��l���͖���������
	IF NUM_TARGET > 1 && TCVAR:MASTER:��ꍇ�� < 2
		TFLAG:194 = 3
		TFLAG:�����|���Ȃ� ++
	ENDIF

	FOR LOCAL,1, NUM_TARGET + 1
		;�D��
		IF TCVAR:(TARGET:LOCAL):�D�� == 1
			CFLAG:(TARGET:LOCAL):���ӂ� = 1
			SIF CFLAG:(TARGET:LOCAL):�D���� < 2
				CFLAG:(TARGET:LOCAL):�D���� = 1
			IF INROOM(CFLAG:MASTER:���݈ʒu) == 2
				CALL DATUI_SHOES(LOCAL,0)
				CALL DATUI_SHOES(MASTER,0)
			ENDIF
		;���Ӗ��擾
		ELSEIF !GETBIT(CFLAG:(TARGET:LOCAL):�������� , 1)
			;���擾���Ƒ��l���͑ʖ�
			IF NUM_TARGET > 1
				TFLAG:194 = 3
				TFLAG:�����|���Ȃ� ++
				BREAK
			ELSE
				CALL ������((TARGET:LOCAL))
			ENDIF
		;���ӎ擾�ς�
		ELSE
			IF FLAG:�����f�[�g���� == TARGET:LOCAL
				GOTO OK
			ELSEIF TALENT:TARGET:�����}��
				GOTO OK
			ELSEIF CFLAG:TARGET:���ӂ�
				GOTO OK
			ELSEIF (BASE:(TARGET:LOCAL):���[�h < 300 || TCVAR:MASTER:��ꍇ�� < 2)
				TFLAG:194 = 4
				TFLAG:�����|���Ȃ� ++
			ELSE
				$OK
				CFLAG:(TARGET:LOCAL):���ӂ� = 1
				IF INROOM(CFLAG:MASTER:���݈ʒu) == 2
					CALL DATUI_SHOES(LOCAL,0)
					CALL DATUI_SHOES(MASTER,0)
				ENDIF
			ENDIF
		ENDIF
	NEXT
ENDIF

IF TFLAG:�����|���Ȃ�
	FOR LOCAL,1, NUM_TARGET + 1
		CALL ENDUFUFU(TARGET:LOCAL)
	NEXT
	DOWNBASE:MASTER:�C�� = 50
	BASE:TARGET:���[�h /= 2
ELSE
;�U����
;ELSEIF CFLAG:MASTER:���ӂ� == 1 && !FLAG:70
;	FOR LOCAL,0,CHARANUM
;		CFLAG:(TARGET:LOCAL):���ӂ� == 2
;	NEXT
;	TIME += 1
;	RETURN 1
	CFLAG:MASTER:���ӂ� = 1
	SIF !FLAG:70
		TIME += 1
ENDIF
RETURN 1

;�A�ꍞ�ݏh���u�z�ȊO�̏o������ł��ӂӂ��邽�߂̓������
@���ꂤ�ӂӏ���(ARG)
#FUNCTION
SELECTCASE ARG
	CASE 67
		SIF TCVAR:ARG:����C�x���g >= 4 && CFLAG:ARG:�s�� != 5 && GETBIT(CFLAG:ARG:�������� , 1) && TCVAR:ARG:��ꍇ�� >= 2 && CFLAG:ARG:���݈ʒu == ���q�� && GET_TARGETNUM() < 2
			RETURNF 1
ENDSELECT

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE350
#DIM NUM_TARGET
;�ϑz�Ȃ̂őS�ʂ�
SIF TFLAG:�ϑz�� == 1 && CFLAG:���ӂ� != 1
	RETURN 1
;�����|�����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(350)
	RETURN RESULT
;���Ԓ�~���̓X�L�b�v
IF !FLAG:70
	;���l��
	NUM_TARGET = GET_TARGETNUM()
	SELECTCASE NUM_TARGET
	CASE 0
		RETURN 0
	CASE 1
	CASEELSE
		FOR LOCAL, 1, NUM_TARGET + 1
			;�S�L�����ɍ��ӂ��Ȃ��ƃ_��
			SIF !GETBIT(CFLAG:(TARGET:LOCAL):�������� , 1)
				RETURN 0
			;�Q�Ă�L����������ƃ_��
			SIF CFLAG:(TARGET:LOCAL):����
				RETURN 0
			;�����Ă�L����������Ƒʖ�
			SIF TCVAR:(TARGET:LOCAL):�D��
				RETURN 0
		NEXT
	ENDSELECT
	SIF TFLAG:�L�X�}�[�N != TARGET && TFLAG:�L�X�}�[�N
		RETURN 0
	;������
	SIF CFLAG:����
		RETURN 0
	;�Y���Q��
	SIF CFLAG:�Y���Q��
		RETURN 0
	;�d����
	SIF CFLAG:�s�� == 5 && !TCVAR:TARGET:�D��
		RETURN 0
	SIF TCVAR:�D���ɂ���
		RETURN 0
	;�f�[�g��
	SIF (CHK_DATENOW(CFLAG:MASTER:�f�[�g��) && CFLAG:���݈ʒu != �A�ꍞ�ݏh && CFLAG:���݈ʒu != ���u�z && CFLAG:���݈ʒu != OMANEKIBEYA()) && !���ꂤ�ӂӏ���(TARGET)
		RETURN 0
	;SIF MONEY < 3000 && (CFLAG:���݈ʒu == �A�ꍞ�ݏh || CFLAG:���݈ʒu == ���u�z)
		;RETURN 0
ENDIF
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
RETURN 1

;�l�ڂ����邩�ǂ����Ԃ������֐�
;���Ă�L�����������1����u����2
@EYEWITNESS()
#FUNCTION
FOR LOCAL, 1, CHARANUM
	SIF CFLAG:LOCAL:���݈ʒu == CFLAG:MASTER:���݈ʒu
		CONTINUE
	SIF CAN_MOVE(CFLAG:LOCAL:���݈ʒu, CFLAG:MASTER:���݈ʒu) & 2
		RETURNF 1
NEXT
SIF WITH_MOB()
	RETURNF 2
SIF DATE_HITOGOMI()
	RETURNF 2

RETURNF 0


code:
;-------------------------------------------------
;�A��o��
;����n�R�}���h�A���x��2
;-------------------------------------------------
@COM351
#DIM NUM_TARGET
NUM_TARGET = GET_TARGETNUM()
;�A��o��
VARSET LOCAL
SIF !NUM_TARGET
	RETURN -1
FOR LOCAL, 1, NUM_TARGET + 1
	IF COM_351_CONDITION(TARGET:LOCAL) >= 2
		LOCAL:97 += 1
	ENDIF
NEXT
IF NUM_TARGET == 1 || LOCAL:97 == 1
	IF COM_351_CONDITION(TARGET) < 1
		RETURN -1
	ELSEIF COM_351_CONDITION(TARGET) < 2
		PRINTFORMW %CALLNAME:(TARGET)%�͎�荞�ݒ��ł��B
		RETURN -1
	ENDIF
	IF CFLAG:TARGET:���s
		CFLAG:TARGET:���s = 0
		CFLAG:MASTER:���s = 0
		PRINTFORMW ���s�������܂��B
	ELSE
		CFLAG:TARGET:���s = 60
		;�J�{�O�{�Por���肪�P�̎��͑������P
		SIF TIME:5 > 3 && TIME:5 < 14 && OUTROOF(CFLAG:MASTER:���݈ʒu) && (ITEM:36 || EQUIP:TARGET:�A�N�Z�T�� == 6)
			TEQUIP:TARGET:201 = 1
		PRINTFORMW %CALLNAME:TARGET%��A��o���܂�
		CFLAG:MASTER:���s = 60
	ENDIF
	TIME += 1
	SIF CFLAG:TARGET:���s
		CALL KOJO_MESSAGE_SEND("DIRECT",351,TARGET,-1,-1)
	RETURN 1
ENDIF

PRINTL �N��U���܂����H
FOR LOCAL, 1, NUM_TARGET + 1
;	SIF CFLAG:(TARGET:LOCAL):�ԓx > 0 || TCVAR:(TARGET:LOCAL):�D�� == 1
	SIF COM_351_CONDITION(TARGET:LOCAL) <= 0
		CONTINUE
	PRINTFORML [{LOCAL}] - %CALLNAME:(TARGET:LOCAL)%
NEXT
PRINTL [98] - �܂Ƃ߂ĘA��o��
PRINTL [99] - ���s����
PRINTL [100] - ��߂�
DO
	INPUT
	SELECTCASE RESULT
	CASE 100
		RETURN -1
	CASE 99
		FOR LOCAL, 1, NUM_TARGET + 1
			SIF CFLAG:(TARGET:LOCAL):���s
				CFLAG:(TARGET:LOCAL):���s =  0
			;�������P���Ȃ��Ȃ�
			TEQUIP:(TARGET:LOCAL):201 = 0
		NEXT
		CFLAG:MASTER:���s = 0
		RETURN 1
	CASE 98
		FOR LOCAL, 1, NUM_TARGET + 1
			IF COM_351_CONDITION(TARGET:LOCAL) >= 3
				CFLAG:(TARGET:LOCAL):���s = 60
				LOCAL:98 += 1
			ENDIF
		NEXT
		PRINTFORMW {LOCAL:98}�l�܂Ƃ߂ĘA��o���܂�
		CFLAG:MASTER:���s = 60
		TIME += LOCAL:98
		SIF CFLAG:TARGET:���s
			CALL KOJO_MESSAGE_SEND("DIRECT",351,TARGET,-1,-1)
		RETURN 1
	CASEELSE
		IF !INRANGE(RESULT, 1, NUM_TARGET)
			CLEARLINE 1
			CONTINUE
		ELSEIF COM_351_CONDITION(TARGET:RESULT) < 1
			CLEARLINE 1
			CONTINUE
		ELSEIF COM_351_CONDITION(TARGET:RESULT) < 2
			PRINTFORMW %CALLNAME:(TARGET:RESULT)%�͎�荞�ݒ��ł��B
			CLEARLINE 2
			CONTINUE
		ENDIF
		BREAK
	ENDSELECT
LOOP 1

CFLAG:(TARGET:RESULT):���s = 60
;�J�{�O�{�Por���肪�P�̎��͑������P
SIF TIME:5 > 3 && TIME:5 < 14 && OUTROOF(CFLAG:MASTER:���݈ʒu) && (ITEM:36 || EQUIP:TARGET:�A�N�Z�T�� == 6)
	TEQUIP:TARGET:201 = 1
PRINTFORMW %CALLNAME:(TARGET:RESULT)%��A��o���܂�
CFLAG:MASTER:���s = 60
TIME += 1
;SOURCE�܂ł��񂳂Ȃ��̂ł����Ō����\��������
SIF CFLAG:TARGET:���s
	CALL KOJO_MESSAGE_SEND("DIRECT",351,TARGET,-1,-1)

RETURN 1

@EQUIP_COM351(ARG)
;�\�[�X�͍T���߂ɓK���B������肷�����̂Ŏ��d
IF FLAG:70 == 1

ELSE
	SOURCE:���y += ABL:�e�� * 5
	SOURCE:� += ABL:�e�� * 5
	SOURCE:���� += 100 - MIN(ABL:�e�� * 10,100)
	SIF ABL:�e�� > 9 && TIME_PROGRESS(TIME:1) > 10
	EXP:ARG:����o�� += RAND:2
ENDIF
RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE351
;��~���͕s��
SIF FLAG:70
	RETURN 0
;�A��o�����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(351)
	RETURN RESULT
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
SIF CFLAG:���ӂ�
	RETURN 0
;�f�[�g��
SIF CHK_DATENOW(CFLAG:MASTER:�f�[�g��)
	RETURN 0
SIF IN_HOME(CFLAG:���݈ʒu) == 0
	RETURN 0
;TARGET�̓�ꍇ�����x1
FOR LOCAL,0,CHARANUM
	;TARGET:1�`��������
	SIF !TARGET:LOCAL
		CONTINUE
	;�Y���Q��
	SIF CFLAG:(TARGET:LOCAL):�Y���Q��
		CONTINUE
	;�d�������O
	SIF CFLAG:(TARGET:LOCAL):�s�� == 5 && CFLAG:(TARGET:LOCAL):350 != 49 && CFLAG:(TARGET:LOCAL):350 != 51
		CONTINUE
	;�\�ȃL�����������1��Ԃ�
	SIF COM_351_CONDITION(TARGET:LOCAL) > 0
		RETURN 1
NEXT
RETURN 0

;�߂�l
; 3 �܂Ƃ߂ĘA��o����
; 2 �ʑI���ŘA��o����
; 1 �A��o���Ȃ��i��荞�ݒ����b�Z�[�W�j
; 0 �A��o���Ȃ�
@COM_351_CONDITION(CHARA)
#FUNCTION
#DIM CHARA
SIF CHARA == MASTER
	RETURNF 0
SIF CFLAG:CHARA:�ԓx > 0 && CFLAG:CHARA:���� == 0 && CFLAG:CHARA:�s�� != 5
	RETURNF 3

;���ݓ��s���̃L�����͋���(���s�����𖞂����Ȃ��Ȃ����ꍇ�Ɏ蓮�œ��s�����ł���悤�ɂ���)
SIF CFLAG:CHARA:���s
	RETURNF 2

SIF CFLAG:CHARA:�ԓx < 1 && TCVAR:CHARA:�D�� == 0 && !CAN_IRAI_CHARA_GO_TOGATHER(CHARA)
	RETURNF 0
SIF CFLAG:CHARA:����
	RETURNF 0
SIF CFLAG:CHARA:�s�� == 5 && !TCVAR:CHARA:�D��
	RETURNF 1

RETURNF 2


code:
;-------------------------------------------------
;��������
;����n�R�}���h�A���x��2
;-------------------------------------------------
@COM352
LOCAL = 0
IF FLAG:�b�㐫��
	PRINTFORMW %CALLNAME:MASTER%�ɂ͂���ȓx���͂Ȃ�
	RETURN -1
ENDIF
;�����Ώۊm�F
PRINTFORML %CALLNAME:TARGET%�ɍ������܂��B�y���l�z��1�l�����擾�o���܂���B
PRINTW ��낵���ł����H
PRINTL [0] - ��߂�
PRINTL [1] - ��������B
$INPUT_LOOP
INPUT
IF RESULT < 0 || RESULT > 1
	CLEARLINE 1
	GOTO INPUT_LOOP
ELSEIF RESULT == 0
	RETURN -1
ENDIF

;�p�����[�^�ɂ�萬����b�l����

IF  CFLAG:���Ӕ��� > 300 + TALENT:����z���Ȃ� * 20
	TFLAG:193 = 1
ELSE
	TFLAG:193 = 0
ENDIF
IF TFLAG:193 == 1
	SOURCE:���y = 1000
	SOURCE:�� = 500 + 100 * ABL:�]��
	SOURCE:���� = 500 + 100 * ABL:�T�h���C
ENDIF
RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE352
;��~���͕s��
SIF FLAG:70
	RETURN 0
;�ϑz���͍����ł��Ȃ�
SIF TFLAG:�ϑz�� == 1
	RETURN 0
;����������s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(352)
	RETURN RESULT
;��l����łȂ��Ƃ���
SIF GET_TARGETNUM() > 1
	RETURN 0
;��ꍇ�����x2
SIF TCVAR:MASTER:��ꍇ�� < 2
	RETURN 0
;���łɗ��l������ꍇ�͂���
SIF GETBIT(CFLAG:MASTER:�������� , 2)
	RETURN 0
;������
SIF CFLAG:����
	RETURN 0
;�Y���Q��
SIF CFLAG:�Y���Q��
	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�C�^�Y������
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM353
IF FLAG:�b�㐫��
	PRINTFORMW %CALLNAME:MASTER%�ɂ͂���ȓx���͂Ȃ�
	RETURN -1
ENDIF
;������z�肵�Ă���悤����ABLE�̕��ő��l����e���Ă�
FOR LOCAL, 1, GET_TARGETNUM() + 1
	CALL SET_PRANK(1, TARGET:LOCAL, 1)
NEXT
SIF CFLAG:TARGET:������ < 1
	CFLAG:TARGET:������ = 1
RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE353
;�C�^�Y�����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(353)
	RETURN RESULT
;�������̂�
SIF CFLAG:���� == 0
	RETURN 0
;�^�[�Q�b�g�̎����ł̂�
SIF CFLAG:MASTER:���݈ʒu != CFLAG:311
	RETURN 0

;���Ԓ�~���s��
SIF FLAG:70
	RETURN 0
;���łɃC�^�Y�����[�h
SIF CFLAG:�C�^�Y��
	RETURN 0
;�Y���Q���o���Ȃ�
SIF CFLAG:�Y���Q��
	RETURN 0
;���ɒN������
SIF GET_TARGETNUM() > 1
	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
;����Ă��疳��
SIF CFLAG:���� > 0
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�Y���Q����
;����n�R�}���h�A���x��2
;-------------------------------------------------
@COM354
;�Y���Q����
;�������l����ł����ł��Ȃ��͂�
FOR LOCAL, 1, GET_TARGETNUM() + 1
	CALL SET_TOGETHER(1, TARGET:LOCAL, 1)
	SIF !CFLAG:(TARGET:LOCAL):���� && !CFLAG:(TARGET:LOCAL):������
		CALL SET_SLEEP(0, TARGET:LOCAL, 0)
	CALL SET_DERAY(4, TARGET:LOCAL)
NEXT

RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE354
;��~���͕s��
SIF FLAG:70
	RETURN 0
;�Y���Q���s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(354)
	RETURN RESULT
;�������̂�
SIF CFLAG:���� == 0
	RETURN 0
;����������Ă��Ȃ�
SIF TALENT:���� == 0
	RETURN 0
;�^�[�Q�b�g�̎����ł̂�
;SIF CFLAG:MASTER:���݈ʒu != CFLAG:311
;	RETURN 0
;���łɓY���Q���[�h
SIF CFLAG:�Y���Q��
	RETURN 0
;�C�^�Y�����[�h���o���Ȃ�
SIF CFLAG:�C�^�Y��
	RETURN 0
;�f�[�g��
SIF CHK_DATENOW(CFLAG:�f�[�g��)
	RETURN 0
;���ɒN������
SIF GET_TARGETNUM() > 1
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;���Ԓ�~
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM355
FOR LOCAL, 1, GET_TARGETNUM() + 1
	SIF CHK_DATENOW(CFLAG:LOCAL:�f�[�g��)
		CONTINUE
	CFLAG:(TARGET:LOCAL):���s = 0
	SIF EX:(TARGET:LOCAL):�����r���`�F�b�N == 1
		EX:(TARGET:LOCAL):�����r���`�F�b�N = 0
NEXT
SIF !CHK_DATENOW(CFLAG:MASTER:�f�[�g��)
	CFLAG:MASTER:���s = 0
FLAG:70 = 1
SETBGCOLOR 1, 24, 60

RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE355
;���Ԓ�~���s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(355)
	RETURN RESULT
;��~���͕s��
SIF FLAG:70
	RETURN 0
;�E�t�t���͕s��
SIF CFLAG:���ӂ�
	RETURN 0
;�����C�^�Y�����͕s��
SIF CFLAG:�C�^�Y��
	RETURN 0
;�Y���Q��
SIF CFLAG:�Y���Q��
	RETURN 0
;�f�[�g��
;SIF CHK_DATENOW(CFLAG:�f�[�g��) && CFLAG:���݈ʒu != OMANEKIBEYA()
;	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
;TSP 0
SIF BASE:MASTER:TSP <= 0
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�g��C����
;����n�R�}���h�A���x��3
;-------------------------------------------------
@COM360
TIME += 10
;�C�̓[���̂Ƃ��͕ϓ����Ȃ��i�g��C���邵���ł��Ȃ����߁j
SIF BASE:MASTER:�C�� <= 0
	RETURN 1
;�ʏ�̓v���X,�T�h���Ɣ��]
IF TALENT:TARGET:�T�h
	LOCAL = -1
ELSE
	LOCAL = 1
ENDIF
;�w�������]����3�{
IF COUNTER_SIKOU:TARGET:(TCVAR:TARGET:�J�E���^�[�s��) > 0 && TALENT:TARGET:�T�h
	LOCAL *= 3
ELSEIF COUNTER_SIKOU:TARGET:(TCVAR:TARGET:�J�E���^�[�s��) < 0
	LOCAL *= 3
ENDIF
;�m�f���n�m�K�������n��2�{
SIF TALENT:TARGET:�ԓx < 0 || TALENT:TARGET:�K�����x > 0
	LOCAL *= 2
;�ő�e���x10
COUNTER_SIKOU:TARGET:(TCVAR:TARGET:�J�E���^�[�s��) = LIMIT(COUNTER_SIKOU:TARGET:(TCVAR:TARGET:�J�E���^�[�s��) + LOCAL, -10, 10)
RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------

@COM_ABLE360
;��~���͕s��
SIF FLAG:70
	RETURN 0
;�Ȃ����܂܎��s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(360)
	RETURN RESULT
SIF CFLAG:���ӂ� != 2
	RETURN 0
;���˂��蒆�͕s��
SIF INRANGE(TCVAR:�J�E���^�[�s��, 40, 50)
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;��R����
;����n�R�}���h�A���x��3
;-------------------------------------------------
@COM361
TIME += 10
IF TALENT:TARGET:�T�h
	LOCAL = 1
ELSE
	LOCAL = -1
ENDIF
IF COUNTER_SIKOU:TARGET:(TCVAR:TARGET:�J�E���^�[�s��) < 0 && (TALENT:TARGET:�T�h || ABL:TARGET:�T�h���C >= 10)
	LOCAL *= 3
ELSEIF COUNTER_SIKOU:TARGET:(TCVAR:TARGET:�J�E���^�[�s��) > 0
	LOCAL *= 3
ENDIF
SIF TALENT:TARGET:�ԓx < 0 || TALENT:TARGET:�K�����x > 0
	LOCAL *= 2
COUNTER_SIKOU:TARGET:(TCVAR:TARGET:�J�E���^�[�s��) = LIMIT(COUNTER_SIKOU:TARGET:(TCVAR:TARGET:�J�E���^�[�s��) + LOCAL, -10, 10)
RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------

@COM_ABLE361
;��~���͕s��
SIF FLAG:70
	RETURN 0
;�Ȃ����܂܎��s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(361)
	RETURN RESULT
SIF CFLAG:���ӂ� != 2
	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�ǂݕ�����
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM363

LOCAL = RAND:100
LOCAL:1 = 90 + GET_SUCCESS_RATE() / 5
SIF LOCAL:1 > 99
	LOCAL:1 = 99
IF LOCAL <= 9
	;10���ő听��
	EXP:MASTER:��b�o�� ++
	TFLAG:193 = 1
	TFLAG:98 = 2
ELSEIF LOCAL >= LOCAL:1
	;10�`1���Ŏ��s
	TFLAG:193 = -1
	TFLAG:98 = -2
ELSE
	;�c��͐���
	TFLAG:193 = 0
	TFLAG:98 = 0
ENDIF

DOWNBASE:MASTER:�C�� += 150
DOWNBASE:MASTER:�̗� += 50

;�M��
TFLAG:98 += 3

;���̏�ɋ���TARGET�S���ŉ�
LOCAL:1 = TARGET
FOR LOCAL, 1, GET_TARGETNUM() + 1
	SIF !TALENT:(TARGET:LOCAL):�c�t
		CONTINUE
	SIF CFLAG:(TARGET:LOCAL):����
		CONTINUE
	TARGET = TARGET:LOCAL
	CALL COM363_1
NEXT
TARGET = LOCAL:1

TIME += 30
RETURN 1

@COM363_1

DOWNBASE:�C�� += 50

;�Œ�Ŋl������\�[�X
SOURCE:���y = 1000

;ABL:�]�����݂�
IF ABL:�]�� <= 1
	SOURCE:���y += (ABL:�]�� * 60)
ELSEIF ABL:�]�� <= 3
	SOURCE:���y += 200 + (ABL:�]�� * 65)
ELSEIF ABL:�]�� <= 5
	SOURCE:���y += 500 + (ABL:�]�� * 65)
ELSEIF ABL:�]�� <= 8
	SOURCE:���y += 750 + (ABL:�]�� * 85)
ELSEIF ABL:�]�� <= 11
	SOURCE:���y += 1000 + (ABL:�]�� * 85)
ELSE
	SOURCE:���y += 2000 + (ABL:�]�� * 40)
ENDIF

;�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

SOURCE:�� = 300 + 150 * ABL:�]��
SOURCE:���� = 300 + 100 * ABL:�T�h���C

IF TFLAG:193 == -1
	TIMES SOURCE:���y , 0.10
	TIMES SOURCE:���� , 0.50
	TIMES SOURCE:�� , 0.50
ELSEIF TFLAG:193 == 0
	TIMES SOURCE:���y , 1.00
	TIMES SOURCE:���� , 1.00
	TIMES SOURCE:�� , 1.00
ELSE
	TIMES SOURCE:���y , 2.00
	TIMES SOURCE:���� , 2.00
	TIMES SOURCE:�� , 2.00
ENDIF
CALL SET_DERAY(6,TARGET)
RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE363
;��~���͕s��
SIF FLAG:70
	RETURN 0
SIF !TFLAG:100
	RETURN 0
SIF !TALENT:�c�t
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(301)
	RETURN RESULT
;������
SIF CFLAG:����
	RETURN 0
;�Y���Q��
SIF CFLAG:�Y���Q��
	RETURN 0
;����
;SIF CFLAG:MASTER:���݈ʒu == 13 || CFLAG:MASTER:���݈ʒu == 24 || CFLAG:MASTER:���݈ʒu == 30 || CFLAG:MASTER:���݈ʒu == 39
SIF BATHCHECK(CFLAG:MASTER:���݈ʒu) && GET_MAPID(CFLAG:MASTER:���݈ʒu) == MAIN_MAP
	RETURN 0
;�f�[�g��
SIF CHK_DATENOW(CFLAG:�f�[�g��) && CFLAG:���݈ʒu != OMANEKIBEYA()
	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
SIF !ITEM:104
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;���܂�
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM364

;-------------------------------------------------
;COM��FLAG�̐ݒ�
;-------------------------------------------------
;�s�׎�
TCVAR:116 = PLAYER
TFLAG:98 = -1
TFLAG:193 = 1
LOCAL:2 = TARGET

FOR LOCAL, 1, GET_TARGETNUM() + 1
	SIF CFLAG:(TARGET:LOCAL):����
		CONTINUE
	SIF TALENT:(TARGET:LOCAL):�z���S
		CONTINUE
	SIF GROUPMATCH(TARGET:LOCAL, 10, 64)
		CONTINUE
	TFLAG:193 ++
	TARGET = TARGET:LOCAL
	CALL COM364_1
NEXT

TARGET = LOCAL:2

DOWNBASE:�̗� += TFLAG:193 * 200
DOWNBASE:�C�� += TFLAG:193 * 200

SOURCE:��� = TFLAG:193 * 1000
SOURCE:���| = TFLAG:193 * 2000
SOURCE:���� = TFLAG:193 * 500

DOWNBASE:MASTER:�C�� += 50
;�d�������ŋ�������
TFLAG:207 += TFLAG:193 * 300
;-------------------------------------------------
;����\�[�X����
;-------------------------------------------------
;��ɂ̃p�����[�^�ɂ���ɂ̃\�[�X�����͐�ɏ������Ă���
SOURCE:��� = SOURCE:��� * (10 + 5 * MAX(GETPALAMLV(PALAM:���,5) - 1, 0)) / 10
TIME += 30
RETURN 1

@COM364_1
DOWNBASE:�C�� += 50
SOURCE:���y = 1500 + 300 * ABL:�T�h���C
SOURCE:���� = 500 + 200 * ABL:�T�h���C

RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE364
;��~���͕s��
SIF FLAG:70
	RETURN 0
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(301)
	RETURN RESULT
;������
SIF CFLAG:����
	RETURN 0
;�Y���Q��
SIF CFLAG:�Y���Q��
	RETURN 0
SIF FESTIVAL() != "�ߕ�"
	RETURN 0
;TARGET���S����Ȃ��Ƒʖ�
SIF TARGET != 64 && TARGET != 10 && !TALENT:TARGET:�z���S
	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
RETURN 1


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

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

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

CALL DRAW_MAP

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

�o���n�_ = CFLAG:MASTER:���݈ʒu
���O�̖ړI�n = -1

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

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

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

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

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


code:
;-------------------------------------------------
;�R���N�V����
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM401
#DIM ���
FLAG:700 = 0
FOR LOCAL,1,CHARANUM
	FOR ���,0,MAXPANTS
		CFLAG:LOCAL:(��� + �p���c�Ǘ�) += PANTS_TEMP:LOCAL:���
		SIF PANTS_TEMP:LOCAL:���
		PRINTFORML %CALLNAME:LOCAL%��%PANTSNAME(���)%���R���N�V�����ɒǉ�����
		PANTS_TEMP:LOCAL:��� = 0
		CFLAG:LOCAL:293 = 0
		SIF CFLAG:LOCAL:(��� + �p���c�Ǘ�)
			FLAG:700 ++
	NEXT
NEXT
FLAG:�p���c�A�� = 0

PRINTFORMW �R���N�V�����͌���{FLAG:700}�킾
RETURN 1

;�R���N�V����
@COM_ABLE401
;�ړ����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(401)
	RETURN RESULT
;�����ݒ�
SIF CFLAG:MASTER:���݈ʒu != CFLAG:MASTER:311
	RETURN 0
;SIF CSTR:MASTER:12 == ""
SIF !FLAG:�p���c�A��
	RETURN 0
SIF CFLAG:���ӂ� == 2
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�A�Q
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM402
#DIM �J����
#DIM ���v
IF TARGET > 0
	CFLAG:���s = 0
	CFLAG:�Y���Q�� = 0
	CFLAG:MASTER:���s = 0
	CFLAG:MASTER:�Y���Q�� = 0
ENDIF

IF CFLAG:MASTER:���݈ʒu == CFLAG:MASTER:311
	CALL SET_SLEEP(1,MASTER,0)
ELSE
	CALL SET_SLEEP(1,TARGET,1)
	SIF CFLAG:TARGET:����
		CFLAG:TARGET:���� = 0
ENDIF

CALL SET_SNEAK(0,TARGET,1)
;CALL SET_TOGETHER(0,TARGET,1)

IF FLAG:���E && !CFLAG:�Y���Q�� && BASE:MASTER:�C�� > 300 && BASE:MASTER:TSP > 0
	PRINTFORML %CALLNAME:MASTER%�͐Q��O�Ɏc����TSP���g���ē��E������
	�J���� = MIN(BASE:MASTER:�C��, BASE:MASTER:TSP /2)
	���v = �J���� * (5 + RAND:5) / 10
	PRINTFORMW \\{���v}�҂���
ENDIF

IF �q���̐�������(TARGET) && CFLAG:�o�Y�o�ߓ� >= CHILD_�悿�悿 && FLAG:�q���`�� && !INRANGE(TIME, 540, 840)
	PRINTFORMDL �Ƒ��O�l�Ő�̎��ɂȂ��ĐQ�鎖�ɂ����c
	CALL KOJO_MESSAGE_SEND("EVENT", 0, TARGET, 0, 0, "CHILD_RAISING_OYASUMI")
	TFLAG:193 = 1
	RESETCOLOR
ENDIF

CFLAG:MASTER:�A�Q���� = DAY * 1440 + TIME
BEGIN AFTERTRAIN

RETURN 1

;�A�Q
@COM_ABLE402
;�ړ����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(402)
	RETURN RESULT
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;�����ݒ�
SIF CFLAG:MASTER:���݈ʒu != CFLAG:MASTER:311 && CFLAG:MASTER:���݈ʒu != OMANEKIBEYA() && CFLAG:�Y���Q�� == 0
	RETURN 0
;�N����12���Ԉȏ�o�߂��ĂȂ��ƃ_���i�f�o�b�O���j
IF FLAG:1005 == 0
SIF NEMUKE() < 720
	RETURN 0
SIF CFLAG:���ӂ� == 2
	RETURN 0
ENDIF
RETURN 1


code:
;-------------------------------------------------
;�x�e
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM403
#DIM �񕜑O�̗�
#DIM �񕜑O�C��
#DIM �񕜌�̗�
#DIM �񕜌�C��
�񕜑O�̗� = BASE:MASTER:�̗�
�񕜑O�C�� = BASE:MASTER:�C��
IF NEMUKE() >= 960 && !CFLAG:MASTER:����
	PRINTFORMW �ЂƋx�݂��悤�Ƃ���%CALLNAME:MASTER%�͂��̂܂ܖ����Ă��܂���
	TFLAG:193 = -1
	CALL SET_SLEEP(1,MASTER,0)
	CFLAG:MASTER:�A�Q���� = DAY * 1440 + TIME
	BEGIN AFTERTRAIN
ELSE
	;�N���A��Ă鎞�͂������D
	;"���Q����"����R�s�y���Ă邩�炱�̕��򂪂���������΂��߂�Ȃ���
	IF TARGET > 0 && CFLAG:TARGET:6 > 0
		;�z���S�܂��͌����������Ŗ�̊�
		;�܂��͓����������Œ��̊�
		IF ((TALENT:�z���S || TALENT:������) && (TIME > 1140 || TIME < 360)) || (TALENT:������ && (TIME > 360 && TIME < 1140))
			CALL RECOVER_PERMIL(TARGET,120,"�̗�",1)
			CALL RECOVER_PERMIL(TARGET,160,"�C��",1)
		ELSEIF TALENT:�H���l
			CALL RECOVER_PERMIL(TARGET,200,"�̗�",1)
			CALL RECOVER_PERMIL(TARGET,300,"�C��",1)
		ELSE
			CALL RECOVER_PERMIL(TARGET,75,"�̗�",1)
			CALL RECOVER_PERMIL(TARGET,100,"�C��",1)
		ENDIF
	ENDIF
	CALL RECOVER_PERMIL(MASTER,75,"�̗�",1)
	CALL RECOVER_PERMIL(MASTER,100,"�C��",1)
ENDIF
TIME += 60
�񕜌�̗� = BASE:MASTER:�̗�
�񕜌�C�� = BASE:MASTER:�C��
DRAWLINE
PRINTFORML �̗�+{ABS(�񕜌�̗� - �񕜑O�̗�)}�i%CALLNAME:MASTER%�j
PRINTFORML �C��+{ABS(�񕜌�C�� - �񕜑O�C��)}�i%CALLNAME:MASTER%�j
RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE403
;�ړ����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(403)
	RETURN RESULT
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;�����A�g���فA���q���A�A�ꍞ�ݏh�A�����������ȊO�͕s��
SIF CFLAG:MASTER:���݈ʒu != CFLAG:MASTER:311 && !�x�e��(CFLAG:MASTER:���݈ʒu)
	RETURN 0
;�Y���Q��
SIF CFLAG:�Y���Q��
	RETURN 0
;�C�^�Y����
SIF CFLAG:MASTER:�C�^�Y��
	RETURN 0
SIF NEMUKE() >= 960
	RETURN 0
SIF CFLAG:���ӂ� == 2
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�o�|����
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM405
VARSET LOCAL
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 ����𒴂��Ă��邽�ߏo�|���邱�Ƃo���܂���
	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
LOCAL:3 = 0
DRAWLINE
CALL OTHERREGIONS
LOCAL:2 = RESULT
LOCAL = 0
IF LOCAL:2 == MAIN_MAP || LOCAL:2 == 100
	RETURN -1
ENDIF
RETURN 1

@COM_ABLE405
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(405)
	RETURN RESULT
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
SIF CFLAG:���ӂ� == 2
	RETURN 0
;�Q���ݒ�
SIF !CHK_ENTRANCE(CFLAG:MASTER:���݈ʒu, MAIN_MAP)
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�|��
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM410
#DIM �|���O�̉���
#DIM �|����̉���
#DIM ���|��
#DIM SWEEPID
SWEEPID = CFLAG:MASTER:���݈ʒu

IF YOGORE:SWEEPID < 3000 && TALENT:MASTER:���L�ϐ� == 2
	PRINTFORML ����ȂɎU�炩���Ă��Ȃ����A�܂��|�����Ȃ��ł������낤
	RETURN -1
ENDIF

SELECTCASE YOGORE:SWEEPID
	CASE IS < 500
		TFLAG:194 = 0
	CASE IS < 2000
		TFLAG:194 = 1
	CASE IS < 5000
		TFLAG:194 = 2
	CASEELSE
		TFLAG:194 = 3
ENDSELECT
;=================================================
LOCAL:4 = 0
SIF BASE:MASTER:TSP > 1500
LOCAL:4 = 1
SIF BASE:MASTER:TSP > 2000
LOCAL:4 = 2

IF YOGORE:(SWEEPID) > 5000 && TALENT:MASTER:61 == -2 && BASE:MASTER:�̗� > (1500 - LOCAL:4 * 300) && BASE:MASTER:�C�� > (2000 - LOCAL:4 * 100) && BASE:MASTER:TSP > 1000 && !CFLAG:MASTER:335 && !FLAG:70
	PRINTL ����ɂ��Ă��A�ς��������������c
	;PRINTL [0]����S��ۂ�
	;PRINTL [1]����
	;INPUT
	;IF RESULT == 0
		GOTO CANCEL_LOOP
	;ELSE
	;	CALL OSOUJI(LOCAL:4)
	;	RETURN 1
	;ENDIF
;=================================================
ELSE
	$ CANCEL_LOOP
	IF (!TARGET || !SHIRAHU(TARGET))
		CALL �p���c����
	ENDIF
	IF TARGET && ABL:�e�� * 500 + ABL:�]�� * 500 + ABL:���|�Z�\ * 1000 > CFLAG:310 - CFLAG:MASTER:310
		TFLAG:193 = 1
	ELSE
		TFLAG:193 = 0
	ENDIF

	���|�� = (2 + ABL:MASTER:���|�Z�\ + 3 * TALENT:MASTER:���|����)
	���|�� = ���|�� * (5 - TALENT:MASTER:61) / 5
	�|���O�̉��� = YOGORE:(SWEEPID)
	IF TFLAG:193 && !CFLAG:����
		YOGORE:(SWEEPID) = YOGORE:(SWEEPID) / (���|�� + 1)
	ELSE
		YOGORE:(SWEEPID) = YOGORE:(SWEEPID) / ���|��
	ENDIF
	IF (CFLAG:MASTER:���݈ʒu == 9 || CFLAG:MASTER:���݈ʒu == 10)
		PRINTL ���łɒ��������Y��ɂ���
		PRINTFORML �j���ۂ̎������ǂ��ċt���ɐU�邾��������ȒP��
		YOGORE:(54) = 0
	ENDIF
	�|����̉��� = YOGORE:(CFLAG:MASTER:���݈ʒu)
	EX:MASTER:�����̑|���� = EX:MASTER:�����̑|���� + �|���O�̉��� - �|����̉���
	IF FLAG:70
		BASE:MASTER:TSP -= 50
		LOCAL:3 = 0
		FOR LOCAL,1,CHARANUM
			SIF CFLAG:LOCAL:����
				LOCAL:3 ++
		NEXT
		IF LOCAL:3 == 1
			EXP:MASTER:�ُ퐴�|�o�� ++
			IF !GETBIT(CFLAG:MASTER:3,11)
				EXP:MASTER:�ُ�o�� ++
				SETBIT CFLAG:MASTER:3,11
			ENDIF
		ENDIF
	ELSE
		DOWNBASE:MASTER:�̗� = 50
		DOWNBASE:MASTER:�C�� = 100
	ENDIF

	IF TARGET > 0 && !CFLAG:���� && !FLAG:70 && !CFLAG:���ӂ�
		;�Œ�Ŋl������\�[�X
		SOURCE:���y = 400
		;�M��
		TFLAG:98 = 3

		;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

		;�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
		SOURCE:���� = 300 + 100 * ABL:�T�h���C
	ELSEIF TARGET > 0 && CFLAG:���ӂ� && !FLAG:70
		DOWNBASE:�C�� += 100
		SOURCE:���� += 500
		SOURCE:�T�� += 100
		LOCAL:3 = 0
		FOR LOCAL,1,CHARANUM
			SIF CFLAG:LOCAL:����
				LOCAL:3 ++
		NEXT
		IF LOCAL:3 == 1
			EXP:MASTER:�ُ퐴�|�o�� ++
			IF !GETBIT(CFLAG:3,11)
				EXP:�ُ�o�� ++
				SETBIT CFLAG:3,11
			ENDIF
		ENDIF
	ENDIF

	IF !FLAG:70
		TIME += 30
		SIF CFLAG:���s
			CFLAG:���s += 30
	ENDIF
	SIF TFLAG:193 && !CFLAG:���� && !FLAG:70 && !CFLAG:���ӂ�
		EXP:���|�o�� ++
	EXP:MASTER:���|�o�� ++
ENDIF
RETURN 1

@OSOUJI(ARG)
VARSET LOCAL
SETCOLOR 0xEE1010
PRINTFORMW %CALLNAME:PLAYER%�͌��{�����B
PRINTW �K���A���̔t�՘T�Ёi�͂��΂�낤�����j��%GET_MAPNAME(MAIN_MAP)%��ЂÂ��Ȃ���΂Ȃ�ʂƌ��ӂ����B
PRINTFORMW %CALLNAME:PLAYER%�ɂ͐M���킩��ʁB
PRINTFORMW %CALLNAME:PLAYER%�́A����̋������ł���B
PRINTW �����~�߁A������M��ŕ邵�ė����B
PRINTW ����ǂ�����ɑ΂��ẮA�l��{�ɕq���ł������B
RESETCOLOR
PRINTFORML
PRINTFORML %CALLNAME:PLAYER%�͎����~�߁A%GET_MAPNAME(MAIN_MAP)%����|�����ĉ�����I
PRINTFORML
PRINTFORMW %CALLNAME:PLAYER%���|�����c
PRINTFORMW %CALLNAME:PLAYER%���|�����c�c
PRINTFORMW %CALLNAME:PLAYER%���|�����c�c�c
FOR LOCAL,MINROOM(), MAXROOM
IF YOGORE:( LOCAL) > 2000
	YOGORE:( LOCAL) = YOGORE:( LOCAL:1) / (3 + ABL:MASTER:���|�Z�\)
FLAG:562 += 1
ENDIF
NEXT
PRINTFORMW %CALLNAME:PLAYER%��{FLAG:562}�����|������
CFLAG:MASTER:335 += 4 + RAND:(13 - 2 * ABL:MASTER:���|�Z�\)
CFLAG:MASTER:���݈ʒu = CFLAG:MASTER:�����ʒu
FOR LOCAL,1,11
	CFLAG:LOCAL:���݈ʒu = 9
	CFLAG:LOCAL:335 = 1 + RAND:(ABL:MASTER:�b�p�Z�\)
NEXT
FLAG:562 = 1
TIME += (500 - ARG * 100)
DOWNBASE:MASTER:�̗� = (1500 - ARG * 300)
DOWNBASE:MASTER:�C�� = (1500 - ARG * 100)
BASE:MASTER:TSP = 0
SIF ARG
	EXP:MASTER:���|�o�� += (1 + RAND: (ARG * 3))
SIF !ARG
	EXP:MASTER:���|�o�� += (1 + RAND: (2))
EXP:MASTER:�ُ퐴�|�o�� += RAND:5
@�p���c����
#DIM ����L����
VARSET LOCAL
[SKIPSTART]
SELECTCASE CFLAG:MASTER:���݈ʒu
	;�얲����
	CASE 15
		LOCAL = 1
	;�{�������iEX�����o�[�����j
	CASE 16
		LOCAL = FLAG:15
	;�������[�ˁi��`���Ɓj
	CASE 17
		LOCAL = 2
	;��������i�J�i�j
	CASE 18
		LOCAL = 3
	;�傫���[�ˁi���j
	CASE 19
		LOCAL = 10
	;�T�j�[����
	CASE 32
		LOCAL = 7
	;���i����
	CASE 33
		LOCAL = 5
	;�X�^�[����
	CASE 34
		LOCAL = 6
	;��������
	CASE 43
		LOCAL = 9
	;����莄��
	CASE 44
		LOCAL = 8
	;����i�����l��p����j
	CASE 52
		LOCAL = 4
	CASE 54
		LOCAL = 71
	CASE 55
		LOCAL = FLAG:16
	CASEELSE
		LOCAL = 0
		FOR ����L����,1,CHARANUM
			IF CFLAG:MASTER:���݈ʒu == CFLAG:(����L����):�_�ЍݏZ
				LOCAL = ����L����
			ENDIF
		NEXT
ENDSELECT
[SKIPEND]

FOR ����L����,1,CHARANUM
	IF CFLAG:MASTER:���݈ʒu == CFLAG:(����L����):�_�ЍݏZ
		LOCAL = ����L����
	ENDIF
NEXT
LOCAL:1 = �����̂ς��(LOCAL)
LOCAL:2 =  RAND:5000
SIF FLAG:��|�����e == 202
	LOCAL:2 = RAND:4000
IF YOGORE:(CFLAG:MASTER:���݈ʒu) > LOCAL:2 && LOCAL && LOCAL:1 && !FLAG:70
	TSTR:3 = %CALLNAME:LOCAL%{LOCAL:1}/
	TSTR:2 = %PANTSNAME(LOCAL:1)%
	FOUND_PANTS_TYPE = LOCAL:1
	FOUND_PANTS_OWNER = LOCAL
ENDIF

@COM_ABLE410
;�|�����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(410)
	RETURN RESULT
SIF CHK_DATENOW(CFLAG:MASTER:�f�[�g��)
	RETURN 0
;����ĂȂ��ƃ_��
SIF YOGORE:(CFLAG:MASTER:���݈ʒu) < 100
	RETURN 0
;�Y���Q���̓_��
SIF CFLAG:�Y���Q��
	RETURN 0
SIF CFLAG:���ӂ� == 2
	RETURN 0
SIF CFLAG:�s�� == 5 && CFLAG:350 != 40
	RETURN 0
;�O�o���̓_���A�����������͑|���ł���
SIF AT_HOME(MASTER) == 0 && CFLAG:MASTER:���݈ʒu != OMANEKIBEYA()
	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
;���Ȃ��̎��C��0�ȏ�Ȃ�U
SIF BASE:MASTER:���C > 0
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�퓬�P��
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM411
;�V�C���Q��
SELECTCASE TIME:5
	CASE 4,6,8,10,12,13
		;���V��
		TFLAG:194 = 1
	CASE 5,9
		;���o���V�C
		TFLAG:194 = 2
	;����ȊO
	CASEELSE
		;�ď�͎��˂�
		SIF DAY:2 == 2 && TIME:5 == 1 && TIME > 360 && TIME < 1020
			TFLAG:194 = 3
ENDSELECT
SIF !OUTROOF(CFLAG:MASTER:���݈ʒu)
	TFLAG:194 = 0
SELECTCASE TFLAG:194
	CASE 0
		DOWNBASE:MASTER:�̗� = 200
		DOWNBASE:MASTER:�C�� = 200
		IF TARGET > 0 && !CFLAG:����
			;�Œ�Ŋl������\�[�X
			SOURCE:���y = 400
				MAXBASE:TARGET:�̗� += RAND:10
			;�M��
			TFLAG:98 += 3
			SIF ABL:MASTER:�퓬�\�� > 2
			TFLAG:98 ++
			IF ABL:MASTER:�퓬�\�� > ABL:�퓬�\��
				EXP:�퓬�o�� += 2
				TFLAG:98 ++
			ENDIF
			SIF ABL:MASTER:�퓬�\�� < ABL:�퓬�\�� - 2
				EXP:MASTER:�퓬�o�� ++
			;ABL:�e�����݂�
			IF ABL:�e�� <= 5
				SOURCE:���y += 500 + (ABL:�e�� * 60)
				TFLAG:98 ++
			ELSEIF ABL:�e�� <= 8
				SOURCE:���y += 750 + (ABL:�e�� * 75)
			ELSEIF ABL:�e�� <= 11
				SOURCE:���y += 1000 + (ABL:�e�� * 75)
			ELSE
				SOURCE:���y += 2000 + (ABL:�e�� * 30)
			ENDIF
			;�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:�퓬�o�� ++
			EXP:�퓬�o�� ++
		ENDIF
	CASE 1
	;���V��
	DOWNBASE:MASTER:�̗� = 300
	DOWNBASE:MASTER:�C�� = 300
	IF TARGET > 0 && !CFLAG:����
		;�Œ�Ŋl������\�[�X
		SOURCE:���y = 450
			MAXBASE:TARGET:�̗�  += RAND:15
			MAXBASE:TARGET:�C��  += RAND:10
		;�M��
		TFLAG:98 += 3
		SIF ABL:MASTER:�퓬�\�� > 2
		TFLAG:98 ++
		IF ABL:MASTER:�퓬�\�� > ABL:�퓬�\��
			EXP:�퓬�o�� += 2
			TFLAG:98 ++
		ENDIF
		SIF ABL:MASTER:�퓬�\�� < ABL:�퓬�\�� - 2
			EXP:MASTER:�퓬�o�� ++
		;ABL:�e�����݂�
		IF ABL:�e�� <= 5
			SOURCE:���y += 520 + (ABL:�e�� * 60)
			TFLAG:98 ++
		ELSEIF ABL:�e�� <= 8
			SOURCE:���y += 750 + (ABL:�e�� * 75)
		ELSEIF ABL:�e�� <= 11
			SOURCE:���y += 1100 + (ABL:�e�� * 75)
		ELSE
			SOURCE:���y += 2150 + (ABL:�e�� * 30)
		ENDIF

		;�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:�퓬�o�� += 2
		EXP:�퓬�o�� += 2
	ENDIF
	CASE 2,3
	;���o���V�C
		DOWNBASE:MASTER:�̗� = 600
		DOWNBASE:MASTER:�C�� = 600
		IF TARGET > 0 && !CFLAG:����
			;�Œ�Ŋl������\�[�X
			SOURCE:���y = 500
				MAXBASE:TARGET:�̗� += RAND:30
				MAXBASE:TARGET:�C�� += RAND:30
			;�M��
			TFLAG:98 += 3
			SIF ABL:MASTER:�퓬�\�� > 2
			TFLAG:98 ++
			IF ABL:MASTER:�퓬�\�� > ABL:�퓬�\��
				EXP:�퓬�o�� += 2
				TFLAG:98 ++
			ENDIF
			SIF ABL:MASTER:�퓬�\�� < ABL:�퓬�\�� - 2
				EXP:MASTER:�퓬�o�� ++
			;ABL:�e�����݂�
			IF ABL:�e�� <= 5
				TFLAG:98 ++
				SOURCE:���y += 550 + (ABL:�e�� * 60)
			ELSEIF ABL:�e�� <= 8
				SOURCE:���y += 800 + (ABL:�e�� * 75)
			ELSEIF ABL:�e�� <= 11
				SOURCE:���y += 1200 + (ABL:�e�� * 75)
			ELSE
				SOURCE:���y += 2300 + (ABL:�e�� * 30)
			ENDIF
			;�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:�퓬�o�� += 3
			EXP:�퓬�o�� += 3
		ENDIF
ENDSELECT
TIME += 60
	SIF CFLAG:���s
		CFLAG:���s += 60
EXP:MASTER:�퓬�o�� ++
TCVAR:MASTER:�󕠎��� -= 15
SIF TARGET
	TCVAR:TARGET:�󕠎��� -= 15
SIF ITEM:101 && !RAND:2
	EXP:MASTER:�퓬�o�� ++
IF ITEM:�X�|�[�c�h�����N
	IF TFLAG:194 == 3
		DOWNBASE:MASTER:�̗� -= 200
		DOWNBASE:MASTER:�C�� -= 300
	ELSE
		DOWNBASE:MASTER:�̗� -= 50
		DOWNBASE:MASTER:�C�� -= 50
	ENDIF
	SIF TARGET
		SOURCE:���y += 300
	TFLAG:193 = 1
ENDIF
RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE411
;�퓬�P�����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(411)
	RETURN RESULT
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;�d����
SIF CFLAG:�s�� == 5
	RETURN 0
SIF !�퓬�P����(CFLAG:MASTER:���݈ʒu)
	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
SIF CFLAG:���ӂ� == 2
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�׋�
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM412
DOWNBASE:MASTER:�̗� = 100
DOWNBASE:MASTER:�C�� = 300

IF TARGET > 0 && !CFLAG:���� && CFLAG:�s�� != 5
	;�Œ�Ŋ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

	;�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
SIF CFLAG:���s
	CFLAG:���s += 60
EXP:MASTER:�w�K�o�� ++
SIF ITEM:103 && !RAND:2
	EXP:MASTER:�w�K�o�� ++
SIF ITEM:214 > 0
	EXP:MASTER:�w�K�o�� ++
RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE412
;�׋����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(412)
	RETURN RESULT
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;�׋��o���镔����
SIF !�׋���(CFLAG:MASTER:���݈ʒu)
	RETURN 0

;�Y���Q��
SIF CFLAG:�Y���Q��
	RETURN 0
;�C�^�Y����
SIF CFLAG:MASTER:�C�^�Y��
	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
SIF CFLAG:���ӂ� == 2
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;���������
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM413
;�H�ނ��Ȃ�
IF !HAS_INGREDIENT()
	PRINTFORMW �H�ނ��Ȃ�
	RETURN -1
ENDIF
CALL COOKING_MENU
SIF !RESULT
	RETURN -1
IF TFLAG:194 == 1
	DOWNBASE:MASTER:�̗� = 50
	DOWNBASE:MASTER:�C�� = 50
	TIME += 15
	SIF CFLAG:���s
		CFLAG:���s += 15
ELSEIF TFLAG:194 == 2
	DOWNBASE:MASTER:�̗� = 100
	DOWNBASE:MASTER:�C�� = 100
	TIME += 45
	SIF CFLAG:���s
		CFLAG:���s += 45
ELSEIF TFLAG:194 == 3
	DOWNBASE:MASTER:�̗� = 100
	DOWNBASE:MASTER:�C�� = 100
	TIME += 45
	SIF CFLAG:���s
		CFLAG:���s += 45
ELSEIF TFLAG:194 == 4
	DOWNBASE:MASTER:�̗� = 150
	DOWNBASE:MASTER:�C�� = 150
	TIME += 45
	SIF CFLAG:���s
		CFLAG:���s += 45
ENDIF

IF TARGET > 0 && !CFLAG:���� && !FLAG:70
	IF TARGET && ABL:�e�� * 500 + ABL:�]�� * 500 + ABL:�����Z�\ * 1000 > CFLAG:310 - CFLAG:MASTER:310
		TFLAG:193 = 1
		EXP:�����o�� ++
	ELSE
		TFLAG:193 = 0
	ENDIF
	;�Œ�Ŋl������\�[�X
	SOURCE:���y = 200

	;�M��
	TFLAG:98 = 3

	;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

	;�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
ENDIF
TCVAR:MASTER:308 = 0
SIF TARGET < 1
	CALL MIX_MENU

SIF ITEM:102 && !RAND:2
	EXP:MASTER:�����o�� ++
DISHTIME = 1440 * DAY + TIME

STAIN:MASTER:0 = 0
STAIN:MASTER:1 = 0
CFLAG:MASTER:���ɐ��t = 0
CFLAG:MASTER:��ɐ��t = 0
CFLAG:MASTER:��ɐ��t = 0
IF TARGET
	STAIN:0 = 0
	STAIN:1 = 0
	CFLAG:���ɐ��t = 0
	CFLAG:��ɐ��t = 0
	CFLAG:��ɐ��t = 0
ENDIF

RETURN 1

@COOKING_MENU
PRINTL �������܂����H
CALL ASK_M("����ς��߂�",1,"�y�H",1,"��H",ABL:MASTER:�����Z�\ > 1,"�f�U�[�g",ABL:MASTER:�����Z�\ > 2,"�֒f�̗���",ABL:MASTER:�����Z�\ > 2, "������", ABL:MASTER:�����Z�\ > 1)
SELECTCASE RESULT
CASE 1
	DISHTYPE = RESULT
	CALL INGREDIENT_CHOICE
	SIF RESULT == 0
		RETURN 0
	TFLAG:194 = 1
	CALL COOKING
	RETURN 1
CASE 2
	DISHTYPE = RESULT
	CALL INGREDIENT_CHOICE
	SIF RESULT == 0
		RETURN 0
	TFLAG:194 = 2
	CALL COOKING
	RETURN 1
CASE 3
	DISHTYPE = RESULT
	CALL INGREDIENT_CHOICE
	SIF RESULT == 0
		RETURN 0
	TFLAG:194 = 3
	CALL COOKING
	RETURN 1
CASE 4
	IF !ITEM:0
		PRINTFORMW �H�ނ�����܂���
		TIME += 5
		RETURN 0
	ENDIF

	ITEM:0 --
	DISHTYPE = 4
	CALL COOKING
	TFLAG:194 = FLAG:����
	RETURN 1
CASE 5
	PRINTFORML �H�ނ�I��ł�������
	CALL ASK_M(@"���@{ITEM:��}������", ITEM:��, @"���܂����@{ITEM:���܂���}������", ITEM:���܂���,@"�J�G���@{ITEM:�J�G��}�C����", ITEM:�J�G��,"��߂�",1)
	SELECTCASE RESULT
		CASE 0
			DISHQUALITY = 1
			ITEM:�� --
		DISHTYPE = 5
		CASE 1
			DISHQUALITY = 2
			ITEM:���܂��� --
		DISHTYPE = 5
		CASE 2
			DISHQUALITY = 1
			ITEM:�J�G�� --
		DISHTYPE = 6
		CASE 3
			RETURN 0
	ENDSELECT
	TFLAG:194 = 2
	CALL COOKING
	RETURN 1
CASE 6

CASE 0
	RETURN 0
ENDSELECT

;�������s�֐�
;�����˗��ɗ��p�ł���悤�ɍ쐬
;��ɌĂяo������DISHTYPE��DISHQUALITY�����߂Ă�������
;�H�ނ̏��������ɂ��܂��Ă�������
@COOKING(CHARA)
#DIM  CHARA ;�L������n���Ǝ�`���Ă����i�˗��p�ACOM413�͎��s��ɗ����o������̂ŕs�v�j
#DIMS CONST MENU_TYPE, 7 = "", "SNACK", "MAINDISH", "DESSERT", "FORBIDDEN","FISH", "FROG"
CALL SET_DISHNAME(MENU_TYPE:DISHTYPE)
PRINTFORMW %DISHNAME%�����܂�
SELECTCASE DISHTYPE
CASE 1
	;���l
	IF !RAND:20 && VISIT(66) && AT_HOME(MASTER) && CFLAG:MASTER:���݈ʒu != OMANEKIBEYA()
		SETBIT FLAG:50,55
		CFLAG:66:���݈ʒu = CFLAG:MASTER:���݈ʒu
		PRINTFORML �������Ă�C�z��k������%CALLNAME:66%������Ă����c�c
	ENDIF
CASE 2
	;���l
	IF !RAND:10 && VISIT(66) && AT_HOME(MASTER) && CFLAG:MASTER:���݈ʒu != OMANEKIBEYA()
		SETBIT FLAG:50,55
		CFLAG:66:���݈ʒu = CFLAG:MASTER:���݈ʒu
		PRINTFORML �������Ă�C�z��k������%CALLNAME:66%������Ă����c�c
	ENDIF
	EXP:MASTER:�����o�� ++
	SIF CHARA
		EXP:CHARA:�����o�� ++
CASE 3
CASE 4
CASE 5
	YOGORE:(CFLAG:MASTER:���݈ʒu) += 500
ENDSELECT
YOGORE:(CFLAG:MASTER:���݈ʒu) += 500
EXP:MASTER:�����o�� ++
SIF CHARA
	EXP:CHARA:�����o�� ++

;�������I�֐�
;�����̌����FLAG�ւ̋L�^�ADISHNAME����܂�
;DISHQUALITY�̐ݒ�͌Ăяo�����ōs������
@SET_DISHNAME(MENU_TYPE)
#DIMS MENU_TYPE
#DIM  FOOD_ID
SELECTCASE MENU_TYPE
CASE "SNACK"
	DISHTYPE = 1
	FLAG:���� = RAND:MENUS_SNACK + 1
	DISHNAME = %FOOD_SNACK:(FLAG:����)%
CASE "MAINDISH"
	DISHTYPE = 2
	FOOD_ID = RAND:MENUS_MAINDISH
	FLAG:���� = FOOD_ID + 10
	DISHNAME = %FOOD_MAINDISH:(FOOD_ID)%
	IF FESTIVAL_MENU() != ""
		DISHNAME = %FESTIVAL_MENU()%
		FLAG:���� = 999
		DISHTYPE = 5
	ENDIF
CASE "DESSERT"
	DISHTYPE = 3
	FOOD_ID = RAND:MENUS_DESSERT
	DISHNAME = %FOOD_DESSERT:(FOOD_ID)%
	FLAG:���� = FOOD_ID + 50
CASE "FORBIDDEN"
	DISHTYPE = 4
	DISHNAME = %FOOD_FORBIDDEN:(DAY:2)%
	FLAG:���� = 99 + DAY:2
CASE "FISH"
	DISHTYPE = 2
	DISHNAME = %FOOD_FISH:(RAND:MENUS_FISH)%
CASE "FROG"
	DISHTYPE = 2
	DISHNAME = %FOOD_FROG:(RAND:MENUS_FROG)%
ENDSELECT

@�H��(ARG)
#DIM ���͉񕜗�
#DIM �C�͉񕜗�
#DIM �̗͉񕜗�
#DIM ���͉񕜗�
#DIM �C�͉񕜗�
#DIM �̗͉񕜗�

;�񕜗���0.1%�P��

���͉񕜗� = 0
�C�͉񕜗� = 0
�̗͉񕜗� = 0
���͉񕜗� = 0
�C�͉񕜗� = 0
�̗͉񕜗� = 0

SELECTCASE DISHTYPE
	CASE 1
		�̗͉񕜗� = 65
		�C�͉񕜗� = 200
		���͉񕜗� = 50
		CALL �����x�㏸(ARG,"�y�H")
	CASE 2
		�̗͉񕜗� = 200
		�C�͉񕜗� = 300
		���͉񕜗� = 200
		CALL �����x�㏸(ARG,"��H")
	CASE 3
		�̗͉񕜗� = 50
		�C�͉񕜗� = 500
		���͉񕜗� = 50
		CALL �����x�㏸(ARG,"�f�U�[�g")
	CASE 4
		�̗͉񕜗� = 300
		�C�͉񕜗� = 300
		���͉񕜗� = 300
		CALL �����x�㏸(ARG,"��H")
		EXP:ARG:�b�o�� += 30
	CASE 5
		�̗͉񕜗� = 100
		�C�͉񕜗� = 150
		���͉񕜗� = 100
		CALL �����x�㏸(ARG,"��H")
ENDSELECT
�̗͉񕜗� = (MAXBASE:ARG:�̗� * �̗͉񕜗� / 1000) * (ABL:MASTER:�����Z�\ + 5 + DISHQUALITY) / 10
�C�͉񕜗� = (MAXBASE:ARG:�C�� * �C�͉񕜗� / 1000) * (ABL:MASTER:�����Z�\ + 5 + DISHQUALITY) / 10
���͉񕜗� = (MAXBASE:ARG:���� * ���͉񕜗� / 1000) * (ABL:MASTER:�����Z�\ + 5 + DISHQUALITY) / 10

CALL RECOVER(ARG,�̗͉񕜗�,"�̗�")
CALL RECOVER(ARG,�C�͉񕜗�,"�C��")
SIF ARG == MASTER
	CALL RECOVER(ARG,���͉񕜗�,"����")

;�C�^�Y�����d���܂�Ă���
IF !TCVAR:MASTER:308 < 8
	IF GETBIT(TCVAR:MASTER:308, 21)
		TCVAR:TARGET:�Z�� = 210
	ELSEIF GETBIT(TCVAR:MASTER:308, 22)
		TCVAR:TARGET:���A�� = 210
	ELSEIF GETBIT(TCVAR:MASTER:308, 23)
		TCVAR:TARGET:����� = 210
	ELSEIF GETBIT(TCVAR:MASTER:308, 24)
		IF TCVAR:TARGET:�����򋭓x < 2
			TCVAR:TARGET:�����򋭓x = 2
			TCVAR:TARGET:�����򂨒��g�p = 1
		ENDIF
	ENDIF
ENDIF

@�����x�㏸(ARG,ARGS)
SELECTCASE ARGS
	CASE "�y�H"
		TCVAR:ARG:�󕠎��� = 1440 * DAY + TIME + 180
		SIF TALENT:ARG:���V
			TCVAR:ARG:�󕠎��� -= 30
	CASE "��H"
		TCVAR:ARG:�󕠎��� = 1440 * DAY + TIME + 360
		SIF TALENT:ARG:���V
			TCVAR:ARG:�󕠎��� -= 90
	CASE "�f�U�[�g"
		TCVAR:ARG:�f�U�[�g�󕠎��� = 1440 * DAY + TIME + 180
		SIF TALENT:ARG:���V
			TCVAR:ARG:�f�U�[�g�󕠎��� -= 30
ENDSELECT

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE413
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;�|�����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(413)
	RETURN RESULT

;�~�[�Ȃ̂�
SIF !KITCHEN(CFLAG:MASTER:���݈ʒu)
	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
SIF CFLAG:���ӂ�
	RETURN 0
;�Y���Q��
SIF CFLAG:�Y���Q��
	RETURN 0
;�C�^�Y����
SIF CFLAG:MASTER:�C�^�Y��
	RETURN 0
;���ɗ���������Ă���
SIF DISHNAME != ""
	RETURN 0
RETURN 1

@HUNGER(ARG)
#FUNCTIONS
LOCAL = TCVAR:ARG:�󕠎��� - TIME:1
SELECTCASE LOCAL
	CASE IS > 270
	SETCOLOR C_GREEN
		RETURNF "����"
	CASE IS > 180
	SETCOLOR C_P_GREEN
		RETURNF "������"
	CASE IS > 0
	SETCOLOR C_P_YELLOW
		RETURNF "����"
	CASEELSE
		RETURNF "�H����"
ENDSELECT

@INGREDIENT_CHOICE
PRINTFORML �H�ނ�I��ł�������
CALL ASK_M(@"�G��({ITEM:48})", ITEM:48, @"�Õ�({ITEM:50})", ITEM:50, @"����({ITEM:47})", ITEM:47,"��߂�",1)
SELECTCASE RESULT
	CASE 0
		ITEM:48 --
	CASE 1
		ITEM:50 --
	CASE 2
		ITEM:47 --
	CASE 3
		DISHTYPE = 0
		RETURN 0
ENDSELECT
DISHQUALITY = RESULT + 1
RETURN DISHQUALITY

@RESET_DISH
DISHTIME = 0
DISHSPOIL = 0
FLAG:���� = 0
DISHQUALITY = 0
DISHTYPE = 0
DISHNAME =

;�H�ޏ�������
@HAS_INGREDIENT
#FUNCTION
;������͗����Z�\�֌W�Ȃ�
SIF MAX(ITEM:����, ITEM:�G��, ITEM:�Õ�) > 0
	RETURNF 1
;�������͗����Z�\2�`
SIF ABL:MASTER:�����Z�\ > 1 && MAX(ITEM:��, ITEM:���܂���, ITEM:�J�G��) > 0
	RETURNF 1
;�֒f�̗����͗����Z�\3�`
SIF ABL:MASTER:�����Z�\ > 2 && ITEM:���[�^�[ > 0
	RETURNF 1
RETURNF 0


code:
;-------------------------------------------------
;�H�������
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM414
#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 TARGET
	�񕜑O�̗͂Q = BASE:TARGET:�̗�
	�񕜑O�C�͂Q = BASE:TARGET:�C��
	LOCAL = RAND:(100 - ABL:MASTER:�����Z�\ * 2)
	LOCAL:1 = 90 + GET_SUCCESS_RATE() / 5
	SIF LOCAL:1 > 99
		LOCAL:1 = 99
	IF LOCAL <= 9
		;10���ő听��
		EXP:MASTER:��b�o�� ++
		TFLAG:193 = 1
		TFLAG:98 = 2
	ELSEIF LOCAL >= LOCAL:1
		;10�`1���Ŏ��s
		TFLAG:193 = -1
		TFLAG:98 = -2
	ELSE
		;�c��͐���
		TFLAG:193 = 0
		TFLAG:98 = 0
	ENDIF
	;�M��
	TFLAG:98 += 3
	SIF ABL:MASTER:�����Z�\ > 1
		TFLAG:98 ++
	SIF ABL:MASTER:�����Z�\ > 3
		TFLAG:98 ++

	;�C�^�Y�����d���܂�Ă��Ȃ�
	IF TCVAR:MASTER:308 < 8
		;���t�����c�{���Ǝ��s���Ȃ�
		IF CFLAG:TARGET:���o�n�D & TCVAR:MASTER:308
			TFLAG:193 = MAX(TFLAG:193,0)
			;�M���ɂ��C��
			TFLAG:98 += 2
		ENDIF
	ENDIF
	SELECTCASE DISHTYPE
		CASE 1

		CASE 2,4,5

		CASE 3

	ENDSELECT
	;���̏�ɂ͂��ĂȂ��L���������邩�m�F
	IF DISHNAME == "����Ԃ����"
		FOR LOCAL, 1, CHARANUM
			SIF EQUIP:LOCAL:6 == 0 && CFLAG:LOCAL:���݈ʒu == CFLAG:PLAYER:���݈ʒu
				TFLAG:194 = 1
		NEXT
	ENDIF
	;����ȐH���t���O
	SIF DISHNAME == "�M���M�[����"
		TFLAG:194 = 34
	SIF DISHNAME == "���b�c�@�����`�[�Y�ƃg�}�g�̃T���_"
		TFLAG:194 = 30
	SIF DISHNAME == "�h�[�s���O�R���\���X�[�v"
		TFLAG:194 = 31
	SIF DISHTYPE == 4
		TFLAG:194 = 2

	;���̏�ɋ���TARGET�S���ŉ�
	LOCAL:1 = TARGET
	FOR LOCAL, 1, GET_TARGETNUM() + 1
		SIF CFLAG:(TARGET:LOCAL):����
			CONTINUE
		TARGET = TARGET:LOCAL
		CALL COM414_1
	NEXT
	TARGET = LOCAL:1
	�񕜌�̗͂Q = BASE:TARGET:�̗�
	�񕜌�C�͂Q = BASE:TARGET:�C��
ENDIF

;�y�H
IF DISHTYPE == 1
	CALL �H��(MASTER)
	TIME += 20
	SIF CFLAG:���s
		CFLAG:���s += 20
;����������Ԃ���Ԃł͂��ĂȂ��L����������ƃm�[�p������Ԃ���Ԃ�
ELSEIF TFLAG:194 == 1
	BASE:MASTER:�̗� = MIN(BASE:MASTER:�̗� + MAXBASE:MASTER:�̗� / 3 , MAXBASE:MASTER:�̗�)
	BASE:MASTER:�C�� = MIN(BASE:MASTER:�C�� + MAXBASE:MASTER:�C�� / 2 , MAXBASE:MASTER:�C��)
	BASE:MASTER:���� = MIN(BASE:MASTER:���� + MAXBASE:MASTER:���� / 2 , MAXBASE:MASTER:����)
	;�H���������t���O
	CALL �����x�㏸(MASTER,"��H")
	TIME += 40
	SIF CFLAG:���s
		CFLAG:���s += 40
ELSEIF DISHTYPE == 2
	CALL �H��(MASTER)
	TIME += 40
	SIF CFLAG:���s
		CFLAG:���s += 40
ELSEIF DISHTYPE == 3
	CALL �H��(MASTER)
	TIME += 20
	SIF CFLAG:���s
		CFLAG:���s += 20
ELSEIF DISHTYPE == 4 || DISHTYPE == 5
	CALL �H��(MASTER)
	TIME += 40
	SIF CFLAG:���s
		CFLAG:���s += 40
ENDIF
�񕜌�̗͂P = BASE:MASTER:�̗�
�񕜌�C�͂P = BASE:MASTER:�C��
CALL RESET_DISH
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
RETURN 1

@COM414_1
#DIM ��
�� = 0
IF DISHTYPE == 3
	SIF TIME_PROGRESS(TCVAR:�f�U�[�g�󕠎���)
		�� = 1
ELSE
	SIF TIME_PROGRESS(TCVAR:�󕠎���)
		�� = 1
ENDIF
;�����łȂ�
IF ��
	;�Œ�Ŋl������\�[�X
	SELECTCASE DISHSPOIL
		CASE 0
			SOURCE:���y = 800
		CASE 1
			SOURCE:���y = 400
		CASE 2
			SOURCE:���y = 100
			SOURCE:�s�� = 400
			SOURCE:���� = 400
	ENDSELECT
	;�C�^�Y�����d���܂�Ă��Ȃ�
	IF TCVAR:MASTER:308 < 8
		;���o�n�D������
		SIF CFLAG:TARGET:���o�n�D & TCVAR:MASTER:308
			SOURCE:���y += 200
	ENDIF

	;ABL:�]�����݂�
	IF ABL:�]�� <= 1
		SOURCE:���y += (ABL:�]�� * 60)
	ELSEIF ABL:�]�� <= 3
		SOURCE:���y += 500 + (ABL:�]�� * 60)
	ELSEIF ABL:�]�� <= 5
		SOURCE:���y += 700 + (ABL:�]�� * 60)
	ELSEIF ABL:�]�� <= 8
		SOURCE:���y += 1000 + (ABL:�]�� * 75)
	ELSEIF ABL:�]�� <= 11
		SOURCE:���y += 1500 + (ABL:�]�� * 75)
	ELSE
		SOURCE:���y += 3000 + (ABL:�]�� * 30)
	ENDIF

	;�m�[�p������Ԃ���ԂŘI�o�ǉ�
	SIF TFLAG:194 == 1
		SOURCE:�I�o += 1000
	;�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

	SOURCE:�� = 200 + 100 * ABL:�]��
	SOURCE:���� = 200 + 100 * ABL:�T�h���C

	IF TFLAG:193 == -1
		TIMES SOURCE:���y , 0.10
		TIMES SOURCE:���� , 0.50
		TIMES SOURCE:�� , 0.50
	ELSEIF TFLAG:193 == 0
		TIMES SOURCE:���y , 1.00
		TIMES SOURCE:���� , 1.00
		TIMES SOURCE:�� , 1.00
		CALL KIGEN_CHANGE(TARGET,30,1)
	ELSE
		TIMES SOURCE:���y , 2.00
		TIMES SOURCE:���� , 2.00
		TIMES SOURCE:�� , 2.00
		IF TALENT:�@�� < 0
			CALL KIGEN_CHANGE(TARGET,100,1)
		ELSE
			CALL KIGEN_CHANGE(TARGET,50,1)
		ENDIF
	ENDIF
SOURCE:���y = SOURCE:���y * (ABL:MASTER:�����Z�\ + DISHQUALITY * 2) / 5
SOURCE:���� = SOURCE:���� * (ABL:MASTER:�����Z�\ + DISHQUALITY * 2) / 5
SOURCE:�� = SOURCE:�� * (ABL:MASTER:�����Z�\ + DISHQUALITY * 2) / 5
	IF CFLAG:�s�� == 5
		TIMES SOURCE:���y , 2.00
		TIMES SOURCE:���� , 2.00
		TIMES SOURCE:�� , 2.00
		TFLAG:98 += 2
	ENDIF
	CALL �H��(TARGET)
ENDIF
SIF TALENT:���V
	TIMES SOURCE:���y , 1.50

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE414
;�H�����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(414)
	RETURN RESULT
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;�C�^�Y�������������͎����ŐH�ׂȂ�
SIF TCVAR:MASTER:308 > 8
	RETURN 0
;�������Ȃ�
SIF DISHNAME == ""
	RETURN 0
;�y�H�ȊO�͉�������Ȃ��ᖳ��
SIF FLAG:20 >= 10 && !INROOM(CFLAG:MASTER:���݈ʒu)
	RETURN 0
;�H�ׂ��΂���
IF DISHTYPE == 3
	SIF !TIME_PROGRESS(TCVAR:MASTER:�f�U�[�g�󕠎���)
		RETURN 0
ELSE
	SIF !TIME_PROGRESS(TCVAR:MASTER:�󕠎���)
		RETURN 0
ENDIF
SIF CFLAG:MASTER:���ӂ�
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�H�����ӂ�܂�
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM415
LOCAL = RAND:(100 - ABL:MASTER:�����Z�\ * 2)
LOCAL:1 = 90 + GET_SUCCESS_RATE() / 5
SIF LOCAL:1 > 99
	LOCAL:1 = 99
IF LOCAL <= 9
	;10���ő听��
	EXP:MASTER:��b�o�� ++
	TFLAG:193 = 1
	TFLAG:98 = 2
ELSEIF LOCAL >= LOCAL:1
	;10�`1���Ŏ��s
	TFLAG:193 = -1
	TFLAG:98 = -2
ELSE
	;�c��͐���
	TFLAG:193 = 0
	TFLAG:98 = 0
ENDIF

;�M��
TFLAG:98 += 3
SIF ABL:MASTER:�����Z�\ > 1
	TFLAG:98 ++
SIF ABL:MASTER:�����Z�\ > 3
	TFLAG:98 ++
;�搧�������͎��s���Ȃ�
SIF TCVAR:20
	TFLAG:193 = MAX(TFLAG:193,0)
;�C�^�Y�����d���܂�Ă��Ȃ�
IF TCVAR:MASTER:308 < 8
	;���t�����c�{���Ǝ��s���Ȃ�
	IF CFLAG:TARGET:���o�n�D & TCVAR:MASTER:308
		TFLAG:193 = MAX(TFLAG:193,0)
		TFLAG:98 += 2
	ENDIF
ENDIF

DOWNBASE:MASTER:�C�� += 50

;���̏�ɋ���TARGET�S���ŉ�
LOCAL:1 = TARGET
FOR LOCAL, 1, GET_TARGETNUM() + 1
	SIF CFLAG:(TARGET:LOCAL):����
		CONTINUE
	TARGET = TARGET:LOCAL
	CALL COM415_1
NEXT
TARGET = LOCAL:1

SELECTCASE DISHTYPE
	CASE 1,3
		TIME += 20
		SIF CFLAG:���s
			CFLAG:���s += 20
	CASE 2,4,5
		TIME += 40
		SIF CFLAG:���s
			CFLAG:���s += 40
ENDSELECT

CALL RESET_DISH

RETURN 1

@COM415_1
#DIM ��
�� = 0
IF DISHTYPE == 3
	SIF TIME_PROGRESS(TCVAR:�f�U�[�g�󕠎���)
		�� = 1
ELSE
	SIF TIME_PROGRESS(TCVAR:�󕠎���)
		�� = 1
ENDIF
;�����łȂ�
IF ��
	;�Œ�Ŋl������\�[�X
	SELECTCASE DISHSPOIL
		CASE 0
			SOURCE:���y = 1600
		CASE 1
			SOURCE:���y = 400
		CASE 2
			SOURCE:���y = 100
			SOURCE:�s�� = 400
			SOURCE:���� = 400
	ENDSELECT
	;�C�^�Y�����d���܂�Ă��Ȃ�
	IF TCVAR:MASTER:308 < 8
		;���o�n�D������
		SIF CFLAG:TARGET:���o�n�D & TCVAR:MASTER:308
			SOURCE:���y += 200
	ENDIF

	;ABL:�]�����݂�
	IF ABL:�]�� <= 1
		SOURCE:���y += (ABL:�]�� * 60)
	ELSEIF ABL:�]�� <= 3
		SOURCE:���y += 500 + (ABL:�]�� * 60)
	ELSEIF ABL:�]�� <= 5
		SOURCE:���y += 700 + (ABL:�]�� * 60)
	ELSEIF ABL:�]�� <= 8
		SOURCE:���y += 1200 + (ABL:�]�� * 75)
	ELSEIF ABL:�]�� <= 11
		SOURCE:���y += 2000 + (ABL:�]�� * 75)
	ELSE
		SOURCE:���y += 3000 + (ABL:�]�� * 30)
	ENDIF

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

	SOURCE:�� = 500 + 100 * ABL:�]��
	SOURCE:���� = 500 + 100 * ABL:�T�h���C

	IF TFLAG:193 == -1
		TIMES SOURCE:���y , 0.10
		TIMES SOURCE:���� , 0.50
		TIMES SOURCE:�� , 0.50
	ELSEIF TFLAG:193 == 0
		TIMES SOURCE:���y , 1.00
		TIMES SOURCE:���� , 1.00
		TIMES SOURCE:�� , 1.00
		CALL KIGEN_CHANGE(TARGET,30,1)
	ELSE
		TIMES SOURCE:���y , 2.00
		TIMES SOURCE:���� , 2.00
		TIMES SOURCE:�� , 2.00
		IF TALENT:�@�� < 0
			CALL KIGEN_CHANGE(TARGET,100,1)
		ELSE
			CALL KIGEN_CHANGE(TARGET,50,1)
		ENDIF
	ENDIF
	IF CFLAG:�s�� == 5
		TIMES SOURCE:���y , 2.00
		TIMES SOURCE:���� , 2.00
		TIMES SOURCE:�� , 2.00
		TFLAG:98 += 2
	ENDIF
SOURCE:���y = SOURCE:���y * (ABL:MASTER:�����Z�\ + DISHQUALITY * 2) / 5
SOURCE:���� = SOURCE:���� * (ABL:MASTER:�����Z�\ + DISHQUALITY * 2) / 5
SOURCE:�� = SOURCE:�� * (ABL:MASTER:�����Z�\ + DISHQUALITY * 2) / 5
	CALL �H��(TARGET)
ENDIF

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE415
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;�H�����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(415)
	RETURN RESULT
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
SIF TARGET < 1
	RETURN 0
;������
SIF CFLAG:����
	RETURN 0
;����
SIF !DISHTYPE
	RETURN 0
;�y�H�ȊO�͉�������Ȃ��ᖳ��
SIF DISHTYPE != 1 && !INROOM(CFLAG:MASTER:���݈ʒu)
	RETURN 0
;�H�ׂ��΂���
IF DISHTYPE == 3
	SIF !TIME_PROGRESS(TCVAR:�f�U�[�g�󕠎���)
		RETURN 0
ELSE
	SIF !TIME_PROGRESS(TCVAR:�󕠎���)
		RETURN 0
ENDIF
SIF CFLAG:���ӂ� == 2
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;���t����
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM416
#DIM �Q���l��
#DIM BAND_BONUS
#DIM NUM_TARGET
NUM_TARGET = GET_TARGETNUM()

TFLAG:�g�p�y�� = 0
PRINTL �����g�������c�c
FOR LOCAL,30,35
	SIF MUSIC_ABLE(LOCAL)
		PRINTFORML [{LOCAL}] - %ITEMNAME:LOCAL%
NEXT
PRINTL [100] - �߂�
$INPUT_LOOP
INPUT
SELECTCASE RESULT
	CASE 100
		TFLAG:�g�p�y�� = 0
		RETURN -1
	CASE 30 TO 34
		IF !MUSIC_ABLE(RESULT)
			GOTO INPUT_LOOP
		ELSE
			TFLAG:�g�p�y�� = RESULT - 29
		ENDIF
	CASEELSE
		GOTO INPUT_LOOP
ENDSELECT

LOCAL = RAND:100
LOCAL:1 = 90 + GET_SUCCESS_RATE() / 5
SIF LOCAL:1 > 99
	LOCAL:1 = 99
IF LOCAL <= (9 + ABL:MASTER:���y�Z�\)
	;10���ő听��
	EXP:MASTER:���t�o�� ++
	EXP:MASTER:���t�o�� += 5
	TFLAG:193 = 1
ELSEIF LOCAL >= LOCAL:1
	;10�`1���Ŏ��s
	TFLAG:193 = -1
ELSE
	;�c��͐���
	EXP:MASTER:���t�o�� ++
	TFLAG:193 = 0
ENDIF

DOWNBASE:MASTER:�̗� = 300
DOWNBASE:MASTER:�C�� = 300

;���̏�ɋ���TARGET�S���ŉ�
LOCAL:1 = TARGET
�Q���l�� = 0
CVARSET TCVAR, GETNUM(TCVAR, "���t�Q��"), 0
FOR LOCAL, 1, GET_TARGETNUM() + 1
	SIF !SHIRAHU(TARGET:LOCAL)
		CONTINUE
	TARGET = TARGET:LOCAL
	CALL COM416_1
	SIF TCVAR:���t�Q��
		�Q���l�� ++
NEXT

SELECTCASE �Q���l��
	CASE 0
		BAND_BONUS = 0
	CASE 1
		BAND_BONUS = 1
	CASE 2,3
		BAND_BONUS = 2
	CASEELSE
		BAND_BONUS = 4
ENDSELECT

IF TFLAG:193 < 0
	FOR LOCAL, 1, GET_TARGETNUM() + 1
		SOURCE:(TARGET:LOCAL):���� += 20
		SIF TCVAR:(TARGET:LOCAL):���t�Q��
			SOURCE:(TARGET:LOCAL):�T�� += 30
		SOURCE:(TARGET:LOCAL):���� = SOURCE:(TARGET:LOCAL):���� * (2 + BAND_BONUS) / 2
		SOURCE:(TARGET:LOCAL):�T�� = SOURCE:(TARGET:LOCAL):�T�� * (2 + BAND_BONUS) / 2
		SOURCE:(TARGET:LOCAL):���y = SOURCE:(TARGET:LOCAL):���y * 2 / (2 + BAND_BONUS)
		SOURCE:(TARGET:LOCAL):���� = SOURCE:(TARGET:LOCAL):���� * 2 / (2 + BAND_BONUS)
		;���̎�̌ʏ����͖����ق����ǂ����v�����Ă��܂������͎̂d�����Ȃ�
		;���i�T
		SIF TCVAR:22:���t�Q��
			TIMES SOURCE:(TARGET:LOCAL):�T��, 1.1
	NEXT
ELSE
	BAND_BONUS += TFLAG:193
	FOR LOCAL, 1, GET_TARGETNUM() + 1
		SIF !SHIRAHU(TARGET:LOCAL)
			CONTINUE
		SOURCE:(TARGET:LOCAL):���y = SOURCE:(TARGET:LOCAL):���y * (2 + BAND_BONUS) / 2
		SOURCE:(TARGET:LOCAL):���� = SOURCE:(TARGET:LOCAL):���� * (2 + BAND_BONUS) / 2
		;��������
		SIF TCVAR:21:���t�Q��
			TIMES SOURCE:(TARGET:LOCAL):���y, 1.1
		;����
		SIF TCVAR:96:���t�Q��
			TIMES SOURCE:(TARGET:LOCAL):����, 1.1
	NEXT
ENDIF

TFLAG:�D���x�{�[�i�X = BAND_BONUS * 50
TARGET = LOCAL:1

TIME += 30
RETURN 1

@COM416_1

DOWNBASE:�C�� += 100

;���y���x
SOURCE:���y = 700 + ABL:MASTER:���y�Z�\ * 300 + ABL:�e�� * 50
;�������x
SOURCE:���� = 100 * (ABL:MASTER:���y�Z�\ + 1) + ABL:�e�� * 30

IF TFLAG:193 == -1
	TIMES SOURCE:���y , 0.10
	TIMES SOURCE:���� , 0.50
ELSEIF TFLAG:193 == 0
	TIMES SOURCE:���y , 1.00
	TIMES SOURCE:���� , 1.00
ELSE
	TIMES SOURCE:���y , 2.00
	TIMES SOURCE:���� , 2.00
ENDIF
;���y�Z�\�Ŋ��y������ɑ���
IF ABL:MASTER:���y�Z�\ >= 5
	TIMES SOURCE:���y , 3.00
ELSEIF ABL:MASTER:���y�Z�\ == 4
	TIMES SOURCE:���y , 2.00
ELSEIF ABL:MASTER:���y�Z�\ == 3
	TIMES SOURCE:���y , 1.00
ELSEIF ABL:MASTER:���y�Z�\ == 2
	TIMES SOURCE:���y , 0.50
ELSE
	TIMES SOURCE:���y , 0.10
ENDIF
;[���y�m��]�������Ă���ꍇ�A���y����
SIF TALENT:MASTER:���y�m��
	TIMES SOURCE:���y , 2.00
;�����̂���Ȃ��ł�����������
IF TALENT:MASTER:���� == 2
	TIMES SOURCE:���y , 2.00
ELSEIF TALENT:MASTER:���� == 1
	TIMES SOURCE:���y , 1.50
ELSEIF TALENT:MASTER:���� == -1
	TIMES SOURCE:���y, 0.50
ENDIF

SIF TARGET <= 0
	RETURN 1
SELECTCASE TALENT:TARGET:���y�m��
;�y�펝���L�����A�v�����o�O�o���Ƌ�\��o���Ɨ��ۂ�TARGET
CASE 1
	EXP:MASTER:���t�o�� ++
	IF ACCOMPANY_ABLE(TARGET)
		TCVAR:���t���� = TIME
		DOWNBASE:�C�� += 200
		DOWNBASE:�̗� += 100
		TIMES SOURCE:���y , 2.00
		TCVAR:���t�Q�� = 1
		EXP:���t�o�� ++
		PRINTFORMW %CALLNAME:TARGET%�͊y���t�Ŏn�߂��I
		IF ABL:MASTER:���y�Z�\ >= ABL:TARGET:���y�Z�\
			EXP:���t�o�� ++
			TIMES SOURCE:���� , 1.50
		ENDIF
	ENDIF
;�̏��L�����A�~�X�e�B�A�Ƌ��q�A�G������TARGET
CASE 2
	EXP:MASTER:���t�o�� ++
	IF ACCOMPANY_ABLE(TARGET)
		TCVAR:���t���� = TIME
		DOWNBASE:�C�� += 200
		DOWNBASE:�̗� += 100
		TIMES SOURCE:���y , 2.00
		TCVAR:���t�Q�� = 2
		EXP:�̏��o�� ++
		PRINTFORMW %CALLNAME:TARGET%��%CALLNAME:MASTER%�̐����ɍ��킹�ĉ̂��n�߂��I
		IF ABL:MASTER:���y�Z�\ >= ABL:TARGET:���y�Z�\
			EXP:�̏��o�� ++
			TIMES SOURCE:���� , 1.50
		ENDIF
	ENDIF
;�����L�����i�܂�����
[SKIPSTART]
CASE 3
	EXP:MASTER:���t�o�� ++
	IF ACCOMPANY_ABLE(TARGET)
		TCVAR:���t���� = TIME
		DOWNBASE:�C�� += 200
		DOWNBASE:�̗� += 100
		TIMES SOURCE:���y , 2.00
		TCVAR:���t�Q�� = 3
		EXP:�����o�� ++
		PRINTFORMW %CALLNAME:TARGET%��%CALLNAME:MASTER%�̐����ɍ��킹�ėx��o�����I
		IF ABL:MASTER:���y�Z�\ >= ABL:TARGET:���y�Z�\
			EXP:�����o�� ++
			TIMES SOURCE:���� , 1.50
		ENDIF
	ENDIF
[SKIPEND]
CASEELSE
	SIF ABL:MASTER:���y�Z�\ <= ABL:TARGET:���y�Z�\ || TALENT:TARGET:���y�m��
		EXP:MASTER:���t�o�� ++
ENDSELECT
RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE416
;���t���s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(416)
	RETURN RESULT

;������̊y��i30�`34�j���g���Ȃ�
LOCAL:1 = 0
FOR LOCAL,30,35
	SIF MUSIC_ABLE(LOCAL)
		LOCAL:1 ++
NEXT
SIF !LOCAL:1
	RETURN 0

;�y��O��̂����ꂩ�������Ă��Ă�13,24,30���C��14,40�g�C���ł͉��t�ł��Ȃ�
;SIF CFLAG:MASTER:���݈ʒu == 13 || CFLAG:MASTER:���݈ʒu == 14 || CFLAG:MASTER:���݈ʒu == 24 || CFLAG:MASTER:���݈ʒu == 30 || CFLAG:MASTER:���݈ʒu == 39 || CFLAG:MASTER:���݈ʒu == 40
SIF (IN_TOILET(CFLAG:MASTER:���݈ʒu) || BATHCHECK(CFLAG:MASTER:���݈ʒu)) && GET_MAPID(CFLAG:MASTER:���݈ʒu) == MAIN_MAP
	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
SIF CFLAG:���ӂ� == 2
	RETURN 0
;������
;�������������N��������Ƃ����Ă���������
SIF CFLAG:���� && !CFLAG:�Y���Q�� || CFLAG:�Y���Q��
	RETURN 0
;�d����
SIF CFLAG:�s�� == 5
	RETURN 0
;��~���͕s��
SIF FLAG:70
	RETURN 0
RETURN 1

@MUSIC_ABLE(ARG)
#FUNCTION
SIF !ITEM:ARG
	RETURNF 0
SELECTCASE ARG
;�L�[�{�[�h�A�M�^�[�A�y�b�g
	CASE 30,32,33
		RETURNF 1
;�s�A�m
;����_�Ћ��ԁA�g���ق̍L��Ɣp�m�فA�n��a�̍L��A���q���ɐݒu���Ă���Ƃ����`�ł��B
	CASE 31
		SIF GROUPMATCH(CFLAG:MASTER:���݈ʒu,GET_MAP_REPLACEMENT(9),GET_MAP_REPLACEMENT(222),GET_MAP_REPLACEMENT(309),GET_MAP_REPLACEMENT(335))
			RETURNF 1
;�o�C�I����
	CASE 34
		SIF ABL:MASTER:���y�Z�\ >= 2
			RETURNF 1
	CASEELSE
		RETURNF 0
ENDSELECT
RETURNF 0

@ACCOMPANY_ABLE(ARG)
#FUNCTION
SIF BASE:ARG:�C�� < 200
	RETURNF 0
SIF TIME_PROGRESS(TCVAR:ARG:���t����) < 90
	RETURNF 0
SIF ABL:MASTER:���y�Z�\ < 3
	RETURNF 0
SIF !SHIRAHU(ARG)
	RETURNF 0
SIF CFLAG:ARG:�s�� == 5
	RETURNF 0

RETURNF 1


code:
;-------------------------------------------------
;����
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM417
#DIM �񕜑O�̗�,2
#DIM �񕜑O�C��,2
#DIM �񕜌�̗�,2
#DIM �񕜌�C��,2
�񕜑O�̗�:0 = BASE:MASTER:�̗�
�񕜑O�C��:0 = BASE:MASTER:�C��
IF TARGET > 0 && CFLAG:TARGET:6 > 0
	�񕜑O�̗�:1 = BASE:TARGET:�̗�
	�񕜑O�C��:1 = BASE:TARGET:�C��
	CALL RECOVER_PERMIL(TARGET,125,"�̗�",1)
	CALL RECOVER_PERMIL(TARGET,150,"�C��",1)
	�񕜌�̗�:1 = BASE:TARGET:�̗�
	�񕜌�C��:1 = BASE:TARGET:�C��
		;ABL:�e�����݂�
		IF ABL:�e�� <= 1
			SOURCE:� += (ABL:�e�� * 30)
		ELSEIF ABL:�e�� <= 3
			SOURCE:���y += 100 + (ABL:�e�� * 40)
			SOURCE:� += 200 + (ABL:�e�� * 30)
		ELSEIF ABL:�e�� <= 5
			SOURCE:���y += 400 + (ABL:�e�� * 50)
			SOURCE:� += 300 + (ABL:�e�� * 30)
		ELSEIF ABL:�e�� <= 8
			SOURCE:���y += 700 + (ABL:�e�� * 60)
			SOURCE:� += 400 + (ABL:�e�� * 40)
		ELSEIF ABL:�e�� <= 11
			SOURCE:���y += 1200 + (ABL:�e�� * 80)
			SOURCE:� += 600 + (ABL:�e�� * 40)
		ELSE
			SOURCE:���y += 2000 + (ABL:�e�� * 50)
			SOURCE:� += 1500 + (ABL:�e�� * 20)
		ENDIF
		;�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
		CFLAG:333 += 90
		TFLAG:98 += 3
	TFLAG:194 = 1
	PRINTFORM %CALLNAME:TARGET%�ƈꏏ��
	IF TIME > 660 && TIME < 900
		PRINT ���Q
	ELSE
		PRINT ����
	ENDIF
	PRINTL ���邱�Ƃɂ���
ELSE
 	PRINTFORM %CALLNAME:MASTER%����
	IF TIME > 660 && TIME < 900
		PRINT ���Q
	ELSE
		PRINT ����
	ENDIF
	PRINTL ���邱�Ƃɂ���
 	TFLAG:194 = 2
ENDIF
CALL RECOVER_PERMIL(MASTER,125,"�̗�",1)
CALL RECOVER_PERMIL(MASTER,150,"�C��",1)
CALL RECOVER_PERMIL(MASTER,50,"����",1)
TIME += 90
TFLAG:���Q = 90
�񕜌�̗�:0 = BASE:MASTER:�̗�
�񕜌�C��:0 = BASE:MASTER:�C��
DRAWLINE
PRINTFORML �̗�+{ABS(�񕜌�̗� - �񕜑O�̗�)}�i%CALLNAME:MASTER%�j
PRINTFORML �C��+{ABS(�񕜌�C�� - �񕜑O�C��)}�i%CALLNAME:MASTER%�j
IF TFLAG:194 == 1
	PRINTFORML �̗�+{ABS(�񕜌�̗�:1 - �񕜑O�̗�:1)}�i%CALLNAME:TARGET%�j
	PRINTFORML �C��+{ABS(�񕜌�C��:1 - �񕜑O�C��:1)}�i%CALLNAME:TARGET%�j
ENDIF
RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE417
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;�ړ����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(417)
	RETURN RESULT
;�����ݒ�
SIF CFLAG:MASTER:���݈ʒu != CFLAG:MASTER:311
	RETURN 0
SIF NEMUKE() < 180
	RETURN 0
SIF NEMUKE() > 720
	RETURN 0
SIF TFLAG:���Q > 0
	RETURN 0
SIF CFLAG:���ӂ� == 2
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�ƒ�؉�
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM418
LOCAL:1 = 1 + FLAG:���g��
FOR LOCAL,0, LOCAL:1
	CALL SHOW_PLANT(LOCAL)
NEXT
PRINTL [999] ��߂�
$INPUT_LOOP
INPUT
IF INRANGE(RESULT / 100, 0, LOCAL:1)
	CALL FARMING(RESULT / 100, RESULT % 100)
ELSE
	TIME += 5
	RETURN 0
ENDIF

@FARMING(ARG, �s���ԍ�)
#DIM �s���ԍ�
LOCALS = %HATAKE_NAME:ARG%
IF �s���ԍ� == 0
	IF PLANT_TYPE:ARG > 0
		PRINTFORML ����%LOCALS%���A����Ă���
		TIME += 5
	ELSE
		PRINTL �ǂ��A���܂����H
		CALL INPLANT(ARG)
		TIME += 10
	ENDIF
ELSEIF �s���ԍ� == 1
	IF !PLANT_DRY:ARG
		PRINTL �����͂����������낤
	ELSEIF !TFLAG:������
		PRINTL ��������ł��Ȃ��Ă�
	ELSE
		PLANT_DRY:ARG = 0
		PRINTFORML %LOCALS%�ɐ��������
		TIME += 5
	ENDIF
ELSEIF �s���ԍ� == 2
	SIF PLANT_DAYS:ARG > 9
		PLANT_GROW:ARG += 2
	IF PLANT_GROW:ARG > 10
		PRINTL �L�삾�I
		LOCAL = 10
	ELSEIF PLANT_GROW:ARG > 7
		LOCAL = 5
	ELSE
		LOCAL = 3
	ENDIF
	PRINTFORML {LOCAL}��%LOCALS%�����n����
	IF PLANT_TYPE:0 == 190
		ITEM:0 += LOCAL
	ELSE
		ITEM:(200 + PLANT_TYPE:ARG) += LOCAL
	ENDIF
	PLANT_TYPE:ARG = 0
	PLANT_DAYS:ARG = 0
	PLANT_GROW:ARG = 0
	PLANT_DRY:ARG = 0
	HATAKE_NAME:ARG =
	TIME += 20
ELSEIF �s���ԍ� == 3
	PLANT_TYPE:ARG = 0
	PLANT_DAYS:ARG = 0
	PLANT_GROW:ARG = 0
	PLANT_DRY:ARG = 0
	HATAKE_NAME:ARG =
	PRINTFORML %LOCALS%��������������
	TIME += 10
;�����g�����ꂽ��S�̂ɂ��܂�
ELSEIF �s���ԍ� == 4 && ITEM:�ȈՃv�[�� && GETBIT (FLAG:�v�[��, 2)
	IF !PLANT_DRY:ARG
		PRINTL �����͂����������낤
	ELSE
		PLANT_DRY:ARG = 0
		PRINTFORML %LOCALS%�ɐ��������
		TIME += 5
	ENDIF
ELSE
	TIME += 5
	RETURN 0
ENDIF

@INPLANT(ARG)
FOR LOCAL,151,200
	SIF ITEM:LOCAL
		PRINTFORML [{LOCAL}]%ITEMNAME:(LOCAL)%
NEXT
PRINTL [999] ��߂�
$INPUT_LOOP
INPUT
IF RESULT >= 151 && RESULT <= 199 && ITEM:RESULT
	PRINTFORML ��{ARG}��%ITEMNAME:(RESULT)%��A����
	ITEM:RESULT -= 1
	PLANT_TYPE:ARG = RESULT
	PLANT_DRY:ARG = 1
	IF PLANT_TYPE:ARG >= 190
		HATAKE_NAME:ARG = %ITEMNAME:(PLANT_TYPE:ARG - 190)%
	ELSE
		HATAKE_NAME:ARG = %STR:(3500 + PLANT_TYPE:ARG)%
	ENDIF
ELSE
	RETURN
ENDIF

@SHOW_PLANT(ARG)
PRINTFORM ��{ARG}�F
IF PLANT_TYPE:ARG > 0
	SETCOLOR 0x00FF00
	PRINTFORM %HATAKE_NAME:ARG%�͔|��
	IF PLANT_DRY:ARG > 3 || PLANT_GROW:ARG > 10
		SETCOLOR 0x994C00
		PRINT �i�́j
	ELSE
		SELECTCASE PLANT_GROW:ARG
			CASE 10
				SETCOLOR 0xFF0000
				PRINT �i�n�j
			CASE 8,9
				SETCOLOR 0xFF8000
				PRINT �i���j
			CASE 6,7
				SETCOLOR 0xFFFF00
				PRINT �i�ԁj
			CASE 4,5
				PRINT �i�t�j
			CASEELSE
				PRINT �i�c�j
		ENDSELECT
	ENDIF
	IF !PLANT_DRY:ARG
		SETCOLOR C_AQUA
		PRINT �@���T���ς�
	ENDIF
	RESETCOLOR
	PRINTL
	;���T��
	IF PLANT_DRY:ARG
		LOCAL = ARG * 100 + 1
		LOCALS = [%TOSTR(LOCAL, "000")%] - �����T��
		PRINTBUTTONLC LOCALS, LOCAL
	ELSE
		PRINTLC �@
	ENDIF
	;���n
	IF PLANT_DAYS:ARG > 7 && !(PLANT_DRY:ARG > 3 || PLANT_GROW:ARG > 10)
		LOCAL = ARG * 100 + 2
		LOCALS = [%TOSTR(LOCAL, "000")%] - ���n����
		PRINTBUTTONLC LOCALS, LOCAL
	ELSE
		PRINTLC �@
	ENDIF
	;���n
	LOCAL = ARG * 100 + 3
	LOCALS = [%TOSTR(LOCAL, "000")%] - ����������
	PRINTBUTTONLC LOCALS, ARG * 100 + 03
	;�X�v�����N���[
	IF ITEM:�ȈՃv�[�� && GETBIT (FLAG:�v�[��, 2) && PLANT_DRY:ARG
		LOCAL = ARG * 100 + 4
		LOCALS = [%TOSTR(LOCAL, "000")%] - �X�v�����N���[
		PRINTBUTTONLC LOCALS, LOCAL
	ENDIF
ELSE
	PRINTL ��
	;�c�A��
	LOCAL = ARG * 100 + 0
	LOCALS = [%TOSTR(LOCAL, "000")%] - �c��A����
	PRINTBUTTONLC LOCALS, LOCAL
ENDIF
PRINTL

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE418
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;�|�����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(418)
	RETURN RESULT
;��
SIF !�ƒ�؉���(CFLAG:MASTER:���݈ʒu)
	RETURN 0
;�ƒ�؉��Z�b�g
SIF !ITEM:150
	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
SIF CFLAG:���ӂ� == 2
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;������
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM419
SELECTCASE CFLAG:MASTER:���݈ʒu
	CASE ���̌�
		TFLAG:������ = 2
	CASE 347
		TFLAG:������ = 2
	CASE ���n������
		TFLAG:������ = 3
	CASE 940
		TFLAG:������ = 3
	;CASE �R�̌�
	;	TFLAG:������ = 4
	;CASE 830
	;	TFLAG:������ = 4
	;�A�C�e���ݒ�L��ǂ�����o�H���v�����Ȃ��̂ŃR�����g�A�E�g
	;CASE
	;	TFLAG:������ = 5
	;CASE
	;	TFLAG:������ = 5
	;CASE �䏊
	;	TFLAG:������ = 6
	;CASE 11
	;	TFLAG:������ = 6
	;CASE �����X
	;	TFLAG:������ = 7
	;CASE 270
	;	TFLAG:������ = 7
	CASEELSE
		TFLAG:������ = 1
ENDSELECT

STAIN:MASTER:0 = 0
STAIN:MASTER:1 = 0
CFLAG:MASTER:���ɐ��t = 0
CFLAG:MASTER:��ɐ��t = 0
CFLAG:MASTER:��ɐ��t = 0
IF TARGET
	STAIN:0 = 0
	STAIN:1 = 0
	CFLAG:���ɐ��t = 0
	CFLAG:��ɐ��t = 0
	CFLAG:��ɐ��t = 0
ENDIF
PRINTFORML %STR:(7000 + TFLAG:������)%������
IF GET_MAPID(CFLAG:MASTER:���݈ʒu) != MAIN_MAP
	PRINTL �������܂ܕ����̂͂���ǂ��̂ŋA��܂�
	CALL �O�o�悩��A��
ENDIF
TIME += 3

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE419
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;���s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(419)
	RETURN RESULT
SIF !�����݉�(CFLAG:MASTER:���݈ʒu)
	RETURN 0
SIF CFLAG:���ӂ� == 2
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;��`���ƂƘb��
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM420
PRINTL �u�������悤�ł����H�v
PRINTL [0] - �l��T���Ă���
PRINTL [1] - �|����������
PRINTL [2] - git�ɂ���
PRINTL [100] - �߂�
INPUT
IF RESULT == 0
	PRINTL �u�N�����T���ł����H�v
	CALL HITOSAGASI()
ELSEIF RESULT == 1
CALL OHEYA_CHECK
ELSEIF RESULT == 2
	PRINTDATA
		DATAFORM �ugit���g���ƃp�b�`���ꔭ�Ń}�[�W�ł����ł���v
		DATAFORM �ugit������ΕύX�ӏ����ȒP�ɔc���ł���悤�ɂȂ�܂��v
		DATAFORM �u�ߋ��̃R�[�h�������ƕۑ����Ă���܂��v
	ENDDATA
	PRINTW �ǂ���琦�����̂炵��
	RETURN -1
ELSEIF RESULT == 100
	RETURN -1
ELSE
	RETURN -1
ENDIF
INPUTS
RESULT = TOINT(RESULTS)
IF RESULT == 0
	REPLACE RESULTS, CALLNAME:MASTER, "%CALLNAME:MASTER%"
	FOR LOCAL, 1, 19
		SIF STR:LOCAL == RESULTS
			RESULT = LOCAL
	NEXT
ENDIF
SIF RESULT == 0
	RETURN -1
IF FLAG:�[�ˎ{��
	PRINTW �����J���Ȃ���
	RESTART
ENDIF
IF (RESULT >= 26 && RESULT <= 35) && ABL:MASTER:���{ < 1 && !MAIN_MAP && !INRANGE(CFLAG:MASTER:�����ʒu,26,35)
	PRINTFORMW ���n��%CALLNAME:MASTER%�ɂ͌����邱�Ƃ��ł��Ȃ��c
ELSE
	IF IN_HOME(RESULT) == 1
		;NEXTCOM = GETNUM(TRAINNAME, "�ړ�")
		;TFLAG:195 = RESULT
		CALL SKIP_MOVE(CFLAG:MASTER:���݈ʒu, RESULT)
	ENDIF
ENDIF
RETURN -1

@OHEYA_CHECK
VARSET LOCAL
	FOR LOCAL,MINROOM(),MAXROOM
		LOCALS = %NAME_FROM_PLACE(LOCAL)%
		SIF LOCAL == CFLAG:MASTER:311
			LOCALS = %CALLNAME:MASTER%����
		SIF LOCALS == ""
			GOTO SYOURYAKU
		SIF CFLAG:MASTER:���݈ʒu == LOCAL
			SETCOLOR 0 , 255, 0
		PRINTBUTTON "["+LOCALS+"]", LOCAL
		RESETCOLOR
		PRINTFORM %" "*(22-STRLENS(LOCALS))%
		LOCALS = %SEIKETU(LOCAL)%
		PRINTFORM %LOCALS,15,RIGHT%
		RESETCOLOR
		LOCAL:1 ++
		SIF LOCAL:1 % 2 == 0
			PRINTL
		$SYOURYAKU
	NEXT
PRINTFORML
DRAWLINE
	PRINTBUTTON "[�m�F�I��]", 0

@SEIKETU(ARG)
#FUNCTIONS
IF OUTROOF(CFLAG:MASTER:���݈ʒu) && DAY:2 == 4
	SELECTCASE YOGORE:ARG
		CASE IS < 100
			SETCOLOR C_GREEN
			RETURNF "�ϐ��:�X�b�L��"
		CASE IS < 500
			SETCOLOR C_M_GREEN
			RETURNF "�ϐ��:��"
		CASE IS < 1000
			SETCOLOR C_P_GREEN
			RETURNF "�ϐ��:��⏬"
		CASE IS < 2000
			SETCOLOR 0xFFFFFF
			RETURNF "�ϐ��:��"
		CASE IS < 3500
			SETCOLOR 0xFFFFFF
			RETURNF "�ϐ��:����"
		CASE IS < 5000
			SETCOLOR 0xFFFFFF
			RETURNF "�ϐ��:��"
		CASEELSE
			SETCOLOR 0xFFFFFF
			RETURNF "�ϐ��:��̎R"
	ENDSELECT
ELSE
	SELECTCASE YOGORE:ARG
		CASE IS < 100
			SETCOLOR C_GREEN
			RETURNF "�����x:�ō�"
		CASE IS < 500
			SETCOLOR C_M_GREEN
			RETURNF "�����x:��"
		CASE IS < 1000
			SETCOLOR C_P_GREEN
			RETURNF "�����x:��⍂"
		CASE IS < 2000
			SETCOLOR 0xFFFF00
			RETURNF "�����x:��"
		CASE IS < 3500
			SETCOLOR 0xFF00FF
			RETURNF "�����x:����"
		CASE IS < 5000
			SETCOLOR 0xFF00FF
			RETURNF "�����x:��"
		CASEELSE
			SETCOLOR 0xFF0000
			RETURNF "�����x:�S�~�̎R"
	ENDSELECT
ENDIF

@HITOSAGASI(ARG)
IF ARG
	FOR LOCAL,1,CHARANUM
		SIF CFLAG:LOCAL:�_�ЍݏZ > 0
			CONTINUE
		SIF AT_HOME(LOCAL) == 1
			CONTINUE
		SIF CFLAG:LOCAL:���݈ʒu == MAXROOM && CFLAG:LOCAL:����
			CONTINUE
		FOR LOCAL:1,10,100,10
			IF CFLAG:LOCAL:���݈ʒu == ARG * 100 + LOCAL:1
				PRINTFORML %CALLNAME:LOCAL,15,LEFT%
				LOCAL:2 ++
			ENDIF
		NEXT
	NEXT
	SIF !LOCAL:2
		PRINTFORML �N�����Ȃ�
ELSE
	FOR LOCAL,1,CHARANUM
		SIF AT_HOME(LOCAL) == 0
			CONTINUE
		SIF CFLAG:LOCAL:���݈ʒu < MINROOM()
			CONTINUE
		SIF CFLAG:LOCAL:���݈ʒu == MAXROOM && CFLAG:LOCAL:����
			CONTINUE
		PRINTFORM %CALLNAME:LOCAL,15,LEFT%
		LOCALS = %NAME_FROM_PLACE(CFLAG:LOCAL:���݈ʒu)%
		SIF CFLAG:LOCAL:���݈ʒu == CFLAG:MASTER:311
			LOCALS = %CALLNAME:MASTER%����
		PRINTBUTTON "["+LOCALS+"]", CFLAG:LOCAL:���݈ʒu
		PRINTFORM %" "*(22-STRLENS(LOCALS))%
		IF CFLAG:LOCAL:����
			PRINTL �A�Q��
		ELSE
			PRINTL
		ENDIF
	NEXT
	IF FLAG:17
		PRINTL
		FOR LOCAL,1,6
			;���o���Ȃ�X�L�b�v
			SIF !GETBIT(FLAG:17,LOCAL)
				CONTINUE
			PRINTFORM %STR:(200 + LOCAL),15,LEFT%
			LOCALS = %STR:(TFLAG:(200 + LOCAL))%
			;MASTER������荞��
			SIF TFLAG:(200 + LOCAL) == CFLAG:MASTER:311
				LOCALS = %CALLNAME:MASTER%����
			PRINTBUTTON "["+LOCALS+"]", TFLAG:(200 + LOCAL)
			PRINTFORML %" "*MIN(0,(22-STRLENS(LOCALS)))%
		NEXT
	ENDIF
ENDIF
PRINTBUTTON "[�m�F�I��]", 0

;-------------------------------------------------
;���s����
;-------------------------------------------------
;��`���ƂƘb��
@COM_ABLE420
;����O�͕s��
SIF AT_HOME(MASTER) == 0
	RETURN 0
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;�ړ����s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(420)
	RETURN RESULT
SELECTCASE MAIN_MAP
	CASE 0
		;��`���Ƃ��Q�Ă�����_��
		SIF CFLAG:2:����
			RETURN 0
		;��`���Ƃ̋��鏊
		SIF CFLAG:MASTER:���݈ʒu != CFLAG:2:���݈ʒu
			RETURN 0
	CASE 3
		SIF CFLAG:MASTER:���݈ʒu != 323
			RETURN 0
	CASE 9
		SIF CFLAG:MASTER:���݈ʒu != 923
			RETURN 0
	CASEELSE
		RETURN 0
ENDSELECT

SIF CFLAG:���ӂ� == 2
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;��|��
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM421

PRINTL �����肢�܂����H
$INPUT_LOOP
PRINTL [0] - ������(\1000)
SIF TALENT:MASTER:2 & 2
PRINTL [1] - ���͐��(\3000)
PRINTL [2] - �S�̕���(\3000)
PRINTL [10] - �M�����̃p���e�B������[���I�I�I�I(\5000)
PRINTL [15] - �݂�Ȃ��g�ȋC���ɂȂ�܂��悤��(\10000)
SIF TARGET && ABL:�T�h���C >= 3
	PRINTFORML [16] - \@ TALENT:���l? ���z���ꂩ�킢��# \@%CALLNAME:TARGET%������������̂ŉ��Ƃ�����
SIF TARGET
	PRINTFORML [20] - \@ TALENT:���l? ���z���ꂩ�킢��# \@%CALLNAME:TARGET%�������Ƃg�ɂȂ�܂��悤��
SIF TALENT:TARGET:����
	PRINTFORML [21] - �q��F��(���݂̎q��␳:{CFLAG:�q��␳})
PRINTFORML [30] - ���̎q�Ɍ����Ă��܂����̂����Ƃ�������
SIF CFLAG:MASTER:���͉�� && CFLAG:MASTER:���� < 6
	PRINTFORML [40] - ���Ƃ̑㏞����菜���Ăق���
SIF FLAG:�J�^���w���� > 10
	PRINTFORML [50] - �������l�ɓV����
PRINTL [999] - ����ς��߂�
INPUT
SIF RESULT == 999
	RETURN -1

IF RESULT == 0
	IF MONEY < 1000
		PRINTL ����������Ȃ�
		GOTO INPUT_LOOP
	ENDIF
	PRINTL �N�̎����v�������ׂ܂����H
	CALL SHOW_CHALALIST
	PRINTL [999] - ����ς��߂�
	INPUT
	IF RESULT == 51 || RESULT == 52
		CALL GANKAKE_0(RESULT)
		MONEY -= 1000
	ELSEIF RESULT == 999
		RETURN -1
	ELSE
		CALL GANKAKE_0(RESULT)
		MONEY -= 1000
	ENDIF
;���͐��
ELSEIF RESULT == 1
	IF MONEY < 3000
		PRINTL ����������Ȃ�
		GOTO INPUT_LOOP
	ENDIF
	MONEY -= 3000
	FLAG:��|�����e = 200
	;�ː��o����������Β�m���ŉi���I�ɐ��͂��㏸����
	IF EXP:MASTER:11 > (100 + FLAG:561 * 100) && FLAG:561 < 11
		LOCAL += 100
		FLAG:561 += 1
	ENDIF
	CALL BUFF_BASE(MASTER,BASE_����,500)
	FLAG:71 ++
;�S�̕���
ELSEIF RESULT == 2
	IF MONEY < 3000
		PRINTL ����������Ȃ�
		GOTO INPUT_LOOP
	ENDIF
	MONEY -= 3000
	CALL BUFF_BASE(MASTER,BASE_�C��,500)
	FLAG:��|�����e = 201
	FLAG:71 = 0
ELSEIF RESULT == 10
	IF MONEY < 5000
		PRINTL ����������Ȃ�
		GOTO INPUT_LOOP
	ELSE
		MONEY -= 5000
		FLAG:��|�����e = 202
	ENDIF
ELSEIF RESULT == 15
	IF MONEY < 10000
		PRINTL ����������Ȃ�
		GOTO INPUT_LOOP
	ELSE
		MONEY -= 10000
		FLAG:��|�����e = 203
	ENDIF
ELSEIF RESULT == 16 && ABL:�T�h���C
		CALL IKENIE(TARGET,7)
ELSEIF RESULT == 20 && TARGET != 0
		CALL IKENIE(TARGET,2)
ELSEIF RESULT == 21 && TALENT:TARGET:����
		CALL IKENIE(TARGET,6)
ELSEIF RESULT == 30
	PRINTL �N���H
	DRAWLINE
	FOR LOCAL,1,CHARANUM
		SIF MARK:LOCAL:�������� && !CFLAG:LOCAL:�o��
			PRINTFORMLC [{LOCAL}] %CALLNAME:LOCAL,15,LEFT%
	NEXT
	PRINTL
	DRAWLINE
	PRINTL [999] - ����ς��߂�
	INPUT
	IF RESULT >= 1 && RESULT <= CHARANUM && MARK:RESULT:��������
		CALL IKENIE(RESULT,1)
	ELSE
		RETURN -1
	ENDIF
ELSEIF RESULT == 40 && CFLAG:MASTER:���͉�� && CFLAG:MASTER:���� < 6
	CALL IKENIE(71,3)
ELSEIF RESULT == 50 && FLAG:�J�^���w���� > 10
	CALL IKENIE(53,5)
ENDIF
DOWNBASE:MASTER:�C�� = 100
TIME += 10
RETURN 1

;��|��
@COM_ABLE421
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;�|�����s����
SIF !TFLAG:100
	RETURN 0
;���łɍ�����|�����Ă���e��
SIF FLAG:��|�����e > 0
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(421)
	RETURN RESULT
;�ΑK��
SIF !�V�̐���(CFLAG:MASTER:���݈ʒu) && CFLAG:MASTER:���݈ʒu != ���_�Ж{�a
	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
SIF CFLAG:���ӂ� == 2
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�V�̐��𕷂�
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM422
PRINTL [0] - �l��T���Ă���
PRINTL [1] - �|����������
PRINTL [2] - �O�ɋ���l��T������
PRINTL [100] - �߂�
INPUT
IF RESULT == 0
	CALL HITOSAGASI()
ELSEIF RESULT == 1
	CALL OHEYA_CHECK
ELSEIF RESULT == 2
	CALL BROAD_HITOSAGASI
	TIME += 3
	RETURN 1
ELSEIF RESULT == 100
	RETURN -1
ENDIF
INPUTS
RESULT = TOINT(RESULTS)
IF RESULT == 0
	REPLACE RESULTS, CALLNAME:MASTER, "%CALLNAME:MASTER%"
	FOR LOCAL, 1, 19
		SIF STR:LOCAL == RESULTS
			RESULT = LOCAL
	NEXT
ENDIF

IF (RESULT >= 26 && RESULT <= 35) && ABL:MASTER:���{ < 1 && !INRANGE(CFLAG:MASTER:�����ʒu,26,35)
	PRINTFORMW ���n��%CALLNAME:MASTER%�ɂ͌����邱�Ƃ��ł��Ȃ��c
ELSE
	IF IN_HOME(RESULT) == 1
		SIF AT_HOME(MASTER) == 0
			GOTO MURIDESU
		CALL SKIP_MOVE(CFLAG:MASTER:���݈ʒu, RESULT)
	ENDIF
ENDIF

TIME += 10
RETURN 1
$MURIDESU
PRINTW ��������͍s���Ȃ��c
TIME += 10
RETURN 1

@BROAD_HITOSAGASI
$KAKUNIN
FOR LOCAL,0,11
	SIF LOCAL == MAIN_MAP
		CONTINUE
	LOCAL:1 = 5000 + LOCAL
	PRINTFORMLC [{LOCAL}] - %STR:(LOCAL:1)%
	CALL �L��`�F�b�N(LOCAL,1)
NEXT
DRAWLINE
PRINT [100] - �m�F�I��
$INPUT_LOOP
INPUT
IF RESULT == 100 || RESULT == MAIN_MAP
	RETURN -1
ELSEIF RESULT < 0
	CLEARLINE 1
	GOTO INPUT_LOOP
ELSEIF RESULT >= 11
	PRINTW ���쐬�ł�
	CLEARLINE 2
	GOTO INPUT_LOOP
ENDIF
CALL �L��`�F�b�N(RESULT,2)
CALL ASK_YN("���̒n�������","�m�F�I��")
SIF !RESULT
	GOTO KAKUNIN

@�L��`�F�b�N(ARG,ARG:1)
VARSET LOCAL

FOR LOCAL,1,CHARANUM
	SIF AT_HOME(LOCAL) == 1
		CONTINUE
	SIF CFLAG:LOCAL:���݈ʒu == MAXROOM && CFLAG:LOCAL:����
		CONTINUE
	FOR LOCAL:1,10,100,10
		IF CFLAG:LOCAL:���݈ʒu == ARG * 100 + LOCAL:1
			;���̒n��ɂ���L������\��
			IF ARG:1 == 2
				SIF CFLAG:LOCAL:�s�� == 5
					SETCOLOR 255, 100, 0
				PRINTFORML %CALLNAME:LOCAL,15,LEFT%
				RESETCOLOR
			ENDIF
			LOCAL:2 ++
		ENDIF
	NEXT
NEXT
;���̒n��ɂ���l��
IF ARG:1 == 1
	IF LOCAL:2
		PRINTFORML {LOCAL:2}�l
	ELSE
		PRINTL �N�����Ȃ�
	ENDIF
ENDIF

;�V�̐��𕷂�
@COM_ABLE422
;��~���͕s��
SIF FLAG:70 == 1
	RETURN 0
;���s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(421)
	RETURN RESULT
;�ΑK��
SIF !�V�̐���(CFLAG:MASTER:���݈ʒu) && CFLAG:MASTER:���݈ʒu != �V�E
	RETURN 0
SIF CFLAG:���ӂ� == 2
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;��𐷂�
;����n�R�}���h�A���x��1
;-------------------------------------------------
@COM425
PRINTL �ǂ̖�������܂����H
$LOOP
SIF ITEM:41
	PRINTFORML [{41}] %ITEMNAME:41%
SIF ITEM:42
	PRINTFORML [{42}] %ITEMNAME:42%
SIF ITEM:250
	PRINTFORML [{250}] %ITEMNAME:250%
SIF ITEM:252
	PRINTFORML [{252}] %ITEMNAME:252%
PRINTL [999] ��߂�
INPUT

SIF RESULT == 999
	RETURN 0
IF RESULT != 41 && RESULT != 42 && RESULT != 250 && RESULT != 252
	GOTO LOOP
ELSEIF ITEM:RESULT
	TFLAG:131 = RESULT
	PRINTFORML ������%ITEMNAME:RESULT%�������܂���
	ITEM:RESULT -= 1
IF FLAG:70
	BASE:MASTER:TSP -= 30
ELSE
	TIME += 10
ENDIF
	RETURN 1
ELSE
	RETURN 0
ENDIF

;-------------------------------------------------
;���s����
;-------------------------------------------------
;��𐷂�
@COM_ABLE425
;�ڌ��҂�����Ƒʖ�
SIF TARGET > 0 && !FLAG:70
	RETURN 0
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(425)
	RETURN RESULT
;�~�[�E�d���̃L�b�`���E��Ղ̒������E�����X
SIF !KITCHEN(CFLAG:MASTER:���݈ʒu) &&  CFLAG:MASTER:���݈ʒu != 29 &&  CFLAG:MASTER:���݈ʒu != 42 &&  CFLAG:MASTER:���݈ʒu != �����X
	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
SIF CFLAG:���ӂ� == 2
	RETURN 0
SIF TFLAG:131
	RETURN 0
RETURN 1