code:
;FileName_JOB.ERB ----------------------------- Rev1.00
;�d���J�n����
;CALL		USER
;ARG		�L����NO
;RETURN		VOID
;COMMENT
;-----------------------------------------------------------
@CHARA_JOBSTR(ARG)
#DIM �ړ��O
#DIM �ړ���
#DIMS HOLD_SAMEN

IF EX:ARG:�S�����t + EX:ARG:�A�i�������t >= 500
	HOLD_SAMEN = �����ɂ����Ղ萸�t�𗭂߂�
ELSEIF EX:ARG:�S�����t + EX:ARG:�A�i�������t >= 100
	HOLD_SAMEN = �����ɐ��t�𗭂߂�
ELSE
	HOLD_SAMEN =
ENDIF

;FOR LOCAL,0,CHARANUM
;	SIF CFLAG:LOCAL:�E�� == 0 && CFLAG:LOCAL:�s�� == 5
;		PRINTFORMW ### JOB 326ERROR %CALLNAME:LOCAL% ###
;NEXT
VARSET LOCAL
�ړ��O = 0
�ړ��� = 0
;���������d���� �^�ʖڂ������
IF CFLAG:ARG:���ӂ� && !GROUPMATCH(CFLAG:ARG:�E��, 49, 51)
	PRINTFORMW %CALLNAME:ARG%�͎d��\@ CFLAG:ARG:�E�� == CFLAG:ARG:���݈ʒu ? ���͂��߂� # �Ɍ������ \@����΂����Ȃ��悤���c
	CALL ENDUFUFU(ARG)
	CFLAG:MASTER:���ӂ� = 0
	TFLAG:106 = 0
	IF TFLAG:102 == 3 && TFLAG:���������[�h
		TFLAG:���������[�h = 0
		TFLAG:102 = 1
	ENDIF
ENDIF

SIF CFLAG:ARG:�s�� == 5
	CALL JOBMOVE(ARG)

IF (CAN_MOVE(CFLAG:MASTER:���݈ʒu, CFLAG:ARG:���݈ʒu) == 2 || CFLAG:MASTER:���݈ʒu == CFLAG:ARG:���݈ʒu) && !TFLAG:�������ړ�
	IF CFLAG:ARG:���݈ʒu == TFLAG:����� && TIME_PROGRESS(TIME:1) && (CFLAG:ARG:�E�� == 49 || CFLAG:ARG:�E�� == 51)
		CALL ����`��(ARG)
	ELSEIF CFLAG:ARG:���݈ʒu == CFLAG:ARG:�E�� && TIME_PROGRESS(TIME:1)
		CALL �d����i�`��(ARG)
		IF BASE:ARG:�d����
			;�d�����܂�3����2�ȏ�c���Ă���
			IF BASE:ARG:�d���� >= (MAXBASE:ARG:�d���� / 3) * 2
				IF CFLAG:ARG:�E�� == 48
					PRINTW �@����̏����͂��Ȃ�c���Ă���悤���c
				ELSEIF CFLAG:ARG:�E�� == 50
					PRINTW �@����̕ЂÂ��͂��Ȃ�c���Ă���悤���c
				ELSEIF CFLAG:ARG:�E�� == 46
					PRINTW �V�тɖv�����Ă���c
				ELSE
					PRINTFORMW %GET_JOBNAME(ARG)%�͂��Ȃ�c���Ă���悤���c
				ENDIF
				LOCAL = 3
			;�d�����܂�3����1�ȏ�c���Ă���
			ELSEIF BASE:ARG:�d���� >= (MAXBASE:ARG:�d���� / 3)
				IF CFLAG:ARG:�E�� == 48
					PRINTW �@����̏������I����ɂ͂܂����Ԃ��|���肻�����c
				ELSEIF CFLAG:ARG:�E�� == 50
					PRINTW �@����̕ЂÂ����I����ɂ͂܂����Ԃ��|���肻�����c
				ELSEIF CFLAG:ARG:�E�� == 46
					PRINTW �܂��܂��V�ё���Ȃ��悤���c
				ELSE
					PRINTFORMW %GET_JOBNAME(ARG)%���I����ɂ͂܂����Ԃ��|���肻�����c
				ENDIF
				LOCAL = 2
			ELSE
				IF CFLAG:ARG:�E�� == 48
					PRINTW �@���������ŉ���̏������I���邱�Ƃ��o���������c
				ELSEIF CFLAG:ARG:�E�� == 50
					PRINTW �@���������ŉ���̕ЂÂ����I���邱�Ƃ��o���������c
				ELSEIF CFLAG:ARG:�E�� == 46
					PRINTW �V�є��Ă����悤���c
				ELSE
					PRINTFORMW ����������%GET_JOBNAME(ARG)%���I���邱�Ƃ��o���������c
				ENDIF
				LOCAL = 1
			ENDIF
			;�ʏ�̂��d������@���d����������t���O�������ĂȂ���Ε\������
			SIF CFLAG:ARG:����Q�� == 0
				CALL KOJO_MESSAGE_SEND("EVENT",13,ARG,2,LOCAL)
		ENDIF
		;����̏ꍇ�̂݁A�X���[�Y�Ɏ��̓���Ɍq����
		;�������ݏI��������ɂP�^�[�����������{�[���Ƃ���̂�h�~���鏈��
;		SIF CFLAG:ARG:����Q�� > 0 && BASE:ARG:�d���� <= 0
;			CALL CHARA_JOBEND(ARG)
	ELSEIF CFLAG:ARG:�E�� != 51
		IF !AT_HOME(ARG) && GET_MAPID(CFLAG:ARG:���݈ʒu) != MAIN_MAP
			�ړ��O = 6000 + (CFLAG:ARG:���݈ʒu / 10)
		ELSE
			�ړ��O = CFLAG:ARG:���݈ʒu
		ENDIF
		IF IN_HOME(CFLAG:ARG:�E��) == 0 && GET_MAPID(CFLAG:ARG:�E��) != MAIN_MAP
			�ړ��� = 6000 + (CFLAG:ARG:�E�� / 10)
		ELSE
			�ړ��� = CFLAG:ARG:�E��
		ENDIF
		IF CFLAG:ARG:���݈ʒu == OMANEKIBEYA() && TIME_PROGRESS(TIME:1)
			;�����ɏオ���Ă���o��,�����܂���ʓ|�Ȃ̂Œn�̕��܂Ƃ߂��Ⴂ�܂��G
			CFLAG:MASTER:���݈ʒu = CFLAG:ARG:����ʒu
			PRINTFORMW %CALLNAME:ARG%�͗p��������悤�Ȃ̂ŊO�ɏo��
		ELSEIF CFLAG:ARG:�E�� == 48 && TIME_PROGRESS(TIME:1)
			PRINTFORM %HOLD_SAMEN%%CALLNAME:ARG%�͉���̏����̂��߂ɁA
			PRINTFORMS NAME_FROM_PLACE(�ړ��O)
			PRINT ����
			PRINTFORMS NAME_FROM_PLACE(�ړ���)
			PRINTW �Ɍ������܂����B
		ELSEIF CFLAG:ARG:�E�� == 49 && TIME_PROGRESS(TIME:1)
			PRINTFORM %HOLD_SAMEN%%CALLNAME:ARG%��
			PRINTFORMS NAME_FROM_PLACE(�ړ��O)
			PRINT ����
			PRINTFORMS NAME_FROM_PLACE(�ړ���)
			PRINTW �̉���ɎQ�����ɍs���܂����B
		ELSEIF CFLAG:ARG:�E�� == 46 && TIME_PROGRESS(TIME:1)
			PRINTFORM %HOLD_SAMEN%%CALLNAME:ARG%��
			PRINTFORMS NAME_FROM_PLACE(�ړ��O)
			PRINT ����
			PRINTFORMS NAME_FROM_PLACE(�ړ���)
			PRINTW �ɗV�тɍs���܂����B
		ELSEIF TIME_PROGRESS(TIME:1)
			PRINTFORM %HOLD_SAMEN%%CALLNAME:ARG%��%GET_JOBNAME(ARG)%�̂��߂ɁA
			PRINTFORMS NAME_FROM_PLACE(�ړ��O)
			PRINT ����
			PRINTFORMS NAME_FROM_PLACE(�ړ���)
			PRINTW �Ɍ������܂����B
		ENDIF

		;�ʏ�̐E��Ɉړ�����@����t���O�������ĂȂ���Ε\������
		SIF CFLAG:ARG:����Q�� == 0
			CALL KOJO_MESSAGE_SEND("EVENT",13,ARG,1,LOCAL)
	ENDIF
ENDIF
SIF CFLAG:ARG:�Y���Q��
	CALL SET_TOGETHER(0,ARG,1)
SIF CFLAG:ARG:���s && CFLAG:ARG:�E�� != 51
	CFLAG:ARG:���s = 0
IF FLAG:�f�[�g���� == ARG
	FLAG:�f�[�g���� = 0
	TFLAG:�f�[�g�O�D���x = 0
	CFLAG:ARG:�f�[�g�� = MAIN_MAP
ENDIF
;�E��ֈړ�
SIF CFLAG:ARG:�E�� && SHIRAHU(ARG)
	CFLAG:ARG:���݈ʒu = CFLAG:ARG:�E��
SIF CFLAG:ARG:�E�� == 49 && !TCVAR:ARG:�D�� && (BASE:ARG:���C > (MAXBASE:ARG:���C / 10) * 8)
	CALL ENKAI_DRUNK(ARG)
CFLAG:ARG:�s�� = 5
IF TCVAR:ARG:���ւ�
	CALL OKIGAE(ARG,TCVAR:ARG:���ւ�)
ENDIF
;FileName_JOB.ERB ----------------------------- Rev1.00
;�d���I������
;CALL		USER
;ARG		�L����NO
;RETURN		VOID
;COMMENT
;-----------------------------------------------------------
@CHARA_JOBEND(ARG)
;�d����f�B���CSET
SIF CFLAG:ARG:�s�� == 5
	CALL SET_DERAY(3,ARG)

;�d���ʂ�0�ɂ���
SIF CFLAG:ARG:�s�� == 5
	BASE:ARG:�d���� = 0
;���̃^�C�~���O�Ŕ�J�ǉ�
CALL ADD_TIRED(ARG, MAXBASE:ARG:�d���� / 2)

;�d�����t���OOFF
CFLAG:ARG:�s�� = 0
IF CFLAG:ARG:���݈ʒu == CFLAG:ARG:�E�� && CFLAG:ARG:�E�� != 51
	SELECTCASE CFLAG:ARG:�E��
	CASE 46
		IF CFLAG:ARG:���݈ʒu == CFLAG:MASTER:���݈ʒu
			PRINTFORMW %CALLNAME:ARG%�͗V�яI���܂����B
			;�����l����
			SIF CFLAG:ARG:����Q�� == 0
				CALL KOJO_MESSAGE_SEND("EVENT",13,ARG,3,0)
		ENDIF
	CASE 48
		IF CFLAG:ARG:���݈ʒu == CFLAG:MASTER:���݈ʒu
			PRINTFORMW %CALLNAME:ARG%�̉���̏������I���܂����B
			SIF ARG == 1
				PRINTL �@����ꂢ��
		ENDIF
		IF DAY == FLAG:�J�n�� && TIME >= FLAG:33
			CALL ENKAI_START(ARG)
		ELSEIF FLAG:����J�Ãt���O >= 98
			CALL ENKAI_START(ARG)
		ENDIF
	CASE 49
		CALL ENKAI_DRUNK(ARG)
	CASE 50
		IF CFLAG:ARG:���݈ʒu == CFLAG:MASTER:���݈ʒu
			PRINTFORMW %CALLNAME:ARG%�̉���̕ЂÂ����I���܂����B
			SIF ARG == 1
				PRINTL �@����ꂢ��
		ENDIF
		CFLAG:ARG:�E�� = 0
		CFLAG:ARG:����Q�� = 3
		CALL CHARA_JOBEND_GO_HOME(ARG)
	CASEELSE
		IF CFLAG:ARG:���݈ʒu == CFLAG:MASTER:���݈ʒu
			PRINTFORMW %CALLNAME:ARG%��%GET_JOBNAME(ARG)%���I���܂����B
			;�����l����
			CALL KOJO_MESSAGE_SEND("EVENT",13,ARG,3,0)
			IF MAXBASE:ARG:�d���� < (TCVAR:ARG:��`������ * 3) && TCVAR:ARG:����
				PRINTFORMW %CALLNAME:ARG%����%ITEMNAME:(TCVAR:ARG:����)%������
				ITEM:(TCVAR:ARG:����) ++
			ENDIF
		ENDIF
		IF CFLAG:ARG:���݈ʒu / 100 != MAIN_MAP && !CFLAG:ARG:�_�ЍݏZ && VISIT(ARG)
			IF !RAND:15
				CALL ��l�������֌�����(ARG)
			ELSEIF CFLAG:ARG:���݈ʒu == CFLAG:MASTER:���݈ʒu && CAN_DATE(ARG)
				PRINTFORML %CALLNAME:ARG%���f�[�g�ɗU�������H
				CALL ASK_YN
				IF !RESULT
					CALL �O�o�悩��U���邩(ARG)
					IF RESULT
						CFLAG:MASTER:���s = 60
						CFLAG:ARG:���s = 60
						CFLAG:ARG:�f�[�g�� = CFLAG:MASTER:���݈ʒu / 100
						FLAG:�f�[�g���� = ARG
						TFLAG:�f�[�g�O�D���x = CFLAG:ARG:�D���x
						TIME += 1
						PRINTFORMW �d�����I����%CALLNAME:ARG%�ƃf�[�g���邱�Ƃɂ���
						;�K�v���킩��񂪈ꉞ
						RETURN
					ENDIF
				ENDIF
			ENDIF
		ENDIF
		CALL CHARA_JOBEND_GO_HOME(ARG)
	ENDSELECT
ENDIF

@CHARA_JOBEND_GO_HOME(ARG)
IF CFLAG:ARG:�_�ЍݏZ && !AT_HOME(ARG)
	SIF CFLAG:ARG:���݈ʒu == CFLAG:MASTER:���݈ʒu
		PRINTFORMW %CALLNAME:ARG%��%GET_MAPNAME(MAIN_MAP)%�֋A���čs����
	CFLAG:ARG:���݈ʒu = MAXROOM
ENDIF

path: 原版+前人整合等各种readme/パッチ/eraTW4.632_宴会会場修正パッチ/ERB/MOVEMENTS/JOB_仕事開始終了処理.ERB


code:
;----------------------------
;������1��Ԃ��L������MOVEMENT�֌W�̏�������؍s��Ȃ�
;----------------------------
@MOVEMENT�X�L�b�v����(ARG)
#FUNCTION
SIF TALENT:ARG:�ϑz�̎Y��
	RETURNF 1
SIF FLAG:�����f�[�g���� == ARG && GET_MAPID(CFLAG:MASTER:���݈ʒu) != MAIN_MAP
	RETURNF 1
SIF CFLAG:ARG:�o��
	RETURNF 1
RETURNF 0

;----------------------------
;MASTER�܂ޑS�ẴL�����ɓK�p
;���Ԍo�߂ɂ�鎩�R�ϓ��A��b�ݐϓx�A���C�̏���
;----------------------------
@MOVEMENT���ʏ���(ARG)
;BASE�̎��R�ϓ�
CALL BASE���R�ϓ�(ARG)

;��b�ݐϒl�i100�ȏ��b����Ǝ��Ԍo��100���o�߂܂ŉ�b�s�\�j
SIF TCVAR:ARG:301 > 100
	TCVAR:ARG:302 = 1
TCVAR:ARG:301 = MAX(TCVAR:ARG:301 - TIME_PROGRESS(TIME:1) , 0)
;�����o�߂ŗݐϒl��0�ɂȂ������b�\
SIF TCVAR:ARG:301 == 0
	TCVAR:ARG:302 = 0

;�g�̂̐����x
LOCAL = CFLAG:ARG:���C

;DEBUGPRINTFORML �yMOVEMENT�zBATH_NO:{ARG} , {LOCAL} , \@ CFLAG:ARG:���݈ʒu == BATHROOM() ? in_BATH # {CFLAG:ARG:���݈ʒu} \@

;IF BATHCHECK(CFLAG:ARG:���݈ʒu) && GET_MAPID(CFLAG:ARG:���݈ʒu) == MAIN_MAP
IF BATHROOM(CFLAG:ARG:���݈ʒu) && GET_MAPID(CFLAG:ARG:���݈ʒu) == MAIN_MAP
	;���L�ϐ����Ⴂ�قǒ����C�i���C�t���O��������ɂ����j,������̉���͑��30���Ő��
	CFLAG:ARG:���C = MAX(CFLAG:ARG:���C - TIME_PROGRESS(TIME:1) * (50 + TALENT:ARG:���L�ϐ� * 15), 0)
ELSE
	;�������܂Œ~��
	CFLAG:ARG:���C = MIN(CFLAG:ARG:���C + TIME_PROGRESS(TIME:1), 2500)
ENDIF

;�������֎~���Ԃ̌���
IF TCVAR:ARG:�������֎~���� > 0
	TCVAR:ARG:�������֎~���� = MAX(TCVAR:ARG:�������֎~���� - TIME_PROGRESS(TIME:1), 0)
ENDIF

;----------------------------
;�s�K�؂Ȉʒu�ɂ���L������ʂ̏ꏊ�ֈړ�������
;----------------------------
@�����ړ�(ARG)
;���Ԓ�~���������Ȃ�
IF !FLAG:70
	;���J�S�ɓ���Ȃ��L�����𒎃J�S����ǂ��o��
	IF CFLAG:ARG:���݈ʒu == 54 && TALENT:ARG:�̌^ > -5
		CFLAG:ARG:���݈ʒu = 9
	ENDIF

	;���_�̊O�ɐ��㒆�̃L����������ꍇ�X�L�}�ɑ���
	IF CFLAG:ARG:����
		SIF GET_MAPID(CFLAG:ARG:���݈ʒu) != MAIN_MAP
			CFLAG:ARG:���݈ʒu = SUKIMA()
	ENDIF
ENDIF

;----------------------------
;�L�������������ԑт��ǂ������擾 �����Q�Ȃǂ��܂�
;@��������(ARG)�Ƃ͋������قȂ�̂Œ���
;----------------------------
@�L�����ʏA�Q����(ARG)
TRYCCALLFORM CHARAMOVE_DATA_{ARG}(3, ARG)
;�Ώۂ̃L�����f�[�^�Q�Əo�������Ȃ�f�t�H���g����
CATCH
	;AM1�`AM7�܂Ő���
	RETURN TIME > 60 && TIME < 420
ENDCATCH
RETURN RESULT

;----------------------------
;���s���̃L���������Ȃ��ɍ��킹�Ĉړ�������
;----------------------------
@���s����(ARG)
;���D�����͉\
SIF FLAG:���Ԓ�~ || CFLAG:ARG:���� || CFLAG:ARG:������ || CFLAG:ARG:����
	RETURN

;�d�����͊�{�I�ɖ����A����������Ő����Ԃ�Ă���ꍇ�͗�O
SIF CFLAG:ARG:�s�� == 5 && CFLAG:ARG:�E�� != 51
	RETURN

;���s�t���O��1���Ԏ���
SIF !CHK_DATENOW(CFLAG:ARG:�f�[�g��) && CFLAG:ARG:���s
	CFLAG:ARG:���s = MAX(CFLAG:ARG:���s - TIME_PROGRESS(TIME:1),0)
SIF CFLAG:ARG:���s || CHK_DATENOW(CFLAG:ARG:�f�[�g��)
	CFLAG:ARG:���݈ʒu = CFLAG:MASTER:���݈ʒu

;@�L�����ړ��O����(ARG)
;;���㒆
;IF CFLAG:ARG:���� || TCVAR:ARG:�D�� || CFLAG:ARG:������
;	RETURN
;ENDIF
;
;;��������(�����Ȃǂ�Ǝ�����)
;IF
;	CALL MOVEMENT_OMANEKI(ARG)
;	RETURN
;ENDIF
;
;;���Q���������������Ԓ�
;IF !CFLAG:ARG:���� && ��������(ARG)
;	;�Z�ݍ��݃L�����̉Ƃɂ����܂肵�����͋A��Ȃ��悤��97 + MAIN_MAP * 100�ɔ��
;	IF CFLAG:(ARG):���݈ʒu != 97 + MAIN_MAP * 100
;		;�f�[�g���Ȃ狭���I�ɒ��~���ċA��
;		CALL �������f�[�g���f(ARG)
;	ENDIF
;ENDIF

;------------------------------------------
;���Ԃɍ��킹�ăL�������N�����^�Q����
;------------------------------------------
@�N���A�Q����(ARG)
SIF FLAG:���Ԓ�~ || CFLAG:ARG:���� || TCVAR:ARG:�D��
	RETURN

CALL �L�����ʏA�Q����(ARG)
;�������ԑт̏ꍇ
IF RESULT
	;�N���Ă���Q������
	IF !CFLAG:ARG:���� && !CFLAG:ARG:���ӂ�
		;�f�[�g���Ȃ璋�Q�͖�������
		IF !(CHK_DATENOW(CFLAG:ARG:�f�[�g��) && !��������(ARG))
			;�Z�ݍ��݃L�����̉Ƃɂ����܂肵�����͋A��Ȃ��悤��97 + MAIN_MAP * 100�ɔ��
			IF CFLAG:ARG:���݈ʒu != 97 + MAIN_MAP * 100
				;�f�[�g���ɏA�Q���ԂɂȂ����狭���I�ɒ��~���ċA��
				CALL �������f�[�g���f(ARG)
			ENDIF
			IF !CFLAG:ARG:������ && !(CFLAG:ARG:�_�ЍݏZ && CFLAG:ARG:���݈ʒu == CFLAG:ARG:�����ʒu)
				SIF CFLAG:MASTER:���݈ʒu == CFLAG:ARG:���݈ʒu && !CFLAG:MASTER:����
					PRINTFORMW %CALLNAME:ARG%�͉ɂ�������ƁA�������ɋ����čs���܂���
			ENDIF
		ENDIF
	ENDIF
	;��l�����N�����Ȃ烁�b�Z�[�W�\��
	CALL CHARA_SLEEP, ARG, !CFLAG:MASTER:����
;�������ԑт���O��Ă���ꍇ
ELSE
	;�Q�Ă���N����
	IF CFLAG:ARG:����
		CALL CHARA_AWAKE, ARG
		;�Z�ݍ��݃L�����������̉ƂŋN�����ꍇ�A�Q���̌������Ɉړ�������
		SIF CFLAG:ARG:�_�ЍݏZ && CFLAG:ARG:���݈ʒu == 97 + MAIN_MAP * 100
			CFLAG:ARG:���݈ʒu = MAXROOM
	ENDIF
ENDIF

;------------------------------------------
;�K��t���O�������Ă���L���������Ȃ��̋��_�����Ɉړ�������
;�L�����������̉ƂɕԂ��^�ݑ�̏������s��
;------------------------------------------
@�K��A���(ARG)
SIF FLAG:���Ԓ�~ || CFLAG:ARG:���� || TCVAR:ARG:�D�� || CFLAG:ARG:������ || CFLAG:ARG:���ӂ�
	RETURN

;�Z�ݍ��݃L�����E����ɎQ������L�����͗��K�E�A��̏������s��Ȃ�
IF !CFLAG:ARG:�_�ЍݏZ && !CFLAG:ARG:����Q��
	;�������ԓ�
	IF VISIT(ARG)
		IF CFLAG:ARG:���_���K
			;���K�t���O������Ȃ��l���̋��_�ɏo��������(�d�����͖���)
			IF !AT_HOME(ARG) && !�d�����`�F�b�N(ARG)
				CALL ��l�������֌�����(ARG)
			ENDIF
		ENDIF
	;�������ԊO
	ELSE
		;�A��E�ݑ��
		CALL KITAKU(ARG)
	ENDIF
ENDIF

;------------------------------------------
;�d�����Ȃ��L�������O�o������
;------------------------------------------
@�x���ړ�����(ARG)
SIF FLAG:���Ԓ�~ || CFLAG:ARG:���� || TCVAR:ARG:�D�� || CFLAG:ARG:���� || CFLAG:ARG:������ || CFLAG:ARG:���ӂ�
	RETURN

;�_�Ђɍs���\��̃L�����A�����d���̂���L�����A�_�ЂɏZ��ł���L�����͖���
SIF CFLAG:ARG:���_���K || �d�����`�F�b�N(ARG) || CFLAG:ARG:�_�ЍݏZ
	RETURN

;�K�⎞�Ԃł܂��ړ����Ă��Ȃ��ꍇ
IF VISIT(ARG) && !CFLAG:ARG:�x���ړ���
	CFLAG:ARG:�x���ړ��� = 1
	LOCAL = 0
	IF CFLAG:ARG:���݈ʒu == CFLAG:MASTER:���݈ʒu
		;�����܂肷��ƋN���錻�ہi�A���L�������l������Ɩʓ|�Ȃ��ƂɁj
		LOCAL = 1
	ENDIF
	;�S�����ʂ̏���
	CFLAG:ARG:���݈ʒu = CFLAG:ARG:�����ʒu ? CFLAG:ARG:�����ʒu # SUKIMA()
	CFLAG:ARG:���s = 0
	;�A�����O������L�����p�̏���
	TRYCALLFORM CHARAMOVE_DATA_{ARG}(1,ARG)
	IF CFLAG:ARG:���݈ʒu != CFLAG:MASTER:���݈ʒu && LOCAL
		PRINTFORMW %CALLNAME:ARG%�͂ǂ����֏o�|�����悤��
	ENDIF
ENDIF

;------------------------------------------
;�d�����Ȃ�1��Ԃ�
;@WORKING�Ƃ͋������Ⴄ�̂Œ���
;------------------------------------------
@�d�����`�F�b�N(ARG)
#FUNCTION
SIF TCVAR:ARG:�d���J�n >= 0 && BETWEENTIME(TCVAR:ARG:�d���J�n,TCVAR:ARG:�d���I��) && BASE:ARG:�d���� > 0
	RETURNF 1
RETURNF 0

;------------------------------------------
;�����Ɏd���̗\�肪����Ȃ�1��Ԃ�
;@WORKING�Ƃ͋������Ⴄ�̂Œ���
;------------------------------------------
@�d�����`�F�b�N(ARG)
#FUNCTION
SIF TCVAR:ARG:�d���J�n >= 0
	RETURNF 1
RETURNF 0

@��l�������֌�����(ARG)
;�����܂肷��ƋN���錻��
IF CFLAG:ARG:���݈ʒu == CFLAG:MASTER:���݈ʒu && !CHK_DATENOW(CFLAG:ARG:�f�[�g��)
	IF CFLAG:�ԓx && !FLAG:�f�[�g����
		PRINTFORMW %CALLNAME:ARG%��%GET_MAPNAME(MAIN_MAP)%�ɍs�������悤��
		PRINTL [0] - �ꏏ�ɍs���@[1] - ������
		INPUT
		IF !RESULT
			PRINTFORMW %CALLNAME:ARG%��A��ċA�邱�Ƃɂ���
			CALL �A��̎��Ԍo��
			CALL SET_DATE(99,ARG)
			CFLAG:ARG:���݈ʒu = ENTRANCE
			CFLAG:MASTER:���݈ʒu = ENTRANCE
			CFLAG:ARG:�f�[�g�� = MAIN_MAP
			CFLAG:MASTER:�f�[�g�� = MAIN_MAP
			CFLAG:ARG:���s = 60
			CFLAG:MASTER:���s = 60
			IF TARGET == 93 && !GETBIT (FLAG:�v�[��, 0)
				TIME += 30
				BASE:MASTER:�̗� = MAX(BASE:MASTER:�̗� - 500,500)
			ENDIF
		ELSE
			PRINTFORMW %CALLNAME:ARG%��%GET_MAPNAME(MAIN_MAP)%�ɏo�|����
			IF CFLAG:ARG:(450 + MAIN_MAP)
				CFLAG:ARG:���݈ʒu = CFLAG:ARG:(450 + MAIN_MAP)
			ELSE
				CFLAG:ARG:���݈ʒu = MAXROOM
			ENDIF
		ENDIF
	ELSE
		PRINTFORMW %CALLNAME:ARG%��%GET_MAPNAME(MAIN_MAP)%�ɏo�|�����悤��
		IF CFLAG:ARG:(450 + MAIN_MAP)
			CFLAG:ARG:���݈ʒu = CFLAG:ARG:(450 + MAIN_MAP)
		ELSE
			CFLAG:ARG:���݈ʒu = MAXROOM
		ENDIF
	ENDIF
ELSE
	IF CFLAG:ARG:(450 + MAIN_MAP)
		CFLAG:ARG:���݈ʒu = CFLAG:ARG:(450 + MAIN_MAP)
	ELSE
		CFLAG:ARG:���݈ʒu = MAXROOM
	ENDIF
	SIF GETBIT(TALENT:MASTER:���ꏊ�@�m, 1) && AT_HOME(MASTER) == 1 && !CFLAG:MASTER:���� && !CFLAG:MASTER:���ӂ�
		PRINTFORMW �y%CALLNAME:ARG%���K��Ă����悤���z
ENDIF
CALL EX_COSTUME(ARG, "�������f�[�g")

;------------------------------------------
;�d���≃��̊J�n�^�o�߁^�I���⃁�b�Z�[�W�̕\�����s��
;------------------------------------------
@�d�������(ARG)
SIF FLAG:���Ԓ�~ || CFLAG:ARG:���� || CFLAG:ARG:������ || CFLAG:ARG:����
	RETURN

IF TCVAR:ARG:�D��
	;����Ő����Ԃꂽ�ꍇ�̓��b�Z�[�W�̂ݕ\�����Ė߂�
	IF CFLAG:ARG:�E�� == 51 && CFLAG:ARG:���݈ʒu == TFLAG:����� && CFLAG:MASTER:���݈ʒu == CFLAG:ARG:���݈ʒu
		CALL ����`��(ARG)
	ENDIF
	RETURN
ENDIF

IF !CFLAG:ARG:���ӂ� || WORKING(ARG) || (CFLAG:ARG:���ӂ� == 2 && CFLAG:ARG:����Q�� == 2)
	;����ԑьĂяo��
	IF CFLAG:ARG:����Q�� == 1 || CFLAG:ARG:����Q�� == 2
		CALL ENKAI_WORK(ARG)

	;������ɗ����������߂Â����L�����͈��m���ŉ���ɉ����
	ELSEIF FLAG:�Q���l�� >= 2 && (CFLAG:ARG:���݈ʒu == TFLAG:����� || CAN_MOVE(CFLAG:ARG:���݈ʒu, TFLAG:�����) >= 2) && !CFLAG:ARG:���ӂ�
		IF CFLAG:ARG:����Q�� == 0 && RAND:5 < 4 && FLAG:30 >= 98 && TIME_PROGRESS(TIME:1)
			IF CFLAG:MASTER:���݈ʒu == TFLAG:�����
				IF FLAG:�Q���l�� >= 8
					PRINTFORMW �y�����ȗl�q�ɁA%CALLNAME:ARG%������ɉ�������I
				ELSE
					PRINTFORMW �l�q�����Ă���%CALLNAME:ARG%�́A���̂܂܉���ɉ�������I
				ENDIF
			ENDIF
			CFLAG:ARG:����Q�� = 1
			CALL ENKAI_START(ARG)
		ENDIF
	ENDIF

	;�f�[�g���肪����₻�̏����ɉ�������ꍇ�A�f�[�g�͋����I�ɒ��~
	IF GROUPMATCH(CFLAG:ARG:�E��, 48, 49, 50, 51) && CHK_DATENOW(CFLAG:ARG:�f�[�g��)
		PRINTFORMW %CALLNAME:ARG%�Ƃ̃f�[�g�͈�U���J���ɂ��邱�Ƃɂ���
		CFLAG:ARG:�f�[�g�� = MAIN_MAP
		FLAG:�f�[�g���� = 0
		TFLAG:�f�[�g�O�D���x = 0
		CFLAG:ARG:���s = 0
	ENDIF

	;����̕Еt���\�肪�����Ă���L�����͎肪�󂫎���Еt���J�n
	IF CFLAG:ARG:�Еt���d����
		IF CFLAG:ARG:�s�� == 0 && FLAG:�Q���l�� == 0
			CALL ENKAI_KATAZUKE(ARG)
			CFLAG:ARG:�Еt���d���� = 0
			CFLAG:ARG:�Еt���ꏊ = 0
		ENDIF
	ENDIF

	;�d�����Ԓ��A����Q�����A��������Ȃ��CHARA_JOBSTR(ARG)
	IF WORKING(ARG) || (GROUPMATCH(CFLAG:ARG:�E��, 48, 49, 50) && BASE:ARG:�d���� > 0) || GROUPMATCH(CFLAG:ARG:�E��, 51)
		CALL CHARA_JOBSTR(ARG)
	;�d���I�����Ă���ΏI������
	ELSEIF CFLAG:ARG:�s�� == 5
		CALL CHARA_JOBEND(ARG)
	ENDIF
ENDIF

@�������f�[�g���f(ARG)
IF CHK_DATENOW(CFLAG:ARG:�f�[�g��)
	IF CFLAG:ARG:����
		PRINTFORMW %CALLNAME:ARG%�͂�������Ƃ��Ė����������c
	ELSE
		PRINTFORMW %CALLNAME:ARG%�͂����A���Ė��鎞�Ԃł��c
	ENDIF
	IF GET_MAPID(CFLAG:ARG:����ʒu) == MAIN_MAP
		PRINTFORMW �ꏏ��%GET_MAPNAME(MAIN_MAP)%�֋A�邱�Ƃɂ��܂���
		CALL SET_DATE(99, ARG)
	ELSE
		CALL ASK_YN("�Ƃ܂ő���","���̏�ŕʂ��")
		IF RESULT == 0
			PRINTFORMW %CALLNAME:ARG%���Ƃ܂ő���͂��邱�Ƃɂ��܂���
			CALL SET_DATE(99, ARG)
		ELSE
			PRINTFORMW %CALLNAME:ARG%�Ƃ̃f�[�g�͂��̏�ł��J���ƂȂ�܂���
			FLAG:�f�[�g���� = 0
			TFLAG:�f�[�g�O�D���x = 0
			CFLAG:ARG:�f�[�g�� = MAIN_MAP
		ENDIF
		CFLAG:ARG:���݈ʒu = CFLAG:ARG:����ʒu
	ENDIF
	CFLAG:ARG:���s = 0
ENDIF

repo_name: akadiya/eratw

license: unknown


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
TFLAG:����� = GET_JOBPLACE("����")

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
IF FLAG:�~���_�x�� >= NOW_PERIOD() && !ITEM:�~���_�̐�
	CALL COLORMESSAGE(@"���~��Ɛ肷��~���_�̐΃~���j�A���͒m���Ă�H", C_D_PINK,2)
	PRINTFORMW �����~��Ɛ肷��~���_�̐΃~���j�A�����x�����ꂽ
	ITEM:�~���_�̐� ++
	FLAG:�~���_�x�� = NOW_PERIOD()
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 ������
	;�����ł̉����������CHARA_MOVEMENT�ŕs����o�����ߏ㕔�ֈړ�
	;FLAG:32 = GET_JOBPLACE("����")
	IF TIME:3 >= FLAG:33
		FOR ����ʒu����,1,CHARANUM
			IF CFLAG:����ʒu����:����Q��
				CFLAG:����ʒu����:�E�� = TFLAG:�����
				CFLAG:����ʒu����:���݈ʒu = TFLAG:�����
			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
			SIF CFLAG:MASTER:�����ʒu == 54
				CFLAG:MASTER:�����ʒu = �f�t�H���g�����ʒu
		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) && !FLAG:70
	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 == TFLAG:�����
			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 == TFLAG:�����
		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 == TFLAG:�����
		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 == TFLAG:�����
		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 == TFLAG:�����
		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:
@EVENTTURNEND
#DIM �{���
SIF TFLAG:�ϑz��
	DELCHARA (CHARANUM - 1)
;������Ɉ�����I���Ɖ���t���OOFF
;IF DAY >= FLAG:34 && FLAG:����J�Ãt���O
IF TIME + 1440 * DAY >= FLAG:�J�n���� + 1440 * FLAG:�J�n�� && FLAG:����J�Ãt���O
	;���ƂȂ����ꏊ�͍r��ʂĂ�A���_�O�ł��Ώےn�_�̉��ꑝ�������邽�߉����ł͂Ȃ�
	SIF YOGORE:(FLAG:32) < 300
		YOGORE:(FLAG:32) += 1000
	FLAG:����J�Ãt���O = 0
	FLAG:31 = 0
	FLAG:32 = 0
	TFLAG:����� = 0
	FLAG:33 = 0
	FLAG:34 = 0
	FLAG:35 = 0
	FLAG:36 = 0
	;������\�� =
	FLAG:��������� = 0
	FOR LOCAL,0,CHARANUM
		CFLAG:LOCAL:350 = 0
		MAXBASE:LOCAL:�d���� = 0
		BASE:LOCAL:�d���� = 0
		CFLAG:LOCAL:����Q�� = 0
		CFLAG:LOCAL:�s�� = 0
	NEXT
ENDIF
;��_�t���OOFF
FLAG:17 = 0
DRAWLINE
PRINTFORML
;SETCOLOR C_PINK
;FONTBOLD
FOR LOCAL,1,CHARANUM
	;����擾
	IF ����擾����(LOCAL)
		;�ʗ�C�͓��ʂ�����
		IF LOCAL == 57
			PRINTFORMW %CALLNAME:LOCAL%��%CALLNAME:MASTER%�ւ̎v�������o����Ɠ����A�������ɂ߂�
			PRINTFORMW ���R�ȏΊ�𕂂��ׂ�%CALLNAME:LOCAL%�́A�\��𓾂��l��
			PRINTFORMW %CALLNAME:LOCAL%��\@ TALENT:LOCAL:�v�� ? [�v��] # [���~] \@��[����]�ɂȂ���
			FLAG:10 ++
		;���~�̗L���ŕ���
		ELSEIF TALENT:LOCAL:���~
			PRINTFORMW %CALLNAME:LOCAL%�͐g���S��%CALLNAME:MASTER%�ɖ�������邱�Ƃɉx�т������Ă���c
			PRINTL ࣂꂽ�֌W�̉ʂĂɎ��������S�A������܂���̗��̃J�^�`�c
			PRINTFORMW %CALLNAME:LOCAL%��[���~]��[����]�ɂȂ���
		ELSE
			PRINTFORML %CALLNAME:LOCAL%��%CALLNAME:MASTER%�Ɖ߂������ԂɍK���������Ă���悤���c
			PRINTFORMW %CALLNAME:LOCAL%��[�v��]��[����]�ɂȂ���
			FLAG:10 ++
		ENDIF
		SIF !MARK:LOCAL:�������� && !TALENT:LOCAL:���~
			CFLAG:LOCAL:�������� = 1
		TALENT:LOCAL:���� = 1
		TALENT:LOCAL:�v�� = 0
		TALENT:LOCAL:���~ = 0
		TALENT:LOCAL:�Z�t�� = 0
		CALL KOJO_MESSAGE_SEND("EVENT",21,LOCAL,1,0)
	;�v��擾
	;�Z�t���^���l�̎擾�ŕ���
	ELSEIF �v��擾����(LOCAL)
		IF TALENT:LOCAL:�Z�t��
			PRINTFORML %CALLNAME:LOCAL%��%CALLNAME:MASTER%�̐g�̈ȊO�̂��Ƃɂ��������L��悤��
			PRINTFORMW %CALLNAME:LOCAL%��[�v��]�𓾂�
		ELSE
			PRINTFORML %CALLNAME:LOCAL%��%CALLNAME:MASTER%�̂��Ƃ��C�ɂȂ�悤���c
			PRINTFORMW %CALLNAME:LOCAL%��[�v��]�𓾂�
		ENDIF
		TALENT:LOCAL:�v�� = 1
		CALL KOJO_MESSAGE_SEND("EVENT",21,LOCAL,2,0)
	;���~�擾
	;��d���y�̕��򂪂܂��Ȃ��̂ŁA�擾�����ɕ���
	ELSEIF ���~�擾����(LOCAL)
		;�v�玝���A�S���g�̂�I�񂾓I��
		IF TALENT:LOCAL:�v��
			PRINTFORML %CALLNAME:LOCAL%��%CALLNAME:MASTER%�ƐS�ȏ�ɑ̂̂Ȃ���ɖ������Ă���悤���c
			PRINTFORML �ڂɌ����Ȃ��J�����ڂɌ�����؂�~���Ă��ꂩ����g�̂��d�˂�̂��낤
			PRINTFORMW %CALLNAME:LOCAL%��[���~]�𓾂�
		ELSE
			PRINTFORML %CALLNAME:LOCAL%��%CALLNAME:MASTER%�Ƃ̏�~�ɂ��ڂ�Ă���悤���c
			PRINTFORMW %CALLNAME:LOCAL%��[���~]�𓾂�
		ENDIF
			FLAG:10 ++
			TALENT:LOCAL:���~ = 1
			TALENT:LOCAL:�v�� = 0
			CALL KOJO_MESSAGE_SEND("EVENT",21,LOCAL,3,0)
	;�Z�t���^���l�擾
	;�Z�t���ƈ��l�̈Ⴂ�͎v��̗L��
	ELSEIF �Z�t���擾����(LOCAL)
		;�v��擾�ρ{�Z�t�����擾
		IF TALENT:LOCAL:�v�� && !TALENT:LOCAL:�Z�t��
			PRINTFORML %CALLNAME:LOCAL%��%CALLNAME:MASTER%�ƂȂ���y�ɓM��Ă������Ǝv���n�߂��悤���c
			PRINTFORMW %CALLNAME:LOCAL%��%CALLNAME:MASTER%��[���l]�ɂȂ���
			TALENT:LOCAL:�Z�t�� = 2
			CALL KOJO_MESSAGE_SEND("EVENT",21,LOCAL,4,0)
		;�v��擾�ρ{�Z�t���擾��
		ELSEIF TALENT:LOCAL:�v�� && TALENT:LOCAL:�Z�t�� == 1
			PRINTFORML %CALLNAME:LOCAL%��%CALLNAME:MASTER%�ɒP�Ȃ���̊֌W�ȏ�̂��̂�]��ł���悤���c
			PRINTFORMW %CALLNAME:LOCAL%��[���l]�ɂȂ���
			TALENT:LOCAL:�Z�t�� = 2
			CALL KOJO_MESSAGE_SEND("EVENT",21,LOCAL,4,0)
		;�v�疢�擾�{�Z�t�����擾�Ȃ�܂��Z�t���擾
		ELSEIF !TALENT:LOCAL:�Z�t��
			PRINTFORML %CALLNAME:LOCAL%��%CALLNAME:MASTER%����^��������y�ɓM�����c
			PRINTFORMW %CALLNAME:LOCAL%��%CALLNAME:MASTER%��[�Z�t��]�ɂȂ��Ă��܂���
			TALENT:LOCAL:�Z�t�� = 1
			CALL KOJO_MESSAGE_SEND("EVENT",21,LOCAL,5,0)
		ENDIF
	ENDIF

	IF EXP:LOCAL:�L�X�o�� > 300 && ABL:LOCAL:�l���o > 5 && !TALENT:LOCAL:�L�X��
		PRINTFORMW %CALLNAME:LOCAL%��[�L�X��]�𓾂�
		TALENT:LOCAL:�L�X�� = 1
	ENDIF
	IF EXP:LOCAL:�������Ԍo�� > 200 && EXP:LOCAL:���Ԍo�� > 500 && !TALENT:LOCAL:���ԋ���
		PRINTFORMW %CALLNAME:LOCAL%��[���ԋ���]�𓾂�
		TALENT:LOCAL:���ԋ��� = 1
	ENDIF
	IF EXP:LOCAL:�q�{���J���o�� > 50 && !TALENT:LOCAL:�|���`�I����
		PRINTFORML �J��Ԃ��q�{�����U�߂�ꂽ%CALLNAME:LOCAL%�́A��ɂ������y��������悤�ɂȂ��Ă����悤���c
		PRINTFORMW %CALLNAME:LOCAL%��[�|���`�I����]�𓾂�
		TALENT:LOCAL:�|���`�I���� = 1
	ENDIF
	IF EXP:LOCAL:���t�o�� >= 1000 && ABL:LOCAL:�Z�I > 3 && !TALENT:LOCAL:���y�m��
		PRINTFORMW %CALLNAME:LOCAL%�͊y�퉉�t�ɑ��w���[���Ȃ���
		PRINTFORMW %CALLNAME:LOCAL%��[�y��m��]�𓾂�
		;PRINTFORMW %CALLNAME:LOCAL%�͉��y�ɑ��w�[���Ȃ���
		;PRINTFORMW %CALLNAME:LOCAL%��[���y�m��]�𓾂�
		TALENT:LOCAL:���y�m�� = 1
	ELSEIF EXP:LOCAL:���t�o�� >=5000 && !TALENT:LOCAL:����
		PRINTFORMW %CALLNAME:LOCAL%�̉����͂��Ȃ�b�����Ă����悤��
		PRINTFORMW %CALLNAME:LOCAL%��[���Ή���]�𓾂�
		TALENT:LOCAL:���� = 1
	ENDIF
	IF CFLAG:LOCAL:�s�@��
		CFLAG:LOCAL:�s�@�� --
		IF !CFLAG:LOCAL:�s�@��
			SIF MARK:LOCAL:��������
				CFLAG:LOCAL:�s�@�� ++
		ENDIF
	ENDIF
	;EX�L�����̗��玞�̓����o�[�ǉ��C�x���g�t���O�𗧂Ă�
	IF LOCAL >= 11 && LOCAL <= CHARANUM && LOCAL != 57 && LOCAL != 71
		SIF TALENT:LOCAL:���� && EXP:LOCAL:����o�� >= 200
			FLAG:1 = 3
	ENDIF
NEXT

IF EXP:MASTER:�ُ퐴�|�o�� > (500 + 100 * FLAG:850) && ABL:MASTER:���|�Z�\ > 3 && !TALENT:MASTER:���|����
	PRINTFORMW %CALLNAME:MASTER%�͋��낵�����ƂɋC�t���Ă��܂���
	PRINTFORMW �Q�Ă��o�߂Ă��A�����~�߂Ă���Ԃ��A���������Ɣ����d�˂Ă��鎞�ł���A
	PRINTFORMW �������U�炩���Ă��Ȃ����C�ɂȂ��Ďd�����Ȃ��̂�
	PRINTFORMW ���͂�%CALLNAME:MASTER%�̐S�����炮�̂͂������đ|�������Ă���Ԃ̂�
	PRINTFORMW %CALLNAME:MASTER%�̑|���ւ̂������́A���Ԃ��̂��Ȃ���ɒB���Ă���
	PRINTFORMW %CALLNAME:MASTER%��[���|����]�𓾂�
	TALENT:MASTER:���|���� = 1
ENDIF
;MASTER�������S���̃v���Z�b�g����
FOR LOCAL,1,CHARANUM
	;�C�͂̉�
	BASE:LOCAL:�C�� = MAXBASE:LOCAL:�C��

	LOCAL:1 = MAXBASE:LOCAL:�̗� / 3

	;�񕜑����A�񕜒x��
	LOCAL:1 = LOCAL:1 * 3 / (3 - TALENT:LOCAL:�񕜑��x)

	;�Y���Q���Ă���񕜑��x����
	SIF CFLAG:LOCAL:�Y���Q��
		LOCAL:1 *= 2
	SIF CFLAG:LOCAL:�O��
		LOCAL:1 /= 2
	CFLAG:LOCAL:�O�� = 0
	BASE:LOCAL:�̗� = MIN(MAXBASE:LOCAL:�̗�, BASE:LOCAL:�̗� + LOCAL:1)

	;�얳�O�J�[�h���s�҂������甭�s�t���OOFF
	CFLAG:LOCAL:328 = 0
NEXT
;�S���̃v���Z�b�g����
FOR LOCAL,1,CHARANUM
	BASE:LOCAL:���� = MIN(MAXBASE:LOCAL:����, BASE:LOCAL:���� + MAXBASE:LOCAL:���� * BASE:LOCAL:�̗� / MAXBASE:LOCAL:�̗�)

	;�B�����̃L������������t���OOFF
	CALL SET_SNEAK(0,LOCAL,1)
	;CFLAG:LOCAL:�B���� = 0

	;�C�^�Y�����̃L������������t���OOFF
	CALL SET_PRANK(0,LOCAL,1)
	;CFLAG:LOCAL:�C�^�Y�� = 0

NEXT

;����̊J�Ô���
SIF FLAG:3 && FLAG:����J�Ãt���O == 0
	CALL ENKAI_SETTING

IF CFLAG:MASTER:�玙�l��
	�{��� = CFLAG:MASTER:�玙�l�� * 1000 / (1 + FLAG:�b�㐫��)
	PRINTFORML %CALLNAME:MASTER%�͎q���̗{���Ƃ���\\{�{���}�x�������B
	MONEY -= �{���
ENDIF

CALL RANK_POINT
PRINTW

FLAG:0 = 0

BEGIN SHOP

@RANK_POINT
VARSET LOCAL
;�����x
LOCAL:2 = EX:MASTER:�����̑|���� / 10
PRINTFORML �����|�������S�~�̗�{EX:MASTER:�����̑|����}
PRINTFORML ���|�ɂ��{�[�i�X \\{LOCAL:2}
IF DAY:2 == 4 && DAY:3 == 31
	PRINT (x2)  �y��|���{�[�i�X�z
	LOCAL:2 *= 2
ENDIF
;���_�̎�̍D���x�ƐM���x���㏸
LOCAL:3 = MIN(10, EX:MASTER:�����̑|���� / 2000)
IF LOCAL:3
	PRINTFORML �|�����撣�������ƂŁA%CALLNAME:���__���%����̕]�����オ����
	CFLAG:���__���:�D���x += LOCAL:3 * 2
	CFLAG:���__���:�M���x += LOCAL:3
ENDIF
PRINTL
;��`����V
LOCAL:4 = TCVAR:MASTER:��`������

SIF LOCAL:4 > 0
	PRINTFORML �d����`���ɂ��{�[�i�X \\{LOCAL:4}

MONEY += LOCAL:2 + LOCAL:4

;�D���x�㏸
IF FLAG:12 && MONEY:2 < CM_LIMIT
	LOCAL:5 = MAX(1,FLAG:12 / 100)
	LOCAL:5 = MIN(LOCAL:5, CM_LIMIT - MONEY:2)
	PRINTFORML �D���x�㏸�{�[�i�X �{{LOCAL:5}�J���X�}
	MONEY:2 += LOCAL:5
	PRINTFORML ���݂̃J���X�}�F{MONEY:2}�@�J���X�}�ۗL����F{CM_LIMIT}
ENDIF
FLAG:12 = 0

PRINTW

@����擾����(ARG)
#FUNCTION
SIF TALENT:ARG:����
	RETURNF 0
SIF CFLAG:ARG:�D���x < REQUIRED_FAVOR_����
	RETURNF 0
SIF CFLAG:ARG:�M���x < REQUIRED_TRUST_����
	RETURNF 0
SIF ABL:ARG:�e�� < REQUIRED_AFFECTION_����
	RETURNF 0
SIF MARK:ARG:��������
	RETURNF 0
SIF TALENT:ARG:���~ && !FLAG:�ח��H���ω�
	RETURNF 0
RETURNF 1

@�v��擾����(ARG)
#FUNCTION
SIF TALENT:ARG:���~
	RETURNF 0
SIF TALENT:ARG:����
	RETURNF 0
SIF TALENT:ARG:�v��
	RETURNF 0
SIF CFLAG:ARG:�D���x < REQUIRED_FAVOR_�v��
	RETURNF 0
SIF CFLAG:ARG:�M���x < REQUIRED_TRUST_�v��
	RETURNF 0
SIF ABL:ARG:�e�� < REQUIRED_AFFECTION_�v��
	RETURNF 0
SIF TALENT:ARG:�Z�t�� && !FLAG:�ח��H���ω�
	RETURNF 0
RETURNF 1

@���~�擾����(ARG)
#FUNCTION
SIF TALENT:ARG:����
	RETURNF 0
SIF TALENT:ARG:���~
	RETURNF 0
SIF !TALENT:ARG:�Z�t��
	RETURNF 0
SIF CFLAG:ARG:�D���x < REQUIRED_FAVOR_���~
	RETURNF 0
SIF ABL:ARG:�~�] < REQUIRED_DESIRE_���~
	RETURNF 0
SIF (EXP:ARG:�Ⓒ�o�� - EXP:ARG:�����o�Ⓒ�o��) < REQUIRED_ECSTACY_���~
	RETURNF 0
SIF (ABL:ARG:�~�] - ABL:ARG:�e��) < 1
	RETURNF 0
RETURNF 1

@�Z�t���擾����(ARG)
#FUNCTION
SIF TALENT:ARG:���l
	RETURNF 0
SIF TALENT:ARG:����
	RETURNF 0
SIF TALENT:ARG:�Z�t�� == 2
	RETURNF 0
SIF CFLAG:ARG:�D���x <= REQUIRED_FAVOR_�Z�t��
	RETURNF 0
SIF ABL:ARG:�~�] < REQUIRED_DESIRE_�Z�t��
	RETURNF 0
SIF (EXP:ARG:�Ⓒ�o�� - EXP:ARG:�����o�Ⓒ�o��) < REQUIRED_ECSTACY_�Z�t��
	RETURNF 0
SIF (ABL:ARG:�~�] - ABL:ARG:�e��) < 0
	RETURNF 0
RETURNF 1


code:
@HININSHITE(ARG)

IF ESTRUS_CYCLE(ARG) == 150
	LOCALS = �댯����
ELSEIF ESTRUS_CYCLE(ARG) != 15
	LOCALS = ���S������Ȃ�
ENDIF

IF TALENT:ARG:153
	;PRINTL Feed
	IF CFLAG:ARG:�D�P�o�ߓ��� <= 30
		PRINTFORML %CALLNAME:ARG%�͂܂��̂��s���Ȃ̂ň�����܂ő҂��ė~�����ƌ����Ȃ���}�������₵���B
		TFLAG:16 = 1
	ELSEIF CFLAG:ARG:�D�P�o�ߓ��� >= 71
		PRINTFORML %CALLNAME:ARG%�o�Y���߂��Ȃ����̂ŏo�Y�܂ő҂��ė~�����ƌ����Ȃ���}�������₵���B
		TFLAG:16 = 1
	ENDIF
	RETURN 0
ENDIF
;WAIT

IF CFLAG:ARG:�玙�l�� >= 1 && CFLAG:ARG:�玙�l�� <= 3
	PRINTFORML %CALLNAME:ARG%�͂���ȏ�̂��ǂ��𓯎��Ɉ�Ă�̂͂������ɖ����Ȃ̂�
	PRINTFORML �����Ɣ�D���Ăق����ƌ����Ă����c
ELSE
	PRINTFORML %CALLNAME:ARG%�͍�����%LOCALS%�̂ł����Ɣ�D���Ăق����ƌ����Ă����c
ENDIF

IF CFLAG:ARG:������ < 2
	CALL KOJO_MESSAGE_SEND("EVENT",18,TARGET,1,0)
ELSE
	CALL KOJO_MESSAGE_SEND("EVENT",31,TARGET,0,0)
ENDIF

WAIT
PRINTFORML [1] �R���h�[��������i�c��{ITEM:45}���j
PRINTFORML [2] �s����n���i�c��{ITEM:49}���j
SIF !TCVAR:���� && !CFLAG:ARG:�玙�l��
PRINTL [3] �i�}�ł�点�ĉ��������肢���܂�
SIF (TEQUIP:TARGET:�� || TEQUIP:TARGET:�S��) && !CFLAG:ARG:�玙�l��
PRINTL [4] ������D�P�����͐�΂��ĖႤ
SIF CFLAG:ARG:�玙�l�� && CFLAG:ARG:�q��Ē����� == 0
PRINTL [5] �{���ɔ�D���Ăق����������Ă݂�

PRINTL [0] ������߂�
$LOOP
INPUT
IF RESULT == 1
	IF !ITEM:45
		PRINTL �R���h�[���������Ă��Ȃ�
		GOTO LOOP
	ELSE
		ITEM:45 -= 1
		PRINTL �R���h�[��������
		TEQUIP:MASTER:�R���h�[�� = 1
	ENDIF
ELSEIF RESULT == 2
	IF !ITEM:49
		PRINTL �s���������Ă��Ȃ�
		GOTO LOOP
	ELSE
		ITEM:49 -= 1
		TCVAR:ARG:�s�� = 1
		PRINTFORML %CALLNAME:ARG%�Ƀs��������ł������
	ENDIF
ELSEIF RESULT == 3 && !CFLAG:ARG:�玙�l��
	TCVAR:ARG:���� = 1
	CALL OGAMITAOSHI(ARG)
ELSEIF RESULT == 4 && !CFLAG:ARG:�玙�l��
	TCVAR:ARG:����� = 1
ELSEIF RESULT == 5 && CFLAG:ARG:�玙�l��
	CALL NAMA_POISONING(ARG)
ELSE
	TFLAG:16 = 3
	TFLAG:17 = ARG
ENDIF
RETURN 0

@��D�v��(ARG)
IF �D�P��(ARG) && TALENT:MASTER:2 & 2 && !TFLAG:16 && !TALENT:ARG:���m && !TCVAR:ARG:����� && !TCVAR:ARG:�D��
	IF !CFLAG:ARG:������ && ESTRUS_CYCLE(ARG) != 15
		CALL HININSHITE(ARG)
	ELSEIF CFLAG:ARG:������ < 2 && ESTRUS_CYCLE(ARG) == 150
		CALL HININSHITE(ARG)
	ELSEIF TALENT:ARG:�玙�� && CFLAG:ARG:�o�Y�o�ߓ� <= 50 && !TFLAG:16 && ESTRUS_CYCLE(TARGET) != 15 && !CFLAG:ARG:�q��Ē�����
		CALL HININSHITE(ARG)
	ENDIF
ENDIF

@�D�P��(ARG)
#FUNCTION
SIF TEQUIP:PLAYER:�R���h�[�� || TCVAR:ARG:�s��
	RETURNF 0
SIF TALENT:ARG:�c�t && !TALENT:ARG:����
	RETURNF 0
SIF TALENT:ARG:�񐶕� || TALENT:ARG:�H���l || TALENT:ARG:�D�P
	RETURNF 0
RETURNF 1

path: 原版+前人整合等各种readme/パッチ/eraTW4.632_宴会会場修正パッチ/ERB/イベント関連/妊娠関連/HININSHITE.ERB


code:
@CHK_NAMA_POISONING(ARG)
#FUNCTION
LOCAL = 0

;����o���n����S�˒��łȂǂ̕������m������
;�F�X臒l���L�c������
;����p�C�x���g�́A�ꉞEVENT31�ɐݒ�B
;1�FOK
;2�FNG
;3�F�́H�H�H�i�^��j

SIF TALENT:ARG:���l
	LOCAL += 100
SIF TALENT:ARG:�����}��
	LOCAL += 300
SIF TALENT:ARG:���Ȉ� == 1
	LOCAL += 50
SIF TALENT:ARG:�|���I
	LOCAL += 100
SIF TALENT:ARG:�u���x == 1
	LOCAL += 50
SIF TALENT:ARG:�|���`�I����
	LOCAL += 100
SIF TALENT:ARG:����
	LOCAL += 150

LOCAL:3 += GETPALAMLV(PALAM:�~��,15) * (10 + TALENT:ARG:�������� * 2)
LOCAL:3 += GETPALAMLV(PALAM:����,15) * (10 - TALENT:ARG:�ԓx * 2)
IF TALENT:ARG:�}�]
	LOCAL:3 += GETPALAMLV(PALAM:����,15) * 2
ELSE
	LOCAL:3 += GETPALAMLV(PALAM:����,15)
ENDIF

LOCAL:5 += ABL:ARG:�]�� * 5
LOCAL:5 += ABL:ARG:�~�] * (10 + TALENT:ARG:�������� * 2)
LOCAL:5 += ABL:ARG:��d���_ * 5
LOCAL:5 += ABL:ARG:�u���o * 10
LOCAL:5 += ABL:ARG:�}�]���C * 5
LOCAL:5 += ABL:ARG:���t���� * 7
LOCAL:5 += ABL:ARG:�S�˒��� * 20
LOCAL:5 += ABL:ARG:�S�˒��� * 15
LOCAL:5 += MARK:ARG:���y���� * 10
LOCAL:5 += MARK:ARG:��ɍ��� * 10
LOCAL:5 += MARK:ARG:�������� * 10

LOCAL = LOCAL:3 * LOCAL:5 / 500

RETURNF LOCAL

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

��������l = 800 + MARK:ARG:�������� * 500

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

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

IF TALENT:ARG:�c���f��
	IF TALENT:ARG:����
		��������l = ��������l / 2
	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

;�D���x
SELECTCASE CFLAG:ARG:�D���x
CASE 0 TO 2000
	��������l *= 10
CASE 2000 TO 3999
	��������l *= 8
CASE 4000 TO 5999
	��������l *= 6
CASE 6000 TO 7999
	��������l *= 4
CASE 8000 TO 9999
	��������l *= 2
CASEELSE
;	��������l *= 1
ENDSELECT

;�J�E���^�[���Ƃ����őf���������Ă���
IF ARGS == "COUNTER"
	SIF TALENT:ARG:��R
		��������l += 300
	IF TALENT:MASTER:��̖���
		��������l = ��������l * 9 / 10
	ENDIF
	IF TALENT:ARG:�v���C�h == 1
		��������l = ��������l * 7 / 5
	ENDIF
	IF OTOKOGIRAI(ARG)
		��������l = ��������l * 3 / 2
	ENDIF
	IF TALENT:ARG:�|���I
		��������l = ��������l * 9 / 10
	ENDIF

	IF ABL:ARG:�u���o > 10
		��������l = ��������l * 9 / 10
		SIF TALENT:ARG:�u���x == 1
			��������l = ��������l * 4 / 5
		SIF TALENT:ARG:�|���`�I����
			��������l = ��������l * 4 / 5
		SIF TALENT:ARG:����
			��������l = ��������l / 2
	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

@NAMA_POISONING(ARG)
#DIM ��������l
#DIM �~�]����l
#DIM �D�ӕ\��
VARSET LOCAL

PRINTFORMW %CALLNAME:ARG%�̋���

�~�]����l = CHK_NAMA_POISONING(ARG)
CALL SHOW_NAMAPOWER(�~�]����l)

WAIT
��������l = CHK_NAMA_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 || TALENT:ARG:���g�I == 1
	��������l  = ��������l * 9 / 10
	CALL COLORMESSAGE(@"%CALLNAME:ARG%�́A�����܂ŗ��݂��܂ꂽ��Ǝv���Ă��܂����c�c",C_PINK,1,1)
ELSEIF TALENT:ARG:�v���C�h == 1
	��������l = ��������l * 7 / 5
	CALL COLORMESSAGE(@"�C�ʂ̍���%CALLNAME:ARG%�́A��������Ȍ����ɕ��𗧂Ă��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 == 1
		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�����l���Ȃ������ɓ|���I�Ȗ��͂��������c�c",C_PINK,1,1)
	��������l = ��������l * 9 / 10
	CALL SHOW_REASONWALL(��������l)
ENDIF

IF ABL:ARG:�u���o > 10
	CALL COLORMESSAGE(@"%CALLNAME:ARG%�̎q�{���A�Ⴆ�悤���Ȃ��u�����c�c�I",C_PINK,1,1)
	��������l = ��������l * 9 / 10
	SIF TALENT:ARG:�u���x == 1
		��������l = ��������l * 4 / 5
	SIF TALENT:ARG:�|���`�I����
		��������l = ��������l * 4 / 5
	SIF TALENT:ARG:����
		��������l = ��������l / 2
	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_NAMA_POISONING(ARG) > ��������l
	PRINTFORMW %CALLNAME:MASTER%����̖₢�ɁA%CALLNAME:ARG%�̓����~��ɗn����
	PRINTFORMW %CALLNAME:ARG%�́A��������������c�c
	CFLAG:ARG:�q��Ē����� = 1
	;�ꉞEVENT31�ɐݒ�B
	CALL KOJO_MESSAGE_SEND("EVENT",31,TARGET,1,0)
ELSE
	PRINTFORML	%CALLNAME:ARG%�͂����ƒf����
	CALL KOJO_MESSAGE_SEND("EVENT",31,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�\ + 2 * CFLAG:ARG:�_���o��)
		LOCAL:2 = ��������l * (100 - LOCAL) / 200
		CALL SHOW_REASONWALL(LOCAL:2)
		IF CHK_NAMA_POISONING(ARG) > LOCAL:2
			PRINTFORMW %CALLNAME:MASTER%�͐��O���łǂ��ɂ�%CALLNAME:ARG%�̗~�]�������o����
			PRINTFORMW %CALLNAME:ARG%�́A��������������c�c
			CFLAG:ARG:�q��Ē����� = 1
			CALL KOJO_MESSAGE_SEND("EVENT",31,TARGET,1,0)
		ELSE
			CALL KOJO_MESSAGE_SEND("EVENT",31,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_NAMAPOWER(�~�]����l, UNIT = 100)
#DIM �~�]����l
#DIM �~�]�\��
#DIM UNIT

PRINTFORM ���n��������:
�~�]�\�� = MAX(�~�]����l / UNIT,0)
LOCALS:1 = %GETFONT()%
SETFONT "Times New Roman"
LOCAL = GETCOLOR()
PRINTFORM %UNICODE(0x2764) * MAX((�~�]�\�� / 10000 -1),0)%
RESETCOLOR
SETCOLOR 255,51,153
SIF �~�]�\�� >=10000
	PRINTFORM %UNICODE(0x2764) * (9999)%%UNICODE(0x2764)%

PRINTFORM %UNICODE(0x2764) * (�~�]�\�� % 10000)%
SETCOLOR LOCAL

SIF �~�]����l % UNIT > (UNIT / 2)
	PRINTFORML %UNICODE(0x2764)%
SETFONT LOCALS:1
PRINTW

path: 原版+前人整合等各种readme/パッチ/eraTW4.632_宴会会場修正パッチ/ERB/イベント関連/妊娠関連/NAMA_POISONING.ERB


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�� = TFLAG:�����
	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�� = TFLAG:�����
	CFLAG:ARG:���݈ʒu = TFLAG:�����
	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�� = GET_MAP_REPLACEMENT(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
TFLAG:����� = 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
������\�� =

@�����\��
#FUNCTIONS
LOCALS = �����\���G���[
IF FLAG:����J�Ãt���O
	IF IN_HOME(FLAG:32)
		LOCALS = %NAME_FROM_PLACE(FLAG:32)%
	ELSE
		LOCALS = %GET_MAPNAME(FLAG:32/100)%��%GET_PLACENAME(FLAG:32)%
	ENDIF
ENDIF
RETURNF LOCALS

@����\��
#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 == TFLAG:�����
			FLAG:�Q���l�� ++
	ENDIF
NEXT

path: 原版+前人整合等各种readme/パッチ/eraTW4.632_宴会会場修正パッチ/ERB/イベント関連/宴会.ERB


path: 原版+前人整合等各种readme/パッチ/eraTW4.632_宴会会場修正パッチ/ERB/ステータス表示関連/INFO.ERB