code:
@KICKOUT_9()
#FUNCTION
SELECTCASE CHK_INHOME(CFLAG:MASTER:���݈ʒu)
	CASE 21
		RETURNF 922
	CASE 34
		RETURNF 932
ENDSELECT
RETURNF 0

@MAP_UNIQUEMESSAGE_9
CALL DRAW_INFORMATIONLINE("Info",1)
IF WITH_MOB()
	CALL MOB_MESSAGE_9
	RETURN 1
ELSE
	SELECTCASE CFLAG:MASTER:���݈ʒu
		CASE 944,946
			PRINTFORML �ɉ؊X�̌������������Ă���@���̌������ɂ͒n��a��������
		CASE 948
			PRINTFORML ���̒[�ɂ����Ȓn����������
	ENDSELECT
ENDIF
IF CHK_FOCUS(944,CFLAG:MASTER:���݈ʒu,948)
	SIF CFLAG:60:�s�� == 5
		PRINTFORML ���̏�ł̓p���X�B���ʍs�҂����Ȃ����������Ă���
ENDIF
RETURN 1
@MOB_MESSAGE_9
IF CHK_FOCUS(927,CFLAG:MASTER:���݈ʒu,930)
	IF FLAG:70
		PRINTL ����B����~���Ă���
	ELSE
		IF !RAND:2
			PRINTL ���삪���܂���Ă���
		ELSE
			PRINTL ���삪�Y���Ă���
		ENDIF
	ENDIF
ELSEIF CHK_FOCUS(931,CFLAG:MASTER:���݈ʒu,939)
	IF FLAG:70
		PRINTL �S�B����~���Ă���
	ELSEIF GROUPMATCH(TIME:2,1,6,7)
		PRINTL �S�B�������Ă���c
	ELSE
		SELECTCASE RAND:6
			CASE 0
				PRINTL �S�B���𐷂肵�Ă���
			CASE 1
				PRINTL �S�B�����ނ낵�Ă���
			CASE 2
				PRINTL �S�B�����܂����Ă���
			CASE 3
				PRINTL �S�B��������Ă���
			CASE 4
				PRINTL �S�B�������ł���
			CASE 5
				PRINTL �S���Q���ׂ��Ă���c�ז�������
		ENDSELECT
	ENDIF
ELSE
	IF FLAG:70
		PRINTFORML %ANIMALNAME()%����~���Ă���
	ELSEIF GROUPMATCH(TIME:2,1,6,7)
		PRINTFORML %ANIMALNAME()%�������Ă���c
	ELSEIF CFLAG:MASTER:���݈ʒu == 923
		IF !RAND:2
			PRINTFORML %ANIMALNAME()%�������т����Ă���
		ELSE
			PRINTFORML %ANIMALNAME()%���j���ł���
		ENDIF
	ELSE
		IF !RAND:2
			PRINTFORML %ANIMALNAME()%��������Ă���
		ELSE
			PRINTFORML %ANIMALNAME()%���Q���ׂ��Ă���c�ז�������
		ENDIF
	ENDIF
ENDIF
;-----------------------------------------
;�񎩑�ɍ����ւ���ꏊID��Ԃ��֐�
;ARG,�Ώ�ID
;RETURNF,�����ւ��ςݑΏ�ID
;-----------------------------------------

@MAP_SEARCH_REPLACEMENT_9(ARG)
#FUNCTION
SELECTCASE ARG
	CASE 948
	;���z����
		RETURNF 910
	CASE 940 TO 946
	;�n���̐[��
		RETURNF 920
	CASE 934
	;���n������
		RETURNF 940
	CASE 935
	;���u�z
		RETURNF 950
	CASE 931 TO 939
	;���n���X��
		RETURNF 930
	CASE 901 TO 926
	;�n��a
		RETURNF 960
	CASE 927 TO 930
	;�ܔM�n����
		RETURNF 970
ENDSELECT
RETURNF 0

@MAP9_AREANAME(PLACE_ID)
#FUNCTIONS
#LOCALSIZE 1
#LOCALSSIZE 1
#DIM PLACE_ID
IF MAIN_MAP == 9
	SIF INRANGE(PLACE_ID, 901, 926)
		RETURNF "�n��a"
	SIF INRANGE(PLACE_ID, 927, 930)
		RETURNF "���n��"
	SIF INRANGE(PLACE_ID, 931, 944)
		RETURNF "���s"
	RETURNF "�n��"
ELSE
	SELECTCASE PLACE_ID
	CASE 930, 940, 950
		RETURNF "���s"
	CASE 960
		RETURNF "�n��a"
	CASE 970
		RETURNF "���n��"
	CASEELSE
		RETURNF "�n��"
	ENDSELECT
ENDIF


code:
;
;	���͂����ꏊID����������Ȃ��0-99�ɍ����ւ���֐�
;
;	FLAG:(XXX + ����ꏊID)��FLAG:(XXX + CHK_INHOME(����ꏊID))�Ƃ������`�Ŏg�p���Ă���
;
;ARG,�ꏊID
@CHK_INHOME(ARG)
#FUNCTION
SIF MAIN_MAP == GET_MAPID(ARG)
	RETURNF (ARG) % 100
RETURNF ARG
;
;	�ꏊ�ɂ��Ă̔�����֐����ł��Ȃ����ƍ�������́B
;
@CHK_PLACE(ARG, ARGS, ARG:1 = 0, MAPID = -1)
#FUNCTION
#DIM MAPID
#DIM TARGET_INHOME
IF MAPID == -1
	MAPID = GET_MAPID(ARG:1)
ENDIF
IF MAPID == MAIN_MAP
	TARGET_INHOME = CFLAG:ARG:���݈ʒu % 100
ELSE
	TARGET_INHOME = -1
ENDIF

IF ARGS == "MASTER"
	SIF CFLAG:ARG:���݈ʒu == CFLAG:MASTER:���݈ʒu
		RETURNF 1
ELSEIF ARGS == "ADDRESS"
	SIF CFLAG:ARG:���݈ʒu == ARG:1 + MAPID * 100 && CFLAG:ARG:���݈ʒu != 1000
		RETURNF 1
ELSEIF ARGS == "FLAG"
	SIF CFLAG:ARG:���݈ʒu == FLAG:(ARG:1)
		RETURNF 1
ENDIF
RETURNF 0

;
;	�ꏊ�ɂ��Ă̓��͂��֐����ł��Ȃ����ƍ��������
;
@SET_PLACE(ARG, ARGS, ARG:1 = 0, MAPID = -1)
#DIM MAPID
#DIM TARGET_INHOME
IF MAPID == -1
	MAPID = GET_MAPID(ARG:1)
ENDIF

IF ARGS == "MASTER"
	CFLAG:ARG:���݈ʒu = CFLAG:MASTER:���݈ʒu
ELSEIF ARGS == "ADDRESS"
	CFLAG:ARG:���݈ʒu = ARG:1 + MAPID * 100
ELSEIF ARGS == "FLAG"
	CFLAG:ARG:���݈ʒu = FLAG:(ARG:1)
ENDIF
;-------------------------------------------------
;
;	���͂���MAPID��MAIN_MAP�ƈ�v����ꍇ��0��Ԃ��֐�
;	IF CFLAG:�L����:�f�[�g�� �̗ނł͂��Ȃ炸�g������
;
;	����:MAIN_MAP, 0, 1, ... , MAIN_MAP-1, MAIN_MAP+1, ...
;	�o��:             0, 1, 2, ... ,    MAIN_MAP, MAIN_MAP+1, ...
;MAPID_DATE, ��{CFLAG:�`:�f�[�g���𒆂ɓ����
;-------------------------------------------------
@CHK_DATENOW(MAPID_DATE)
#FUNCTION
#DIM MAPID_DATE
SIF MAPID_DATE < MAIN_MAP
	RETURNF MAPID_DATE + 1
SIF MAPID_DATE == MAIN_MAP
	RETURNF 0
SIF MAPID_DATE > MAIN_MAP
	RETURNF MAPID_DATE

;-------------------------------------------------
;�ꏊID��������MAPID��Ԃ��֐�
;ARG, �ꏊID
;-------------------------------------------------
@GET_MAPID(ARG)
#FUNCTION
RETURNF ARG / 100

@GET_DATE_PLACE(ARG)
#FUNCTION
RETURNF ARG % 100 % 10
;-------------------------------------------------
;������ROUND�֐�����
;ARG <= ARG:1 <= ARG:2�Ȃ��1���A�����łȂ����0��Ԃ�
;-------------------------------------------------
@CHK_FOCUS(ARG, ARG:1, ARG:2)
#FUNCTION
;SIF CALC_FOCUS(ARG, ARG:1, ARG:2) != ARG:1
;	RETURNF 0
;RETURNF 1
IF ARG <= ARG:1 && ARG:1 <= ARG:2
	RETURNF 1
ENDIF
SIF ARG > ARG:2
	PRINT ARG:0 > ARG:2 �G���[
RETURNF 0
;-------------------------------------------------
;������ROUND�֐��o��
;-------------------------------------------------
@CALC_FOCUS(ARG, ARG:1, ARG:2)
#FUNCTION
SIF ARG >= ARG:1
	RETURNF ARG
SIF ARG	:1 >= ARG:2
	RETURNF ARG:2
RETURNF ARG:1

;-------------------------------------------------
;�ݑ��
;CALL		USER
;ARG		�L�����ԍ�
;RETURN		0=���_�ɂ��Ȃ��A1=���_�ɂ���A2=�Q���̌�����
;COMMENT	�w��L���������_�ɂ��邩����
;-----------------------------------------------------------
@AT_HOME(ARG)
#FUNCTION
RETURNF IN_HOME(CFLAG:ARG:���݈ʒu)

;-------------------------------------------------
;���_����
;CALL		USER
;ARG		�ꏊID
;RETURN		0=���_�ł͂Ȃ��A1=���_�A2=�Q���̌�����
;COMMENT	�w��L���������_�ɂ��邩����
;-----------------------------------------------------------
@IN_HOME(ARG)
#FUNCTION
LOCAL = MAXROOM
IF ARG == LOCAL
	RETURNF 2
ELSEIF CHK_FOCUS(MINROOM(), ARG, LOCAL)
	RETURNF 1
ELSE
	RETURNF 0
ENDIF

;-------------------------------------------------
;�n��敪����֐�
;����_�Ѓ}�b�v�ɂ�����u����_�Ёv�u�O�d���̉Ɓv�u������Ձv�̂悤�Ȓn��敪
;�n�_ID��AREA��MAP�����z���S�́A�݂�����
;���ł���MAP�̃X�|�b�g�����኱���������ςł��i�҂����킹�ꏊ�̎w��ɂ͎g���Ȃ����x�H�j
;MAIN_MAP���Q�Ƃ��ċ��_�}�b�v����/���ł����}�b�v�����؂�ւ��Ă���_�ɒ���
;����_�ЍݏZ���ɔ���_�Ђ̂��ł����}�b�v��ł̔ԍ���n���Ă���肭���삵�Ȃ�
;-------------------------------------------------
@MAP_AREANAME(PLACE_ID)
#FUNCTIONS
#LOCALSIZE 1
#LOCALSSIZE 1
#DIM PLACE_ID
SIF PLACE_ID == OMANEKIBEYA()
	RETURNF "����"
SIF PLACE_ID == SUKIMA()
	RETURNF "�X�L�}���"
SELECTCASE GET_MAPID(PLACE_ID)
CASE 0
	RETURNF MAP0_AREANAME(PLACE_ID)
CASE 1
	RETURNF MAP1_AREANAME(PLACE_ID)
CASE 2
	RETURNF MAP2_AREANAME(PLACE_ID)
CASE 3
	RETURNF MAP3_AREANAME(PLACE_ID)
CASE 4
	RETURNF MAP4_AREANAME(PLACE_ID)
CASE 5
	RETURNF MAP5_AREANAME(PLACE_ID)
CASE 6
	RETURNF MAP6_AREANAME(PLACE_ID)
CASE 7
	RETURNF MAP7_AREANAME(PLACE_ID)
CASE 8
	RETURNF MAP8_AREANAME(PLACE_ID)
CASE 9
	RETURNF MAP9_AREANAME(PLACE_ID)
CASE 10
	RETURNF MAP9_AREANAME(PLACE_ID)
ENDSELECT

;�ڍ׃}�b�v�������̂��߉��u��
@MAP6_AREANAME(PLACE_ID)
#FUNCTIONS
#LOCALSIZE 1
#LOCALSSIZE 1
#DIM PLACE_ID
IF MAIN_MAP == 6
ELSE
	SELECTCASE PLACE_ID
	CASE 610
		RETURNF "���L�̓�"
	CASE 620
		RETURNF "�O�r�̐�"
	CASE 630
		RETURNF "�}���q�K"
	CASE 670
		RETURNF "�ފ�"
	CASE 680, 690
		RETURNF "���ʘO"
	CASEELSE
		RETURNF "���E"
	ENDSELECT
ENDIF

@MAP10_AREANAME(PLACE_ID)
#FUNCTIONS
#LOCALSIZE 1
#LOCALSSIZE 1
#DIM PLACE_ID
IF MAIN_MAP == 10
ELSE
	SELECTCASE PLACE_ID
	CASE 101
		RETURNF "�ň��ʘH"
	CASE 1050, 1060, 1070
		RETURNF "���̓s"
	CASE 1080, 1090
		RETURNF "���s�x�O"
	CASEELSE
		RETURNF "����"
	ENDSELECT
ENDIF

repo_name: akadiya/eratw

license: unknown


code:
;FileName_SHOP.ERB -------------------------------- Rev1.00
;RESULT_104(�ݒ�) ����
;CALL		SYSTEM
;ARG		VOID
;RETURN		VOID
;COMMENT
;----------------------------------------------------------
@SCHEDULE
PRINT [0] - �N�����Ԑݒ�
PRINTFORML �i�O���A�Q����%�����\��(CFLAG:MASTER:�A�Q���� - DAY * 1440)%�j�E�i�N������%�����\��(TIME:3)%�j
SIF FLAG:10
	PRINTL [1] - �����ݒ�
;SIF FLAG:15 == 0
;	PRINTL [2] - �Z�ݍ���
PRINTFORML [4] - ���E�i����\@ FLAG:���E? �I��# �I�t\@�j
PRINTFORML [5] - ����
PRINTFORML [6] - �𒎂̕r���ړ�
;#;PRINTFORML [-99] - �f�o�b�O�p�A�֐��Ăяo���ڂ���
PRINTL [100] - �߂�
INPUT
IF RESULT == 100
	RETURN 0
ELSEIF RESULT == 0
	VARSET LOCAL
	FOR LOCAL,1,CHARANUM
		SIF CFLAG:LOCAL:�����ʒu == CFLAG:MASTER:�����ʒu
			BREAK
	NEXT

	PRINTL �����ɋN�����܂���?(0~23����͂��Ă�������)
	PRINTFORML
	PRINTFORML [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]
	PRINTFORML [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23]
	IF LOCAL < CHARANUM && LOCAL
		LOCAL:1 = CFLAG:(LOCAL-1):�N������ / 60
		DRAWLINE
		PRINTFORML [{LOCAL:1}] - ��������%CALLNAME:(LOCAL-1)%�̋N������
	ENDIF
	$INPUT_LOOP
	INPUT
	SIF RESULT < 0 || RESULT > 23
		GOTO INPUT_LOOP
	TIME:3 = RESULT * 60
;;------------------------------------------------------------
;;�ĂQ�@�������Ԃ𒼐ڎw�肷����@�A�N�����Ԃ������Őݒ肵�Ă����
;	$INPUT_LOOP_0
;	PRINTL �Œ�ł�4���Ԃ͐Q��K�v������A12���Ԉȏ�͎��R�ɖڂ����߂Ă��܂��܂�
;	PRINTFORML �����ԐQ�܂����H(4~12����͂��Ă�������)(8���Ԃ����ϓI�Ȑ������Ԃł�)
;	$INPUT_LOOP_1
;	INPUT
;	SIF RESULT < 4 || RESULT > 12
;		GOTO INPUT_LOOP_1
;	TIME:3 = ((LOCAL:1 / 60) + RESULT) * 60
;	SIF (LOCAL:1 % 60)
;		TIME:3 += 60
;	SIF TIME:3 >= 1440
;		TIME:3 -= 1440
;	PRINTFORML �N�����Ԃ́i%�����\��(TIME:3)%�j�ɂȂ�܂�
;	PRINTL ��낵���ł����H
;	PRINTL  [0] �͂�
;	PRINTL  [1] ������
;	$INPUT_LOOP_2
;	INPUT
;	IF RESULT == 0
;		PRINTFORMW �N�����Ԃ��i%�����\��(TIME:3)%�j�ɐݒ肵�܂���
;	ELSEIF RESULT == 1
;		GOTO INPUT_LOOP_0
;	ELSE
;		GOTO INPUT_LOOP_2
;	ENDIF
ELSEIF RESULT == 1 && FLAG:10
	PRINTL �Q�N�����镔����ς��邱�Ƃ��o���܂�
	IF CFLAG:MASTER:�����ʒu == 16
		PRINTFORML ���݂̎����@%CALLNAME:(FLAG:15)%�̏���
	ELSE
		PRINTFORML ���݂̎����@%NAME_FROM_PLACE(CFLAG:MASTER:311)%
	ENDIF
	PRINTFORML [0] - %NAME_FROM_PLACE(�f�t�H���g�����ʒu)%
	FOR LOCAL,1,CHARANUM
		IF TALENT:LOCAL:����
			IF CFLAG:LOCAL:�_�ЍݏZ
				PRINTFORML [{LOCAL}] - %CALLNAME:LOCAL%�̕���
			ELSEIF FLAG:15 == LOCAL && !MAIN_MAP
				PRINTFORML [{LOCAL}] - %CALLNAME:LOCAL%�̕���
			ELSEIF FLAG:16 == LOCAL && !MAIN_MAP
				PRINTFORML [{LOCAL}] - %CALLNAME:LOCAL%�̕���
			ELSEIF LOCAL == 71 && !MAIN_MAP
				PRINTFORML [{LOCAL}] - %CALLNAME:LOCAL%�̒�����
			ENDIF
		ENDIF
;		IF MAP_�Z�l(MAIN_MAP,LOCAL) && CFLAG:LOCAL:��ƌ��
;			LOCAL:1 ++
;			SIF CFLAG:LOCAL:�Z�ݍ��ݕK�v�M���x > CFLAG:LOCAL:�M���x && DAY > 1
;				SETCOLOR C_L_GRAY
;			IF MAIN_MAP == 0
;				LOCALS:LOCAL = %STR:(CFLAG:LOCAL:��ƌ��)%
;			ELSE
;				LOCALS:LOCAL = %STR:(CFLAG:LOCAL:��ƌ�� + 8000)%
;			ENDIF
;			PRINTFORML [{LOCAL + 500}] - %LOCALS%�@���:%CALLNAME:LOCAL% �K�v�M���x:{CFLAG:LOCAL:�Z�ݍ��ݕK�v�M���x}
;			RESETCOLOR
;		ENDIF
	NEXT
	PRINTFORML [998] - ���̑�
	SIF !MAIN_MAP
		PRINTL [999] - �[��
	$INPUT_LOOP2
	INPUT
	IF RESULT < 0 || RESULT >= CHARANUM && RESULT != 999
		CLEARLINE 1
		GOTO INPUT_LOOP2
	ELSEIF RESULT == 0
	;�������Ȃ�����
		CFLAG:MASTER:�����ʒu = �f�t�H���g�����ʒu
	ELSEIF RESULT == 999
		CFLAG:MASTER:�����ʒu = 53
		STR:53 = %CALLNAME:MASTER%�̔[��
	ELSEIF RESULT == 71 && TALENT:MASTER:100 >= -4 && TALENT:RESULT:����
		PRINTW ���l����Ȃ�����ꏏ�ɂ͐Q���Ȃ�
		CLEARLINE 2
		GOTO INPUT_LOOP2
	ELSEIF TALENT:RESULT:���� && CFLAG:RESULT:�_�ЍݏZ
		CFLAG:MASTER:�����ʒu = CFLAG:RESULT:�����ʒu
		STR:53 = �[��
	;ELSEIF TALENT:RESULT:���� && (RESULT <= 10 ||FLAG:16 == RESULT)
	;	CFLAG:MASTER:�����ʒu = CFLAG:RESULT:�����ʒu
;	ELSEIF INRANGE(RESULT - 500,1,CHARANUM)

	ELSE
		CLEARLINE 1
		GOTO INPUT_LOOP2
	ENDIF
	PRINTW �ύX�͗������甽�f����܂�
ELSEIF RESULT == 4
	FLAG:���E = !FLAG:���E
ELSEIF RESULT == 5
	CALL NAME_CUSTOM(MASTER)
ELSEIF RESULT == 6
	CALL �𒎈����z��
ELSEIF RESULT == -99
	;���̍��ڂł͂Ȃ�
	;@TEST_����e�X�g�p�̒��g���������ĉ�������
	;#; CALL TEST_����e�X�g�p
ENDIF
RETURN 1

[SKIPSTART]
�֐��̓���e�X�g�p
PRINTFORM���R�s�y����Ό���\�����̃E�F�C�g�̕p�x�������x�̗p�r�ɂ͎g����
���ӓ_
�E�g�p�ł���^�C�~���O��������i�̂ŁA������e�ɂ���Ă͋������ς��j
�ECFLAG�̑���Ȃǂ��s�����ꍇ�ɂ̓Z�[�u�����ɂ��̂܂�Emuera���I�������ق�������
�E�g���I������甒���ɖ߂��Ă����܂��傤
[SKIPEND]
@TEST_����e�X�g�p
;�D���ɏ���

[SKIPSTART]
;����Ղ�\���A�����C�x���g�̓���e�X�g
DO
	PRINTFORMW �Ă��Ƒҋ@��
	CALL DAIRY_EV2
LOOP 1
[SKIPEND]

@�𒎈����z��
#DIMS �����z���於��
#DIM �����z����n�_
PRINTFORML �ǂ��Ɉړ������悤���H
FOR LOCAL,1,100
	IF ROOMDATA:LOCAL & �ꏊ_�~�[
		IF MAIN_MAP == 0
			LOCALS = %STR:LOCAL%
		ELSE
			LOCALS = %STR:(LOCAL + 8000 + MAIN_MAP * 100)%
		ENDIF
		SIF LOCAL == ���__�� % 100
			SETCOLOR C_AQUA
		PRINTFORML [{LOCAL}] %LOCALS%
		RESETCOLOR
	ENDIF
NEXT
DRAWLINE
PRINTFORML [100] ����ς��߂�
INPUT
IF INRANGE(RESULT,1,99) && ROOMDATA:RESULT & �ꏊ_�~�[
	IF PRIVATEROOM:RESULT && !TALENT:RESULT:����
		PRINTFORML �������ɂ����ɒu���͕̂s�����낤
		RETURN 1
	ENDIF
	�����z����n�_ = RESULT
	IF MAIN_MAP == 0
		�����z���於�� = %STR:�����z����n�_%
	ELSE
		�����z���於�� = %STR:(�����z����n�_ + 8000 + MAIN_MAP * 100)%
		�����z����n�_ += MAIN_MAP * 100
	ENDIF

	PRINTFORML %�����z���於��%�ɕr�������Ă������Ƃɂ���
	PRINTFORML ���g�̓��������r���^�Ԃ̂͂Ȃ��Ȃ��̏d�J�����c�c
	CALL COLORMESSAGE(@"�𒎂�%�����z���於��%�Ɉړ������܂���",C_YELLOW,2)
	���__�� = �����z����n�_
ENDIF


code:
;FLAG:50:bit�\�L:0������,1��݂�,2�傿���,3�H,4���,5���~���A,6�A���X,7���S��,8���S���A9-10-11�v���Y�����o�[�Y,12�d��,13-14-15���_��,16���O��,17�݂����[,18�����,19�f�P�l,20-21-22�R�̐_�l����,23�V�q,24�ߋ肳��,25-26-27�n��g,28�i�Y�[,29��������[��,30�ʂ�,31�͂��Ă�,32�ؐ�,33�G����,34�����q,35����,
;FLAG:50:bit�\�L:36����,37���C�Y,38���Ƃ�l,39�t���������,40�ɂƂ��,41���,42�Ă�,43�p�`�F,44�Ђ����,45�_�q�l,(46������,�Ӗ��Ȃ�),47�߁[���,48����,49�p���X�B,50��������,51�P�l,52�e�T,53�E�V,54��,55���l,56���[��,57�䂤�����,58�}�~�]�E,59����,(60�j���ہE�Ӗ��Ȃ�),61�i��,62�Ԕ؊�,63���e�B
;FLAG:51:bit�\�L:0���f�B,1����,2�×t,3���q,4��,5����,6�@�q,7�����[,8�L�X��,9���}��,10���,11�����T,12��,13���q,14�F��,15�ɂ��ɂ��,16�g�W,17�t�g,18�킩����,19�فX,20����,21����,22����,23,24,25,26,27,28,29,30,31,32,33,34,35,
;FLAG:51:bit�\�L:
;FileName_BEFORETRAIN.ERB -------------------------- Rev1.00
;���P���X�^�[�g����
;CALL		SYSTEM
;ARG		VOID
;RETURN		VOID
;COMMENT
;-----------------------------------------------------------
@EVENTTRAIN
#PRI
#DIM �R���N�V�����X�L�}���萔
#DIM �Տ����萔
#DIM ��������
#DIM ���Ȃ��̋N������
#DIM �˗�����
#DIM �˗��l
#DIM �����l
#DIM �ǉ���������
#DIM �N���W�Q�m��

;TRAGET������
VARSET TARGET
VARSET LOCAL
;��1���X�^�[�g����
;������

FLAG:���ւ��C�x���g = RAND:1000
FLAG:70 = 0
RESETBGCOLOR
CFLAG:MASTER:�Y���Q�� = 0
IF IN_HOME(CFLAG:MASTER:�����ʒu) == 0 || CFLAG:MASTER:�����ʒu <= 0
	PRINTW �����ʒu���s���ł��B�f�t�H���g�̈ʒu�ɖ߂��܂��B
	CFLAG:MASTER:�����ʒu = �f�t�H���g�����ʒu
ENDIF
TFLAG:102 = 1

FOR LOCAL,0,CHARANUM
	CFLAG:LOCAL:�������o = 0
	CFLAG:(LOCAL):�O�^�[���ʒu = 0
	CFLAG:(LOCAL):�f�[�g�� = MAIN_MAP
	;�ː��A�u�N�A���[�h�A�����A�{��
	BASE:LOCAL:�ː� = 0
	BASE:LOCAL:�u�N = 0
	BASE:LOCAL:���[�h = 0
	BASE:LOCAL:���� = MAXBASE:LOCAL:11
	BASE:LOCAL:�{�� = 0
	BASE:LOCAL:���C = 0
	BASE:LOCAL:�u�N = 0
	BASE:LOCAL:�[�x = 0
	CFLAG:LOCAL:�u�N�x = 0
	;�s���̓��Z�b�g
	CFLAG:LOCAL:�s�� = 0
	;�锇���N�����Z�b�g
	CLEARBIT CFLAG:LOCAL:42,8
	;�o���\���p
	FOR LOCAL:1,0,100
		TCVAR:LOCAL:(400 + LOCAL:1) = EXP:LOCAL:(LOCAL:1)
	NEXT
	CALL SETTING_PERSONALITY(LOCAL)
	;�����t���O
	TEQUIP:LOCAL:50 = -1
	TEQUIP:LOCAL:51 = -1
	TCVAR:LOCAL:100 = -1
	TCVAR:LOCAL:101 = -1
	;���o���\���p�t���O
	TCVAR:LOCAL:103 = -1
	TCVAR:LOCAL:105 = -1
	;�����򂨒��֘A
	TCVAR:TARGET:�����򂨒��g�p = 0
	;�ː������p������ϐ�
	CSTR:LOCAL:10 = /
	CSTR:LOCAL:11 = /
	IF LOCAL && CFLAG:LOCAL:���݈ʒu != OMANEKIBEYA()
		SIF ((CFLAG:MASTER:�A�Q���� - DAY * 1440) && (CFLAG:MASTER:�A�Q���� - DAY * 1440) < CFLAG:LOCAL:�A�Q����)
			CFLAG:LOCAL:���݈ʒu = CFLAG:LOCAL:�����ʒu
	ENDIF
	SIF IN_HOME(CFLAG:LOCAL:�����ʒu) != 1 & CFLAG:LOCAL:����
		CALL SET_SLEEP(0,LOCAL,0)
	RESET_STAIN LOCAL
NEXT

;EX�L�����������Ē�`

SIF CFLAG:MASTER:�����ʒu == 53
	STR:53 = %CALLNAME:MASTER%�̔[��
SIF FLAG:16
	STR:55 = %CALLNAME:(FLAG:16)%����
FLAG:�[�ˎ{�� = 0

CALL RESET_DISH
CALL CHANGE_TIMEZONE
;���Ԃ�MASTER�̋N���\�莞�����傫����Γ��t�{�P
IF TIME > TIME:3
	DAY ++
	DAY:3 ++
	TIME -= 1440
	CALL CHANGE_MONTH
	;����̎Q���Ҍ���
	SIF FLAG:3 && FLAG:����J�Ãt���O != 98 && FLAG:����J�Ãt���O != 99 && DAY >= FLAG:34
		CALL ENKAI_ENTRY
ENDIF

;�����̐g�̎����̐i�s
;=================================
FOR LOCAL,0,CHARANUM
	;�L�X�o����0�Ȃ�[�L�X���o��]���擾�i���ݒ�L�����ւ̑΍�Ǝv����j
	SIF EXP:LOCAL:27 == 0
		 TALENT:LOCAL:6 = 1
	;������s�݁i���ʂ�bit0��0�j��������[�c���^�c���ލs][�c�t]��[����]���擾�ł���Ύ�����ݒ肵�Ȃ�
	IF ((TALENT:LOCAL:150 || TALENT:LOCAL:151) && !TALENT:LOCAL:����) || !GETBIT(TALENT:LOCAL:����,0)
		CFLAG:LOCAL:900 = 0
		CONTINUE
	ENDIF
	;���������ݒ�̏ꍇ�����Ō���
	SIF (CFLAG:LOCAL:900 == 0 || CFLAG:LOCAL:900 > 11)
		CFLAG:LOCAL:900 = RAND:10
	;������1�i��
	CFLAG:LOCAL:900 += 1
	;�Ȃ�10�������i11�ȏ��1�̈ʂ����ɂ���j
	SIF CFLAG:LOCAL:900 > 10
		 CFLAG:LOCAL:900 %= 10
	SIF TALENT:LOCAL:�D�P > 0
	 	TALENT:LOCAL:�D�P += 1
NEXT
;=================================

CALL ���K�t���O

;EX�L�����x���f�[�g��΂����蔻��
CALL ��������

�����l = 0
�ǉ��������� = 0
;�z�c�Ɉ������荞�܂��
IF CFLAG:MASTER:���݈ʒu == OMANEKIBEYA()
	�����l = CFLAG:MASTER:������
ELSEIF PRIVATEROOM:(CFLAG:MASTER:�����ʒu % 100) && CFLAG:MASTER:���݈ʒu == CFLAG:MASTER:�����ʒu
	�����l = PRIVATEROOM:(CFLAG:MASTER:�����ʒu % 100)
ENDIF

IF TALENT:�����l:���� && INRANGE(TIME:3, CFLAG:�����l:�N������ - 180,CFLAG:�����l:�N������)
	�N���W�Q�m�� = 20
	SIF DAY:2 == 2
		�N���W�Q�m�� = 10
	SIF DAY:2 == 4
		�N���W�Q�m�� = 35
	IF �N���W�Q�m�� > RAND:100
		PRINTFORML %CALLNAME:MASTER%���̂��̂��ƕz�c���甇���o�悤�Ƃ���ƁA%CALLNAME:�����l%�ɕ��������ꂽ
		PRINTFORML ����������ƈꏏ�ɐQ�Ă������悤��
		PRINTFORMW ���傤���Ȃ��̂Ŕޏ����N����܂ŕz�c�ŉ߂������Ƃɂ����c�c
		EXP:�����l:����o�� += 5
		CALL COLORMESSAGE(@"����o���{5 �i%CALLNAME:�����l%�j",C_PINK,1)
		�ǉ��������� = CFLAG:�����l:�N������ - TIME:3
	ENDIF
ENDIF

;30�����ɐ_�Ђ̃L�������ړ�������
LOCAL = 1
WHILE LOCAL
	IF TIME + 30 < TIME:3 + �ǉ���������
		TIME:1 = TIME + 1440 * DAY
		TIME += 30
		CALL CHARA_MOVEMENT
	ELSE
		;�S�L�����̌��݈ʒu�ۑ�
		FOR LOCAL:1,0,CHARANUM
			CFLAG:(LOCAL:1):�O�^�[���ʒu = CFLAG:(LOCAL:1):���݈ʒu
		NEXT
		;���Ԃ�MASTER�̋N���\�莞����
		TIME =  TIME:3 + �ǉ���������
		TIME:1 = TIME + 1440 * DAY
		TFLAG:���Ȃ��N�� = TIME + 1440 * DAY
		CALL CHARA_MOVEMENT
		BREAK
	ENDIF
WEND

;�ڊo�ߋ��ʃ��b�Z�[�W�\��
CALL GOODMORNING

FOR LOCAL,1,CHARANUM
	;�����ʒu��99�œ���i53�͌Â��f�[�^�p�j
	SIF CFLAG:LOCAL:�����ʒu == 53 || CFLAG:LOCAL:�����ʒu == MAXROOM || CFLAG:LOCAL:�����ʒu == 0
		CFLAG:LOCAL:�����ʒu = SUKIMA()
	SIF CFLAG:LOCAL:�_�ЍݏZ
		CFLAG:LOCAL:�����ʒu = CFLAG:LOCAL:�_�ЍݏZ
	;���d�����`
	BASE:LOCAL:�d���� = MAXBASE:LOCAL:�d����
	;���������Ă����瑘���t���O������ʒu�ɂ���
	IF CFLAG:LOCAL:������
		[SKIPSTART]
		;�A���L�����̓��[�v���Ă��܂��̂ňꊇ�␳
		;������ǂ������Ӗ�����A�\���������Ō��FLAG:(590 + LOCAL) = CFLAG:LOCAL:����ʒu�����ł����C�����邯��
		SELECTCASE LOCAL
		;�v���Y�����o�[
		CASE 20, 21, 22
			FLAG:(590 + 20) = CFLAG:LOCAL:����ʒu
			FLAG:(590 + 21) = CFLAG:LOCAL:����ʒu
			FLAG:(590 + 22) = CFLAG:LOCAL:����ʒu
		;�H�o��
		CASE 77, 78
			FLAG:(590 + 77) = CFLAG:LOCAL:����ʒu
			FLAG:(590 + 78) = CFLAG:LOCAL:����ʒu
		;�@����
		CASE 81, 82
			FLAG:(590 + 81) = CFLAG:LOCAL:����ʒu
			FLAG:(590 + 82) = CFLAG:LOCAL:����ʒu
		;��\��o���i����͂Ȃ����ݒ肵�����p�j
		CASE 94, 95
			FLAG:(590 + 94) = CFLAG:LOCAL:����ʒu
			FLAG:(590 + 95) = CFLAG:LOCAL:����ʒu
		CASEELSE
			FLAG:(590 + LOCAL) = CFLAG:LOCAL:����ʒu
		ENDSELECT
		[SKIPEND]
		CFLAG:LOCAL:�����ʒu = CFLAG:LOCAL:����ʒu
		;MASTER�͊O�����Ă�����f�[�g�t���O�i�O�o�t���O�j�𗧂Ă�
		SIF CFLAG:MASTER:������
			CFLAG:MASTER:�f�[�g�� = CFLAG:LOCAL:����ʒu / 100
		;���̓��͘A���ł��Ȃ��悤��
		TCVAR:LOCAL:�A���֎~ = 1
	ENDIF
NEXT

;�V�X�e���ω��n�C�x���g
CALL SYS_EVENT

;�N�����Ԃ̋L�^
���Ȃ��̋N������ = 1440 * DAY + TIME

;�̗͋C�͂̉�
�������� = ���Ȃ��̋N������ - CFLAG:MASTER:�A�Q���� - �ǉ��������� / 2
PRINTL
IF FLAG:�C�⒆�f
	SIF CFLAG:MASTER:���݈ʒu != ENTRANCE
		CFLAG:MASTER:�f�[�g�� = FLAG:�C�⒆�f - 100
	FLAG:�C�⒆�f = 0
	�������� /= 5
	PRINTFORMW �ςȏꏊ�ŐQ�������Ŕw�����ɂ��c�c
ELSEIF CFLAG:MASTER:�O��
	�������� /= 2
	PRINTFORMW ��ӂ͂悭�Q���Ȃ������c�c
ELSE
	PRINTFORMW {�������� / 60}���ԐQ��
ENDIF
BASE:MASTER:�̗� += MAXBASE:MASTER:�̗� * �������� / 2 / (480 - 60 * TALENT:MASTER:�񕜑��x)
BASE:MASTER:�C�� += MAXBASE:MASTER:�C�� * �������� / (480 - 60 * TALENT:MASTER:�񕜑��x)
BASE:MASTER:���� += MAXBASE:MASTER:���� * �������� / (480 - 60 * TALENT:MASTER:�񕜑��x)
BASE:MASTER:�̗� = MIN(MAXBASE:MASTER:�̗�,BASE:MASTER:�̗�)
BASE:MASTER:�C�� = MIN(MAXBASE:MASTER:�C��,BASE:MASTER:�C��)
BASE:MASTER:���� = MIN(MAXBASE:MASTER:����,BASE:MASTER:����)
BASE:MASTER:�u�N = MIN(1000 * BASE:MASTER:�̗� / MAXBASE:MASTER:�̗�,1000)
DEBUGPRINTFORM �̗�{MAXBASE:MASTER:�̗� * �������� / 2 / (480 -120 * TALENT:MASTER:�񕜑��x)}��
CFLAG:MASTER:�O�� = 0

;�˗��̔����Ə���
CALL IRAI_HAPPEN
CALL IRAI_VANISH
CALL MEMO_IRAI_DEADLINE

IF FLAG:���݂����_��
	DRAWLINE
	PRINTFORML
	PRINTFORML ��������������������
	PRINTFORML �b�@�@�@�@�@�@�@�@�b
	PRINTFORML �b�@�@�f�G�ȁ@�@�@�b
	PRINTFORML �b�@�@���݂����@�@�b
	PRINTFORML �b�@�@�@�@�@�@�@�@�b
	PRINTFORML ��������������������
	PRINTFORMW
	CALL FORTUNE
	PRINTFORML
	DRAWLINE
ENDIF
IF FLAG:�R���N�V�����X�L�} != NOW_PERIOD()
	IF FLAG:�R���N�V�����X�L�} < NOW_PERIOD()
		�R���N�V�����X�L�}���萔 = 2
		�Տ����萔 = 1
	ELSE
		�R���N�V�����X�L�}���萔 = (FLAG:�R���N�V�����X�L�} - NOW_PERIOD()) * 2
		�Տ����萔 = FLAG:�R���N�V�����X�L�} - NOW_PERIOD()
	ENDIF
	ITEM:�R���N�V�����̃X�L�} = MIN(�R���N�V�����X�L�}���萔 + ITEM:�R���N�V�����̃X�L�}, 10)
	ITEM:�Տ� = MIN(�Տ����萔 + ITEM:�Տ�, 5)
	FLAG:�R���N�V�����X�L�} = NOW_PERIOD()
	PRINTL
	PRINTFORML ���R���N�V�����̃X�L�}��������[����Ă����i���݁F{ITEM:�R���N�V�����̃X�L�}}�j
	PRINTFORML ���Տ���������[����Ă����i���݁F{ITEM:�Տ�}�j
ENDIF
;����l�������߁i���������j�Ȃ�N�v�̂Ƃ肽��
;�O�����ē����܂�邱�Ƃ��ł��Ȃ��͂Ȃ�
SIF FLAG:�n�� && FLAG:�N�v && (TARGET == FLAG:�n�� || CFLAG:MASTER:���݈ʒu != OMANEKIBEYA())
	CALL NENGU_NOUMIN
CALL KODUCHI
CALL CHARA_MOVEMENT

;�N�����ɖ����ւ̃v���[���g������s��
;CALL GET_GIFT

;�����҂͒N��
IF ASSIPLAY == 0
	PLAYER = MASTER
ELSE
	PLAYER = ASSI
ENDIF
;--------------------------------------------
;��|��
FOR LOCAL,1,11
SIF CFLAG:LOCAL:335 > 0
	CFLAG:LOCAL:335 -= 1
NEXT
SIF CFLAG:MASTER:335 > 0
	CFLAG:MASTER:335 -= 1

FOR LOCAL, 0, CHARANUM
	;�ߑ��ݒ�
	;�s�����ɒ��镞��ݒ肵�Ă����ւ�����
	IF LOCAL == MASTER || !��������(LOCAL)
		CALL SELECT_CLOTHES(LOCAL, "�����̈ߑ�")
		CALL SELECT_CLOTHES(LOCAL, "�����̃p�W���}")
		CALL CTRL_CLOTHES_SET(LOCAL, "���݈ߑ��̕ύX_���i��")
		SETBIT CFLAG:LOCAL:���ւ����s, 0
	ELSE
		CALL SELECT_CLOTHES(LOCAL, "�����̈ߑ�")
		CALL SELECT_CLOTHES(LOCAL, "�����̃p�W���}")
		CALL CTRL_CLOTHES_SET(LOCAL, "���݈ߑ��̕ύX_�p�W���}")
		CFLAG:LOCAL:�p�W���} = 1
		SETBIT CFLAG:LOCAL:���ւ����s, 1
	ENDIF
	IF SPECIAL_OUTFIT(LOCAL)
		CALL CTRL_CLOTHES_SET(LOCAL, "���݈ߑ��̕ύX_�ߑ��Z�b�g", SPECIAL_OUTFIT(LOCAL))
		[IF_DEBUG]
		PRINTFORML %CALLNAME:LOCAL%�͂����ƈႤ���ɒ��ւ��܂���
		[ENDIF]
		TCVAR:LOCAL:�A�i�U�[���i�� = 1
	ENDIF
	CALL CLOTHES_SETTING_TRAIN(LOCAL)
NEXT

;��|�����Z�b�g
CVARSET CFLAG, GETNUM(CFLAG, "�������K"), 0
FLAG:560 = 0
FLAG:561 = 0
;----------------------------------------------

;----------------------------------------------
;FileName_BEFORETRAIN.ERB -------------------------- Rev1.00
;�ڊo�ߋ��ʃ��b�Z�[�W�\��
;CALL		USER
;ARG		VOID
;RETURN		VOID
;COMMENT
;-----------------------------------------------------------
@GOODMORNING
#DIM �N����
#DIM �N���ꏊ
#DIM ����ʒu����
#DIM  DYNAMIC CNT_BIRTHDAY
#DIMS DYNAMIC NAME_CHILD   , 10 * �L�����N�^����� + 1
#DIM  DYNAMIC AGE_CHILD    , 10 * �L�����N�^����� + 1
VARSET LOCAL
TARGET = 0
�N���� = 0
�N���ꏊ = 0

;MASTER�Ɠ����̃L������T��
FOR LOCAL,1,CHARANUM
	SIF CFLAG:MASTER:���݈ʒu == CFLAG:LOCAL:���݈ʒu
		;TARGET����
		TARGET = LOCAL
NEXT
;�^�[�Q�b�g������Ε\��
IF TARGET
	;IF CFLAG:TARGET:����
	IF ��������(TARGET)
		;������
		IF CFLAG:MASTER:�����ʒu == CFLAG:TARGET:�����ʒu
			PRINTFORMW %CALLNAME:MASTER%���ڊo�߂�Ɨׂł͂܂�%CALLNAME:TARGET%�����₷��Ɩ����Ă���
			PRINTFORMW %CALLNAME:MASTER%��%CALLNAME:TARGET%���N�����Ȃ��悤��\@ BEDROOM(CFLAG:MASTER:���݈ʒu) ? �z�c # ���̉� \@�𔲂��o������̏������n�߂�
			FOR LOCAL,0,CHARANUM
				CALL SET_TOGETHER(0,LOCAL,1)
			NEXT
			;MASTER�Ƃ̐ڐG�ʒu�����Z�b�g
			CALL TOUCH_SET(0,0,0,1)
			;�����������肪�Q�Ă�
			�N���� = 3
			;RETURN 1
		;�񓯐���(��������o�čs���̂ŁA�N������͖���
		ELSE
			PRINTFORMW %CALLNAME:MASTER%���ڊo�߂�Ɨׂ�%CALLNAME:TARGET%�������Ă���
			PRINTFORMW %CALLNAME:TARGET%�ɋC�t����Ȃ��悤��%CALLNAME:MASTER%�͂������ƕ����𔲂��������c
			FOR LOCAL,0,CHARANUM
				CALL SET_TOGETHER(0,LOCAL,1)
			NEXT
			;MASTER�Ƃ̐ڐG�ʒu�����Z�b�g
			CALL TOUCH_SET(0,0,0,1)
			;�E�э���OFF
			CALL SET_SNEAK(0,TARGET,2)
			;�C�^�Y��OFF
			CALL SET_PRANK(0,TARGET,2)
			;�ړ��\�ȏꏊ�ֈړ�
			CALL GETOUT(MASTER)
		ENDIF
	ELSE
		;������
		IF CFLAG:MASTER:�����ʒu == CFLAG:TARGET:�����ʒu
			PRINTFORMW %CALLNAME:MASTER%���ڊo�߂��%CALLNAME:TARGET%�Ɩڂ�������
			PRINTFORMW ���΂炭%CALLNAME:TARGET%�Ǝ��������킵�Ă���z�c�𔲂��o������̏������n�߂�
			FOR LOCAL,0,CHARANUM
				CALL SET_TOGETHER(0,LOCAL,1)
			NEXT
			;MASTER�Ƃ̐ڐG�ʒu�����Z�b�g
			CALL TOUCH_SET(0,0,0,1)
			;�����������肪�N���Ă�
			�N���� = 2
		;�񓯐���
		ELSE
			PRINTFORMW %CALLNAME:MASTER%���ڊo�߂��%CALLNAME:TARGET%�Ɩڂ�������
			;MASTAR�̎����ŋN������
			IF CFLAG:MASTER:���݈ʒu == CFLAG:MASTER:311
				PRINTFORMW �Ȃ�%CALLNAME:TARGET%�������ɂ���̂��낤�ƕs�R�Ɏv���Ȃ�����z�c�𔲂��o������̏������n�߂�
				FOR LOCAL,0,CHARANUM
					CALL SET_TOGETHER(0,LOCAL,1)
				NEXT
				;MASTER�Ƃ̐ڐG�ʒu�����Z�b�g
				CALL TOUCH_SET(0,0,0,1)
				�N���ꏊ = 1
			;TARGET�̎����ŋN�������i����t������̕����œY���Q��A�Q���݂̂̔�
			ELSEIF CFLAG:MASTER:���݈ʒu == CFLAG:TARGET:311
				PRINTFORMW �Â���%CALLNAME:TARGET%�ׂ̗𔲂��o������̏������n�߂�
				FOR LOCAL,0,CHARANUM
					CALL SET_TOGETHER(0,LOCAL,1)
				NEXT
				;MASTER�Ƃ̐ڐG�ʒu�����Z�b�g
				CALL TOUCH_SET(0,0,0,1)
				�N���ꏊ = 0
			;����ȊO(
			ELSE
				PRINTFORMW �Ȃ�%CALLNAME:TARGET%���ׂɂ���̂��낤�ƕs�R�Ɏv���Ȃ�������̉��𔲂��o������̏������n�߂�
			ENDIF
			;�E�э���OFF
			CALL SET_SNEAK(0,TARGET,2)
			;�C�^�Y��OFF
			CALL SET_PRANK(0,TARGET,2)
			;�񓯐������肪�N���Ă�
			�N���� = 1
		ENDIF
		;CALL KOJO_EVENT(6, TARGET, 1)
		;�Y���Q�ォ�ǂ���
		;�Y���Q�t���O�������Ȃ��̂ŁA�ʏ�N���̂�
		;IF CFLAG:MASTER:�Y���Q��
			;CALL KOJO_MESSAGE_SEND("EVENT",2,TARGET,2,0)
		;ELSE
		;ENDIF
	ENDIF
	SIF �N����
		CALL KOJO_MESSAGE_SEND("EVENT",2,TARGET,�N����,�N���ꏊ)
ENDIF
IF FLAG:�ُ�C��
	PRINTFORML ��C�ɂ͂����Ȃ�ʋC�z���Y���Ă���
ELSE
SELECTCASE TIME:5
	CASE 0,1
		PRINTL �����V�C���B
	CASE IS & 4
		PRINTL �J���~���Ă���B
	CASE IS & 8
		PRINTL �Ⴊ�~���Ă���B
ENDSELECT
ENDIF
IF FESTIVAL() != ""
	PRINTFORML ������%FESTIVAL()%���B
	CALL SEASONAL_MORNING
ENDIF
IF FLAG:�J�n�� - DAY <= 0 && FLAG:����J�Ãt���O
;�����
	PRINTFORM ������
	CALL ����\��\��
	PRINTL ������
	FLAG:32 = GET_JOBPLACE("����")
	IF TIME:3 >= FLAG:33
		FOR ����ʒu����,1,CHARANUM
			IF CFLAG:����ʒu����:����Q��
				CFLAG:����ʒu����:�E�� = FLAG:32
				CFLAG:����ʒu����:���݈ʒu = FLAG:32
			ENDIF
		NEXT
	ENDIF
ENDIF
IF CHILD_HAPPY_BIRTHDAY(CNT_BIRTHDAY, NAME_CHILD, AGE_CHILD)
	PRINTFORM ������
	FOR LOCAL, 1, CNT_BIRTHDAY + 1
		PRINTFORM %NAME_CHILD:LOCAL%�i��{AGE_CHILD:LOCAL}�ˁj
		SIF LOCAL == CNT_BIRTHDAY
			BREAK
		PRINTFORM  ��
	NEXT
	PRINTFORML  �̒a������
ENDIF
CALL CHARA_MOVEMENT
SIF CFLAG:MASTER:���Z�����Ď肪�����Ȃ�
	PRINTFORML �c�ǂ���玩�Ԃ������܂ܖ����Ă��܂����悤���c

CALL TODAYS_CHARISMA

;----------------------------------------------
@KODUCHI
;���Ƃ̑㏞
IF CFLAG:MASTER:���� > 0
	CFLAG:MASTER:���͉�� -= 1
	LOCAL = CFLAG:MASTER:���͉��
	IF CFLAG:MASTER:���� == 8
			PRINTFORMW �j���ۂ̐g�̂͌��ɖ߂��Ă���
		TALENT:71:�̌^ = -5
		IF CFLAG:71:�����ʒu == 54 || CFLAG:71:���݈ʒu == 9
			CFLAG:71:���݈ʒu = 54
			CFLAG:71:�����ʒu = 54
		ENDIF
	ELSEIF CFLAG:MASTER:���� == 4
		IF CFLAG:MASTER:���͉�� < 1
			TALENT:MASTER:�`�� = CFLAG:MASTER:382
		ELSE
			PRINTW ����Ȃɑ傫���������m���ߎS�Ȃ��ƂɂȂ��Ă���c
			TALENT:MASTER:�`�� = 2
		ENDIF
	ELSEIF CFLAG:MASTER:���� == 5
		IF CFLAG:MASTER:���͉�� < 1
			TALENT:MASTER:�`�� = CFLAG:MASTER:382
		ELSE
			PRINTW ��������Ƃ��c�c��{�Ɂc�ǂ��낶��Ȃ��Ȃ��Ă���
			TALENT:MASTER:183 = 0
			TALENT:MASTER:�`�� = 2
			BASE:MASTER:���� -= MAXBASE:MASTER:���� / 2
		ENDIF
	ELSEIF CFLAG:MASTER:���� == 6
		SIF CFLAG:MASTER:���͉�� == 2
			PRINTFORMW %CALLNAME:MASTER%�̐g�̂͌��ɖ߂��Ă���
		TALENT:MASTER:100 = FLAG:���̑̊i
		IF CFLAG:MASTER:�����ʒu == 54 || CFLAG:MASTER:���݈ʒu == 54
			CFLAG:MASTER:���݈ʒu = 9
			CFLAG:MASTER:�����ʒu = 9
		ENDIF
	ELSEIF CFLAG:MASTER:���� == 7
		;���̑傫���ɖ߂������Ȃ̂ŕω��Ȃ�
	ENDIF
	SIF CFLAG:MASTER:���͉�� <= 0
		CFLAG:MASTER:���� = 0
ENDIF
;----------------------------------------------


code:
;FileName_EVENTCOMEND.ERB -------------------------- Rev1.00
;�^�[���I���̏���
;CALL		SYSTEM
;ARG		VOID
;RETURN		VOID
;COMMENT
;-----------------------------------------------------------
@EVENTCOMEND
#DIM ��������
#DIMS �q���̖��O
;�d������̃G���[�`�F�b�N
;FOR LOCAL,0,CHARANUM
;	SIF CFLAG:LOCAL:326 == 0 && CFLAG:LOCAL:�s�� == 5
;		PRINTFORMW ### COM_END 326ERROR %CALLNAME:LOCAL% ### CHARA_NO:{LOCAL}
;	SIF CFLAG:LOCAL:���݈ʒu == 0
;		PRINTFORMW ### COM_END LOCATION ERROR %CALLNAME:LOCAL% �̌��݈ʒu���ُ�ł� ### CHARA_NO:{LOCAL}
;NEXT
;�^�[���I�����ʏ���
CALL TURN_RESET

SIF FLAG:����J�Ãt���O > 0
	CALL ENKAI_SINKOU

SIF TFLAG:102 < 2 && TARGET && SHIRAHU(TARGET)
	CALL �{�b�V���[�g
IF BASE:MASTER:���C >= MAXBASE:MASTER:���C
	;AT_HOME�݂邾���ł��ǂ���������Ȃ�
	IF !AT_HOME(MASTER) && GET_MAPID(CFLAG:MASTER:���݈ʒu) != MAIN_MAP
		CALL �f�[�g�I���^�C���A�b�v����
	ELSE
		PRINTFORMW ���E�܂ň��ݑ�����%CALLNAME:MASTER%�́A���̂܂܃o�b�^���Ɠ|��Ă��܂����c
	ENDIF
	GOTO OYASUMI
ENDIF
IF (BASE:MASTER:�̗� <= 500 && !TCVAR:TARGET:�D���ɂ���) || BASE:MASTER:�̗� <= 0
	PRINT �i�̗͂����E�ɗ��Ă��܂��j
	;�����|���ꒆ�Ȃ番��
	IF TFLAG:102 == 3 && BASE:MASTER:�̗� > 0 && !TCVAR:TARGET:�D���ɂ���
		PRINTL
		PRINTL [0]�D���ɂ��Ă��炤 [1]������Ă��炤
		INPUT
		IF !RESULT
			TCVAR:TARGET:�D���ɂ��� = 1
			BASE:MASTER:�̗� -= 250
			GOTO SUKINISITE
		ENDIF
	ENDIF
	PRINTW �@������I�����܂�
	IF BASE:MASTER:�̗� <= 0 && !CHK_DATENOW(CFLAG:MASTER:�f�[�g��)
		PRINTFORMW %CALLNAME:MASTER%�̗͑͂��g���ʂ����Ď��_���Ă��܂����c
		FLAG:�C�⒆�f = 100 + CFLAG:MASTER:���݈ʒu / 100
	ENDIF
	;�����|���ꒆ�Ȃ�TARGET�ɚn�s�o��
	IF TFLAG:102 == 3
		IF BASE:MASTER:�̗� <= 0
			EXP:�n�s���y�o�� += 10
			PRINTL
			PRINTFORMW �n�s���y�o�� +10(%CALLNAME%)
			PRINTL
		ELSE
			EXP:�n�s���y�o�� += 2
			PRINTL
			PRINTFORMW �n�s���y�o�� +2(%CALLNAME%)
			PRINTL
		ENDIF
	ENDIF
	$OYASUMI
	CALL SET_SLEEP(1,MASTER,0)
	CFLAG:MASTER:�A�Q���� = DAY * 1440 + TIME
	;�O���ł����ԂȂ炻�̂܂ܐQ��i����O��j
	IF CFLAG:MASTER:���݈ʒu == OMANEKIBEYA() && !TCVAR:(CFLAG:MASTER:������):�A���֎~
		IF CFLAG:(CFLAG:MASTER:������):�f�[�g��
			PRINTFORMW ������%CALLNAME:(CFLAG:MASTER:������)%�����߂Ă����悤��
			FLAG:�C�⒆�f = 0
		ENDIF
	ELSEIF TARGET > 0 && TALENT:TARGET:���� && BASE:TARGET:�̗� >= 500 && !CFLAG:TARGET:���� && !CFLAG:MASTER:�Y���Q�� && ((CFLAG:TARGET:���s && CHK_DATENOW(CFLAG:MASTER:�f�[�g��)) || !CHK_DATENOW(CFLAG:MASTER:�f�[�g��))
		IF CHK_DATENOW(CFLAG:MASTER:�f�[�g��)
			PRINTFORMW %CALLNAME:TARGET%�Ɏx�����%CALLNAME:MASTER%��%GET_MAPNAME(MAIN_MAP)%�܂Ŗ߂��Ă���
		ENDIF
		IF CFLAG:MASTER:���݈ʒu != CFLAG:MASTER:�����ʒu
			PRINTFORMW %CALLNAME:TARGET%��%CALLNAME:MASTER%�������ւƉ^��ł��ꂽ�c
			CFLAG:MASTER:���݈ʒu = CFLAG:MASTER:311
			CALL KOJO_MESSAGE_SEND("EVENT",3,TARGET,6,0)
		ELSE
			PRINTFORMW %CALLNAME:TARGET%��%CALLNAME:MASTER%��\@ INROOM(CFLAG:MASTER:���݈ʒu) == 2 ? �x�b�h # �z�c \@�ւƉ^��ł��ꂽ�c
		ENDIF
		CFLAG:MASTER:�f�[�g�� = MAIN_MAP
		FLAG:�C�⒆�f = 0
	ELSEIF CFLAG:MASTER:���݈ʒu == ���l�̒�����
		CFLAG:MASTER:���݈ʒu = ����
		PRINTFORMW ���̊Ԃɂ�%CALLNAME:MASTER%�͉����ɓ]�����Ă����c
	ELSEIF CHK_DATENOW(CFLAG:MASTER:�f�[�g��)
		PRINTFORMW %CALLNAME:MASTER%�͍Ō�̗͂�U��i���āA%GET_MAPNAME(MAIN_MAP)%�܂Ŗ߂��Ă���
		FLAG:�C�⒆�f = 100 + CFLAG:MASTER:���݈ʒu / 100
		CFLAG:MASTER:���݈ʒu = ENTRANCE
		PRINTFORMW
	ELSE
		PRINTFORMW %CALLNAME:MASTER%�͂ӂ�������ŁA�����ւƖ߂���
		CFLAG:MASTER:���݈ʒu = CFLAG:MASTER:311
		FLAG:�C�⒆�f = 0
	ENDIF
	FOR LOCAL,0,CHARANUM
		SIF CFLAG:LOCAL:�o��
			CONTINUE
		CALL ENDUFUFU(LOCAL)
		CALL SET_PRANK(0,LOCAL)
		CFLAG:LOCAL:�f�[�g�� = MAIN_MAP
		CFLAG:LOCAL:���s = 0
		FLAG:�f�[�g���� = 0
		TFLAG:�f�[�g�O�D���x = 0
		SIF !BATHCHECK(CFLAG:LOCAL:���݈ʒu) && TEQUIP:LOCAL:�����C��v���C
			TEQUIP:LOCAL:�����C��v���C = 0
	NEXT
;	���l�ϐ��������_�ȉ���؂�̂Ă���������p�������̂�������A���̕ϐ����g��Ȃ���������̂ق��������̂����H
	CFLAG:MASTER:�f�[�g�� = CFLAG:MASTER:���݈ʒu / 100
	TFLAG:106 = 0
	BEGIN AFTERTRAIN
ENDIF
IF TARGET && TFLAG:�L�X�}�[�N == TARGET && TFLAG:��� && !RAND:2
	PRINTFORMW %CALLNAME:MASTER%�̎�؂𕢂����̂ɋC�t����%CALLNAME:TARGET%�́A��т������؂�����
	TFLAG:��� = 0
	BASE:�{�� += 500
ENDIF
$SUKINISITE
IF TARGET && CFLAG:�s�@�� && !FLAG:70
	IF TALENT:TARGET:�x�� < 0
		PRINTFORMW %CALLNAME:TARGET%���������Ă��܂����c
		CALL KOJO_MESSAGE_SEND("EVENT",29,TARGET,2,0)
	ELSE
		PRINTFORMW %CALLNAME:TARGET%��{�点�Ă��܂����c
		CALL KOJO_MESSAGE_SEND("EVENT",29,TARGET,1,0)
	ENDIF

	IF !TCVAR:����� && FLAG:�����f�[�g���� != TARGET
		FOR LOCAL,0,CHARANUM
			CALL ENDUFUFU(LOCAL)
		NEXT
		TFLAG:106 = 0
	ENDIF
ENDIF

IF FLAG:70 == 1
	IF BASE:MASTER:TSP <= 0
		PRINTFORML (TSP���Ȃ��Ȃ�܂���)
		[SKIPSTART]
		FOR LOCAL,1,CHARANUM
			IF CFLAG:LOCAL:���݈ʒu == CFLAG:PLAYER:���݈ʒu
				FOR ��������,0,23
					SIF (!��������(LOCAL) && EQUIP:LOCAL:�������� != CFLAG:LOCAL:(200 + ��������)) || (��������(LOCAL) && EQUIP:LOCAL:�������� != CFLAG:LOCAL:(240 + ��������))
						LOCAL:1 ++
					SIF �������� == 6 && CFLAG:LOCAL:�m�[�p�� && ((!��������(LOCAL) && EQUIP:LOCAL:�������� != CFLAG:LOCAL:(200 + ��������)) || (��������(LOCAL) && EQUIP:LOCAL:�������� != CFLAG:LOCAL:(240 + ��������)))
						LOCAL:1 --
				NEXT
				IF LOCAL:1
					EQUIP:LOCAL:0 = 1
					IF CFLAG:LOCAL:���Ԓ�~�����ւ� == 1
						PRINTFORMW %CALLNAME:MASTER%��%CALLNAME:LOCAL%��\@ CFLAG:LOCAL:�m�[�p�� ? �p���c�ȊO�� #  \@���̊i�D�ɖ߂����I
						CFLAG:LOCAL:���Ԓ�~�����ւ� = 0
					ELSE
						PRINTFORMW %CALLNAME:MASTER%��%CALLNAME:LOCAL%��\@ CFLAG:LOCAL:�m�[�p�� ? �p���c�ȊO�� #  \@���𒅂���
					ENDIF
				ENDIF
			ENDIF
		NEXT
		[SKIPEND]
		IF CFLAG:MASTER:���݈ʒu != OMANEKIBEYA()
			PRINTFORMW %CALLNAME:MASTER%�͍Q�ĂĂ��̏�𗣂ꂽ
			TFLAG:�^�� = 0
			CALL FISHER_YATES_SHAFFLE(CHARANUM - 1)
			FOR LOCAL:10, 0, CHARANUM - 1
				LOCAL = SHAFFLE_ARRAY:(LOCAL:10) + 1
				SIF CFLAG:LOCAL:���݈ʒu != CFLAG:MASTER:���݈ʒu
					CONTINUE
				IF EX:LOCAL:�b�Ⓒ + EX:LOCAL:�u�Ⓒ + EX:LOCAL:�`�Ⓒ + EX:LOCAL:�a�Ⓒ + EX:LOCAL:�l�Ⓒ > 30
					PRINTFORMW �ˑR�������Ⓒ�ɏP��ꂽ%CALLNAME:LOCAL%�́A�Â��g���������Ă��̏�ɂւ��荞��ł��܂���
					CFLAG:LOCAL:333 += 20
				ELSEIF EX:LOCAL:�b�Ⓒ + EX:LOCAL:�u�Ⓒ + EX:LOCAL:�`�Ⓒ + EX:LOCAL:�a�Ⓒ + EX:LOCAL:�l�Ⓒ > 0
					PRINTFORMW %CALLNAME:LOCAL%�́A��̉����ɂт���Ɛg�������点��
				ELSEIF CFLAG:LOCAL:291 == 1
					PRINTFORMW �m��ʊԂɃp���c��E�����ꂽ%CALLNAME:LOCAL%�͗��������Ȃ�������
				ENDIF
				SIF EX:LOCAL:�����r���`�F�b�N == 1
					PRINTFORMW %CALLNAME:LOCAL%�͌ҊԂ̓ݒɂɊ�������߂Ă���c
			NEXT
			IF !AT_HOME(MASTER)
				PRINTFORML %GET_MAPNAME(MAIN_MAP)%�܂őS�͎������Ă��܂����c
				BASE:MASTER:�̗� -= TIME_REQUIRED(MAIN_MAP,CFLAG:MASTER:�f�[�g��) * 5
				BASE:MASTER:�C�� -= TIME_REQUIRED(MAIN_MAP,CFLAG:MASTER:�f�[�g��) * 5
				BASE:MASTER:�̗� = MAX(BASE:MASTER:�̗�,0)
				BASE:MASTER:�C�� = MAX(BASE:MASTER:�C��,0)
				TIME += TIME_REQUIRED(MAIN_MAP,CFLAG:MASTER:�f�[�g��) / 5
			ENDIF
			IF CFLAG:MASTER:���݈ʒu != CFLAG:MASTER:�����ʒu
				CFLAG:MASTER:���݈ʒu = CFLAG:MASTER:�����ʒu
			ELSE
				CFLAG:MASTER:���݈ʒu = ����
			ENDIF
			BASE:MASTER:TSP = 0
			CALL AFTER_AFFAIR
			FOR LOCAL,0,CHARANUM
				IF CFLAG:LOCAL:���ӂ� == 1 && LOCAL != 0
					;���ӂӏI������Ăяo��
					CALL KOJO_MESSAGE_SEND("EVENT",15,LOCAL,2,0)
				ENDIF
				CALL ENDUFUFU(LOCAL)
				CFLAG:LOCAL:�f�[�g�� = MAIN_MAP
			NEXT
			FLAG:�f�[�g���� = 0
			TFLAG:�f�[�g�O�D���x = 0
			TFLAG:106 = 0
		ELSE
			CALL FISHER_YATES_SHAFFLE(CHARANUM - 1)
			FOR LOCAL:10, 0, CHARANUM - 1
				LOCAL = SHAFFLE_ARRAY:(LOCAL:10) + 1
				IF CFLAG:LOCAL:���݈ʒu == CFLAG:MASTER:���݈ʒu
					IF EX:LOCAL:�b�Ⓒ + EX:LOCAL:�u�Ⓒ + EX:LOCAL:�`�Ⓒ + EX:LOCAL:�a�Ⓒ + EX:LOCAL:�l�Ⓒ > 30
						PRINTFORMW �ˑR�������Ⓒ�ɏP��ꂽ%CALLNAME:LOCAL%�́A�Â��g���������Ă��̏�ɂւ��荞��ł��܂���
						CFLAG:LOCAL:333 += 20
					ELSEIF EX:LOCAL:�b�Ⓒ + EX:LOCAL:�u�Ⓒ + EX:LOCAL:�`�Ⓒ + EX:LOCAL:�a�Ⓒ + EX:LOCAL:�l�Ⓒ > 0
						PRINTFORMW %CALLNAME:LOCAL%�́A��̉����ɂт���Ɛg�������点��
					ELSEIF CFLAG:LOCAL:291 == 1
						PRINTFORMW �m��ʊԂɃp���c��E�����ꂽ%CALLNAME:LOCAL%�͗��������Ȃ�������
					ENDIF
					SIF EX:LOCAL:�����r���`�F�b�N == 1
						PRINTFORMW %CALLNAME:LOCAL%�͌ҊԂ̓ݒɂɊ�������߂Ă���c
				ENDIF
				CALL ENDUFUFU(LOCAL)
			NEXT
			CFLAG:MASTER:���ӂ� = 0
		ENDIF
		FLAG:70 = 0
		RESETBGCOLOR
		BASE:MASTER:TSP = 0
	ENDIF
	SIF CFLAG:MASTER:���ӂ� && BASE:MASTER:�u�N <= 900 && BASE:MASTER:���� >= 500
		BASE:MASTER:�u�N += 10
ENDIF
IF TARGET && BASE:�̗� < 500
	IF FLAG:70 == 1 && CFLAG:MASTER:���݈ʒu != OMANEKIBEYA()
		IF !CFLAG:����
			PRINTFORML �i%CALLNAME:TARGET%�̗̑͂����E�ɗ��Ă��܂��j
			PRINTFORMW %CALLNAME:MASTER%�͂��̏�𗣂�āA���Ԓ�~����������
			CFLAG:���� = 360
			FLAG:70 = 0
			FLAG:�f�[�g���� = 0
			TFLAG:�f�[�g�O�D���x = 0
			RESETBGCOLOR
			IF AT_HOME(MASTER)
				CFLAG:MASTER:�f�[�g�� = MAIN_MAP
				IF CFLAG:MASTER:���݈ʒu != CFLAG:MASTER:�����ʒu
					CFLAG:MASTER:���݈ʒu = CFLAG:MASTER:�����ʒu
				ELSE
					CFLAG:MASTER:���݈ʒu = ����
				ENDIF
			ELSE
				IF STR:(6000 + CFLAG:MASTER:���݈ʒu + 10) == ""
					CFLAG:MASTER:���݈ʒu -= 10
				ELSE
					CFLAG:MASTER:���݈ʒu += 10
				ENDIF
			ENDIF
		ENDIF
		CALL CHARA_SLEEP, TARGET, 0
		FOR LOCAL,0,CHARANUM
			CALL ENDUFUFU(LOCAL)
			CALL SET_PRANK(0,LOCAL,1)
			SIF LOCAL
				CFLAG:LOCAL:�f�[�g�� = MAIN_MAP
			CFLAG:LOCAL:���s = 0
		NEXT
		FLAG:�f�[�g���� = 0
		TFLAG:�f�[�g�O�D���x = 0
		TFLAG:106 = 0
	ELSE
		IF !CFLAG:����
			PRINTFORMW �i%CALLNAME:TARGET%�̗̑͂����E�ɗ��Ă��܂��j
			CFLAG:���� = 360
			FLAG:70 = 0
			RESETBGCOLOR
		ENDIF
		CALL CHARA_SLEEP, TARGET, 0
		FOR LOCAL,0,CHARANUM
			CALL ENDUFUFU(LOCAL)
			CALL SET_PRANK(0,LOCAL,1)
			SIF LOCAL
				CFLAG:LOCAL:�f�[�g�� = MAIN_MAP
			CFLAG:LOCAL:���s = 0
		NEXT
		FLAG:�f�[�g���� = 0
		TFLAG:�f�[�g�O�D���x = 0
		TFLAG:106 = 0
	ENDIF
ENDIF

IF FLAG:�q���`��
	FOR LOCAL,1,CHARANUM
		SIF !TALENT:LOCAL:�玙��
			CONTINUE
		SIF CFLAG:LOCAL:���݈ʒu != CFLAG:MASTER:���݈ʒu
			CONTINUE
		�q���̖��O = %CHILDNAME:LOCAL:(TALENT:LOCAL:�玙��)%
		;�~���s���x�}���Ɨc�����̋󕠔���ƋN������
		IF TCVAR:LOCAL:�q���󕠓x != -1
			SIF TCVAR:LOCAL:�q���󕠃J�E���g
				TCVAR:LOCAL:�q���󕠓x += (TIME:0 - TCVAR:LOCAL:�q���󕠃J�E���g)
			TCVAR:LOCAL:�q���󕠃J�E���g = TIME:0
			SIF CFLAG:LOCAL:���܂��Ă�x > 300
			CFLAG:LOCAL:���܂��Ă�x = 300
		ELSEIF TCVAR:LOCAL:�q���󕠓x == -1 && TIME:0 - TCVAR:LOCAL:�q���󕠃J�E���g > 120 && !RAND:2 && !CFLAG:MASTER:���ӂ� && CFLAG:LOCAL:�o�Y�o�ߓ� < CHILD_��b
			PRINTFORMDL %�q���̖��O%�͖ڂ��o�܂���
			TCVAR:LOCAL:�q���󕠓x = 120
			TCVAR:LOCAL:�q���󕠃J�E���g = TIME:0
			SIF CFLAG:LOCAL:���܂��Ă�x > 300
			CFLAG:LOCAL:���܂��Ă�x = 300
		ENDIF
		;�ʊw
		IF GO_SCHOOL(LOCAL)
			IF !CHK_DATENOW(CFLAG:LOCAL:�f�[�g��) && INRANGE(TIME, 420, 540) && TCVAR:LOCAL:�q���󕠓x != -1 && !CFLAG:MASTER:���ӂ�
				PRINTFORMDL %�q���̖��O%�͎��q���Ɍ������܂���
				CALL KOJO_MESSAGE_SEND("EVENT", 0, LOCAL, 0, 0, "CHILD_RAISING_�o���Z")
				TCVAR:LOCAL:�q���󕠓x = -1
			;�E�t�t���A���Ă��Ȃ���C�̓ǂ߂�q��
			ELSEIF !CHK_DATENOW(CFLAG:LOCAL:�f�[�g��) && INRANGE(TIME, 840, 1020) && TCVAR:LOCAL:�q���󕠓x == -1 && !CFLAG:MASTER:���ӂ�
				PRINTFORMDL %�q���̖��O%�����q������A���Ă��܂���
				CALL KOJO_MESSAGE_SEND("EVENT", 0, LOCAL, 1, 0, "CHILD_RAISING_�o���Z")
				TCVAR:LOCAL:�q���󕠓x = 0
			ELSEIF INRANGE(TIME, 540, 840)
				TCVAR:LOCAL:�q���󕠓x = -1
			ELSEIF INRANGE(TIME, 1020, 1260)
				TCVAR:LOCAL:�q���󕠓x = 0
			ENDIF
		ENDIF
		;����ȍ~�͒ʊw/�������ɂ͔������Ȃ�
		SIF TCVAR:LOCAL:�q���󕠓x == -1
			CONTINUE
		;���ӂӂ����f����悤�ȃC�x���g�����ׂ����H
		SIF CFLAG:MASTER:���ӂ�
			CONTINUE
		;�ł��Q�Ă��肵�Ă���q�������������Ă̂��Ȃ�
		SIF !SHIRAHU(LOCAL)
			CONTINUE
		;�c����
		IF CFLAG:LOCAL:�o�Y�o�ߓ� < CHILD_��b
			IF BATHROOM(CFLAG:���݈ʒu) && !RAND:2
				CALL KOJO_MESSAGE_SEND("EVENT", 0, LOCAL, 0, 0, "CHILD_RAISING_BATH", "�c����")
			ELSEIF TIME:0 <= CFLAG:LOCAL:�A�Q���� && TCVAR:LOCAL:�q���󕠓x >= 120 && CFLAG:LOCAL:�o�Y�o�ߓ� < CHILD_����
					TCVAR:LOCAL:�q���󕠓x = 0
					EXP:LOCAL:�����o�� ++
					PRINTFORMDL %CALLNAME:LOCAL%��%�q���̖��O%�Ɏ��������Ă���
					CALL KOJO_MESSAGE_SEND("EVENT", 0, LOCAL, 0, 0, "CHILD_RAISING_�H��", "����")
			ELSEIF TIME:0 <= CFLAG:LOCAL:�A�Q���� && TCVAR:LOCAL:�q���󕠓x >= 120 && GROUPMATCH(SELECTCOM, 414, 415, 610, 615, 617)
					TCVAR:LOCAL:�q���󕠓x = 0
					PRINTFORMDL %CALLNAME:LOCAL%��%�q���̖��O%�ɗ����H��^���Ă���
					CALL KOJO_MESSAGE_SEND("EVENT", 0, LOCAL, 0, 0, "CHILD_RAISING_�H��", "�����H")
			ELSEIF TCVAR:LOCAL:�q���󕠓x < 120 && !RAND:6
				PRINTFORMDL %�q���̖��O%�͂��₷��Ɩ����Ă���c�c
				TCVAR:LOCAL:�q���󕠓x = -1
					CALL KOJO_MESSAGE_SEND("EVENT", 0, LOCAL, 0, 0, "CHILD_RAISING_SLEEPING", "�c����")
			ELSEIF CFLAG:LOCAL:�o�Y�o�ߓ� >= CHILD_�ߋ� && !RAND:5
				PRINTFORMDL %�q���̖��O%��%CALLNAME:MASTER%�̍�����ߋ�ŗV��ł���
				CALL KOJO_MESSAGE_SEND("EVENT", 0, LOCAL, 0, 0, "CHILD_RAISING_TOY", "�c����")
			ELSEIF !RAND:3
				CALL KOJO_MESSAGE_SEND("EVENT", 0, LOCAL, 0, 0, "CHILD_RAISING_OTHER", "�c����")
			ENDIF
		;�c����
		ELSEIF INRANGE(CFLAG:LOCAL:�o�Y�o�ߓ�, CHILD_��b, CHILD_�����O -1)
			IF �q���̐�������(LOCAL)
				PRINTFORMDW %�q���̖��O%�͐Q���ւƌ������Ă������c�c
				TCVAR:LOCAL:�q���󕠓x = -1
				CALL KOJO_MESSAGE_SEND("EVENT", 0, LOCAL, 0, 0, "CHILD_RAISING_SLEEPING", "�c����")
			ELSEIF BATHROOM(CFLAG:���݈ʒu) && !RAND:2
				CALL KOJO_MESSAGE_SEND("EVENT", 0, LOCAL, 0, 0, "CHILD_RAISING_BATH", "�c����")
			ELSEIF GROUPMATCH(SELECTCOM, 414, 415, 610, 615, 617)
				CALL KOJO_MESSAGE_SEND("EVENT", 0, LOCAL, 0, 0, "CHILD_RAISING_�H��", "�c����")
			ELSEIF !RAND:6
				PRINTFORMDL %�q���̖��O%��%CALLNAME:MASTER%�̍�����ߋ�ŗV��ł���
				CALL KOJO_MESSAGE_SEND("EVENT", 0, LOCAL, 0, 0, "CHILD_RAISING_TOY", "�c����")
			ELSEIF !RAND:3
				TCVAR:LOCAL:�q���󕠓x = 0
				CALL KOJO_MESSAGE_SEND("EVENT", 0, LOCAL, 0, 0, "CHILD_RAISING_OTHER", "�c����")
			ENDIF
		;�����O
		ELSE
			;�q���̎������łȂ���ΐQ��
			IF �q���̐�������(LOCAL) && CFLAG:LOCAL:�o�Y�o�ߓ� != CHILD_����
				PRINTFORMDW %�q���̖��O%�͐Q���ւƌ������Ă������c�c
				TCVAR:LOCAL:�q���󕠓x = -1
				CALL KOJO_MESSAGE_SEND("EVENT", 0, LOCAL, 0, 0, "CHILD_RAISING_SLEEPING", "�����O")
			ELSEIF BATHROOM(CFLAG:���݈ʒu) && !RAND:2
				CALL KOJO_MESSAGE_SEND("EVENT", 0, LOCAL, 0, 0, "CHILD_RAISING_BATH", "�����O")
			ELSEIF GROUPMATCH(SELECTCOM, 414, 415, 610, 615, 617)
				CALL KOJO_MESSAGE_SEND("EVENT", 0, LOCAL, 0, 0, "CHILD_RAISING_�H��", "�����O")
			ELSEIF CFLAG:LOCAL:���݈ʒu == CFLAG:LOCAL:�����ʒu && !RAND:8
				PRINTFORMDL %�q���̖��O%��%CALLNAME:MASTER%�ɍ���Ă�������؂̊ߋ���v���o�[�����ɒ��߂Ă���c�c
				CALL KOJO_MESSAGE_SEND("EVENT", 0, LOCAL, 0, 0, "CHILD_RAISING_TOY", "�����O")
			ELSEIF !RAND:5
				TCVAR:LOCAL:�q���󕠓x = 0
				CALL KOJO_MESSAGE_SEND("EVENT", 0, LOCAL, 0, 0, "CHILD_RAISING_OTHER", "�����O")
			ENDIF
		ENDIF
	NEXT
	RESETCOLOR
ENDIF

IF GET_EXISTMOB(MAIN_MAP)
	FOR LOCAL,MINROOM(),MAXROOM
		IF ROOMDATA:(LOCAL % 100) & �ꏊ_���u
			YOGORE:LOCAL += TIME_PROGRESS(TIME:1) * MOB_YOGORE(MAIN_MAP)
			SIF CFLAG:MASTER:���݈ʒu == LOCAL && AT_HOME(MASTER)
				TRYCALLFORM MOB_TURNENDEVENT_{MAIN_MAP}
		ENDIF
	NEXT
ENDIF
IF !FLAG:70 && TARGET
	IF TALENT:TARGET:������ && CFLAG:TARGET:900 == 7 && !TCVAR:TARGET:���� && PALAM:TARGET:�~�� >= PALAMLV:5
		PRINTFORML %CALLNAME:TARGET%�͖j����C�����A�����r���Ă���c
		PRINTFORML �댯���ɋɓx�ɋ�������%CALLNAME:TARGET%��[����]���Ă��܂����悤��
		TCVAR:TARGET:���� = 1
	ENDIF
ENDIF

FOR LOCAL,0, CHARANUM
	;IF !CFLAG:LOCAL:���ӂ�
		FOR LOCAL:2,101,109
			SIF TEQUIP:LOCAL:(LOCAL:2) != TEQUIP:LOCAL:(LOCAL:2 + 10)
				TEQUIP:LOCAL:(LOCAL:2) = 0
		NEXT
	;ENDIF
	SIF CFLAG:LOCAL:���݈ʒu == SUKIMA()
		CONTINUE
	;�ߑ��̒��ւ�������@SHOW_STATUS�Ɉړ�
	[SKIPSTART]
	LOCAL:1 = 0
	FOR ��������,0, 23
		SIF (!��������(LOCAL) && EQUIP:LOCAL:�������� != CFLAG:LOCAL:(200 + ��������)) || (��������(LOCAL) && EQUIP:LOCAL:�������� != CFLAG:LOCAL:(240 + ��������))
			LOCAL:1 ++
		SIF �������� == 6 && CFLAG:LOCAL:�m�[�p�� && ((!��������(LOCAL) && EQUIP:LOCAL:�������� != CFLAG:LOCAL:(200 + ��������)) || (��������(LOCAL) && EQUIP:LOCAL:�������� != CFLAG:LOCAL:(240 + ��������)))
			LOCAL:1 --
	NEXT
	IF !CFLAG:LOCAL:���ӂ� && CFLAG:LOCAL:���݈ʒu != BATHROOM(CFLAG:LOCAL:���݈ʒu) && LOCAL:1
		IF ��������(LOCAL)
			;�p�W���}�Z�b�g
			CALL CTRL_CLOTHES_SET(LOCAL, "���݈ߑ��̕ύX_�p�W���}")
			CFLAG:LOCAL:�p�W���} = 1
		ELSE
			;���i���Z�b�g
			CALL CTRL_CLOTHES_SET(LOCAL, "���݈ߑ��̕ύX_���i��")
			CFLAG:LOCAL:�p�W���} = 0
		ENDIF
		SIF !��������(LOCAL) && CFLAG:LOCAL:�������o
			CFLAG:LOCAL:�������o = 0
		CALL CLOTHES_SETTING_TRAIN(LOCAL)
	ENDIF
	[SKIPEND]
	;��������CLOTHES_SETTING_TRAIN�͂���đ��͂Ȃ��낤
		SIF !��������(LOCAL) && CFLAG:LOCAL:�������o
			CFLAG:LOCAL:�������o = 0
		CALL CLOTHES_SETTING_TRAIN(LOCAL)
NEXT
;�����I��WAIT���ǉ������̂�������邽�߂�TWAIT���d����
;����œ��͉񐔂��P�񌸂�
IF CFLAG:MASTER:���݈ʒu == 99
	SETCOLOR C_RED
	PRINTFORMW ### COM_END LOCATION ERROR! %CALLNAME:MASTER%�͑��݂��Ȃ��͂��̏ꏊ�ɂ���I ###
	PRINTW �����I�Ɉ�����I�����܂��B���O������ăX���Ƀo�O�񍐂����肢���܂��B
	RESETCOLOR
	CFLAG:MASTER:���݈ʒu = CFLAG:MASTER:311
	CALL SET_SLEEP(1,MASTER,0)
	TFLAG:106 = 0
	BEGIN AFTERTRAIN
ENDIF
	;CFLAG:MASTER:�A�Q���� = DAY * 1440 + TIME
SIF SELECTCOM == 400
	TWAIT 100,0

@ENKAI_SINKOU
;����̎Q���l�����Z�b�g
FLAG:35 = 0
FOR LOCAL,0,CHARANUM
	IF CFLAG:LOCAL:20 == 1 || CFLAG:LOCAL:20 == 2
		SIF CFLAG:LOCAL:���݈ʒu == FLAG:32
			FLAG:35 ++
	ENDIF
NEXT
;�V�C�������ƒ��~�ɂȂ鉃�������
IF FLAG:����J�Ãt���O > 0 && TIME:5 >= 4 && FLAG:36 > 0 && DAY >= FLAG:34 && TIME >= FLAG:33
	IF CFLAG:MASTER:���݈ʒu == FLAG:32
		PRINTL
		PRINTW �c�O�Ȃ���A�V�C���������߉���͒��~�ɂȂ�܂���
	ELSE
		PRINTL
		PRINTW �c�O�Ȃ���A���V��̂��߉���͒��~�ɂȂ����悤�ł�
	ENDIF
	CALL ENKAI_STOP
;����̓r���ō~��n�߂��ꍇ
ELSEIF FLAG:����J�Ãt���O >= 98 && TIME:5 >= 4 && FLAG:36 > 0
	IF CFLAG:MASTER:���݈ʒu == FLAG:32
		PRINTL
		PRINTW �c�O�Ȃ���A�V�C���������߉���͒��~�ɂȂ�܂���
	ELSE
		PRINTL
		PRINTW �c�O�Ȃ���A���V��̂��߉���͒��~�ɂȂ����悤�ł�
	ENDIF
	CALL ENKAI_STOP
;����J�n
ELSEIF FLAG:����J�Ãt���O > 0 && FLAG:����J�Ãt���O != 98 && FLAG:����J�Ãt���O != 99 && DAY >= FLAG:34 && TIME >= FLAG:33
	IF CFLAG:MASTER:���݈ʒu == FLAG:32
		IF FLAG:35 < 2
			PRINTL
			PRINTW �Â��ȕ��͋C�̒��A����n�܂�܂����c
			PRINTL
		ELSEIF FLAG:35 >= 8
			PRINTL
			PRINTW ���₩�ȕ��͋C�̒��A����n�܂�܂����c
			PRINTL
		ELSE
			PRINTL
			PRINTW �a�₩�ȕ��͋C�̒��A����n�܂�܂����c
			PRINTL
		ENDIF
		FLAG:����J�Ãt���O = 99
	ELSE
		FLAG:����J�Ãt���O = 98
	ENDIF
ELSEIF FLAG:����J�Ãt���O > 0 && FLAG:����J�Ãt���O != 99 && DAY >= FLAG:34 && TIME >= FLAG:33
	IF CFLAG:MASTER:���݈ʒu == FLAG:32
		PRINTL
		PRINTW ���ɉ���͎n�܂��Ă���悤�ł��c
		PRINTL
		FLAG:����J�Ãt���O = 99
	ENDIF
	;��Îґ��͂܂�������t���O�̂܂܂̂��߁A�t���O�𖳗����i�߂�
	FOR LOCAL,0,CHARANUM
		SIF CFLAG:LOCAL:20 == 2
			CALL ENKAI_WORK(LOCAL)
	NEXT
ENDIF


code:
@TURN_RESET
;�����r��
FOR LOCAL, 0, CHARANUM
	SIF !TCVAR:LOCAL:�j�Z
		CONTINUE
	IF TCVAR:LOCAL:�j�Z == 1
		IF TALENT:LOCAL:���� == 1
			TALENT:LOCAL:���� = 0
			EX:LOCAL:�����r���`�F�b�N = 1
		ENDIF
		IF LOCAL && (FLAG:���Ԓ�~ || TCVAR:LOCAL:�D�� || CFLAG:LOCAL:����)
			TALENT:LOCAL:���� = -1
			EX:LOCAL:�����r���`�F�b�N = 1
			CFLAG:LOCAL:292 = 1
		ENDIF
	ENDIF
	IF TCVAR:LOCAL:�j�Z == 2 && TALENT:LOCAL:���� == 2
		TALENT:LOCAL:���� = 0
		EX:LOCAL:�����r���`�F�b�N = 2
	ENDIF
	IF TCVAR:LOCAL:�j�Z == -1 && TALENT:LOCAL:���� == -1
		TALENT:LOCAL:���� = 0
		EX:LOCAL:�����r���`�F�b�N = 1
	ENDIF
NEXT

;����r��
IF TALENT:MASTER:2 & 2
	SELECTCASE SELECTCOM
		CASE 60, 61, 65, 67, 68, 320, 322
			TALENT:MASTER:1 |= 1
		CASE 62, 63, 66, 69, 70, 323
			TALENT:MASTER:1 |= 2
	ENDSELECT
ENDIF
IF TALENT:2 & 2
	SELECTCASE SELECTCOM
		CASE 64
			TALENT:1 |= 1
		CASE 92, 93, 94
			TALENT:1 |= 2
		CASE 71
			IF MASTER_POSE(SET_V, SET_P, 1)
				TALENT:1 |= 2
			ELSE
				TALENT:1 |= 1
			ENDIF
	ENDSELECT
ENDIF

;��������
IF FLAG:���Ԓ�~ == 0
	FOR LOCAL, 1, CHARANUM
		SIF CFLAG:LOCAL:���ӂ� && !TCVAR:LOCAL:���� && !TCVAR:LOCAL:�Z�� && !TCVAR:LOCAL:�D�� && !CFLAG:MASTER:�C�^�Y�� && !TCVAR:LOCAL:�����
			SETBIT CFLAG:LOCAL:�������� , 1
	NEXT
ENDIF
;�L�X����
;���ӎ擾
SIF (SELECTCOM == 312 || SELECTCOM == 602) && TFLAG:193 != 99 && !CFLAG:MASTER:�C�^�Y��
		SETBIT CFLAG:��������, 0

;��������
;���l�擾
IF SELECTCOM == 352 && TFLAG:193
	SETBIT CFLAG:��������, 2
	SETBIT CFLAG:MASTER:��������, 2
	TALENT:MASTER:���l = NO:TARGET
	TALENT:���l = NO:TARGET
	;�Z�t���폜
	IF TALENT:TARGET:�Z�t�� == 1
		TALENT:TARGET:�Z�t�� = 0
	ENDIF
ENDIF

;�H��
SIF SELECTCOM == 414 || SELECTCOM == 415
	CALL RESET_DISH

;����������1�^�[���ۑ�
FOR LOCAL, 0, CHARANUM
	SIF CFLAG:LOCAL:���݈ʒu == SUKIMA()
		CONTINUE
	TCVAR:LOCAL:110 = TCVAR:LOCAL:10
	TCVAR:LOCAL:112 = TCVAR:LOCAL:12

	SIF TCVAR:LOCAL:102
		TCVAR:LOCAL:102 --
	SIF !TCVAR:LOCAL:102
		TCVAR:LOCAL:103 = -1
	SIF TCVAR:LOCAL:104
		TCVAR:LOCAL:104 --
	SIF !TCVAR:LOCAL:104
		TCVAR:LOCAL:105 = -1
	;�̈ʂ̕ۑ�
	FOR LOCAL:1, 1, 11
		TEQUIP:LOCAL:(110 + LOCAL:1) = TEQUIP:LOCAL:(100 + LOCAL:1)
	NEXT
	;�̐�����
	IF TCVAR:LOCAL:�̐�����
		TCVAR:LOCAL:�̐����� --
		SIF TCVAR:LOCAL:�̐����� == 0
			TCVAR:LOCAL:�̐� = 0
	ENDIF
	;�ʒu�֌W����
	IF TCVAR:LOCAL:�ʒu�֌W����
		TCVAR:LOCAL:�ʒu�֌W���� --
		SIF TCVAR:LOCAL:�ʒu�֌W���� == 0
			TCVAR:LOCAL:�ʒu�֌W = 0
	ENDIF
	;���łɎː������p������ϐ��̏�����
	CSTR:LOCAL:10 = /
	CSTR:LOCAL:11 = /
	;�����t���O
	IF FLAG:���Ԓ�~ == 1
	ELSE
		CALL CLOTHES_SETTING_TRAIN(LOCAL)
	ENDIF
	IF BATHROOM(CFLAG:LOCAL:���݈ʒu) && GET_MAPID(CFLAG:LOCAL:���݈ʒu) == MAIN_MAP
		;���C�t���O��MOVEMENT���ʏ����ֈړ����܂���
;		CFLAG:LOCAL:���C = 0
		RESET_STAIN LOCAL
		CFLAG:LOCAL:�S���ː� = 0
		CFLAG:LOCAL:�A�i���ː� = 0
		CFLAG:LOCAL:���ɐ��t = 0
		CFLAG:LOCAL:��ɐ��t = 0
		CFLAG:LOCAL:��ɐ��t = 0
	ELSEIF CFLAG:LOCAL:���C > 120 && !CFLAG:LOCAL:���ӂ�
		STAIN:LOCAL:�` |= ����_�A�i��
	ENDIF
NEXT
;BASE�̕ϓ�
FOR LOCAL, 0, CHARANUM
	SIF CFLAG:LOCAL:���݈ʒu == SUKIMA()
		CONTINUE
	;�u�N�x
	;���Z��
	CFLAG:LOCAL:�u�N�x�Q = BASE:LOCAL:�u�N
	BASE:LOCAL:�u�N = MIN(MAXBASE:LOCAL:�u�N, BASE:LOCAL:�u�N)
	IF NOWEX:LOCAL:�ː�
		IF !MASTER_POSE(SET_V, SET_P) && !MASTER_POSE(SET_A, 1)
			BASE:LOCAL:�u�N = BASE:LOCAL:�u�N * (ABL:LOCAL:�~�] + 1) * (BASE:LOCAL:���� + 200) / ((MAXBASE:LOCAL:���� + 200) * (ABL:LOCAL:�~�] + 10))
		ELSE
			BASE:LOCAL:�u�N = 1000
		ENDIF
	ENDIF
NEXT

SIF CFLAG:MASTER:���ӂ�
	CALL ���ӂӒ�����C�x���g

;�t���O�̃��Z�b�g
TFLAG:193 = 0
TFLAG:194 = 0
TSTR:2 =

;TCVAR�̃��Z�b�g
FOR LOCAL,0,CHARANUM
	SIF CFLAG:LOCAL:���݈ʒu == SUKIMA()
		CONTINUE
	FOR LOCAL:1, 0, 100
		TCVAR:LOCAL:(LOCAL:1) = 0
	NEXT
;�}������
	TCVAR:LOCAL:100 = TEQUIP:LOCAL:50
	TCVAR:LOCAL:101 = TEQUIP:LOCAL:51
NEXT

TFLAG:110 = TCVAR:MASTER:��ꍇ��

;FIRSTTIME��SELECTCOM���Ԃ�����
CALLF FIRSTTIME(SELECTCOM)
FOR LOCAL, 1, CHARANUM
	SIF EXP_UP(15, LOCAL)
		CALLF FIRSTTIME("����", 0, LOCAL)
NEXT
;�ː��ӏ�
FOR LOCAL:1, 0, 60
	IF GETBIT(TFLAG:1, LOCAL:1)
		LOCALS = "�ː�"{LOCAL:1}
		CALLF FIRSTTIME(LOCALS, 0, TARGET)
	ENDIF
NEXT
PREVCOM = SELECTCOM
;�h���R�}���h�̗���
TFLAG:151 = TFLAG:50
;�O���TARGET
TFLAG:103 = TARGET
TFLAG:150 = ASSIPLAY

;�o���l��\���p
FOR LOCAL, 0, CHARANUM
	SIF CFLAG:LOCAL:�o��
		CONTINUE
	;���݈ʒu�̕ۑ�
	CFLAG:LOCAL:�O�^�[���ʒu = CFLAG:LOCAL:���݈ʒu
	FOR LOCAL:1, 0, 100
		TCVAR:LOCAL:(400 + LOCAL:1) = EXP:LOCAL:(LOCAL:1)
	NEXT
NEXT
IF BATHCHECK(CFLAG:MASTER:���݈ʒu) && !FLAG:���Ԓ�~ && AT_HOME(MASTER)
	FOR LOCAL,1,CHARANUM
		SIF ���C�ǂ��o������(LOCAL) && CFLAG:LOCAL:���݈ʒu == CFLAG:MASTER:���݈ʒu
			CALL ���C����ǂ��o��(LOCAL)
	NEXT
ENDIF
;TFLAG�̃��Z�b�g
VARSET TFLAG, 0, 0, 100
TFLAG:400 = 0
TFLAG:�ړ��s�\���b�Z�[�W = 0
;�����ƋC�͂��������Ă���
IF !CFLAG:MASTER:����
	IF NEMUKE() >= 960
		BASE:MASTER:�̗� = MAX(BASE:MASTER:�̗� - 5 * TIME_PROGRESS(TIME:1) , 0)
		BASE:MASTER:�C�� = MAX(BASE:MASTER:�C�� - 10 * TIME_PROGRESS(TIME:1) , 0)
	ELSEIF NEMUKE() >= 840
		BASE:MASTER:�C�� = MAX(BASE:MASTER:�C�� - 2 * TIME_PROGRESS(TIME:1) , 0)
	ENDIF
ENDIF

@���ӂӒ�����C�x���g
#DIM �D�哱���m��
;���Ȃ��哱
IF CFLAG:TARGET:���ӂ� == 1 && CFLAG:���܂��Ă�x > 300
;�U��t�]
	IF SHIRAHU(TARGET) && TEQUIP:TARGET:�̈� == 3
		;���C�ȂقǊm�������������������
		;1/�m��
		�D�哱���m�� = 15
		�D�哱���m�� -= TALENT:TARGET:�x�� * 2
		�D�哱���m�� -= TALENT:TARGET:���� * 2
		�D�哱���m�� -= TALENT:TARGET:�v���C�h * 2
		�D�哱���m�� += TALENT:TARGET:�����S * 3
		�D�哱���m�� -= TALENT:TARGET:���I���� * 3
		�D�哱���m�� += TALENT:TARGET:㵒p�S * 2
		�D�哱���m�� -= TALENT:TARGET:�T�h * 5
		�D�哱���m�� += TALENT:TARGET:�}�] * 5

		;RAND�ɓn���̂ōŒ�l��1
		SIF �D�哱���m�� < 1
			�D�哱���m�� = 1
		IF !RAND(�D�哱���m��)
			CFLAG:MASTER:���ӂ� = 2
			TFLAG:COMABLE�Ǘ� = 3
			FOR LOCAL,1,CHARANUM
				IF CFLAG:MASTER:���݈ʒu == CFLAG:LOCAL:���݈ʒu
					CFLAG:LOCAL:���ӂ� = 2
					LOCAL:1 ++
				ENDIF
			NEXT
			PRINTFORML �C���t���ƁA%CALLNAME:TARGET%\@ LOCAL:1 > 1 ? �B #  \@�Ɏ哱����D���Ă���
		ENDIF
	ENDIF
;����哱
ELSEIF CFLAG:TARGET:���ӂ� == 2
	IF BASE:�C�� <= 0
		PRINTFORML %CALLNAME:TARGET%�͂�����Ɣ�ꂽ�ƌ�����%CALLNAME:MASTER%���������
		CALL �����|����I��("��ꂽ")
	ELSEIF CFLAG:���܂��Ă�x <= 0 && !TCVAR:TARGET:�D���ɂ���
		PRINTFORML %CALLNAME:TARGET%�͖��������悤��
		CALL KIGEN_CHANGE(TARGET,100,1)
		BASE:�{�� = 0
		CFLAG:�s�@�� = 0
		CALL ASK_M("�����o��",1,"�������͂܂��������ĂȂ�",1,"�����ƍU�߂�",ABL:�T�h���C >= 3)
		SELECTCASE RESULT
			CASE 0
				PRINTFORML %CALLNAME:TARGET%��%CALLNAME:MASTER%���������
				CALL �����|����I��("����")
			CASE 1
				PRINTFORML %CALLNAME:MASTER%��%CALLNAME:TARGET%�������|����
				CALL KOJO_MESSAGE_SEND("EVENT",30,TARGET,3)
				FOR LOCAL,0,CHARANUM
					CFLAG:(TARGET:LOCAL):���ӂ� = 1
					IF INROOM(CFLAG:MASTER:���݈ʒu) == 2
						CALL DATUI_SHOES(LOCAL,0)
						CALL DATUI_SHOES(MASTER,0)
					ENDIF
				NEXT
			CASE 2
				PRINTFORML %CALLNAME:TARGET%�͖ڂ��ׂ߁A����Ȃ����܂ł��Ă�����ƚ�����
				CALL KOJO_MESSAGE_SEND("EVENT",30,TARGET,4)
				TCVAR:TARGET:�D���ɂ��� = 1
		ENDSELECT
	ELSEIF OAZUKE(TARGET)
		PRINTFORML ����������H�����%CALLNAME:TARGET%�͕s���������c
		SOURCE:���� += 3000
		SOURCE:���] += 500
		SOURCE:���� -= 1500
	ENDIF
ENDIF

@���C�ǂ��o������(ARG)
#FUNCTION
SIF FLAG:70
	RETURNF 0
SIF !GETBIT(TALENT:MASTER:2,1) && HETEROSEX(MASTER,ARG)
	RETURNF 0
SIF TALENT:ARG:㵒p�S < 0 && ABL:ARG:�e�� >= 5
	RETURNF 0
SIF CFLAG:ARG:�ԓx < 2
	RETURNF 1
SIF CFLAG:ARG:�������� < 1
	RETURNF 1
SIF !(TALENT:ARG:���� || TALENT:ARG:�Z�t��)
	RETURNF 1

RETURNF 0

@OAZUKE(ARG)
#FUNCTION
SELECTCASE TCVAR:ARG:20
	CASE 41
	;�����V
		SIF SELECTCOM != 320
			RETURNF 1
	CASE 43
	;�o�b�NV
		SIF SELECTCOM != 322
			RETURNF 1
	CASE 44
	;�o�b�NA
		SIF SELECTCOM != 323
			RETURNF 1
ENDSELECT
RETURNF 0


code:
@DAIRY_CONDITION_EV10
#DIM YOME
#DIM CHILDNUM
SIF !CFLAG:MASTER:�q���l��
	RETURN -1
SIF RAND:20 > 0
	RETURN -1
YOME = 0
CALL FISHER_YATES_SHAFFLE(CHARANUM - 1)
FOR LOCAL:10, 0, CHARANUM - 1
	LOCAL = SHAFFLE_ARRAY:(LOCAL:10) + 1
	IF CFLAG:LOCAL:�q���l�� - CFLAG:LOCAL:�玙�l�� > 0
		YOME = LOCAL
		CHILDNUM = RAND:(CFLAG:LOCAL:�q���l�� - CFLAG:LOCAL:�玙�l��) + 1
		BREAK
	ENDIF
NEXT
IF YOME
	CALL DAIRY_EV10(YOME, CHILDNUM)
	RETURN 1
ELSE
	RETURN -1
ENDIF

@DAIRY_EV10(ARG, ARG:1)
;PRINTFORMW %CALLNAME:ARG%�Ƃ̎q����%CHILDNAME:ARG:(ARG:1)%����莆������
PRINTFORMW %CHILDNAME:ARG:(ARG:1)%����莆������
LOCAL:1 = 0
FOR LOCAL,1,CHARANUM
	SIF CFLAG:LOCAL:�D���x > CFLAG:ARG:�D���x
		LOCAL:1 ++
NEXT

TARGET = ARG
;�����p�̎莆�C�x���g����i�Ȃ���Βʏ�C�x���g�j
IF !RAND:2
	TRYCCALLFORM M_KOJO_EVENT_K{ARG}_CHILD_DAIRY_����莆(ARG:1)
	CATCH
		GOTO TEGAMI
	ENDCATCH
ELSE
	$TEGAMI
	IF LOCAL:1 >= 3
		TRYCCALLFORM M_KOJO_EVENT_K{ARG}_CHILD_DAIRY_���ʎ莆(ARG:1, "�������܂�")
		CATCH
			PRINTFORMW ������%CALLNAME:ARG%��厖�ɂ���Ə����Ă������c�c
		ENDCATCH
	ELSEIF !RAND:5
		TRYCCALLFORM M_KOJO_EVENT_K{ARG}_CHILD_DAIRY_���ʎ莆(ARG:1, "���̖��S")
		CATCH
			PRINTFORMW ���̖��S���c�c
		ENDCATCH
		PRINTFORMW %CALLNAME:MASTER%��\@ MONEY > 30000? ��30000# �L����S��\@���邱�Ƃɂ���
		MONEY = MAX(MONEY - 30000,0)
	ELSE
		TRYCCALLFORM M_KOJO_EVENT_K{ARG}_CHILD_DAIRY_���ʎ莆(ARG:1, "�d����")
		CATCH
			PRINTFORMW %CALLNAME:ARG%��%CALLNAME:MASTER%���C�������t�Ǝd����\\10000�������Ă���
		ENDCATCH
		MONEY += 10000
	ENDIF
ENDIF
TARGET = TARGET:1
RETURN 1

path: 原版+前人整合等各种readme/パッチ/eraTW4590p_bugfix_m06/ERB/イベント関連/デイリーイベント/DAIRY_EV10 子供から手紙.ERB


code:
@DAIRY_CONDITION_EV12
VARSET LOCAL
IF RAND:15 > 0
	RETURN -1
ELSE
	CALL FISHER_YATES_SHAFFLE(CHARANUM - 1)
	FOR LOCAL:10, 0, CHARANUM - 1
		LOCAL = SHAFFLE_ARRAY:(LOCAL:10) + 1
		IF CFLAG:LOCAL:�M���x >= 100 && CFLAG:LOCAL:�_�ЍݏZ
			LOCAL:1 = LOCAL
			BREAK
		ENDIF
	NEXT
	IF !LOCAL:1
		RETURN -1
	ELSE
		CALL DAIRY_EV12(LOCAL:1)
		RETURN 1
	ENDIF
ENDIF

@DAIRY_EV12(ARG)
#DIM ����
#DIM �o���l
#DIM ��������
#DIM �{��
#DIM FEINT
#DIM �C�J�T�}
VARSET LOCAL
�C�J�T�} = 0
�������� = 2000 - (ABL:ARG:�퓬�\�� - ABL:MASTER:�퓬�\��) * 100
PRINTFORML %CALLNAME:ARG%����V�Z�̌P���ɕt�������ė~�����ƌ���ꂽ
SIF ABL:ARG:�퓬�\�� >= 4
		PRINTFORML ���肪����Ȃ̂ŁA�w�^������Α���䂷�邩������Ȃ��c�c
CALL ASK_YN("�t������","���_")
IF RESULT
	PRINTFORML %CALLNAME:ARG%�͎c�O������
ELSE
	���� = RAND:4
	�o���l = MAX(ABL:ARG:�퓬�\�� * 5, 5)
	SELECTCASE RAND:20
		CASE IS <= 11
		;���ʂ�
			LOCALS:0 = ��
			LOCALS:1 = �E
			LOCALS:2 = ��
			LOCALS:3 = ��
			�{�� = 100
		CASE 12 TO 15
		;���[�}��
			LOCALS:0 = UE
			LOCALS:1 = MIGI
			LOCALS:2 = HIDARI
			LOCALS:3 = SHITA
			�{�� = 160
		;�p��
		CASE 16,17,18
			LOCALS:0 = UP
			LOCALS:1 = RIGHT
			LOCALS:2 = LEFT
			LOCALS:3 = DOWN
			�{�� = 120
		;�X�y�C����
		CASE 19
			LOCALS:0 = encima de
			LOCALS:1 = a la derecha
			LOCALS:2 = a la izquierda
			LOCALS:3 = abajo de
			�{�� = 300
	ENDSELECT
	;�퓬�\�͂������ƃt�F�C���g�����Ă���
	IF ABL:ARG:�퓬�\�� > 3 && !RAND:3
		FEINT = 1
		�������� += 400
		�{�� += 80
	ELSE
		FEINT = 0
	ENDIF
	CALL FISHER_YATES_SHAFFLE(4)
	PRINTFORMW %CALLNAME:ARG%�̍U��������悤�i�N���b�N�ŊJ�n�j
	PRINTFORM %CALLNAME:ARG%��
	SETCOLOR C_YELLOW
	IF FEINT
		PRINTFORM %LOCALS:(RAND:4)%
		RESETCOLOR
		PRINTFORM �ƌ���������%LOCALS:(3 - ����)%
	ELSE
		PRINTFORM %LOCALS:(3 - ����)%
		RESETCOLOR
	ENDIF
	PRINTFORML ����̍U���I
	$LOOP_IKASAMA
	FOR LOCAL:10,0,4
		LOCAL = SHAFFLE_ARRAY:(LOCAL:10)
		PRINTFORML [{LOCAL}] - %LOCALS:LOCAL%�ɔ�����
	NEXT
	SIF !�C�J�T�} && BASE:MASTER:TSP > 500
		PRINTFORML [{4}] - ���Ԓ�~
	TINPUT ��������, -1, 1
	IF RESULT == ����
		PRINTFORML %CALLNAME:MASTER%�͍U������������I
		IF !�C�J�T�}
			PRINTFORMW �݂��ɂ����o���ɂȂ���
		ELSE
			PRINTFORMW �Y�������̂ł��܂���K�ɂȂ�Ȃ������c�c
		ENDIF
		�o���l = �o���l * �{�� / 100
		EXP:MASTER:�퓬�o�� += �o���l
		EXP:ARG:�퓬�o�� += �o���l * 2
		CFLAG:ARG:�D���x += �o���l * 2
		CFLAG:ARG:�M���x += �o���l * 2
		PRINTFORML �퓬�o�� �{{�o���l}�i%CALLNAME:MASTER%�j
		PRINTFORML �퓬�o�� �{{�o���l * 2}�i%CALLNAME:ARG%�j
		PRINTFORML �D���x �{{�o���l * 2}�i%CALLNAME:ARG%�j
		PRINTFORML �M���x �{{�o���l * 2}�i%CALLNAME:ARG%�j
	ELSEIF RESULT == 4 && !�C�J�T�} && BASE:MASTER:TSP > 500
		�C�J�T�} = 1
		�{�� /= 5
		PRINTFORMW %CALLNAME:MASTER%�͎��_��~�\�͂ōU�������ɂ߂��I
		GOTO LOOP_IKASAMA
	ELSE
		PRINTFORML �������˂��I
		PRINTFORM %CALLNAME:MASTER%��
		SELECTCASE ABL:ARG:�퓬�\��
			CASE IS <= 1
				PRINTFORM �������
			CASE 2,3
				PRINTFORM ���\
			CASEELSE
				PRINTFORM ���`���N�`��
		ENDSELECT
		PRINTFORMW �ɂ��v��������
		BASE:MASTER:�̗� -= 400 * (1 + ABL:ARG:�퓬�\��)
		PRINTFORML �퓬�o�� �{{�o���l}�i%CALLNAME:ARG%�j
		EXP:ARG:�퓬�o�� += �o���l
		CFLAG:ARG:�D���x += �o���l / 2
		CFLAG:ARG:�M���x += �o���l / 2
		PRINTFORML �D���x �{{�o���l}�i%CALLNAME:ARG%�j
		PRINTFORML �M���x �{{�o���l}�i%CALLNAME:ARG%�j
	ENDIF
ENDIF
PRINTW


code:
@DAIRY_CONDITION_EV13
#DIM �Ώ�

SIF RAND:(10 - TALENT:MASTER:���@�m)> 0
	RETURN -1
�Ώ� = 0
CALL FISHER_YATES_SHAFFLE(CHARANUM - 1)
FOR LOCAL:10, 0, CHARANUM - 1
	LOCAL = SHAFFLE_ARRAY:(LOCAL:10) + 1
	SIF !CFLAG:LOCAL:�_�ЍݏZ
		CONTINUE
	IF CFLAG:LOCAL:���܂��Ă�x >  700
		�Ώ� = LOCAL
		BREAK
	ENDIF
NEXT
SIF !�Ώ�
	RETURN -1

CALL DAIRY_EV13(�Ώ�)
RETURN 1

@DAIRY_EV13(ARG)
PRINTFORMW �钆�ɖڂ��o�߂Ă��܂���
PRINTFORMW �Q�Ȃ������Ǝv�������ǂ��ɂ��Q�t�������ɂȂ��c�c
CALL ASK_YN("�o����","�����ɂ���")
IF RESULT
	PRINTFORM %CALLNAME:MASTER%�͖����Ȃ�܂�
	PRINTDATA
		DATAFORM �R���N�V�����𐮗��E�ӏ܂��ĉ߂�����
		DATAFORM ����P��p���c�ɂ��Ďv����[�߂�
		DATAFORM �ǂ̃V�~�ƒk�΂���
	ENDDATA
	PRINTFORML �c�c
	CALL COLORMESSAGE("�S���L���ɂȂ�A�ꎞ�I�ɋC�͂�TSP��������Ƒ�����",C_YELLOW,2,1)
	CALL BUFF_BASE(MASTER,BASE_�C��,100)
	CALL BUFF_BASE(MASTER,BASE_TSP,100)
ELSEIF !RAND:4 || (!RAND:4 && ABL:ARG:�e�� >= 7)
	PRINTFORMW �K���ɕ����܂��A\@ CFLAG:MASTER:311 == CFLAG:ARG:311 ? �����܂Ŗ߂��Ă����Ƃ���A����畨������������# ���Ă��낻��߂낤���Ǝv�����Ƃ���A%CALLNAME:ARG%�̕������牽�����������̂Ŋ���Ă݂�\@
	CALL ONABARE(ARG)
	CFLAG:MASTER:�O�� = 1
ELSEIF ITEM:�e���u�J�^���v
		PRINTL ����A�J�^���̗l�q���c�H
		CALL ASK_YN("���o��","�����Ă���")
		IF !RESULT
			ITEM:�e���u�J�^���v --
			SETCOLOR COLOR ("YELLOW")
			PRINTFORMW �e���u�J�^���v�������I
			RESETCOLOR
			PRINTFORMW �K���ɕ����܂��A\@ CFLAG:MASTER:311 == CFLAG:ARG:311 ? �����܂Ŗ߂��Ă����Ƃ���A����畨������������# ���Ă��낻��߂낤���Ǝv�����Ƃ���A%CALLNAME:ARG%�̕������牽�����������̂Ŋ���Ă݂�\@
			CALL ONABARE(ARG)
			CFLAG:MASTER:�O�� = 1
		ELSEIF !RAND:2
			GOTO OYATU
		ELSE
			GOTO NANIMONAI
		ENDIF
ELSEIF !RAND:2
	$OYATU
	PRINTFORML �������󂢂��B����ɉ����H�ׂ��疰���Ȃ邩������Ȃ��B
	PRINTFORMW %CALLNAME:MASTER%�͑䏊�֍s���Č˒I������ƁA�|�����Ȃ�����������B
	PRINTFORMW %CALLNAME:MASTER%�̍w���������̂ł͂Ȃ��B�������N����%CALLNAME:MASTER%�̂��߂ɗp�ӂ��Ă��Ă��ꂽ�\�����̂Ă���Ȃ��B
	PRINTFORML
	CALL COLORMESSAGE("�޳�ֳ�ӳ��޼��з��ݶ޷����!��ڶ�Ը���ø�Ų���!",C_YELLOW,2,2)
	PRINTFORML
	PRINTFORML ��������������Ă���B���肪�����������Ƃɂ��悤�B
	CALL BUFF_BASE(MASTER,BASE_�C��,300)
	CALL COLORMESSAGE("�������������H�ׂĈꎞ�I�ɋC�͂�������",C_YELLOW,2,1)
	PRINTFORMW %CALLNAME:MASTER%�͎��𖁂������ċ@���悭����ɏA�����B
	CALL COLORMESSAGE(@"�Ȃ���%CALLNAME:ARG%�̋@���������Ȃ����c�c",C_RED,2,1)
	TALENT:ARG:�@�� = -1
ELSE
	$NANIMONAI
	PRINTFORMW �o�����Ă݂͂������ɖʔ������Ƃ��Ȃ��A��l�����Q�������Ƃɂ���
	CFLAG:MASTER:�A�Q���� += 60
	CALL COLORMESSAGE("�������Ԃ�1���Ԍ�����",C_YELLOW,2,1)
ENDIF

path: 原版+前人整合等各种readme/パッチ/eraTW4590p_bugfix_m06/ERB/イベント関連/デイリーイベント/DAIRY_EV13 自宅でオナバレ.ERB


code:
@DAIRY_CONDITION_EV2

IF !RAND:10 && TALENT:MASTER:120				;�������ɔ������������悤�@��Ƃ���30����1�ɂ��Ă邯�ǓK���ɕς��Ă�
	CALL DAIRY_EV2
	RETURN 1
ELSE
	RETURN -1
ENDIF

@DAIRY_EV2
#DIMS MAS_HOME
PRINTFORML �钆�A%CALLNAME:MASTER%�͍K���Ȋ��o�����Ėڂ��o�܂���
PRINTFORMW �Ȃ񂾂��ҊԂ��������c�c
PRINTFORML �I�I�I�I�@�������Ă��܂��Ă���I
PRINTFORMW �����ƗL�Ӌ`�Ȏ˂���������΂悩�����c�@%CALLNAME:MASTER%�͐[���������
FLAG:71 = 0
TALENT:MASTER:120 = 0
BASE:MASTER:���� -= 500
EXP:MASTER:�ː��o�� ++
CALL FISHER_YATES_SHAFFLE(CHARANUM)
LOCAL:1 = -1
MAS_HOME '= AREANAME_CHARA_HOME(MASTER)
FOR LOCAL, 0, CHARANUM
	;�Ώۂ����Ȃ�
	SIF SHAFFLE_ARRAY:LOCAL == MASTER
		CONTINUE
	;�łĂ��Ȃ�
	SIF CFLAG:(SHAFFLE_ARRAY:LOCAL):�o��
		CONTINUE
	;�������ĂȂ���
	;���肪�����ɂ����ǑO���̓}�V
	SIF AREANAME_CHARA_HOME(SHAFFLE_ARRAY:LOCAL) != MAS_HOME
		CONTINUE
	LOCAL:1 = SHAFFLE_ARRAY:LOCAL
	BREAK
NEXT
SIF LOCAL:1 <= 0
	RETURN

PRINTFORML %CALLNAME:MASTER%�������ŉ��������������Ă����%CALLNAME:(LOCAL:1)%�����ł����I
PRINTFORMW %CALLNAME:(LOCAL:1)%�͂���Ȃ��̑��̐��󕨂ƈꏏ�ɐ��Ȃ��łƍR�c����ƁA%CALLNAME:MASTER%�̎�Ɏ��܂����������ӂ񂾂���߂��Ă������c
JUEL:(LOCAL:1):11 += 1000
PRINTFORMW %CALLNAME:(LOCAL:1)%�@�~��̎�{1000
RETURN 1


code:
@DAIRY_CONDITION_EV22
#DIM YOME
#DIM CHILDNUM
SIF !TALENT:MASTER:�玙��
	RETURN -1
SIF RAND:5 > 0
	RETURN -1
YOME = 0
CALL FISHER_YATES_SHAFFLE(CHARANUM - 1)
FOR LOCAL:10, 0, CHARANUM - 1
	LOCAL = SHAFFLE_ARRAY:(LOCAL:10) + 1
	IF CHK_HAVE_CHILD(LOCAL,CHILD_�A�w,CHILD_����) > 0
		YOME = LOCAL
		CHILDNUM = CHK_HAVE_CHILD(LOCAL,CHILD_�A�w,CHILD_����)
		BREAK
	ENDIF
NEXT
IF YOME
	CALL DAIRY_EV22(YOME,CHILDNUM)
	RETURN 1
ELSE
	RETURN -1
ENDIF

@DAIRY_EV22(YOME,CHILDNUM)
#DIM YOME
#DIM CHILDNUM
#DIM �Ԏӗ�

PRINTFORM %CALLNAME:YOME%����A���q����%CHILDNAME:YOME:CHILDNUM%��

IF !RAND:4
	PRINTFORMW �悻�̎q�ɉ�����������Ɠ`����ꂽ�c�c
	PRINTFORML ���Ƃ����C���Ȃ������Ƃ��Ă��A��l�����%CHILDNAME:YOME:CHILDNUM%���͂�U�邦�Ηe�Ղ������Ă��܂����낤
	PRINTFORML �e�䂳��ɎӍ߂���������%CHILDNAME:YOME:CHILDNUM%�ɂ��悭�悭�����������Ȃ���΁c�c
	PRINTFORML %CALLNAME:MASTER%�͋C���d���Ȃ���
	PRINTFORML
	CALL KOJO_MESSAGE_SEND("EVENT", 0, YOME, CHILDNUM, 0, "CHILD_DAIRY_���q��", "���䂳����")
	�Ԏӗ� = MIN(10000,MONEY)
	MONEY -= �Ԏӗ�
	CALL COLORMESSAGE(@"����֎��Ô�Ƃ���{�Ԏӗ�}������",C_YELLOW,1,1)
	CALL COLORMESSAGE(@"%CALLNAME:MASTER%�̋C�͂��ꎞ�I�Ɍ�����",C_YELLOW,1,1)
	CALL BUFF_BASE(MASTER,BASE_�C��,-1000)
ELSE
	PRINTFORMW �J�߂�ꂽ�Ɠ`����ꂽ�c�c
	PRINTFORML �������͂����̎q���I
	PRINTFORML
	CALL KOJO_MESSAGE_SEND("EVENT", 0, YOME, CHILDNUM, 0, "CHILD_DAIRY_���q��", "�J�߂�ꂽ")
	CALL COLORMESSAGE(@"%CALLNAME:MASTER%�̋C�͂��ꎞ�I�ɑ�����",C_YELLOW,1,1)
	CALL BUFF_BASE(MASTER,BASE_�C��,1000)
ENDIF
PRINTW

path: 原版+前人整合等各种readme/パッチ/eraTW4590p_bugfix_m06/ERB/イベント関連/デイリーイベント/DAIRY_EV22 子供が寺子屋で.ERB


code:
@DAIRY_CONDITION_EV4

SIF RAND:7 > 0
	RETURN -1
CALL DAIRY_EV4
RETURN 1

@DAIRY_EV4
CALL FISHER_YATES_SHAFFLE(CHARANUM - 1)
FOR LOCAL:10, 0, CHARANUM - 1
	LOCAL = SHAFFLE_ARRAY:(LOCAL:10) + 1
	IF ABL:LOCAL:�e�� >= 5 && !CFLAG:LOCAL:�_�ЍݏZ
		PRINTFORMW �Ƃ�Ƃ߂��Ȃ��v�l�ɒ^���Ă���%CALLNAME:LOCAL%�́A���̊Ԃɂ�%CALLNAME:MASTER%�̂��Ƃ��l���Ă������ƂɋC�Â���
		PRINTFORMW %CALLNAME:LOCAL%�͖���%CALLNAME:MASTER%�ɉ�ɍs�����Ƃɂ����悤��
		CFLAG:LOCAL:�������K = 1
		BREAK
	ENDIF
NEXT


code:
@CHK_HININ_LOVE(ARG)
#FUNCTION
LOCAL = 0
SIF TALENT:ARG:���l
	LOCAL += 300
;����o��

LOCAL += EXP:ARG:����o�� / 2

;�D���x
SELECTCASE CFLAG:ARG:�D���x
CASE 0 TO 499
	LOCAL -= 100
CASE 500 TO 999
	LOCAL += 30
CASE 1000 TO 2999
	LOCAL += 50
CASEELSE
	LOCAL += CFLAG:ARG:�D���x / 30
ENDSELECT

LOCAL += ABL:ARG:�e�� * 20
LOCAL += ABL:ARG:�]�� * 7
LOCAL += ABL:ARG:��d���_ * 7

RETURNF LOCAL

@CHK_HININ_REASON(ARG,ARGS)
#FUNCTION
#DIM ��������l
VARSET LOCAL

LOCAL:3 += GETPALAMLV(PALAM:�~��,15) * (10 + TALENT:ARG:�������� * 3)
LOCAL:3 += GETPALAMLV(PALAM:����,15) * (10 - TALENT:ARG:�ԓx * 3)
LOCAL:3 += GETPALAMLV(PALAM:�D��,15) * 10

LOCAL:5 += ABL:ARG:�S�˒��� * 15
LOCAL:5 += ABL:ARG:�~�] * (10 + TALENT:ARG:�������� * 2)
LOCAL:5 += MARK:ARG:���y���� * 10
LOCAL:5 += MARK:ARG:�s������ * 10
LOCAL:5 += MARK:ARG:��ɍ��� * 10
LOCAL:5 -= MARK:ARG:�������� * 100

��������l = 800 - LOCAL:3 * LOCAL:5 / 300

SIF ESTRUS_CYCLE(ARG) == 150
	��������l += 1000

IF TCVAR:ARG:����
	��������l -= 200
ELSEIF TCVAR:ARG:�Z�� || TCVAR:ARG:�����
	��������l -= 50
ENDIF

IF TALENT:ARG:�c���f��
	IF TALENT:ARG:����
		��������l = ��������l * 2 / 3
	ELSE
		��������l = ��������l * 3 / 2
	ENDIF
ENDIF

;�M���x
IF CFLAG:ARG:�M���x < 100
	��������l *= 5
ELSEIF CFLAG:ARG:�M���x < 300
	��������l *= 5 / 2
ELSEIF CFLAG:ARG:�M���x < 500
	��������l *= 5 / 3
ELSEIF CFLAG:ARG:�M���x < 1000
	��������l *= 5 / 4
ENDIF

;�J�E���^�[���Ƃ����őf���������Ă���
IF ARGS == "COUNTER"
	SIF TALENT:ARG:��R
		��������l += 300
	IF TALENT:ARG:�v���C�h == -1
		��������l  = ��������l * 9 / 10
	ELSEIF TALENT:ARG:�v���C�h == 1
		��������l = ��������l * 6 / 5
	ENDIF
	SIF OTOKOGIRAI(ARG)
		��������l = ��������l * 3 / 2
	SIF TALENT:ARG:�呀 == 1
		��������l = ��������l * 6 / 5
	SIF TALENT:MASTER:��̖���
		��������l = ��������l * 9 / 10
	SIF TALENT:ARG:�|���I
		��������l = ��������l * 9 / 10
	IF TALENT:ARG:����z���Ȃ�
		SELECTCASE EXP:ARG:����o��
			CASE IS >= 500
				��������l = ��������l / 2
			CASE IS >= 300
				��������l = ��������l * 4 / 3
			CASE IS >= 100
				��������l = ��������l * 3 / 2
			CASEELSE
				��������l *= 2
		ENDSELECT
	ENDIF
	IF TALENT:ARG:�c���f��
		IF TALENT:ARG:����
			��������l = ��������l * 2 / 3
		ELSE
			��������l = ��������l * 3 / 2
		ENDIF
	ENDIF
ENDIF

��������l = MAX(��������l,0)
RETURNF ��������l

@OGAMITAOSHI(ARG)
#DIM ��������l
#DIM �D�ӕ\��
VARSET LOCAL

PRINTFORMW %CALLNAME:ARG%�̋���
PRINTFORM %CALLNAME:MASTER%�ւ̍D��

�D�ӕ\�� = MAX(CHK_HININ_LOVE(ARG) / 100,0)
SETCOLOR 255,0,0
PRINTFORM %UNICODE(0x2665) * MAX((�D�ӕ\�� / 10000 -1),0)%
RESETCOLOR
SETCOLOR 255,51,153
SIF �D�ӕ\�� >=10000
	PRINTFORM %UNICODE(0x2665) * (9999)%%UNICODE(0x2665)%

PRINTFORM %UNICODE(0x2665) * (�D�ӕ\�� % 10000)%
RESETCOLOR
SIF CHK_HININ_LOVE(ARG) % 100 > 50
	PRINTFORML %UNICODE(0x2665)%
PRINTL
WAIT
��������l = CHK_HININ_REASON(ARG)

CALL SHOW_REASONWALL(��������l)
IF TALENT:MASTER:��̖���
	CALL COLORMESSAGE(@"%CALLNAME:ARG%�́A%CALLNAME:MASTER%�̓�̖��͂ɗ�����������̂��������c�c",C_PINK,1,1)
	��������l = ��������l * 9 / 10
	CALL SHOW_REASONWALL(��������l)
ENDIF
IF TALENT:ARG:�v���C�h == -1
	��������l  = ��������l * 9 / 10
ELSEIF TALENT:ARG:�v���C�h == 1
	��������l = ��������l * 6 / 5
	CALL COLORMESSAGE(@"�C�ʂ̍���%CALLNAME:ARG%�́A�����������肷��悤�Ȑ^���͂��܂��Ǝv���Ă���",C_PINK,1,1)
	CALL SHOW_REASONWALL(��������l)
ENDIF
IF TALENT:ARG:�呀 == 1
	��������l = ��������l * 6 / 5
	CALL COLORMESSAGE(@"�呀�ϔO�̋���%CALLNAME:ARG%�́A�����܂ŋ����Ă������̂��Ǝv���������c�c",C_PINK,1,1)
	CALL SHOW_REASONWALL(��������l)
ENDIF
IF OTOKOGIRAI(ARG)
	��������l = ��������l * 3 / 2
	IF TALENT:ARG:���ʚn�D == 3
		CALL COLORMESSAGE(@"%CALLNAME:ARG%�͑��҈�ʂɑ΂��Ċ�������������Ă���c�c",C_PINK,1,1)
	ELSEIF TALENT:ARG:���ʚn�D == 3
		CALL COLORMESSAGE(@"%CALLNAME:ARG%�͒j����ʂɑ΂��Ċ�������������Ă���c�c",C_PINK,1,1)
	ENDIF
	CALL SHOW_REASONWALL(��������l)
ENDIF
IF TALENT:ARG:�|���I
	CALL COLORMESSAGE(@"%CALLNAME:ARG%�́A���ł̐����ɓ|���I�Ȗ��͂������Ă���c�c",C_PINK,1,1)
	��������l = ��������l * 9 / 10
	CALL SHOW_REASONWALL(��������l)
ENDIF
IF TALENT:ARG:����z���Ȃ�
	SELECTCASE EXP:ARG:����o��
		CASE IS >= 500
			CALL COLORMESSAGE(@"%CALLNAME:ARG%�́A%CALLNAME:MASTER%�ɂ͂����������������Ă��܂������c�c�I",C_PINK,1,1)
			��������l = ��������l / 2
		CASE IS >= 300
			CALL COLORMESSAGE(@"%CALLNAME:ARG%�́A%CALLNAME:MASTER%����Ƃ����ǂ܂��킸���ɒ�R������悤���c�c",C_PINK,1,1)
			��������l = ��������l * 6 / 5
		CASE IS >= 100
			CALL COLORMESSAGE(@"%CALLNAME:ARG%�́A�e��������ł�������x�̋����͂Ƃ��Ă��������c�c",C_PINK,1,1)
			��������l = ��������l * 3 / 2
		CASEELSE
			CALL COLORMESSAGE(@"%CALLNAME:ARG%�́A���҂������܂Ŏ󂯓��ꂽ���Ƃ͖]��ł��Ȃ��c�c",C_PINK,1,1)
			��������l *= 2
	ENDSELECT
	CALL SHOW_REASONWALL(��������l)
ENDIF
IF TALENT:ARG:�c���f��
	IF TALENT:ARG:����
		��������l = ��������l * 2 / 3
		CALL COLORMESSAGE(@"%CALLNAME:ARG%�̓f�����I",C_PINK,1,1)
	ELSE
		��������l = ��������l * 3 / 2
		CALL COLORMESSAGE(@"%CALLNAME:ARG%�͔�����������c�c",C_PINK,1,1)
	ENDIF
	CALL SHOW_REASONWALL(��������l)
ENDIF
WAIT
IF CHK_HININ_LOVE(ARG) > ��������l
	IF ESTRUS_CYCLE(ARG) != 150
		PRINTFORMW %CALLNAME:MASTER%�̒p���O�����Ȃ�����ɁA%CALLNAME:ARG%���Ƃ��Ƃ��܂�Ă��ꂽ
		CFLAG:ARG:������ = 1
		CALL KOJO_MESSAGE_SEND("EVENT",18,TARGET,4,0)
		PRINTW �댯���ȊO�ł͔�D�Ȃ��ŃZ�b�N�X���Ă������ƂɂȂ����I
	ELSE
		PRINTFORMW %CALLNAME:ARG%�̎q�����~�����A�Ɠ`����ƁA%CALLNAME:ARG%�͊��Ԃ�߂�������
		CFLAG:ARG:������ = 2
		CALL KOJO_MESSAGE_SEND("EVENT",18,TARGET,5,0)
		PRINTFORMW %CALLNAME:ARG%����q���̍��ӂ𓾂��I
	ENDIF
ELSE
	PRINTFORML	%CALLNAME:ARG%�͂����ƒf����
	CALL KOJO_MESSAGE_SEND("EVENT",18,TARGET,2,0)
	PRINTL [0]����̈ӎu�𑸏d����
	PRINTL [1]�����ЂƉ���
	$INPUT2_LOOP
	INPUT
	IF RESULT == 0
		TFLAG:16 =2
		TFLAG:17 = TARGET
	ELSEIF RESULT == 1
	;���̂��܂��Ƒ��莟��ł͔S��΂ǂ��ɂ��Ȃ�
		LOCAL = (4 - TALENT:ARG:���� - TALENT:ARG:�x�� - TALENT:ARG:�ԓx) * (ABL:MASTER:�b�p�Z�\ + 3 * CFLAG:ARG:�_���o��)
		LOCAL:2 = ��������l * (100 - LOCAL) / 100
		CALL SHOW_REASONWALL(LOCAL:2)
		IF CHK_HININ_LOVE(ARG) > LOCAL:2
			PRINTFORMW %CALLNAME:MASTER%�͐��O���łǂ��ɂ�%CALLNAME:ARG%���ۂߍ���
			IF ESTRUS_CYCLE(ARG) != 150
				CFLAG:ARG:������ = 1
				CALL KOJO_MESSAGE_SEND("EVENT",18,TARGET,4,0)
				PRINTW �댯���ȊO�ł͔�D�Ȃ��ŃZ�b�N�X���Ă������ƂɂȂ����I
			ELSE
				CFLAG:ARG:������ = 2
				CALL KOJO_MESSAGE_SEND("EVENT",18,TARGET,5,0)
				PRINTFORMW %CALLNAME:ARG%����q���̍��ӂ𓾂��I
			ENDIF
		ELSE
			CALL KOJO_MESSAGE_SEND("EVENT",18,TARGET,3,0)
			PRINTFORMW %CALLNAME:ARG%�Ɏv��������{��ꂽ�c
			CFLAG:ARG:�_���o�� += 1
			CALL ENDUFUFU(ARG)
			CALL GET_ANGRY(ARG)
			MARK:ARG:�������� = MIN(MARK:ARG:�������� + 1, 3)
			TFLAG:106 = 0
			TFLAG:16 = 2
		ENDIF
	ELSE
		GOTO INPUT2_LOOP
	ENDIF
ENDIF

@SHOW_REASONWALL(��������l)
#DIM ��������l

PRINTFORM �����̕�
SETCOLOR 255,255,0
LOCAL = MAX(��������l / 100,1)
PRINTFORM %"��" * LOCAL%
RESETCOLOR
SIF ��������l % 100 > 50
	PRINTL ��
PRINTL


code:
@ENKAI_SETTING
;------------------------------------------------------------------------------------------------------
;����̊J�Ô���
;------------------------------------------------------------------------------------------------------
;1�^�[���ň��ގ��̗ʂ͌o�ߎ��� * 10 �ʏ��30���Ȃ̂�300�A����K��1200�Ȃ�2���Ԓ��x�̉���ƂȂ�
;��Î҂͉���̏����ƕЂÂ��̎d�������Ȃ���΂Ȃ�Ȃ�
;����ɕ����̉�����J����d�l�ł͂Ȃ��̂Œ��Ӂi�l�����U��������Ď₵�����c�j
;------------------------------------------------------------------------------------------------------
PRINTL

;PRINTFORMW ����J�Ãt���O = {FLAG:����J�Ãt���O}

;�J�Ô���͉���t���O�������Ă��Ȃ���Ԃł����s���Ȃ��i�o�O�h�~�j
IF FLAG:����J�Ãt���O == 0
	;���C����Î҂��o�ւɂȂ��Ă���Ȃ�J�Â���Ȃ�
	;�����ʂ�98�ȏ�ɂ͐ݒ肵�Ȃ�����
	;2 ���z���N�Y���@���C����ÎҁF�Ȃ��@��A���̈�T�ԑO�ɂP�O�O����������
	IF DAY:2 == 4 && DAY:3 >= 25 && DAY:3 <= 30
		;���
		LOCALS = ���z���ΖY���
		;������
		FLAG:����J�Ãt���O = 2
		;����K��
		FLAG:31 = 6000
		;������
		FLAG:32 = 9
		;�J�n����
		FLAG:33 = 900
		;�J�n��
		FLAG:34 = 31 - DAY:3
		;���݂̎Q���l�������Z�b�g
		FLAG:35 = 0
		;�J�V���~
		FLAG:36 = 0
		PRINTL
		PRINTFORMW �Y�N��̃V�[�Y��������Ă���
	;������
	ELSEIF DAY:2 == 3 && DAY:3 >= 1 && DAY:3 < 15
		;���
		LOCALS = ������
		;������
		FLAG:����J�Ãt���O = 3
		;����K��
		FLAG:31 = 2000 + RAND:1000
		;���
		FLAG:32 = 409
		;�J�n����
		FLAG:33 = 1140
		;�J�n��
		FLAG:34 = 15 - DAY:3
		;���݂̎Q���l�������Z�b�g
		FLAG:35 = 0
		;�J�V���~
		FLAG:36 = 1
		PRINTL
		IF MAIN_MAP == 4
			PRINTFORMW �i�Ԃ��猎�����ɗU��ꂽ
		ELSE
			PRINTFORMW �i�������猎�����ɏ��҂��ꂽ
		ENDIF
	;���n��
	ELSEIF DAY:2 == 3 && DAY:3 >= 16 && DAY:3 < 27
		;������
		FLAG:����J�Ãt���O = 4
		;����K��
		FLAG:31 = 2000 + RAND:3000
		;���
		FLAG:32 = 202
		;�J�n����
		FLAG:33 = 540
		;�J�n��
		FLAG:34 = 27 - DAY:3
		;���݂̎Q���l�������Z�b�g
		FLAG:35 = 0
		;�J�V���~
		FLAG:36 = 0
		PRINTL
		PRINTFORMW ���N�����n�Ղ̋G�߂�����Ă���
	; ���~���A�̋C����ȃp�[�e�B�@���C����ÎҁF���~���A�@����g���ف@�y�j���ɂT�O���ŊJ�×\���A���{���͓��j��
	ELSEIF CFLAG:16:�o�� == 0 && DAY%7 == 6 && MAIN_MAP == 3 && RAND:50 <= 49
		;���
		LOCALS = ���~���A�̋C����ȃp�[�e�B
		;������
		FLAG:����J�Ãt���O = 6
		;����K��
		FLAG:31 = 1500 + RAND:2500
		;������
		FLAG:32 = 324
		;�J�n����
		FLAG:33 = 1140
		;�J�n��
		FLAG:34 = 1
		;���݂̎Q���l�������Z�b�g
		FLAG:35 = 0
		;�J�V���~
		FLAG:36 = 1
		PRINTL
		PRINTFORMW %CALLNAME:16%�̓p�[�e�B���������Ȃ����悤��
	;SAMPLE �얲�̋C����𐷂�@���C����ÎҁF�얲�@�y�j���ɂT�O���ŊJ�×\���A���{���͓��j��
	ELSEIF CFLAG:1:�o�� == 0 && DAY%7 == 6 && RAND:100 <= 49
		;���
		LOCALS = �얲�̋C����𐷂�
		;������
		FLAG:����J�Ãt���O = 1
		;����K��
		FLAG:31 = 1000 + RAND:1500
		;������
		IF RAND:5 <= 3
			FLAG:32 = 11
		ELSEIF RAND:4 == 0
			FLAG:32 = 2
		ELSEIF RAND:4 == 0
			FLAG:32 = 20
		ELSEIF RAND:4 == 0
			FLAG:32 = 21
		ELSE
			FLAG:32 = 218
		ENDIF
		;�J�n����
		FLAG:33 = 1360 - (FLAG:31 / 10)
		;�J�n��
		FLAG:34 = 1
		;���݂̎Q���l�������Z�b�g
		FLAG:35 = 0
		;�J�V���~
		FLAG:36 = 1
		PRINTL
		PRINTFORMW %CALLNAME:1%�͉�������Ȃ����悤��
;	ELSEIF DAY:3 >= 8 && DAY:3 <= 10
;		;���
;		LOCALS = ��ʂ��ǌo���C�u
;		;������
;		FLAG:����J�Ãt���O = 5
;		;����K��
;		FLAG:31 = 2000 + RAND:30 * 40
;		;������
;		FLAG:32 = 104
;		;�J�n����
;		FLAG:33 = 1440 + 240 - (FLAG:31 /10) ;���S���܂ŉ����
;		;�J�n��
;		FLAG:34 = 10 - DAY:3
;		;���݂̎Q���l�������Z�b�g
;		FLAG:35 = 0
;		;�J�V���~
;		FLAG:36 = 0
;		PRINTL
;		PRINTFORMW ��ʂ��ǌo���C�u�̎������߂Â��Ă���
	ENDIF
ENDIF
CALL SET_ENKAI_LOCATIONDISPLAY
SIF FLAG:����J�Ãt���O
	CALL ����T�v
PRINTL

@ENKAI_ENTRY
#DIM DYNAMIC HOST_LIST  , �L�����N�^�����;��ÎҎQ��
#DIM DYNAMIC GUEST_LIST , �L�����N�^�����;�q�Q��
#DIM DYNAMIC NG_LIST    , �L�����N�^�����;���Ȃ�
;---   ����̎Q���Ҍ���   -----------------------------------------------------------------------------
;CFLAG:����Q�� 0=�s�Q�� 1=�Q�� 2=��Î� 3=�E���� 4=���܂Ȃ����ǎQ��
;------------------------------------------------------------------------------------------------------
;�t���O������
CVARSET CFLAG, GETNUM(CFLAG, "����Q��"), 0, 1
SELECTCASE FLAG:����J�Ãt���O
	;2 ���z���ΖY���
	CASE 2
		;1:�얲, 2:��[����, 11:������
		HOST_LIST  = 1, 2, 11
		;10:��
		GUEST_LIST = 10
		;���ׂ͎Q�����Ȃ�
		NG_LIST    = 97
		CALL ENKAI_ENTRY_CHARALIST(HOST_LIST, GUEST_LIST, NG_LIST)
		FOR LOCAL, 1, CHARANUM
			IF CFLAG:LOCAL:����Q��
				SIF CFLAG:LOCAL:����Q�� < 0
					CFLAG:LOCAL:����Q�� = 0
				CONTINUE
			ENDIF
			;���̃L�����̓����_���Q��
			SIF RAND:5 == 0
				CFLAG:LOCAL:����Q�� = 1
		NEXT
	;1 �얲�̋C����𐷂�
	CASE 1
		SELECTCASE FLAG:���������
			CASE 51
				FLAG:31 += RAND:1000
			CASE 52
				FLAG:31 += RAND:2000
		ENDSELECT
		;1:�얲, 2:��[����, 11:������
		HOST_LIST  = 1, 2, 11
		;10:��
		GUEST_LIST = 10
		;���ׂ͎Q�����Ȃ�
		NG_LIST    = 97
		CALL ENKAI_ENTRY_CHARALIST(HOST_LIST, GUEST_LIST, NG_LIST)
		IF FLAG:31 >= 2500
		;�K�͂��傫���ƎQ���m����
			FOR LOCAL, 1, CHARANUM
				IF CFLAG:LOCAL:����Q��
					SIF CFLAG:LOCAL:����Q�� < 0
						CFLAG:LOCAL:����Q�� = 0
					CONTINUE
				ENDIF
				;���̃L�����̓����_���Q��
				SIF RAND:7 == 0
					CFLAG:LOCAL:����Q�� = 1
			NEXT
		ELSE
			FOR LOCAL, 1, CHARANUM
				IF CFLAG:LOCAL:����Q��
					SIF CFLAG:LOCAL:����Q�� < 0
						CFLAG:LOCAL:����Q�� = 0
					CONTINUE
				ENDIF
				;���̃L�����̓����_���Q��
				SIF RAND:14 == 0
					CFLAG:LOCAL:����Q�� = 1
			NEXT
		ENDIF
	;������
	CASE 3
		;52:���ǂ�, 53�Ă�, 72:���[���@75:���f�B�X������`��
		HOST_LIST  = 52, 53, 72, 75
		;62:����
		GUEST_LIST = 62
		;���ׂ͎Q�����Ȃ�
		NG_LIST    = 97
		CALL ENKAI_ENTRY_CHARALIST(HOST_LIST, GUEST_LIST, NG_LIST)
		FOR LOCAL, 1, CHARANUM
			IF CFLAG:LOCAL:����Q��
				SIF CFLAG:LOCAL:����Q�� < 0
					CFLAG:LOCAL:����Q�� = 0
				CONTINUE
			ENDIF
			;���̃L�����̓����_���Q�������A�|�ѕ��ʂɏZ��ł�Ɗm�����オ��
			IF CFLAG:LOCAL:����ʒu / 100 == 4 && !RAND:3
				CFLAG:LOCAL:����Q�� = 1
			ELSEIF !RAND:11
				CFLAG:LOCAL:����Q�� = 1
			ENDIF
		NEXT
	;���n��
	CASE 4
		;HOST_LIST�Z���ˑ�����Ȃ̂Ŗ�����
		;�H�o���͕K������
		GUEST_LIST = 77, 78
		;���ׂ͎Q�����Ȃ�
		NG_LIST    = 97
		CALL ENKAI_ENTRY_CHARALIST(HOST_LIST, GUEST_LIST, NG_LIST)
		FOR LOCAL, 1, CHARANUM
			IF CFLAG:LOCAL:����Q��
				SIF CFLAG:LOCAL:����Q�� < 0
					CFLAG:LOCAL:����Q�� = 0
				CONTINUE
			ENDIF
			;�l���ݏZ�̃L�����͓���
			IF CFLAG:LOCAL:����ʒu / 100 == 2
				CFLAG:LOCAL:����Q�� = 2
			ELSEIF !RAND:12
				CFLAG:LOCAL:����Q�� = 1
			ENDIF
		NEXT
	;�ǌo���C�u
;	CASE 5
;		;���@�������o�[�͓���
;		HOST_LIST = 39, 40, 41, 55, 85, 86, 87, 88
;		;GUEST_LIST�Ȃ�
;		;����_�Бg�͂��Ȃ�
;		;���ׂ����Ȃ�
;		NG_LIST   = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 97
;		CALL ENKAI_ENTRY_CHARALIST(HOST_LIST, GUEST_LIST, NG_LIST)
;		FOR LOCAL, 1, CHARANUM
;			IF CFLAG:LOCAL:����Q��
;				SIF CFLAG:LOCAL:����Q�� < 0
;					CFLAG:LOCAL:����Q�� = 0
;				CONTINUE
;			ENDIF
;			;���͎������܂Ȃ�
;			SIF RAND:15 == 0
;				CFLAG:LOCAL:����Q�� = 9
;		NEXT
	;6 ���~���A�̋C����ȃp�[�e�B
	CASE 6
		;15:���, 58:����, 59:�������͓���
		HOST_LIST  = 15, 58, 59
		;16:���~���A, 50:�t�����͓����Ȃ�
		GUEST_LIST = 16, 50
		;54:�p�`�����[, 97:���ׂ͎Q�����Ȃ�
		NG_LIST    = 54, 97
		CALL ENKAI_ENTRY_CHARALIST(HOST_LIST, GUEST_LIST, NG_LIST)
		IF FLAG:31 >= 2500
		;�K�͂��傫���ƎQ���m����
			FOR LOCAL, 1, CHARANUM
				IF CFLAG:LOCAL:����Q��
					SIF CFLAG:LOCAL:����Q�� < 0
						CFLAG:LOCAL:����Q�� = 0
					CONTINUE
				ENDIF
				;���̌Ε��ʂɏZ��ł�Ɗm�����オ��
				SIF CFLAG:LOCAL:����ʒu / 100 == 3 && !RAND:3
					CFLAG:LOCAL:����Q�� = 1
				;���̃L�����̓����_���Q��
				SIF RAND:7 == 0
					CFLAG:LOCAL:����Q�� = 1
			NEXT
		ELSE
			FOR LOCAL, 1, CHARANUM
				IF CFLAG:LOCAL:����Q��
					SIF CFLAG:LOCAL:����Q�� < 0
						CFLAG:LOCAL:����Q�� = 0
					CONTINUE
				ENDIF
				;���̌Ε��ʂɏZ��ł�Ɗm�����オ��
				SIF CFLAG:LOCAL:����ʒu / 100 == 3 && !RAND:3
					CFLAG:LOCAL:����Q�� = 1
				;���̃L�����̓����_���Q��
				SIF RAND:11 == 0
					CFLAG:LOCAL:����Q�� = 1
			NEXT
		ENDIF
ENDSELECT

;���X�g�𗘗p��������L�����̃v���Z�b�g�֐�
@ENKAI_ENTRY_CHARALIST(HOST_LIST, GUEST_LIST, NG_LIST)
#DIM REF HOST_LIST  ;��ÎҎQ��
#DIM REF GUEST_LIST ;�q�Q��
#DIM REF NG_LIST    ;���Ȃ�
#DIM L_NUM
#DIM L_ID
L_NUM = FINDELEMENT(HOST_LIST, 0)
IF L_NUM >= 1
	FOR L_ID, 0, L_NUM
		CFLAG:(HOST_LIST:L_ID):����Q�� = 2
	NEXT
ENDIF
L_NUM = FINDELEMENT(GUEST_LIST, 0)
IF L_NUM >= 1
	FOR L_ID, 0, L_NUM
		CFLAG:(GUEST_LIST:L_ID):����Q�� = 1
	NEXT
ENDIF
;�ݒ肵�����Ƃ𖾊m�����邽�߂�-1�ɂ��܂�
L_NUM = FINDELEMENT(NG_LIST, 0)
IF L_NUM >= 1
	FOR L_ID, 0, L_NUM
		CFLAG:(NG_LIST:L_ID):����Q�� = -1
	NEXT
ENDIF

@ENKAI_WORK(ARG)
;����̍s�����e����͂���
;NOSAMES:���ׂĂ̈������قȂ��1, 1�ł���v���Ă����0��Ԃ�
IF FLAG:����J�Ãt���O > 0 && (NOSAMES(CFLAG:ARG:�E��, 48, 49, 50, 51) || CFLAG:ARG:�s�� == 0)
	;����̎��ԂɂȂ����珀���d���̗ʂɉ����Ď�Î҂������n�߂�
	IF TIME >= FLAG:�J�n���� - (FLAG:����K�� / 30) - 15 && TIME < FLAG:33 && CFLAG:ARG:����Q�� == 2
		CALL ENKAI_PREPARE(ARG)
		RETURN 1
	;�V�тɗ��邾���̓z�͎��ԂɂȂ�����V�тɗ���
	ELSEIF DAY == FLAG:34 && TIME >= FLAG:33 && CFLAG:ARG:���s == 0
		CALL ENKAI_START(ARG)
		RETURN 1
	;�Ƃ����Ɏn�܂��Ă�ꍇ
	ELSEIF FLAG:����J�Ãt���O >= 98 && CFLAG:ARG:���s == 0
		CALL ENKAI_START(ARG)
		RETURN 1
	ENDIF
ELSEIF FLAG:����J�Ãt���O > 0
	RETURN 1
ENDIF
RETURN 0

@ENKAI_PREPARE(ARG)
;��Î҂̏����d��
IF CFLAG:ARG:�E�� != �����
	MAXBASE:ARG:�d���� = FLAG:31 / 3
	;�ő�l�A2400
	SIF MAXBASE:ARG:�d���� >= 2400
		MAXBASE:ARG:�d���� = 2400
	BASE:ARG:�d���� = MAXBASE:ARG:�d����
	CFLAG:ARG:�E�� = �����
	CFLAG:ARG:�E�� = FLAG:32
	TCVAR:ARG:315 = 0
	CFLAG:ARG:�s�� = 5
ENDIF
RETURN 1

@ENKAI_START(ARG)
;���ꂼ�ꂪ���ރy�[�X��ς���̂ŁA���̋K�͂ɉ����Ďd���ʂ��ω�
IF CFLAG:ARG:�E�� != ENKAI_SANKA && TCVAR:ARG:�D�� == 0
	MAXBASE:ARG:�d���� = FLAG:31
	;�ő�l�A�ʏ�7200(����)�E��ۂݐ_�Ȃ琧���Ȃ�
	SIF MAXBASE:ARG:�d���� >= 7200 && TALENT:ARG:��ϐ� != 3
		MAXBASE:ARG:�d���� = 7200
	MAXBASE:ARG:�d���� += RAND:500
	IF TALENT:ARG:��ϐ� == -1
		TIMES MAXBASE:ARG:�d����, 0.75
	ELSEIF TALENT:ARG:��ϐ� == 1
		TIMES MAXBASE:ARG:�d����, 1.25
	ELSEIF TALENT:ARG:��ϐ� == 2
		TIMES MAXBASE:ARG:�d����, 1.5
	ELSEIF TALENT:ARG:��ϐ� == 3
		TIMES MAXBASE:ARG:�d����, 2.0
	ENDIF
	BASE:ARG:�d���� = MAXBASE:ARG:�d����
	;�d�����e�E����ɎQ��
	CFLAG:ARG:�E�� = ENKAI_SANKA
	CFLAG:ARG:�E�� = FLAG:32
	CFLAG:ARG:���݈ʒu = FLAG:32
	TCVAR:ARG:315 = 0
	CFLAG:ARG:�s�� = 5
	IF CFLAG:ARG:����Q�� == 2
		;��Î҂͕Еt���\����Z�b�g(�d���ʂ͍ő�1200)
		CFLAG:ARG:�Еt���d���� = MIN(FLAG:����K�� / 6, 1200)
		CFLAG:ARG:�Еt���ꏊ = FLAG:������
	ENDIF
ENDIF

RETURN 1

@ENKAI_KATAZUKE(ARG)
;��Î҂̕ЂÂ��d��
MAXBASE:ARG:�d���� = CFLAG:ARG:�Еt���d����
BASE:ARG:�d���� = MAXBASE:ARG:�d����
;�d�����e�E����̕ЂÂ�
CFLAG:ARG:�E�� = 50
CFLAG:ARG:�E�� = CFLAG:ARG:�Еt���ꏊ
TCVAR:ARG:��`���Ȃ� = 0
CFLAG:ARG:�s�� = 5
RETURN 1

@ENKAI_DRUNK(ARG)
;�����Ԃ�郉�C���𒴂��Ă�����߂�
IF BASE:ARG:���C > (MAXBASE:ARG:���C / 10) * 8
	RETURN 1
ENDIF

;�������܂Ȃ��Ȃ琌��Ȃ�
IF TALENT:ARG:��ϐ� == -2 || CFLAG:ARG:�D�P���o��� == 1
	CFLAG:ARG:�E�� = 0
	CFLAG:ARG:����Q�� = 4
	IF CFLAG:MASTER:���݈ʒu == CFLAG:ARG:���݈ʒu
		PRINTFORMW %CALLNAME:ARG%�͂����\���y���񂾂悤�ł�
	ENDIF
ELSE
	CFLAG:ARG:�E�� = 0
	CFLAG:ARG:����Q�� = 3
;	PRINTFORMW %CALLNAME:ARG%�͂ق됌���C���̂悤�ł�
	IF CFLAG:MASTER:���݈ʒu == CFLAG:ARG:���݈ʒu
		PRINTFORMW %CALLNAME:ARG%�͂����\���y���񂾂悤�ł�
	ENDIF
ENDIF
RETURN 1

@ENKAI_STOP
;���V��Ȃǂɂ�钆�~
FOR LOCAL,0,CHARANUM
	CFLAG:LOCAL:�E�� = 0
	MAXBASE:LOCAL:�d���� = 0
	BASE:LOCAL:�d���� = 0
	CFLAG:LOCAL:����Q�� = 0
	CFLAG:LOCAL:�s�� = 0
NEXT
FLAG:����J�Ãt���O = 0
FLAG:31 = 0
FLAG:32 = 0
FLAG:33 = 0
FLAG:34 = 0
FLAG:35 = 0
FLAG:36 = 0
FLAG:��������� = 0
������\�� =
RETURN 0

@����\��\��

PRINTFORM {FLAG:33 / 60}:{(FLAG:33 % 60)/10}{(FLAG:33 % 60)%10}����%������\��%��%����\��()%

@SET_ENKAI_LOCATIONDISPLAY
IF FLAG:����J�Ãt���O
	IF IN_HOME(FLAG:32)
		 LOCALS = %NAME_FROM_PLACE(FLAG:32)%
	ELSE
		LOCALS = %GET_MAPNAME(GET_JOBPLACE("����")/100)%��%STR:(6000+(GET_JOBPLACE("����")/10))%
	ENDIF
	������\�� '= LOCALS
ENDIF

@����\��
#FUNCTIONS
SELECTCASE FLAG:����J�Ãt���O
	CASE 1
		LOCALS = �얲�̋C����𐷂�
	CASE 2
		LOCALS = ���z���ΖY���
	CASE 3
		LOCALS = ������
	CASE 4
		LOCALS = ���n��
	CASE 5
		LOCALS = ��ʂ��ǌo���C�u
	CASE 6
		LOCALS = ���~���A�̋C����ȃp�[�e�B
ENDSELECT
RETURNF LOCALS

@����T�v
IF FLAG:34 == 1
	PRINT �����A
ELSE
	PRINTFORM {FLAG:34}����A
ENDIF

PRINTFORML {FLAG:33 / 60}:{(FLAG:33 % 60)/10}{(FLAG:33 % 60)%10}����%������\��%�ɂāA�u%����\��()%�v���J��������

PRINT �b�̗l�q����
IF FLAG:31 >= 5000
	PRINTW �c�c����͒�����ɂȂ肻����
ELSEIF FLAG:31 >= 2500
	PRINTW �A���������������Ղ�p�ӂ��Ă���炵��
ELSEIF FLAG:31 >= 1500
	PRINTW �A�e�r��[�߂�ɂ͒��x�悳������
ELSE
	PRINTW �A������Ƃ����W�܂��\�肵�Ă���悤��
ENDIF
IF FLAG:34 == 1
	PRINTFORMW �}�ȍÂ��ł͂��邪�A�Q�����Ă݂悤���c�c
ELSE
	PRINTFORMW �Q������Ȃ�\����󂯂Ă������c�c
ENDIF
SIF FLAG:36 > 0
	PRINTFORMW �Ȃ��A�J�V���~�Ƃ̂��Ƃ��c�c
PRINTL
FLAG:34 += DAY

@����Q���l���Čv�Z
;����̎Q���l�����Z�b�g
FLAG:�Q���l�� = 0
FOR LOCAL,0,CHARANUM
	IF (CFLAG:LOCAL:����Q�� == 1 || CFLAG:LOCAL:����Q�� == 2) && !TCVAR:LOCAL:�D��
		SIF CFLAG:LOCAL:���݈ʒu == FLAG:������
			FLAG:�Q���l�� ++
	ENDIF
NEXT


code:
@���K�t���O
#DIM ���K�Ґ�
#DIM �Q�ƃt���O
#DIM �Q�ƃr�b�g
#DIM ���K�m��
#DIM ��{���K�m��
#DIM ���K�l�����
;LOCAL = FLAG:50�̊e�L������bit
;FLAG:50�`59 �e�K��҂̖K��t���O
;FLAG:51:bit�\�L:
;LOCAL = �e�L������NO
���K�Ґ� = 0
�Q�ƃt���O = 0
�Q�ƃr�b�g = 0
���K�m�� = 0
��{���K�m�� = 0
;�o�֐l���ɉ����Ċ�{���K���̒����B�����łȂ������v�Z�ɕύX���Ă��܂�
SELECTCASE FLAG:�o�֐l�� * 100 / CHARANUM
CASE IS >= 60
	��{���K�m�� = 15
CASE IS >= 40
	��{���K�m�� = 16
CASE IS >= 20
	��{���K�m�� = 17
CASEELSE
	��{���K�m�� = 18
ENDSELECT

���K�l����� = 10
SIF TALENT:MASTER:��q����
	���K�l����� = 12
;�܂��m��ŗ���L�������J�E���g
FOR LOCAL,1,CHARANUM
	IF CFLAG:LOCAL:����Q��
		IF IN_HOME(FLAG:32)
			CFLAG:LOCAL:���_���K = 1
			���K�Ґ� ++
		;�������_�ЊO�Ȃ�m���ɗ��Ȃ��i��>>�i�z�����Ȃ��ǁj>>���l�̂��Ȃ��j
		ELSE
			CFLAG:LOCAL:���_���K = 0
		ENDIF
	;��|���Ώہ^�˗����s���y�ђB���҂͗��K����
	; // ������o�[�͊�|���t���O��ON�ł����K���Ȃ��悤�� from��|���p�b�`.ERB//
	ELSEIF (CFLAG:LOCAL:�������K && !CFLAG:LOCAL:�_�ЍݏZ) || CFLAG:LOCAL:�˗��� == 3
		CFLAG:LOCAL:���_���K = 1
		���K�Ґ� ++
	ELSE
		CFLAG:LOCAL:���_���K = 0
	ENDIF
	;�킩�����P�̗��K�t���O�̓v�[�����Ȃ���ΐ܂��
	IF LOCAL == 93 && CFLAG:LOCAL:���_���K && FLAG:�v�[�� < 8
		CFLAG:LOCAL:���_���K = 0
		���K�Ґ� --
	;�𗬃��[�h�Ńt���O�܂�
	ELSEIF FLAG:�𗬗��K���[�h == 1 && CFLAG:LOCAL:�D���x <= 0
		CFLAG:LOCAL:���_���K = 0
		���K�Ґ� --
	ELSEIF FLAG:�𗬗��K���[�h == 2
		CFLAG:LOCAL:���_���K = 0
		���K�Ґ� --
	ENDIF
NEXT

CALL FISHER_YATES_SHAFFLE(CHARANUM - 1)
FOR LOCAL:10 , 0 , CHARANUM - 1
	LOCAL = SHAFFLE_ARRAY:(LOCAL:10) + 1
	;����ݏZ�L�����Ȃ瑘�����Ȃ�
	IF CFLAG:LOCAL:�_�ЍݏZ > 0
		CFLAG:LOCAL:���_���K = 0
		CONTINUE
	ENDIF
	;�o�ւ̐l���O
	IF CFLAG:LOCAL:�o�� || TALENT:LOCAL:�s������
		CFLAG:LOCAL:���_���K = 0
		CONTINUE
	ENDIF
	SIF CFLAG:LOCAL:���_���K
		CONTINUE
	;�o�֐l���{�e�f���ɂ��C�����痈�K�����Z�o���A����
	;�ꕔ�L�����ɂ͒ǉ��ŏ�����m���ϓ�������
	;���K�Ґ������K�l������𒴂���ƃX�L�b�v
	SIF ���K�Ґ� > ���K�l�����
		CONTINUE
	���K�m�� = ��{���K�m�� - TALENT:LOCAL:���� * 2 - TALENT:LOCAL:�v�� - CFLAG:LOCAL:(420 + MAIN_MAP)
	SIF CFLAG:LOCAL:�I�i�o��
		���K�m�� += 5
	SELECTCASE LOCAL
		;�t�����A���l
		CASE 50, 66
			IF !RAND:(2 + ���K�m��)
				CFLAG:LOCAL:���_���K = 1
				���K�Ґ� ++
			ELSE
				CFLAG:LOCAL:���_���K = 0
			ENDIF
		;�ς�����
		CASE 54
			IF !RAND:(10 + ���K�m��)
				CFLAG:LOCAL:���_���K = 1
				���K�Ґ� ++
			ELSE
				CFLAG:LOCAL:���_���K = 0
			ENDIF
		;��������&����
		CASE 61, 62
			IF !RAND:(���K�m��) && CFLAG:LOCAL:�D���x > 500
				CFLAG:LOCAL:���_���K = 1
				���K�Ґ� ++
			ELSE
				CFLAG:LOCAL:���_���K = 0
			ENDIF
		;�Ȍ��A�T�O�����q�ꂽ�n��ɂ͍s��������Ȃ�
		CASE 98,99,110
			IF !TALENT:LOCAL:���� && !TALENT:LOCAL:�v��
				CFLAG:LOCAL:���_���K = 0
			ELSEIF !RAND:(5 + ���K�m��)
				CFLAG:LOCAL:���_���K = 1
				���K�Ґ� ++
			ELSE
				CFLAG:LOCAL:���_���K = 0
			ENDIF
		CASEELSE
			IF !RAND:���K�m��
				CFLAG:LOCAL:���_���K = 1
				���K�Ґ� ++
			ELSE
				CFLAG:LOCAL:���_���K = 0
			ENDIF
	ENDSELECT

	;�킩�����P�̗��K�t���O�̓v�[�����Ȃ���ΐ܂��
	IF LOCAL == 93 && CFLAG:LOCAL:���_���K && FLAG:�v�[�� < 8
		CFLAG:LOCAL:���_���K = 0
		���K�Ґ� --
	;�𗬃��[�h�Ńt���O�܂�
	ELSEIF FLAG:�𗬗��K���[�h == 1 && CFLAG:LOCAL:�D���x <= 0
		CFLAG:LOCAL:���_���K = 0
		���K�Ґ� --
	ELSEIF FLAG:�𗬗��K���[�h == 2
		CFLAG:LOCAL:���_���K = 0
		���K�Ґ� --
	ENDIF
NEXT

;�O�����͔�\��
IF ���K�Ґ� > 0 && AT_HOME(MASTER)
	PRINTFORMW %GET_MAPNAME(MAIN_MAP)%�ɗ��K�҂��������悤���B
	PRINTL
ENDIF


code:
;-------------------------------------------------
;300�ԑ�,����(���肪�K�v)
;-------------------------------------------------
[SKIPSTART]
;�Ή��R�}���h�s��
;���𓮂���(A)
@COM_ABLE318
;���s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(318)
	RETURN RESULT
;��~���͕s��
SIF FLAG:70
	RETURN 0
;��ꍇ�����x2
SIF (TCVAR:MASTER:��ꍇ�� < 2) && CFLAG:���� == 0
	RETURN 0
;����
SIF TEQUIP:0 & 4
	RETURN 0
;������
SIF CFLAG:���� && CFLAG:�C�^�Y�� < 2
	RETURN 0
;�d����
SIF CFLAG:�s�� == 5
	RETURN 0
;�f�[�g��
SIF CHK_DATENOW(CFLAG:�f�[�g��) && CFLAG:���݈ʒu != OMANEKIBEYA()
	RETURN 0
;�Y���Q��
SIF CFLAG:�Y���Q��
	RETURN 0
SIF TCVAR:TARGET:101 != PLAYER
	RETURN 0
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
SIF GETBIT (TCVAR:26,8)
	RETURN 0
SIF CFLAG:���ӂ� != 2
	RETURN 0
RETURN 1
[SKIPEND]

;��R����
;�ڐA��

;�Ή��R�}���h�s��
;������
@COM_ABLE362
;��~���͕s��
SIF FLAG:70
	RETURN 0
;��������s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(362)
	RETURN RESULT
;�C��0
SIF BASE:MASTER:�C�� <= 0
	RETURN 0
SIF TFLAG:102 != 4
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;����
;�����n�R�}���h�@���x��2
;-------------------------------------------------
@COM0
#DIM �L�X����
IF (FIRSTTIME(312,1) && FIRSTTIME(20,1)) || (MASTER_POSE(SET_M, SET_M) != TARGET && MASTER_POSE(0,4)) || (STAIN:0 >= 2 && (STAIN:0 != 16 && STAIN:0 != 17) && ASSIPLAY == 0 && TALENT:PLAYER:���L�ϐ� < 2) || TEQUIP:20
;�z��̌��̉��ꂪ����Ƃ��L�X�͂Ȃ��i���t�ƕ���悲��͂n�j�A���ꖳ�������蒲�����͖��Ȃ��j
;�{�[���M���O�g�p�����Ȃ�
	�L�X���� = 0
ELSE
	�L�X���� = 1
ENDIF
;-------------------------------------------------
;COM��FLAG�̐ݒ�
;-------------------------------------------------
;�s�׎�
TCVAR:116 = PLAYER
;��d���y
TCVAR:PLAYER:108 = 1

;TARGET���ӂ��Ȃ�̏ꍇ�ɂ͎ː��\��
CSTR:TARGET:10 += @"{PLAYER}/"
;TCVAR:2 �ː��ӏ��t���O�i-1=�R���h�[�� 1=�S�� 2=�A�i�� 3=��� 4=���� 5=�p�C�Y�� 6=�f�� 7=���R�L 8=�̕\ 9=�A�i����d 10=���� 11=�G�� 12=�`�ӂ� 13=�u�ӂ߁j
TCVAR:TARGET:2 = 3
;���x
TCVAR:TARGET:4 = 1500

;-------------------------------------------------
;�\�[�X�ǉ�����
;-------------------------------------------------
;����̗́A�C��
IF FLAG:70 == 1
	BASE:MASTER:TSP -= 20
	SOURCE:���b = 40
	SOURCE:���a = 40
	IF �L�X����
		SOURCE:���l = 20
		SOURCE:���l += ABL:PLAYER:�� * 3
	ENDIF
	;���Z�␳
	SOURCE:���b += ABL:PLAYER:�w * 4
	SOURCE:���a += ABL:PLAYER:�w * 4

	;�w���g�������ł́A�����҂̎w�g���ɂ���āA�����̃\�[�X����
	IF TALENT:PLAYER:��p�Ȏw
		TIMES SOURCE:���b , 1.50
		TIMES SOURCE:���a , 1.50
	ENDIF
	SIF �L�X���� && TALENT:PLAYER:��g��
		TIMES SOURCE:���l , 1.50

	;�L�X�o��
	EXP:PLAYER:�L�X�o�� ++
	;�z��̌��̒����҂̌��̉��ꂪ�ړ�
	STAIN:0 |= STAIN:PLAYER:0
	STAIN:PLAYER:0 |= STAIN:0
	;�������@���Y�Ȃ�߂�l1�Q�C�Ȃ�߂�l2
	IF HETEROSEX(TARGET,PLAYER)
		EXP:PLAYER:(50 + HETEROSEX(TARGET,PLAYER)) += 5
	ENDIF

	;�����҂��L�㎝���̏ꍇ�́A�����҂ɚn�s���y�o����ǉ�
	SIF TALENT:PLAYER:�L��
		EXP:PLAYER:�n�s���y�o�� += 1
	;�o��
	EXP:PLAYER:����o�� ++
ELSE

	DOWNBASE:�̗� += 10
	DOWNBASE:�C�� += 50

	SOURCE:���b = 40
	SOURCE:���a = 40
	IF �L�X����
		SOURCE:���l = 20 + ABL:PLAYER:�� * 3
		SOURCE:PLAYER:���l = 20 + ABL:TARGET:�� * 3
	ENDIF

	SOURCE:� = 50
	SOURCE:���s�� = 60
	SOURCE:�I�o = 20
	SOURCE:�s�� = 30
	SOURCE:��E = 20
	SOURCE:���� = 20

	;���Z�␳
	SOURCE:���b += ABL:PLAYER:�w * 4
	SOURCE:���a += ABL:PLAYER:�w * 4

	IF TALENT:PLAYER:��p�Ȏw
		TIMES SOURCE:���b , 1.50
		TIMES SOURCE:���a , 1.50
	ENDIF
	SIF �L�X���� && TALENT:PLAYER:��g��
		TIMES SOURCE:���l , 1.50

	SIF TALENT:PLAYER:��g��
		TIMES SOURCE:� , 1.50
	;-------------------------------------------------
	;����\�[�X����
	;-------------------------------------------------
	;�}���A��R�����ɂ́A�}�T�\�[�X�ǉ�
	SIF TALENT:���Ȉ� < 0 || TALENT:��R
		SOURCE:�T�� += 20
	;-------------------------------------------------
	;����̏���
	;-------------------------------------------------
	IF !�L�X����
		SOURCE:�s�� = 0
		SOURCE:� /= 4
		SOURCE:�t�� /= 2
	ELSE
		;�L�X�o��
		EXP:�L�X�o�� ++
		EXP:PLAYER:�L�X�o�� ++
		;���L�݊�
		SIF TALENT:���L�ϐ� > 0
			SOURCE:�s�� /= 4
		;���L�q��
		SIF TALENT:���L�ϐ� < 0
			SOURCE:�s�� *= 3
		;�v���C�h����
		SIF TALENT:�v���C�h > 0
			SOURCE:�s�� *= 2
		IF STAIN:PLAYER:0
		;��l�̌��̉��ꂪ����ƕs��150%
			SOURCE:�s�� *= 3
			SOURCE:�s�� /= 2
		ENDIF
		;�z��̌��̒����҂̌��̉��ꂪ�ړ�
		STAIN:0 |= STAIN:PLAYER:0
		STAIN:PLAYER:0 |= STAIN:0
	ENDIF

	;-------------------------------------------------
	;�o���̏���
	;-------------------------------------------------
	;�������@���Y�Ȃ�߂�l1�Q�C�Ȃ�߂�l2
	CALL ADD_EXP_LESNIAN(5)

	;�����҂��L�㎝���̏ꍇ�́A�����҂ɚn�s���y�o����ǉ�
	SIF TALENT:PLAYER:�L��
		EXP:PLAYER:�n�s���y�o�� += 1
	;�o��
	EXP:PLAYER:����o�� ++
ENDIF
RETURN 1

;-------------------------------------------------
;�������s����
;-------------------------------------------------
@COM_ABLE0
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(0)
	RETURN RESULT
SIF !TARGET
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�N���j
;�����n�R�}���h�@���x��1
;-------------------------------------------------
@COM1
;-------------------------------------------------
;COM��FLAG�̐ݒ�
;-------------------------------------------------
;�s�׎�
TCVAR:116 = PLAYER
;��d���y
TCVAR:PLAYER:108 = 1

CSTR:TARGET:10 += @"{PLAYER}/"
;TCVAR:2 �ː��ӏ��t���O�i-1=�R���h�[�� 1=�S�� 2=�A�i�� 3=��� 4=���� 5=�p�C�Y�� 6=�f�� 7=���R�L 8=�̕\ 9=�A�i����d 10=���� 11=�G�� 12=�`�ӂ� 13=�u�ӂ߁j
TCVAR:TARGET:2 = 4
;���x
TCVAR:TARGET:4 = 500

;-------------------------------------------------
;�\�[�X�ǉ�����
;-------------------------------------------------
;����̗́A�C��
IF FLAG:70 == 1
	BASE:MASTER:TSP -= 20
	SOURCE:���b = 80
	SOURCE:PLAYER:���l += 50
	SOURCE:�t�� = 1000
	;���Z�␳
	IF ABL:PLAYER:�� >= 4
		SOURCE:���b += 100
		SOURCE:�t�� += 400
	ELSE
		SOURCE:���b += ABL:PLAYER:�� * 20
		SOURCE:�t�� += ABL:PLAYER:�� * 80
	ENDIF

	IF HETEROSEX(TARGET,PLAYER)
		EXP:PLAYER:(50 + HETEROSEX(TARGET,PLAYER)) += 3
	ENDIF

	;�����o��
	EXP:PLAYER:�����o�� ++
;���Ԓ�~�Ȃ�
ELSE
	DOWNBASE:�̗� += 5
	DOWNBASE:�C�� += 50
	SOURCE:PLAYER:���l += 50
	SOURCE:���b = 80
	SOURCE:�t�� = 1000
	SOURCE:�I�o = 10
	SOURCE:��E = 15
	SOURCE:���� = 15

	;-------------------------------------------------
	;����\�[�X����
	;-------------------------------------------------
	;�}���A��R�����ɂ́A�}�T�\�[�X�ǉ�
	SIF TALENT:���Ȉ� < 0 || TALENT:��R
		SOURCE:�T�� += 20

	;���Z�␳
	IF ABL:PLAYER:�� >= 4
		SOURCE:���b += 100
		SOURCE:�t�� += 400
	ELSE
		SOURCE:���b += ABL:PLAYER:�� * 20
		SOURCE:�t�� += ABL:PLAYER:�� * 80
	ENDIF

	;-------------------------------------------------
	;�o���̏���
	;-------------------------------------------------
	;�������@���Y�Ȃ�߂�l1�Q�C�Ȃ�߂�l2
	IF HETEROSEX(TARGET,PLAYER)
		EXP:(50 + HETEROSEX(TARGET,PLAYER)) += 3
		EXP:PLAYER:(50 + HETEROSEX(TARGET,PLAYER)) += 3
	ENDIF

	;�����o��
	EXP:PLAYER:�����o�� ++
ENDIF
;-------------------------------------------------
;���Ԓ�~����I���A���ʂ���f���␳�≘��̏���
;-------------------------------------------------
;����g�������ł́A�����҂̐�g���ɂ���āA�����̃\�[�X����
IF TALENT:PLAYER:��g��
	TIMES SOURCE:���b , 1.50
	TIMES SOURCE:�t�� , 1.50
ENDIF
;�L��ł͌����A�����҂ɚn�s���y�o����ǉ�
IF TALENT:PLAYER:�L��
	TIMES SOURCE:���b , 0.75
	EXP:PLAYER:�n�s���y�o�� += 1
ENDIF

;�z��̂u�̒����҂̌��̉��ꂪ�ړ�
STAIN:�u |= STAIN:PLAYER:��
STAIN:PLAYER:�� |= STAIN:�u
IF HETEROSEX(TARGET,PLAYER)
	EXP:PLAYER:(50 + HETEROSEX(TARGET,PLAYER)) += 3
ENDIF

RETURN 1

;-------------------------------------------------
;�N���j���s����
;-------------------------------------------------
@COM_ABLE1
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(1)
	RETURN RESULT
;���킪����Ă����PLAYER�̏ꍇ�N���j�͂ł��Ȃ��i�����҂����ꖳ�������t�A����A�`���R�̂悲��Ȃ�n�j�j
SIF STAIN:3 >= 2 && (STAIN:3 != 16 && STAIN:3 != 17 && STAIN:3 != 128 && STAIN:3 != 129 && STAIN:3 != 144 && STAIN:3 != 145) && ASSIPLAY == 0 && TALENT:PLAYER:���L�ϐ� < 2
	RETURN 0
;���킪����Ă���A���L�q���ŏ]��3�ȉ���ASSI�̏ꍇ�N���j�͂ł��Ȃ��i�����҂����ꖳ�������t�A����A�`���R�̂悲��Ȃ�n�j�j
IF STAIN:3 >= 2 && (STAIN:3 != 16 && STAIN:3 != 17 && STAIN:3 != 128 && STAIN:3 != 129 && STAIN:3 != 144 && STAIN:3 != 145) && ASSIPLAY
	SIF ABL:ASSI:�]�� <= 3 && TALENT:ASSI:���L�ϐ� < 0
		RETURN 0
ENDIF
;�����g����
SIF TEQUIP:0 & 4
	RETURN 0
RETURN 1


code:
;-------------------------------------------------
;�X�C
;SM�n�R�}���h�A���x��3
;-------------------------------------------------
@COM102
;-------------------------------------------------
;COM��FLAG�̐ݒ�
;-------------------------------------------------
;�s�׎�
TCVAR:116 = PLAYER
ITEM:46 --
;������[
IF !ITEM:46 && MONEY >= 2000 && FLAG:1001
	MONEY -= 2000
	ITEM:46 ++
ENDIF
;-------------------------------------------------
;�\�[�X�ǉ�����
;-------------------------------------------------
;����̗́A�C��
IF FLAG:70 == 1
	BASE:MASTER:TSP -= 40
	SOURCE:��� = 1000

ELSE

	DOWNBASE:�̗� += 40
	DOWNBASE:�C�� += 30

	SOURCE:��� = 2000
	SOURCE:���| = 3000
	SOURCE:��E = 150
	SOURCE:���� = 700
ENDIF
;-------------------------------------------------
;����\�[�X����
;-------------------------------------------------
;��ɂ̃p�����[�^�ɂ���ɂ̃\�[�X�����͐�ɏ������Ă���
SOURCE:��� = SOURCE:��� * (10 + 5 * MAX(GETPALAMLV(PALAM:���,5) - 1, 0)) / 10

;-------------------------------------------------
;�o���̏���
;-------------------------------------------------
;�������@���Y�Ȃ�߂�l1�Q�C�Ȃ�߂�l2
IF FLAG:70 == 1
	IF HETEROSEX(TARGET,PLAYER)
		EXP:PLAYER:(50 + HETEROSEX(TARGET,PLAYER)) += 2
	ENDIF
ELSE
	IF HETEROSEX(TARGET,PLAYER)
		EXP:(50 + HETEROSEX(TARGET,PLAYER)) += 2
		EXP:PLAYER:(50 + HETEROSEX(TARGET,PLAYER)) += 2
	ENDIF
ENDIF

EXP:PLAYER:�n�s���y�o�� += 1

RETURN 1

;-------------------------------------------------
;���s����
;-------------------------------------------------
@COM_ABLE102
;�X�C���s����
SIF !TFLAG:100
	RETURN 0
;�ꊇ�Ǘ�
SIF GLOBAL_COMABLE(102)
	RETURN RESULT
;�A�C�e���������Ă��邩�A�A�C�e���Ȃ��ݒ�łȂ��ƃ_��
SIF ITEM:46 == 0 && NOITEM == 0
	RETURN 0
;�]��4������ASSI�̏ꍇ�X�C�͂ł��Ȃ��i�T�h�Ȃ�n�j�j
IF ASSIPLAY
	SIF ABL:ASSI:�]�� < 4 && TALENT:ASSI:�T�h == 0
		RETURN 0
ENDIF
;�S���łȂ��ƃ_���i�C���A��������j
SIF TEQUIP:0 || TEQUIP:1
	RETURN 0
;�����C��v���C���̓_��
SIF TEQUIP:31
	RETURN 0
;�V�ȃv���C���̓_��
SIF TEQUIP:33
	RETURN 0
;�x�b�h���[���łȂ��ƃ_��
SIF !BEDROOM(CFLAG:PLAYER:���݈ʒu)
	RETURN 0
RETURN 1