code:
;≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
;主にシステムイベントで使う関数
;≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
;-------------------------------------------------
;PARTNER関連は "PLAYERとTARGETに加えて、もう１角色が参加するイベント" で追加角色の番号を管理するために使う
;普段の値は CFLAG:優先順位 == 1 の角色となっており(優先順位計算の時に設定)、それ以外の角色が喋る際にPARTNERで優先順位が１の角色を引き合いに出せる
;（"TARGET以外の角色が喋った場合"の追加角色としてTARGETを扱うため設定の手間を減らしている）
;
;※TARGET以外の角色の参加が前提に考えられているイベントでの使い方※
;最初にCALL RESET_PARTNERを行う
;参加者がいた場合はCALL SET_PARTNER, {その角色の番号}でその角色をpartnerにする(続けて行う場合はCALL RESET_SET_PARTNER, {その角色の番号}で1行で書ける)
;その角色が喋ったりする場所の上下でCALL SWAP_PARTNER_TARGETを行ってTARGETとPARTNER()を交換する
;イベント終了時にCALL SET_PARTNERを忘れないように
;-------------------------------------------------
@PARTNER()
#FUNCTION
RETURNF TARGET:9

@SET_PARTNER, ARG
IF ARG == 0 && TARGET:8
	TARGET:9 = TARGET:8
	TARGET:8 = 0
ELSEIF ARG == 0 && TARGET > 0
	TARGET:9 = TARGET
ELSE
	TARGET:9 = ARG
ENDIF

;複数回やっても問題ない
@RESET_PARTNER
SIF TARGET:8 == 0
	TARGET:8 = TARGET:9
TARGET:9 = 0

;RESET_PARTNERとSET_PARTNERを続けて行う関数
@RESET_SET_PARTNER, ARG
CALL RESET_PARTNER
CALL SET_PARTNER, ARG

@SWAP_PARTNER_TARGET
SWAP TARGET, TARGET:9

;-------------------------------------------------
;優先順位 = 1かを見る
;-------------------------------------------------
@IS_TARGET(ARG)
#FUNCTION
SIF ARG == 0 && TARGET > 0
	ARG = TARGET
SIF CFLAG:優先順位 == 1
	RETURNF 1
RETURNF 0

;-------------------------------------------------
;簡単な文字列選択肢を横に並べる関数
;ARGSに並べる選択肢を "選択肢1/選択肢2/……/選択肢n" で記述し、
;もしも各選択肢を選んだRESULTSの冒頭に付く文字列があるならばARGS:1に入れる。逆に後に付けたい場合はARGS:3に入れる
;選択肢の左側にテ接吻トを出したい場合はARGS:2に文字列を入れる。

;例1）　V领毛衣 [橙色][灰色][赤]という選択肢を並べ、それぞれを選択すると V领毛衣橙色,V领毛衣灰色,V领毛衣赤とさせたい場合は
;	CALL SELECTS, "橙色/灰色/赤", "V领毛衣", "　V领毛衣 "
;とすればよい。ARGS:1に何も入れない場合は、選択肢と同じ文字列がRESULTSに返る
;例2) [乱髪][２][３]という選択肢を並べ、それぞれを選択すると 乱髪,乱髪２,乱髪３とさせたい場合は
;	CALL SELECTS, "乱髪/２/３", "乱髪"
;-------------------------------------------------
@SELECTS, ARGS, ARGS:1, ARGS:2, ARGS:3
#DIM LCOUNT
#DIM LCOUNT2
#DIMS MEMO_LASTSELECT
#DIM USE_LASTSELECT
#DIM MEMO_TEXTCOUNT
#DIMS TEXT_REPLACED
#DIM NEXT_TEXTLENS
;ARGS:2の長さを記録しておく
#DIM MEMO_STRLENS
#DIM INITIAL_COLOR

INITIAL_COLOR = GETCOLOR()

CALL PRINT_STR, ARGS:2
MEMO_TEXTCOUNT = TFLAG:表示文字長
MEMO_STRLENS = MEMO_TEXTCOUNT

VARSET LOCALS
SPLIT ARGS, "/", LOCALS

;ARGS:1, ARGS:3に文字列が入っている場合にはLOCALSからその文字列を取り除く処理をする
IF ARGS:1 != ""
	FOR LCOUNT, 0, 100
		SELECTCASE LOCALS:LCOUNT
		CASE ""
			CONTINUE
		CASEELSE
			LOCALS:LCOUNT = %REPLACE(LOCALS:LCOUNT, ARGS:1, "")%
		ENDSELECT
	NEXT
ELSEIF ARGS:3 != ""
	FOR LCOUNT, 0, 100
		SELECTCASE LOCALS:LCOUNT
		CASE ""
			CONTINUE
		CASEELSE
			LOCALS:LCOUNT = %REPLACE(LOCALS:LCOUNT, ARGS:3, "")%
		ENDSELECT
	NEXT
ENDIF

USE_LASTSELECT = 0
MEMO_LASTSELECT =
FOR LCOUNT, 0, 100
	SELECTCASE LOCALS:LCOUNT
	CASE ""
		CONTINUE
	;ARGS:1orARGS:3と選択肢が同じ場合には
	CASE ARGS:1, ARGS:3
		IF USE_LASTSELECT
			PRINT
			MEMO_TEXTCOUNT += 1
		ENDIF
		PRINTBUTTON @"[%LOCALS:LCOUNT%]", @"%LOCALS:LCOUNT%"
		MEMO_TEXTCOUNT += STRLENS(LOCALS:LCOUNT) + 2
		SETCOLOR INITIAL_COLOR
	;空白を入れる場合
	CASE "　"
		PRINT
		MEMO_TEXTCOUNT += 1
		CONTINUE
	;改行させる場合
	CASE "　"
		PRINT
		MEMO_TEXTCOUNT += 1
		CONTINUE
	CASE "_茶色","_ショッキング粉紅","_粉紅","_爱心粉紅","_赤","_紅","_黄色","_暗黄色","_イエロー","_緑","_青","_水色","_藍色","_暗灰色","_灰色","_明灰色","_白"
		LOCALS:LCOUNT = %EXTSTR(LOCALS:LCOUNT, "_")%
		SETCOLOR DEF_COLOR(LOCALS:LCOUNT)
		CONTINUE
	CASEELSE
		;現在選択肢が直前選択肢を内包している場合
		IF MEMO_LASTSELECT != "" && STRCOUNT(LOCALS:LCOUNT, MEMO_LASTSELECT)
			TEXT_REPLACED = %REPLACE(LOCALS:LCOUNT, MEMO_LASTSELECT, "")%
			PRINTBUTTON @"[%TEXT_REPLACED%]", @"%ARGS:1%%LOCALS:LCOUNT%%ARGS:3%"
			USE_LASTSELECT = 1
			MEMO_TEXTCOUNT += STRLENS(TEXT_REPLACED) + 2
			;次も内包しているなら改行させない
			IF STRCOUNT(LOCALS:(LCOUNT + 1), MEMO_LASTSELECT)
				CONTINUE
			ELSE
				PRINT
				MEMO_TEXTCOUNT += 1
			ENDIF
		ELSE
			;IF USE_LASTSELECT
			;	PRINT
			;	MEMO_TEXTCOUNT += 1
			;ENDIF

			PRINTBUTTON @"[%LOCALS:LCOUNT%]", @"%ARGS:1%%LOCALS:LCOUNT%%ARGS:3%"
			MEMO_TEXTCOUNT += STRLENS(LOCALS:LCOUNT) + 2
			SETCOLOR INITIAL_COLOR
		ENDIF
	ENDSELECT

	SIF LOCALS:(LCOUNT + 1) == ""
		CONTINUE

	MEMO_LASTSELECT = %LOCALS:LCOUNT%
	USE_LASTSELECT = 0

	;次に表示する選択肢の長さを計算
	NEXT_TEXTLENS = STRLENS(LOCALS:(LCOUNT + 1) ) + 2
	;同じ選択肢が続く場合
	FOR LCOUNT2, 2, 10
		SIF STRCOUNT(LOCALS:(LCOUNT + LCOUNT2), LOCALS:(LCOUNT + 1) )
			NEXT_TEXTLENS += 4
		BREAK
	NEXT

	;改行が近い時は自動改行させる
	IF NUM("折り返し文字数") - MEMO_TEXTCOUNT <= NEXT_TEXTLENS + 2
		PRINTL
		PRINTFORM %BL(MEMO_STRLENS)%
		MEMO_TEXTCOUNT = MEMO_STRLENS
		SETCOLOR INITIAL_COLOR
	ENDIF
NEXT

SETCOLOR INITIAL_COLOR
TFLAG:表示文字長 = MEMO_TEXTCOUNT

;-------------------------------------------------
;SELECTSの改行付き
;-------------------------------------------------
@SELECTSL, ARGS, ARGS:1, ARGS:2, ARGS:3
CALL SELECTS, ARGS, ARGS:1, ARGS:2, ARGS:3
PRINTL

;-------------------------------------------------
;IF文中で"GOTO INPUT_LOOP"を使うとエラーが出るのを回避する。以下は使い方のテンプレ：
;	PRINTL [0]
;	PRINTL [1]
;	CALL INPUT_SELECT, 2
;	IF RESULT == 0
;	ELSEIF RESULT == 1
;	ENDIF
;便利な関数だが、RESULT == 0 && ABL:Ｖ感覚 >= 3 みたいな、条件も同時についているものには向かないので注意。
;また、[100] やめる　など、番号を追加したい時には　INPUT_SELECT, 2, 100　とすること。
;-------------------------------------------------
@INPUT_SELECT, ARG, ARG:1, ARG:2, ARG:3, ARG:4, ARG:5, ARG:6, ARG:7, ARG:8, ARG:9, ARG:10
INPUT

SELECTCASE RESULT
CASE IS < 0
	CLEARLINE 1
	RESTART
CASE 0 TO ARG - 1, ARG:1, ARG:2, ARG:3, ARG:4, ARG:5, ARG:6, ARG:7, ARG:8, ARG:9, ARG:10
	RETURN RESULT
CASEELSE
	CLEARLINE 1
	RESTART
ENDSELECT

;-------------------------------------------------
;半角でARG:1文字以上ARG文字以下の文字列入力をさせて、RESULTSでかえす
;-------------------------------------------------
@INPUTS_SELECT, ARG, ARG:1
INPUTS
SELECTCASE STRLENS(RESULTS)
CASE IS < ARG:1
	IF STRLENS(RESULTS) == 0
		PRINTL 请输入文字
	ELSE
		PRINTFORML %RESULTS%太短了。请在半角{ARG:1}～{ARG}字符以内输入文字。
	ENDIF
	RESTART
CASE IS > ARG
	PRINTFORML %RESULTS%太長了。请在半角{ARG}字符以内输入文字。
	RESTART
CASEELSE

ENDSELECT

;-------------------------------------------------
;@INPUT_SELECTのONEINPUT版
;ARGには一桁の数字を入れること
;-------------------------------------------------
@ONEINPUT_SELECT, ARG, ARG:1, ARG:2, ARG:3, ARG:4, ARG:5, ARG:6, ARG:7, ARG:8, ARG:9, ARG:10
#DIM MEMO_LINECOUNT
MEMO_LINECOUNT = LINECOUNT

ONEINPUT
SELECTCASE RESULT
CASE 0 TO ARG - 1, ARG:1, ARG:2, ARG:3, ARG:4, ARG:5, ARG:6, ARG:7, ARG:8, ARG:9, ARG:10
	RETURN RESULT
ENDSELECT

CLEARLINE LINECOUNT - MEMO_LINECOUNT
RESTART

;-------------------------------------------------
;簡単な選択肢を１行で記述するための関数。ARGS:1は返回とかやめるなどの選択肢用で自動的に[100]が割り振られる
;例えば、CALL PRINT_SELECT, "是/否", "なんだって？" とすると
;	PRINTL  [ 0] 是
;	PRINTL  [ 1] 否
;	PRINTL [100] なんだって？
;	CALL INPUT_SELECT, 2, 100
;と記述した事に等しい。選択肢の番号を飛ばしたりなどは出来ないので、あくまで単純な選択肢を作りたい場合に向く
;途中で選択肢では無い文字列を入れたい場合には 文字列_NOBUTTON とすればよい
;-------------------------------------------------
@PRINT_SELECT, ARGS, ARGS:1
#DIM LCOUNT
#DIM NUM_SELECT
#DIMS MEMOS, 10

VARSET LOCALS
SPLIT ARGS, "/", LOCALS

NUM_SELECT = 0
FOR LCOUNT, 0, 99
	SIF LOCALS:LCOUNT == ""
		BREAK

	VARSET MEMOS
	SPLIT LOCALS:LCOUNT, "_", MEMOS

	SELECTCASE MEMOS:1
	CASE "NOBUTTON"
		CALL PRINT_STRL, @"%MEMOS%"
	CASEELSE
		PRINTFORM  [{LCOUNT, 2}]
		CALL PRINT_STRL, @"%MEMOS%"
	ENDSELECT
	;選択肢の数
	NUM_SELECT += 1
NEXT

SELECTCASE ARGS:1
CASE ""
	CALL INPUT_SELECT, NUM_SELECT
CASEELSE
	PRINTFORML [100] %ARGS:1%
	CALL INPUT_SELECT, NUM_SELECT, 100
ENDSELECT

RETURN RESULT

;-------------------------------------------------
;@PRINT_SELECTのHTML版
;		※要修正 (ぶっちゃけHTML就这様書いたほうが分かりやすいのでは？:thinking:)
;			文字列データを流用したい場合はちょっとなぁ
;			文字列途中で色々弄るの辞めて、無印と同じく末尾に一括記載でも良さそうだけども...
;			いや、意味ないか...多分頭良い人がちょっと捻れば行ける
;			(たとえばERH使ってButtonTextを取り出せるようにするとかね)
;
;			私は好きにした、君らも好きにしろ
;
;指令一覧
;_NOBUTTON：ボタンではなくなります
;_太字				：太字になります
;_太字解除			：太字を解除します
;_斜体				：斜体になります
;_斜体解除			：斜体を解除します
;_下線				：アンダーラインを引きます
;_下線解除			：アンダーラインを解除します
;_取り消し			：取り消し線を引きます
;_選択不可			：ボタンを選択不可にします(NOBUTTONと異なり　[XX] 押せないボタン　みたいな表示が出来ます)
;_黄色：表示色を黄色に変更します
;_赤色：表示色を赤色に変更します
;_灰色：表示色を灰色に変更します
;-------------------------------------------------
@PRINT_SELECT_EX, ARGS, ARGS:1
#DIM ButtonCount
#DIM TagCount
#DIM NumSelect
#DIMS Memos, 100

#DIM IsBold
#DIM IsItalic
#DIM IsUnderLine
#DIM IsStrikethrough
;0でボタン 1で選択不可ボタン 2でテ接吻ト
#DIM IsTextType
#DIMS ButtonText
#DIMS OutPutHTML
#DIMS NowColor

VARSET LOCALS
SPLIT ARGS, "/", LOCALS

NumSelect = 0
FOR ButtonCount, 0, 99
	SIF LOCALS:ButtonCount == ""
		BREAK

	;#region 初期化
		IsBold = 0
		IsItalic = 0
		IsUnderLine = 0
		IsStrikethrough = 0

		IsTextType = 0

		ButtonText =
		OutPutHTML =
		NowColor =
	;#endregion

	VARSET Memos
	SPLIT LOCALS:ButtonCount, "_", Memos

	FOR TagCount, 0, 100
		SELECTCASE Memos:TagCount
		CASE "太字"
			OutPutHTML += ""
		CASE "太字解除"
			OutPutHTML += ""
		CASE "斜体"
			OutPutHTML += ""
		CASE "斜体解除"
			OutPutHTML += ""
		CASE "取り消し"
			OutPutHTML += "<s>"
		CASE "取り消し解除"
			OutPutHTML += "</s>"
		CASE "下線"
			OutPutHTML += ""
		CASE "下線解除"
			OutPutHTML += ""

		CASE "黄色"
			OutPutHTML += ""
		CASE "赤"
			OutPutHTML += ""
		CASE "灰色"
			OutPutHTML += ""
		CASE "色変更解除"
			OutPutHTML += ""

		CASE "選択不可"
			IsTextType = 1
		CASE "NOBUTTON"
			IsTextType = 2
		CASEELSE
			OutPutHTML += Memos:TagCount
			ButtonText += Memos:TagCount
		ENDSELECT
	NEXT

	IF IsTextType == 2
		HTML_PRINT @"<nonbutton>%OutPutHTML%</nonbutton>"
	ELSEIF IsTextType == 1
		HTML_PRINT @"<nonbutton>[{ButtonCount,2}]%OutPutHTML%</nonbutton>"
	ELSE
		HTML_PRINT @"<button value = '{ButtonCount}'>[{ButtonCount,2}]%OutPutHTML%</button>"
	ENDIF
	;選択肢の数
	NumSelect += 1
NEXT

SELECTCASE ARGS:1
CASE ""
	CALL INPUT_SELECT, NumSelect
CASEELSE
	PRINTFORML  [99] %ARGS:1%
	CALL INPUT_SELECT, NumSelect, 99
ENDSELECT
;PRINTFORMW デバッグメッセージ！ RESULT = {RESULT}
RETURN RESULT

;-------------------------------------------------
;文字列の桁数を合わせる
;RJは右詰、LJは左詰め
;-------------------------------------------------
@TEXT_RJ(ARGS, ARG)
#FUNCTIONS
SELECTCASE STRLENS(ARGS)
CASE IS >= ARG
	RETURNF ARGS
CASEELSE
	LOCALS = %BL(ARG-STRLENS(ARGS) )%%ARGS%
ENDSELECT
RETURNF LOCALS

@TEXT_LJ(ARGS, ARG)
#FUNCTIONS
SELECTCASE STRLENS(ARGS)
CASE IS >= ARG
	RETURNF ARGS
CASEELSE
	LOCALS = %ARGS%%BL(ARG-STRLENS(ARGS) )%
ENDSELECT
RETURNF LOCALS

;-------------------------------------------------
;左端にARGSを出力させるDRAWLINE
;ARGSを 文字列Ａ/文字列Ｂ としておくと文字列Ａを文字列Ｂを返すスイッチにします
;-------------------------------------------------
@DRAWLINES, ARGS
#DIM LCOUNT
#DIMS BUTTONS

VARSET LOCALS
SPLIT ARGS, "/", LOCALS
BUTTONS = %LOCALS:1%

;PRINT_STRを呼んだ場合には改めてLOCALSの適切な長さが算出される
TFLAG:表示文字長 = STRLENS(LOCALS)
IF BUTTONS != ""
	IF TOINT(BUTTONS) != 0 || BUTTONS == "0"
		PRINTBUTTON LOCALS, TOINT(BUTTONS)
	ELSE
		PRINTBUTTON LOCALS, BUTTONS
	ENDIF
ELSE
	CALL PRINT_STR, @"%LOCALS%"
ENDIF
FOR LCOUNT, 1, NUM("折り返し文字数") - TFLAG:表示文字長
	PRINTFORM -
NEXT
;自動改行
PRINTL

@DRAWLINES_CENTER, ARGS
#DIM LCOUNT
FOR LCOUNT, 0, (NUM("折り返し文字数") - STRLENS(ARGS) )/2
	PRINTFORM -
NEXT
PRINTFORM %ARGS%
FOR LCOUNT, 0, (NUM("折り返し文字数") - STRLENS(ARGS) )/2
	PRINTFORM -
NEXT
;自動改行
PRINTL

;-------------------------------------------------
;複数指定のSETBIT、CLEARBIT, INVERTBIT
;ただし、ARG:1～ARG:2までのbit全てと、ARG:3, ARG:4, …の単体のbitに作用する
;そして、0bitを操作できるのはARG:1のみである
;例1）LOCAL = SETBITS(LOCAL, 0, 5, 7)でLOCALの0～5bitと7bitがONになる
;例2）LOCAL = SETBITS(LOCAL, 1, 5, 0)だとLOCALの1～5bitがONになる。0bitは変化しない
;例3）LOCAL = SETBITS(LOCAL, 2)はSETBIT LOCAL, 2 と等しい
;-------------------------------------------------
@SETBITS(ARG, ARG:1, ARG:2, ARG:3, ARG:4, ARG:5, ARG:6, ARG:7)
#FUNCTION
FOR LOCAL, ARG:1, MAX(ARG:1, ARG:2)+1
	SETBIT ARG, LOCAL
NEXT
FOR LOCAL, 3, 8
	SIF ARG:LOCAL
		SETBIT ARG, ARG:LOCAL
NEXT
RETURNF ARG

@CLEARBITS(ARG, ARG:1, ARG:2, ARG:3, ARG:4, ARG:5, ARG:6, ARG:7)
#FUNCTION
FOR LOCAL, ARG:1, MAX(ARG:1, ARG:2)+1
	CLEARBIT ARG, LOCAL
NEXT
FOR LOCAL, 3, 8
	SIF ARG:LOCAL
		CLEARBIT ARG, ARG:LOCAL
NEXT
RETURNF ARG

@INVERTBITS(ARG, ARG:1, ARG:2, ARG:3, ARG:4, ARG:5, ARG:6, ARG:7)
#FUNCTION
FOR LOCAL, ARG:1, MAX(ARG:1, ARG:2)+1
	INVERTBIT ARG, LOCAL
NEXT
FOR LOCAL, 3, 8
	SIF ARG:LOCAL
		INVERTBIT ARG, ARG:LOCAL
NEXT
RETURNF ARG

;-------------------------------------------------
;複数指定のGETBIT
;ただし、ARG:1～ARG:2までのbit全てと、ARG:3, ARG:4, …の単体のbitに作用する
;そして、0bitを参照できるのはARG:1のみである
;例1）GETBITS(LOCAL, 0, 5, 7)でLOCALの0～5bitと7bitの和を返す
;例2）GETBITS(LOCAL, 1, 5, 0)orGETBITS(LOCAL, 1, 5)だとLOCALの1～5bitの和を返す
;具体的にはLOCAL = 2+8+32 ならGETBITS(LOCAL, 2, 4) = 8となる
;実例）GETBITS(LOCAL, 2)は大体GETBIT(LOCAL, 2) と等しい用途に用いることが出来る
;-------------------------------------------------
@GETBITS(ARG, ARG:1, ARG:2, ARG:3, ARG:4, ARG:5, ARG:6, ARG:7)
#FUNCTION
#DIM LCOUNT
VARSET LOCAL
FOR LCOUNT, ARG:1, MAX(ARG:1, ARG:2)+1
	SIF GETBIT(ARG, LCOUNT)
		LOCAL += POWER(2, LCOUNT)
NEXT
FOR LCOUNT, 3, 8
	SIF ARG:LCOUNT == 0
		CONTINUE
	SIF GETBIT(ARG, ARG:LCOUNT)
		LOCAL += POWER(2, ARG:LCOUNT)
NEXT
RETURNF LOCAL

;-------------------------------------------------
;複数指定のSTRCOUNT
;-------------------------------------------------
@STRCOUNTS(ARGS, ARGS:1, ARGS:2, ARGS:3, ARGS:4, ARGS:5, ARGS:6, ARGS:7, ARGS:8, ARGS:9, ARGS:10, ARGS:11, ARGS:12, ARGS:13, ARGS:14)
#FUNCTION
#DIM LCOUNT

LOCAL = 0

FOR LCOUNT, 1, 15
	SIF ARGS:LCOUNT == ""
		BREAK
	LOCAL += STRCOUNT(ARGS, ARGS:LCOUNT)
NEXT
RETURNF LOCAL

;-------------------------------------------------
;文字列ARGSの、文字ARGS:2とARGS:3に挟まれた部分に文字列ARGS:1を挿入する。
;当然だがARGS:2とARGS:3が空文字ではならない。
;ARGS:2が複数登場する場合はバグります。注意。
;-------------------------------------------------
@INSERT_STR(ARGS, ARGS:1, ARGS:2, ARGS:3)
#FUNCTIONS
;左側の文字列
#DIMS LSTR
;右側の文字列
#DIMS RSTR
#DIM LCOUNT

VARSET LOCALS
SPLIT ARGS, ARGS:2, LOCALS
;ARGSにARGS:2が含まれていない場合は什麼也不做
SIF LOCALS:1 == ""
	RETURNF ARGS

LSTR = %LOCALS%%ARGS:2%
RSTR = %SUBSTRING(ARGS, STRLENS(LSTR), -1)%

SELECTCASE RSTR
CASE ARGS:3
CASEELSE
	VARSET LOCALS
	SPLIT RSTR, ARGS:3, LOCALS
	;RSTRをLOCALS:0を除いて再構築
	RSTR = %SUBSTRING(RSTR, STRLENS(LOCALS), -1)%
ENDSELECT

RETURNF @"%LSTR%%ARGS:1%%RSTR%"

;-------------------------------------------------
;ARGSから、文字ARGS:1とARGS:2に挟まれた部分を抜き出す
;ARGS:1やARGS:2で分割した際に、２分割になるものだけに使うと間違いがないだろう
;複数分割にされる場合には、文字列の中でARGS:1とARGS:2に挟まれた"一番左の文字列"を返す
;ちなみにARGS:2 == "" の場合にはARGS:1の右側だけを返し、
;ARGS:1 == "" の場合にはARGS:2の左側だけを返す
;-------------------------------------------------
@EXTSTR(ARGS, ARGS:1, ARGS:2)
#FUNCTIONS
#DIM LCOUNT
#DIM LCOUNT2
#DIM NOTEND
#DIMS TEXT_PART, 100

VARSET TEXT_PART
SPLIT ARGS, ARGS:1, TEXT_PART

IF TEXT_PART:1 != ""
	ARGS = %TEXT_PART:1%
	FOR LCOUNT, 2, 100
		SELECTCASE TEXT_PART:LCOUNT
		CASE ""
			;これより先が無いかを判定する
			NOTEND = 0
			FOR LCOUNT2, 0, 100
				SIF LCOUNT + LCOUNT2 >= 100
					BREAK
				SELECTCASE TEXT_PART:(LCOUNT + LCOUNT2)
				CASE ""
				CASEELSE
					NOTEND = 1
					BREAK
				ENDSELECT
			NEXT
			SIF NOTEND == 0
				BREAK
		ENDSELECT
		ARGS += @"%ARGS:1%%TEXT_PART:LCOUNT%"
	NEXT
ELSEIF ARGS:2 == ""
	RETURNF ""
ELSE
	ARGS = %TEXT_PART%
ENDIF

VARSET TEXT_PART
SPLIT ARGS, ARGS:2, TEXT_PART

RETURNF TEXT_PART

;-------------------------------------------------
;EXTSTRの空白を無視する版
;-------------------------------------------------
@EXTSTR_BL(ARGS, ARGS:1, ARGS:2)
#FUNCTIONS

ARGS = %EXTSTR(ARGS, ARGS:1, ARGS:2)%
ARGS = %REPLACE(ARGS, " ", "")%
ARGS = %REPLACE(ARGS, "　", "")%
RETURNF ARGS

;-------------------------------------------------
;SPLIT前提の文字列ARGSを、空要素が無いように文字列ARGS:1で区切り直す
;-------------------------------------------------
@RESET_SPLIT(ARGS, ARGS:1)
#FUNCTIONS
#DIM LCOUNT
#DIMS DELIMITER

DELIMITER = %ARGS:1%

VARSET LOCALS
SPLIT ARGS, DELIMITER, LOCALS

ARGS =
FOR LCOUNT, 0, 100
	SELECTCASE LOCALS:LCOUNT
	CASE ""
	CASEELSE
		;重複は起こさない…ようにしようと思ったが今は敢えて放置
		SIF STRCOUNT(@"%DELIMITER%%ARGS%", @"%DELIMITER%%LOCALS:LCOUNT%%DELIMITER%")
			CONTINUE
		ARGS += @"%LOCALS:LCOUNT%%DELIMITER%"
	ENDSELECT
NEXT
RETURNF ARGS

;-------------------------------------------------
;TOINTの空白を無視する版
;-------------------------------------------------
@TOINT_BL(ARGS)
#FUNCTION
#DIM LCOUNT

VARSET LOCALS
SPLIT ARGS, " ", LOCALS
ARGS =
FOR LCOUNT, 0, 100
	ARGS += @"%LOCALS:LCOUNT%"
NEXT
RETURNF TOINT(ARGS)

;-------------------------------------------------
;文字列ARGSとARGS:1が70%以上一致しているかを返す関数
;主に類似写真の消去に使う
;-------------------------------------------------
@CHECK_HIGHMATCH(ARGS, ARGS:1)
#FUNCTION
#DIM LCOUNT
#DIMS TEXT_LONG
#DIMS TEXT_SHORT
#DIMS TEXT_CHECK

;文字列が長い方をARGSにする
SIF STRLENSU(ARGS) < STRLENSU(ARGS:1)
	SWAP ARGS, ARGS:1
TEXT_LONG = %ARGS%
TEXT_SHORT = %ARGS:1%

;短い方の文字列の長さが、長い方の70％無いなら終わり
SIF STRLENSU(TEXT_SHORT) < STRLENSU(TEXT_LONG)*7/10
	RETURNF 0

FOR LCOUNT, 0, (STRLENSU(TEXT_LONG)*3/10) + 1
	TEXT_CHECK = %SUBSTRINGU(TEXT_SHORT, LCOUNT, STRLENSU(TEXT_LONG)*7/10)%
	;検索文字列の書式はC#の正規表現の仕様に準じますとの事なのでESCAPEしておく
	SIF STRCOUNT(TEXT_LONG, ESCAPE(TEXT_CHECK) )
		RETURNF 1 + LCOUNT
NEXT
RETURNF 0
;-------------------------------------------------
;優先順位を整列させる関数
;-------------------------------------------------
@CHECK_POSITION
#DIM LCOUNT
#DIM LCOUNT2
;現在存在する人
#DIM ACTOR_EXIST, 100
#DIM NUM_EXIST
;現在は居ない人
#DIM ACTOR_ABS, 100
#DIM EMPTY_POSITION, 100
#DIM COUNT_ABS

VARSET ACTOR_EXIST
NUM_EXIST = 0
VARSET ACTOR_ABS
VARSET EMPTY_POSITION, 100
COUNT_ABS = 0

FOR LCOUNT, 2, CHARANUM
	IF COND("現在存在", LCOUNT)
		ACTOR_EXIST:(CFLAG:LCOUNT:優先順位) = LCOUNT
		NUM_EXIST += 1
		;PRINTFORML ACTOR_EXIST:{CFLAG:LCOUNT:優先順位} = {LCOUNT}
	ELSE
		ACTOR_ABS:(CFLAG:LCOUNT:優先順位) = LCOUNT
		;PRINTFORML ACTOR_ABS:{CFLAG:LCOUNT:優先順位} = {LCOUNT}
		EMPTY_POSITION:LCOUNT = CFLAG:LCOUNT:優先順位
	ENDIF
NEXT

;まず居る人たちの優先順位を詰める
FOR LCOUNT, 1, CHARANUM
	;優先順位がLCOUNTの人が居るかどうか
	SIF ACTOR_EXIST:LCOUNT == 0
		CONTINUE
	FOR LCOUNT2, 2, CHARANUM
		SIF CFLAG:(ACTOR_EXIST:LCOUNT):優先順位 <= EMPTY_POSITION:LCOUNT2
			CONTINUE
		SWAP CFLAG:(ACTOR_EXIST:LCOUNT):優先順位, EMPTY_POSITION:LCOUNT2
	NEXT
NEXT

FOR LCOUNT, 1, CHARANUM
	;優先順位がLCOUNTの人が居るかどうか
	SIF ACTOR_ABS:LCOUNT == 0
		CONTINUE
	COUNT_ABS += 1
	CFLAG:(ACTOR_ABS:LCOUNT):優先順位 = NUM_EXIST + COUNT_ABS
NEXT

;-------------------------------------------------
;識別番号を角色の番号に変換する関数
;値が0を越えているのに該当角色が居ない場合には-1を返す
;そもそも調教角色を指していない减少の値の場合にはその値を返す
;-------------------------------------------------
@TO_NUMBER(ARG)
#FUNCTION

SELECTCASE ARG
CASE IS > 0
	LOCAL = FINDCHARA(BASE:識別番号, ARG, 1)
CASEELSE
	LOCAL = ARG
ENDSELECT

RETURNF LOCAL

;-------------------------------------------------
;ARGS == TOSTR(DAY*10 + TIME) を X年Y日 季節 曜日（昼or夜） に直す
;-------------------------------------------------
@TO_DATE(ARGS)
#FUNCTIONS
#DIM MEMO_FLAGYEAR
#DIM MEMO_FLAGSEASON
#DIM MEMO_FLAGDAY
#DIM MEMO_DAY
#DIM MEMO_TIME

MEMO_FLAGYEAR = FLAG:年
MEMO_FLAGSEASON = FLAG:季節
MEMO_FLAGDAY = FLAG:日
MEMO_DAY = DAY
MEMO_TIME = TIME

DAY = TOINT(ARGS)/10
TIME = TOINT(ARGS)%10

;CALL SETFLAG, "年月日"と同じ操作
FLAG:日 = (DAY - 1)%NUM("１年の長さ") + 1
FLAG:年 = (DAY + NUM("１年の長さ") - 1)/NUM("１年の長さ")
FLAG:季節 = (FLAG:日 - 1)/7
LOCALS = %TEXTS("日期表示")%

FLAG:年 = MEMO_FLAGYEAR
FLAG:季節 = MEMO_FLAGSEASON
FLAG:日 = MEMO_FLAGDAY
DAY = MEMO_DAY
TIME = MEMO_TIME

RETURNF LOCALS

;-------------------------------------------------
;/で区切られた要素でなる文字列ARGS中にARGS:1, ARGS:2, …が計何個あるかを返す関数
;-------------------------------------------------
@NUM_STR(ARGS, ARGS:1, ARGS:2, ARGS:3, ARGS:4, ARGS:5, ARGS:6, ARGS:7)
#FUNCTION
#DIM LCOUNT

VARSET LOCALS
;それぞれの要素に分解
SPLIT ARGS, "/", LOCALS

LOCAL = 0

;LOCALSはLOCALS:0～LOCALS:99まで
FOR LCOUNT, 0, 100
	SIF LOCALS:LCOUNT == ""
		RETURNF LOCAL

	SELECTCASE LOCALS:LCOUNT
	CASE ARGS:1, ARGS:2, ARGS:3, ARGS:4, ARGS:5, ARGS:6, ARGS:7
		LOCAL += 1
	ENDSELECT
NEXT

RETURNF LOCAL

;-------------------------------------------------
;/で区切られた数字の要素でなる文字列ARGS中の最大の数値を返す関数
;-------------------------------------------------
@MAX_STR(ARGS)
#FUNCTION
#DIM LCOUNT

VARSET LOCALS
;それぞれの要素に分解
SPLIT ARGS, "/", LOCALS

;左端の要素の数値を初期値とする
LOCAL = TOINT(LOCALS:0)

;LOCALSはLOCALS:0～LOCALS:99まで
FOR LCOUNT, 1, 100
	SIF LOCALS:LCOUNT == ""
		RETURNF LOCAL

	;文字列を数字化して比較
	SIF TOINT(LOCALS:LCOUNT) > LOCAL
		LOCAL = TOINT(LOCALS:LCOUNT)
NEXT

RETURNF LOCAL

;-------------------------------------------------
;/で区切られた数字の要素でなる文字列ARGS中の最小の数値を返す関数
;-------------------------------------------------
@MIN_STR(ARGS)
#FUNCTION
#DIM LCOUNT

VARSET LOCALS
;それぞれの要素に分解
SPLIT ARGS, "/", LOCALS

;左端の要素の数値を初期値とする
LOCAL = TOINT(LOCALS:0)

;LOCALSはLOCALS:0～LOCALS:99まで
FOR LCOUNT, 1, 100
	SIF LOCALS:LCOUNT == ""
		RETURNF LOCAL

	;文字列を数字化して比較
	SIF TOINT(LOCALS:LCOUNT) < LOCAL
		LOCAL = TOINT(LOCALS:LCOUNT)
NEXT

RETURNF LOCAL

;-------------------------------------------------
;/で区切られた数字の要素でなる文字列ARGS中の数値の総和を返す関数
;-------------------------------------------------
@SUM_STR(ARGS)
#FUNCTION
#DIM LCOUNT

VARSET LOCALS
;それぞれの要素に分解
SPLIT ARGS, "/", LOCALS

LOCAL = 0

;LOCALSはLOCALS:0～LOCALS:99まで
FOR LCOUNT, 0, 100
	SIF LOCALS:LCOUNT == ""
		RETURNF LOCAL

	;文字列を数字化して足していく
	LOCAL += TOINT(LOCALS:LCOUNT)
NEXT

RETURNF LOCAL

;-------------------------------------------------
;/で区切られた数字の要素でなる文字列ARGS中の各要素に整数ARGを足す関数
;数値を減らしたい時にはARGに負の整数を代入する
;-------------------------------------------------
@ADDNUM_STR(ARGS, ARG)
#FUNCTIONS
#DIM LCOUNT

VARSET LOCALS
;それぞれの要素に分解
SPLIT ARGS, "/", LOCALS

LOCALS = {TOINT(LOCALS) + ARG}/

;LOCALSはLOCALS:0～LOCALS:99まで
FOR LCOUNT, 1, 100
	SIF LOCALS:LCOUNT == ""
		RETURNF LOCALS

	;文字列を数字化して足していく
	LOCALS = %LOCALS%{TOINT(LOCALS:LCOUNT) + ARG}/
NEXT

RETURNF LOCALS

;-------------------------------------------------
;ある条件における角色以外の数の判定
;NUMの内部使用は禁止
;-------------------------------------------------
@NUM(ARGS, ARG)
#FUNCTION
#DIM LCOUNT

LOCAL = 0
SELECTCASE ARGS
CASE "性処理の採用指令数"
	FOR LCOUNT, 0, 20
		SELECTCASE NAMES("性処理の採用指令", LCOUNT)
		CASE ""
			RETURNF LOCAL
		CASEELSE
			LOCAL += 1
		ENDSELECT
	NEXT
CASE "１年の長さ"
	RETURNF 56
CASE "写真"
	FOR LCOUNT, 70, 100
		LOCAL += STRCOUNT(SAVESTR:LCOUNT, "/")
	NEXT
CASE "胖次没収数"
	FOR LCOUNT, 1, CHARANUM
		LOCAL += CFLAG:LCOUNT:胖次奪われ数
	NEXT
CASE "消耗品使用数"
	FOR LCOUNT, 0, 10
		LOCAL += ITEM:(LCOUNT + 80) - ITEM:(LCOUNT + 50)
	NEXT
CASE "折り返し文字数"
	SELECTCASE GETCONFIG("フォントサイズ")
	CASE 18
		RETURNF 120
	CASE 17
		RETURNF 121
	CASE 16
		RETURNF 135
	CASE 15
		RETURNF 136
	CASE 14
		RETURNF 155
	CASEELSE
		RETURNF 2*GETCONFIG("ウィンドウ幅")/GETCONFIG("フォントサイズ") - 2
	ENDSELECT
CASE "目標金額"
	RETURNF 1000000
CASE "回合数"
	SIF ARG == 0 && TARGET
		ARG = TARGET
	LOCAL = TCVAR:ARG:回合数

CASE "所持衣装"
	FOR LCOUNT, 80, 100
		SIF ITEM:LCOUNT
			LOCAL += 1
	NEXT
CASE "総衣装数"
	FOR LCOUNT, 80, 100
		SIF STRLENS(ITEMNAME:LCOUNT )
			LOCAL += 1
	NEXT
CASE "所持道具"
	FOR LCOUNT, 0, 100
		LOCAL += ITEM:LCOUNT
	NEXT
CASE "属性"
	FOR LCOUNT, 0, 64
		SIF STRLENS(NAMES(ARGS, LCOUNT) ) == 0
			BREAK
		LOCAL += 1
	NEXT
CASE "弱点"
	FOR LCOUNT, 0, 64
		SIF STRLENS(NAMES(ARGS, LCOUNT) ) == 0
			BREAK
		LOCAL += 1
	NEXT
CASE "Ｓランク"
	;この値以上ならＳ
	SELECTCASE ARG
	CASE 60 TO 68
		RETURNF 7
	CASE 35 TO 39
		RETURNF 3
	CASE 20 TO 29, 30 TO 49, 60 TO 69
		RETURNF 5
	;～名器
	CASE 50 TO 59
		RETURNF 80
	CASEELSE
		RETURNF 10
	ENDSELECT

CASE "宝珠：淫核取得"
	SIF ARG == 0 && TARGET
		ARG = TARGET
	LOCAL = 50000
	SIF TALENT:ARG:淫核 + TALENT:ARG:淫壷 + TALENT:ARG:尻穴狂い + TALENT:ARG:淫乳 + TALENT:ARG:蕩唇
		LOCAL *= 5
CASE "宝珠：尿道狂取得"
	SIF ARG == 0 && TARGET
		ARG = TARGET
	LOCAL = 50000
	SIF TALENT:ARG:淫核 + TALENT:ARG:淫壷 + TALENT:ARG:尻穴狂い + TALENT:ARG:淫乳 + TALENT:ARG:蕩唇
		LOCAL *= 5
CASE "宝珠：淫壷取得"
	SIF ARG == 0 && TARGET
		ARG = TARGET
	LOCAL = 50000
	SIF TALENT:ARG:淫核 + TALENT:ARG:淫壷 + TALENT:ARG:尻穴狂い + TALENT:ARG:淫乳 + TALENT:ARG:蕩唇
		LOCAL *= 5
CASE "宝珠：尻穴狂い取得"
	SIF ARG == 0 && TARGET
		ARG = TARGET
	LOCAL = 50000
	SIF TALENT:ARG:淫核 + TALENT:ARG:淫壷 + TALENT:ARG:尻穴狂い + TALENT:ARG:淫乳 + TALENT:ARG:蕩唇
		LOCAL *= 5
CASE "宝珠：淫乳取得"
	SIF ARG == 0 && TARGET
		ARG = TARGET
	LOCAL = 50000
	SIF TALENT:ARG:淫核 + TALENT:ARG:淫壷 + TALENT:ARG:尻穴狂い + TALENT:ARG:淫乳 + TALENT:ARG:蕩唇
		LOCAL *= 5
CASE "宝珠：蕩唇取得"
	SIF ARG == 0 && TARGET
		ARG = TARGET
	LOCAL = 50000
	SIF TALENT:ARG:淫核 + TALENT:ARG:淫壷 + TALENT:ARG:尻穴狂い + TALENT:ARG:淫乳 + TALENT:ARG:蕩唇
		LOCAL *= 5
CASE "経験値：素質獲得"
	;LOCAL = (1 + ABL:素質獲得回数)*200
	;200に固定させることに
	RETURNF 200
CASE "貧乳の上限"
	;AAA～Ａ
	RETURNF 3
CASE "並乳の上限"
	;Ｂ～Ｄ
	RETURNF 6
CASE "巨乳の上限"
	;ＦorＧorＨ
	RETURNF 8 + CONFIG("巨乳補正：罩杯")
CASE "爆乳の上限"
	;ＩorＪorＫ
	RETURNF 11 + CONFIG("巨乳補正：罩杯")
;身高は通常156～168(162±6)、娇小147～155(151±4)、娇小Ⅱ134～146(140±6)、娇小Ⅲ 121～133(127±6)
CASE "娇小Ⅲの上限"
	RETURNF 130
CASE "娇小Ⅱの上限"
	RETURNF 143
CASE "娇小の上限"
	RETURNF 152
CASE "普通の上限"
	RETURNF 165
CASE "高大の上限"
	RETURNF 182
CASE "高大Ⅱの上限"
	RETURNF 199
;日期イベントなど特殊事件
CASE "圣诞节ツリー"
	FOR LCOUNT, 2, CHARANUM
		SIF CEVENT("日期：圣诞节ツリー", LCOUNT)
			LOCAL += 1
	NEXT
ENDSELECT
RETURNF LOCAL

;-------------------------------------------------
;ある条件における角色の人数の判定
;-------------------------------------------------
@CHARA_NUM(ARGS)
#FUNCTION
#DIM LCOUNT
#DIMS MEMOS

LOCAL = 0
SELECTCASE ARGS
CASE "一起学习", "邀请学习", "勉強"
	FOR LCOUNT, 2, CHARANUM
		SIF STRCOUNTS(CSTR:LCOUNT:DAILYCOM履歴, ARGS)
			LOCAL += 1
	NEXT
CASE "入部前"
	FOR LCOUNT, 2, CHARANUM
		SIF CFLAG:LCOUNT:加入日 == 0
			LOCAL += 1
	NEXT
CASE "约会的约定"
	SIF CFLAG:MASTER:ARGS
		RETURNF 1
	;FOR LCOUNT, 2, CHARANUM
	;	SIF CFLAG:LCOUNT:ARGS > 0
	;		LOCAL += 1
	;NEXT
CASE "打招呼していない"
	FOR LCOUNT, 2, CHARANUM
		SIF CFLAG:LCOUNT:打招呼された
			CONTINUE
		SIF COND("現在存在", LCOUNT)
			LOCAL += 1
	NEXT
CASE "行動参加中"
	FOR LCOUNT, 1, CHARANUM
		SIF CFLAG:LCOUNT:ARGS
			LOCAL += 1
	NEXT
;時間がたてば集圆圈総人数
CASE "集合予定"
	FOR LCOUNT, 1, CHARANUM
		SIF CFLAG:LCOUNT:不在 == 0
			LOCAL += 1
	NEXT
;CHARA_NUM("現在存在") - 1と等しい
CASE "室内の邪魔者"
	LOCAL = -1
	FOR LCOUNT, 2, CHARANUM
		SIF COND("現在存在", LCOUNT)
			LOCAL += 1
	NEXT
CASE "性処理合意没有"
	FOR LCOUNT, 2, CHARANUM
		SIF COND("合意：性処理", LCOUNT)
			CONTINUE
		SIF COND("現在存在", LCOUNT)
			LOCAL += 1
	NEXT
CASE "入室打招呼時の室内人数"
	FOR LCOUNT, 2, CHARANUM
		SIF COND("入室打招呼中", LCOUNT)
			CONTINUE
		SIF COND("現在存在", LCOUNT)
			LOCAL += 1
	NEXT
CASE "勧誘可能"
	FOR LCOUNT, 1, 200
		SIF EXISTCSV_EX(LCOUNT) && FINDCHARA(NO, LCOUNT) < 0
			LOCAL += 1
	NEXT
CASE "酔酒"
	FOR LCOUNT, 1, CHARANUM
		SIF STATE("酔酒", LCOUNT)
			LOCAL += 1
	NEXT
CASE "室内露出観客数"
	RETURNF TEQUIP:室内露出PLAY
CASE "出産間近"
	FOR LCOUNT, 2, CHARANUM
		SIF TALENT:LCOUNT:妊娠 == 3
			LOCAL += 1
	NEXT
CASE "助手可能", "同伴可能", "同居中", "同居：一直", "出現予定", "便当の約束", "性処理中", "現在存在", "入室打招呼中", "部室出現可能", "归途イベント可能", "要個室", "约会可能", "自撮り可能", "部員同士の交流可能", "朝袭相手", "夜袭相手", "性処理直後"
	FOR LCOUNT, 2, CHARANUM
		SIF COND(ARGS, LCOUNT)
			LOCAL += 1
	NEXT
CASE "成績：学年上位", "成績：優秀", "成績：赤点", "血縁", "レ阴蒂エーション可能"
	FOR LCOUNT, 1, CHARANUM
		SIF COND(ARGS, LCOUNT)
			LOCAL += 1
	NEXT
CASE "吸能"
	FOR LCOUNT, 1, CHARANUM
		SIF NOWEX:LCOUNT:ARGS
			LOCAL += 1
	NEXT
CASE "指示可能な助手"
	FOR LCOUNT, 2, CHARANUM
		SIF ABL:LCOUNT:助手
			LOCAL += 1
	NEXT

CASE "控え角色"
	LOCAL = CHARANUM - 2
	SIF TARGET
		LOCAL -= 1
CASE "調教経験有"
	FOR LCOUNT, 2, CHARANUM
		SIF EXP:LCOUNT:Ｈ回数
			LOCAL += 1
	NEXT
CASE "繰り越し角色"
	FOR LCOUNT, 2, CHARANUM
		LOCAL += CFLAG:LCOUNT:繰り越し角色
	NEXT
CASE "陥落済み"
	FOR LCOUNT, 2, CHARANUM
		SIF TALENT:LCOUNT:淫乱 || TALENT:LCOUNT:恋慕
			LOCAL += 1
	NEXT
CASE "恋慕淫乱"
	FOR LCOUNT, 2, CHARANUM
		SIF TALENT:LCOUNT:恋慕 || TALENT:LCOUNT:淫乱
			LOCAL += 1
	NEXT
;それ以外は素質や属性
CASEELSE
	MEMOS = %NAMES("素質一覧")%
	LOCAL = 0
	FOR LCOUNT, 2, CHARANUM
		IF STRCOUNT(@"\/%CSTR:LCOUNT:属性%", @"\/%ARGS%\/")
			LOCAL += 1
		ELSEIF STRCOUNT(MEMOS, @"\/%ARGS%\/") && TALENT:LCOUNT:ARGS
			LOCAL += 1
		ENDIF
	NEXT
ENDSELECT
RETURNF LOCAL

;-------------------------------------------------
;文字列ARGSから添え字を消す関数
;-------------------------------------------------
@NONUM(ARGS)
#FUNCTIONS
REPLACE ARGS, "[０-９]", ""
REPLACE RESULTS, "[0-9]", ""
RETURNF RESULTS

;-------------------------------------------------
;文字列ARGSから添え字以外を消す関数。添え字が無い場合には全部消える
;-------------------------------------------------
@ONLYNUM(ARGS)
#FUNCTIONS
REPLACE ARGS, "[０-９]", ""
REPLACE RESULTS, "[0-9]", ""
REPLACE ARGS, RESULTS, ""
RETURNF RESULTS

;-------------------------------------------------
;CALLNAMEがARGSな角色の番号を返す関数
;-------------------------------------------------
@CNUM(ARGS)
#FUNCTION

;極稀にいるCALLNAMEが変わる角色用
SELECTCASE ARGS
CASE "白色死神", "アーリャ"
	RETURNF MAX(FINDCHARA(CALLNAME, "白色死神"), FINDCHARA(CALLNAME, "アーリャ"), 0)
CASEELSE
	RETURNF MAX(FINDCHARA(CALLNAME, ARGS), 0)
ENDSELECT

;-------------------------------------------------
;頻繁に使う条件のまとめ
;LOCALを使う際には慎重に！！
;ARGがARGSを満たすか判定する。ただし、挿入については@INSERTで管理する
;素質については"素質名"を入れると機能し、その素質が無いのを条件とするときには"!素質名"とします
;-------------------------------------------------
@COND(ARGS, ARG)
#FUNCTION
#DIM LCOUNT
#DIMS SUB_ARGS

SIF ARG < 0
	RETURNF 0
SIF ARG == 0 && TARGET
	ARG = TARGET
SELECTCASE ARGS
;角色の名前など基本的なものを隠します
CASE "基本情報隠蔽"
	SIF CEVENT("情報開示：基本", ARG)
		RETURNF 0
	SIF CEVENT("情報隠蔽", ARG) || CEVENT("部分情報隠蔽：基本", ARG)
		RETURNF 1
CASE "素質隠蔽"
	SIF CEVENT("情報開示：素質", ARG)
		RETURNF 0
	SIF CEVENT("情報開示：性格", ARG) || CEVENT("情報開示：体質", ARG) || CEVENT("情報開示：特技", ARG)
		RETURNF 0
	SIF CEVENT("情報開示：嗜好", ARG) || CEVENT("情報開示：損傷", ARG) || CEVENT("情報開示：弱点", ARG) || CEVENT("情報開示：装身", ARG)
		RETURNF 0
	SIF CEVENT("情報隠蔽", ARG)
		RETURNF 1
CASE "素質隠蔽：性格", "素質隠蔽：体質", "素質隠蔽：特技", "素質隠蔽：嗜好", "素質隠蔽：損傷", "素質隠蔽：弱点", "素質隠蔽：装身", "素質隠蔽：未分類"
	SUB_ARGS = %EXTSTR(ARGS, "：")%
	SIF CEVENT("情報開示：素質", ARG) || CEVENT(@"情報開示：%SUB_ARGS%", ARG)
		RETURNF 0
	SIF CEVENT("情報隠蔽", ARG) || CEVENT(@"部分情報隠蔽：%SUB_ARGS%", ARG)
		RETURNF 1
CASE "経験隠蔽"
	SIF CEVENT("情報開示：経験", ARG)
		RETURNF 0
	SIF CEVENT("情報隠蔽", ARG) || CEVENT("部分情報隠蔽：経験", ARG)
		RETURNF 1
CASE "能力隠蔽"
	SIF CEVENT("情報開示：能力", ARG)
		RETURNF 0
	SIF CEVENT("情報隠蔽", ARG) || CEVENT("部分情報隠蔽：能力", ARG)
		RETURNF 1

CASE "仮想角色"
	;ドッペル你の時or仮想角色フラグが立っているとき
	SIF NO:ARG == 99 || CEVENT("仮想角色", ARG)
		RETURNF 1
CASE "交流中"
	SIF CFLAG:ARG:お相手
		RETURNF 1
CASE "部員間Ｈ主導者"
	SIF CEVENT("部員間交流", ARG)
		RETURNF 1
CASE "只和你Ｈ"
	SIF CFLAG:ARG:ＮＴＲ禁止 == 1
		RETURNF 1
CASE "部員間Ｈ可能"
	SIF CONFIG("部員間Ｈ") == 0
		RETURNF 0
	SIF COND("只和你Ｈ", ARG)
		RETURNF 0
	SIF TALENT:ARG:贞操重视
		RETURNF 0
	SIF TALENT:ARG:淫乱
		RETURNF 1
CASE "路人Ｈ可能"
	SIF CONFIG("路人Ｈ") == 0
		RETURNF 0
	SIF CFLAG:ARG:ＮＴＲ禁止
		RETURNF 0
	SIF TALENT:ARG:贞操重视
		RETURNF 0
	SIF TALENT:ARG:淫乱
		RETURNF 1
CASE "避孕套搾精量", "套套内精液量", "避孕套使用数", "精液入り避孕套数"
	VARSET LOCALS
	SPLIT CSTR:ARG:避孕套履歴, "/", LOCALS
	LOCAL = 0
	FOR LCOUNT, 0, 100
		SELECTCASE LOCALS:LCOUNT
		CASE ""
			BREAK
		CASE "喝套内精液"
			SELECTCASE ARGS
			CASE "套套内精液量", "精液入り避孕套数"
				LOCAL = 0
			ENDSELECT
		CASEELSE
			SELECTCASE ARGS
			CASE "避孕套使用数", "精液入り避孕套数"
				LOCAL += 1
			CASEELSE
				LOCAL += TOINT(LOCALS:LCOUNT)
			ENDSELECT
		ENDSELECT
	NEXT
	RETURNF LOCAL
CASE "最新Ｖ中出し相手", "最新Ａ中出し相手", "最新膀胱中出し相手", "最新乳内中出し相手", "最新精飲相手"
	VARSET LOCALS
	SELECTCASE ARGS
	CASE "最新Ｖ中出し相手"
		SPLIT CSTR:ARG:被Ｖ中出, "/", LOCALS
	CASE "最新Ａ中出し相手"
		SPLIT CSTR:ARG:被Ａ中出, "/", LOCALS
	CASE "最新膀胱中出し相手"
		SPLIT CSTR:ARG:被膀胱中出, "/", LOCALS
	CASE "最新乳内中出し相手"
		SPLIT CSTR:ARG:被乳内中出, "/", LOCALS
	CASE "最新精飲相手"
		SPLIT CSTR:ARG:精飲, "/", LOCALS
	ENDSELECT
	SPLIT LOCALS, "：", LOCALS
	RETURNF TO_NUMBER(TOINT(LOCALS))
CASE "緊張緩和"
	SIF TEQUIP:ARG:弛緩
		RETURNF 1
CASE "弛緩"
	SIF TEQUIP:ARG:弛緩 >= 2
		RETURNF 1
CASE "陶酔"
	SIF TEQUIP:ARG:弛緩 >= 3
		RETURNF 1
;SIMULATE_TRAIN中での純粋増分
CASE "絶頂増分"
	RETURNF MAX(EXP:ARG:絶頂経験 - TCVAR:ARG:取得絶頂経験, EXP:ARG:射精経験 - TCVAR:ARG:取得射精経験)
CASE "射精増分"
	RETURNF EXP:ARG:射精経験 - TCVAR:ARG:取得射精経験
CASE "今回初射精"
	SIF NOWEX:ARG:射精 == EX:ARG:射精
		RETURNF 1
CASE "絶頂"
	SIF COND("手下留情中", ARG)
		RETURNF 0
	;絶頂＆射精
	SELECTCASE ARG
	CASE TARGET
		RETURNF NOWEX:ARG:絶頂数合計 + NOWEX:ARG:射精
	CASE PLAYER
		RETURNF TCVAR:ARG:絶頂度
	CASEELSE
		RETURNF MAX(TCVAR:ARG:絶頂度, NOWEX:ARG:絶頂数合計, NOWEX:ARG:射精)
	ENDSELECT
CASE "精通"
	SIF PENIS(ARG) == 0 || EXP:ARG:射精経験 == 0 || TALENT:ARG:未成熟
		RETURNF 0
	SIF NOWEX:ARG:射精 && EXP:ARG:射精経験 == 1
		RETURNF 1
CASE "前立腺刺激"
	SIF PENIS(ARG) == 0
		RETURNF 0
	SIF INSERT("Ａ挿入", ARG) && SIZE("阴茎", INSERT("Ａ挿入相手") ) >= 2
		RETURNF 1
	SIF SIZE("Ａ振動棒", ARG) >= 2
		RETURNF 1
	SIF TEQUIP:ARG:推倒
		RETURNF 0

	SELECTCASE SELECTCOM
	CASE TNUM("肛門拳交"), TNUM("両穴拳交")
		RETURNF 1
	ENDSELECT

CASE "要去了"
	SELECTCASE ARG
	CASE PLAYER
		;絶頂ゲージの75％以上
		SIF BASE:ARG:絶頂 >= MAXBASE:ARG:絶頂 * 3 / 4
			RETURNF 1
	CASEELSE
		SIF EX:ARG:绝顶忍耐
			RETURNF 1
		;快感許容値の75％以上
		SIF BASE:ARG:快感許容値女性 >= MAXBASE:ARG:快感許容値女性 * 3 / 4
			RETURNF 1
		;絶頂ゲージの75％以上
		SIF BASE:ARG:絶頂 >= MAXBASE:ARG:絶頂 * 3 / 4
			RETURNF 1
	ENDSELECT
CASE "忍住"
	SIF TCVAR:ARG:強制射精
		RETURNF 0
	SIF TFLAG:余裕 >= 4 && NOWEX:ARG:Luxurious == 0
		RETURNF 1
CASE "潮噴き可能"
	;女性器があることと、ある程度の尿意が必須
	SIF TALENT:ARG:男性 || BASE:ARG:尿意 < 1000
		RETURNF 0
	;尿道挿入中は不可
	SIF INSERT("尿道挿入", ARG) || TEQUIP:ARG:尿道振動棒
		RETURNF 0

	;絶頂失禁体質などがあるなら条件緩和
	IF TALENT:ARG:絶頂失禁体質 || TEQUIP:ARG:导管 || ABL:ARG:尿道拡張 >= 0
		SIF MAX(NOWEX:ARG:Ｃ絶頂 + NOWEX:ARG:尿道絶頂, NOWEX:ARG:Ｖ絶頂, NOWEX:ARG:Ａ絶頂, NOWEX:ARG:Ｂ絶頂, NOWEX:ARG:Ｍ絶頂) < 2
			RETURNF 0
		SIF MAX(NOWEX:ARG:Ｃ絶頂 + NOWEX:ARG:尿道絶頂, NOWEX:ARG:Ｖ絶頂) == 0 && MAX(NOWEX:ARG:Ａ絶頂, NOWEX:ARG:Ｂ絶頂, NOWEX:ARG:Ｍ絶頂) < 3
			RETURNF 0
	ELSE
		SIF MAX(NOWEX:ARG:Ｃ絶頂 + NOWEX:ARG:尿道絶頂, NOWEX:ARG:Ｖ絶頂) < 3 || NOWEX:ARG:絶頂数合計 < 5
			RETURNF 0
		SIF BASE:ARG:尿意 < 10000
			RETURNF 0
	ENDIF
	RETURNF 1
CASE "疲労", "疲労困憊"
	;通常バリアントでの気力が無くなった状態に相当
	SIF BASE:ARG:体力 < 500
		RETURNF 1
CASE "前回絶頂", "前Ｔ絶頂"
	SIF PREVPLAY("絶頂", ARG)
		RETURNF 1
CASE "炮友"
	SIF TALENT:ARG:炮友 == 1
		RETURNF 1
CASE "炮友契約"
	SIF TALENT:ARG:炮友 == 2
		RETURNF 1
;基本的には炮友契約と同じ。満足させていなくても秘め事を終了できるが、代わりに魂のお値段が割高になっている。
CASE "性処理契約"
	SIF TALENT:ARG:炮友 == 3
		RETURNF 1

CASE "両穴くぱぁ"
	SIF GETBIT(TEQUIP:ARG:特殊行動, 4)
		RETURNF 1
CASE "飲尿待機"
	SIF GETBIT(TEQUIP:ARG:特殊行動, 5)
		RETURNF 1

CASE "絶頂許可"
	RETURNF TCVAR:ARG:絶頂許可
CASE "射精部位変更"
	RETURNF TCVAR:ARG:射精部位の強制変更
CASE "派生前の選択指令"
	RETURNF SELECTCOM:4
CASE "派生前の前回選択指令"
	RETURNF PREVCOM:4
CASE "Ｗ推倒主導中"
	SIF TEQUIP:ARG:Ｗ推倒 == 1
		RETURNF 1
CASE "Ｗ推倒補助中"
	SIF TEQUIP:ARG:Ｗ推倒 == 2
		RETURNF 1
CASE "前回口交"
	SELECTCASE PREVCOM
	CASE 91, 99, 140, 150
		SIF COND("前Ｔ調教者", ARG) == PLAYER && PENIS(PLAYER)
			RETURNF 1
	ENDSELECT
CASE "主人への恋慕"
	SIF TALENT:ARG:恋慕 || CEVENT("助手調教での素質変化：恋慕外し", ARG)
		RETURNF 1
CASE "口の使用"
	;口枷
	SIF TEQUIP:ARG:口枷 == 1
		RETURNF 0
	RETURNF 1
CASE "口淫中"
	SELECTCASE SELECTCOM
	CASE 6, 91, 99, 140, 150
		RETURNF 1
	ENDSELECT
CASE "視力"
	;眼罩
	SIF TEQUIP:ARG:眼罩
		RETURNF 0
	RETURNF 1
CASE "指の使用"
	SIF GETBIT(TEQUIP:ARG:拘束, 20) || CHECK_GLOVE("指の使用禁止", ARG)
		RETURNF 0
	RETURNF 1
CASE "脚の使用"
	SIF COND("種族：拉米亚", ARG) || GETBIT(TEQUIP:ARG:拘束, 21)
		RETURNF 0
	RETURNF 1
CASE "脚が無い"
	SIF COND("種族：拉米亚", ARG)
		RETURNF 1
CASE "靴の着用"
	SIF COND("種族：拉米亚", ARG) || GETBIT(TEQUIP:ARG:拘束, 21)
		RETURNF 0
	SIF TALENT:ARG:動物足
		RETURNF 0
	RETURNF 1
CASE "角ハンドル"
	;悪魔の角だと掴み易い
	SELECTCASE NONUM(CONDS("角の形", ARG) )
	CASE "悪魔", "魔界人"
		RETURNF 1
	ENDSELECT

CASE "穿環存在"
	SIF TALENT:ARG:陰蒂環 + TALENT:ARG:陰唇環 + TALENT:ARG:乳环 + TALENT:ARG:肚脐环 + TALENT:ARG:尿道穿環 + TALENT:ARG:恥丘穿環
        RETURNF 1
CASE "穿環数"
	RETURNF	(TALENT:ARG:陰蒂環 > 0) + (TALENT:ARG:陰唇環 > 0) + (TALENT:ARG:乳环 > 0) + (TALENT:ARG:肚脐环 > 0) + (TALENT:ARG:尿道穿環 > 0) + (TALENT:ARG:恥丘穿環 > 0)
CASE "穿環存在：肚臍以外"
	SIF TALENT:ARG:陰蒂環 + TALENT:ARG:陰唇環 + TALENT:ARG:乳环 + TALENT:ARG:尿道穿環 + TALENT:ARG:恥丘穿環
        RETURNF 1

CASE "豊穣ＯＮ"
	SIF CONFIG("豊穣过滤器") == 0
		RETURNF 0
	SIF TALENT:ARG:豊穣
		RETURNF 1
CASE "Ｖ潤充分"
	RETURNF MAX(GET_PALAMLV(PALAM:ARG:Ｖ潤 + PALAM:PLAYER:Ｐ潤) - MAX(SIZE("阴茎", PLAYER) - ABL:ARG:Ｖ拡張 - (TEQUIP:ARG:弛緩 + 1)/2, 0) - 2, 0)
CASE "Ａ潤充分"
	SIF TALENT:ARG:縦深菊穴 && GET_PALAMLV(PALAM:ARG:Ａ潤)
		RETURNF 1
	RETURNF MAX(GET_PALAMLV(PALAM:ARG:Ａ潤 + PALAM:PLAYER:Ｐ潤) - MAX(SIZE("阴茎", PLAYER) - ABL:ARG:Ａ拡張 - (TEQUIP:ARG:弛緩 + 1)/2, 0) - 2, 0)

;扶她は相手の性別に対する嫌悪がない
CASE "性別嫌悪"
	SIF TALENT:ARG:兩面通吃
		RETURNF 0

	SELECTCASE ARG
	CASE TARGET
		LOCAL = PLAYER
		;好きなら忌避感０
		SIF TALENT:恋慕
			RETURNF 0
	CASEELSE
		LOCAL = TARGET
	ENDSELECT

	IF TALENT:LOCAL:男性
		SIF TALENT:ARG:討厭男人
			RETURNF 2
		SIF TALENT:ARG:討厭女人
			RETURNF 0
		SIF TALENT:ARG:男性 && TALENT:ARG:性反転 == 0
			RETURNF 1
		SIF TALENT:ARG:女性 && TALENT:ARG:性反転
			RETURNF 1
	ELSEIF TALENT:LOCAL:女性
		SIF TALENT:ARG:討厭女人
			RETURNF 2
		SIF TALENT:ARG:討厭男人
			RETURNF 0
		SIF TALENT:ARG:女性 && TALENT:ARG:性反転 == 0
			RETURNF 1
		SIF TALENT:ARG:男性 && TALENT:ARG:性反転
			RETURNF 1
	ENDIF

;返り値が嘔吐確率
CASE "嘔吐確率"
	SIF CONFIG("嘔吐発生") == 0 || BASE:ARG:嘔吐感 == 0
		RETURNF 0
	;嘔吐反射耐性があるとBASE:嘔吐感が3までは平気。それ以降は10％づつ上昇
	IF TALENT:ARG:嘔吐反射耐性
		SELECTCASE BASE:ARG:嘔吐感
		CASE IS <= 3
			RETURNF 0
		CASEELSE
			RETURNF (BASE:ARG:嘔吐感 - 3)*10
		ENDSELECT
	ELSE
		;耐性が無いとRAND:(BASE:ARG:嘔吐感 + 1) で起きる
		RETURNF 100 * BASE:ARG:嘔吐感 / (BASE:ARG:嘔吐感 + 1)
	ENDIF
CASE "想吐"
	SIF TCVAR:ARG:想吐
		RETURNF 1
CASE "嘔吐後余力有"
	SIF EXP:ARG:強制口交嘔吐經驗 == 0
		RETURNF 0
	SIF TALENT:ARG:喉性感 == 0 || TALENT:ARG:汚臭無視 == 0 || ABL:ARG:受虐属性 == 0
		RETURNF 0
	SIF BASE:ARG:体力 < 1000 || BASE:ARG:精力 < 5 || MOOD() < 30
		RETURNF 0
	SIF COND("欲求不満", ARG) == 0 || COND("満足", ARG)
		RETURNF 0
	RETURNF 1
CASE "射精後嘔吐"
	SIF NOWEX:ARG:嘔吐寸止め && COND("絶頂", PLAYER)
		RETURNF 1
CASE "口球"
	SIF TEQUIP:ARG:口枷 == 1
		RETURNF 1
CASE "開口口枷"
	SIF TEQUIP:ARG:口枷 == 2
		RETURNF 1

CASE "假阳具"
	SIF ITEM:假阳具 == 0
		RETURNF 0
	RETURNF 1
CASE "双頭振動棒"
	RETURNF GETBIT(TEQUIP:ARG:振動棒, 10)

CASE "肛門拉珠"
	RETURNF GETBIT(TEQUIP:ARG:肛用振動棒, 11)
CASE "長振動棒"
	RETURNF GETBIT(TEQUIP:ARG:肛用振動棒, 20)

CASE "尿道布ル"
	RETURNF GETBIT(TEQUIP:ARG:尿道振動棒, 11)

CASE "肛門栓"
	SIF TEQUIP:ARG:肛塞 || TEQUIP:ARG:肛用振動棒
		RETURNF 1

;TEQUIP:浣腸は薬剤使用だと>=2となり、精液浣腸時には==１となる
;優先度は温泉＞精液＞液体なので分岐はこの順にするのが望ましい
CASE "液体浣腸"
	SELECTCASE TEQUIP:ARG:浣腸
	CASE IS >= 2
		RETURNF TEQUIP:ARG:浣腸
	ENDSELECT
CASE "大量浣腸"
	SIF TEQUIP:ARG:浣腸 >= 3
		RETURNF 1
CASE "精液浣腸"
	RETURNF TEQUIP:ARG:精液浣腸
CASE "温泉浣腸"
	RETURNF TEQUIP:ARG:温泉浣腸

CASE "排泄：危険域"
	SIF TEQUIP:ARG:浣腸 && BASE:ARG:排泄欲 >= 8000
		RETURNF 1
CASE "排泄：限界"
	SIF BASE:ARG:排泄欲 >= MAXBASE:ARG:排泄欲
		RETURNF 1

CASE "尿道履歴"
	IF PENIS(ARG)
		RETURNF CFLAG:ARG:Ｐ尿道履歴
	ELSE
		RETURNF CFLAG:ARG:Ｖ尿道履歴
	ENDIF
CASE "尿道使用中"
	IF ARG == TARGET
		SELECTCASE SELECTCOM
		;尿道使用中
		CASE 83 TO 88
			RETURNF 1
		CASEELSE
			SIF INSERT("尿道挿入", ARG) || TEQUIP:ARG:尿道振動棒
				RETURNF 1
		ENDSELECT
	ENDIF

CASE "陰蒂環可能"
	SIF ARG == MASTER
		RETURNF 1
	SIF TALENT:ARG:陰蒂環
		RETURNF 1
	SIF TALENT:ARG:淫核 + TALENT:ARG:淫乱 + TALENT:ARG:倒錯的
		RETURNF 1
	SIF ABL:ARG:受虐属性 >= 3
		RETURNF 1
CASE "陰唇環可能"
	SIF TALENT:ARG:男性
		RETURNF 0
	SIF ARG == MASTER
		RETURNF 1
	SIF TALENT:ARG:陰唇環
		RETURNF 1
	SIF TALENT:ARG:淫壷 + TALENT:ARG:淫乱 + TALENT:ARG:倒錯的
		RETURNF 1
	SIF ABL:ARG:受虐属性 >= 2
		RETURNF 1
CASE "恥丘穿環可能"
	SIF ARG == MASTER
		RETURNF 1
	SIF TALENT:ARG:恥丘穿環
		RETURNF 1
	SIF TALENT:ARG:淫核 + TALENT:ARG:淫壷 + TALENT:ARG:淫乱 + TALENT:ARG:倒錯的
		RETURNF 1
	SIF ABL:ARG:受虐属性 >= 1
		RETURNF 1
CASE "乳环可能"
	SIF COND("真性陥没乳頭", ARG)
		RETURNF 0
	SIF ARG == MASTER
		RETURNF 1
	SIF TALENT:ARG:乳环
		RETURNF 1
	SIF TALENT:ARG:淫乳 + TALENT:ARG:淫乱 + TALENT:ARG:倒錯的
		RETURNF 1
	SIF ABL:ARG:受虐属性 >= 1
		RETURNF 1
CASE "尿道穿環可能"
	SIF ARG == MASTER
		RETURNF 1
	SIF TALENT:ARG:尿道穿環
		RETURNF 1
	SIF ABL:ARG:尿道拡張 < 0
		RETURNF 0
	SIF TALENT:ARG:尿道狂 + TALENT:ARG:淫乱 + TALENT:ARG:倒錯的
		RETURNF 1
	SIF ABL:ARG:受虐属性 >= 4
		RETURNF 1

;ちんこの挿入具合
CASE "臍下到達"
	SIF SIZE("阴茎", PLAYER) < 2
		RETURNF 0
	SIF ABL:ARG:Ｖ拡張 >= 2 || COND("陶酔", ARG)
		RETURNF 1
CASE "臍上侵入"
	SIF SIZE("阴茎", PLAYER) < 3
		RETURNF 0
	SELECTCASE ABL:ARG:Ｖ拡張
	CASE IS >= 4
		RETURNF 1
	CASE 3
		;完全挿入と同じ条件
		SIF EXP:ARG:Ｖ性交経験 >= 20 && CALCF("阴茎好き度", ARG) >= SIZE("阴茎", PLAYER)
			RETURNF 1
		SIF COND("陶酔", ARG)
			RETURNF 1
	CASE 2
		SIF COND("陶酔", ARG) && EXP:ARG:Ｖ性交経験 >= 50 && CALCF("阴茎好き度", ARG) >= SIZE("阴茎", PLAYER)
			RETURNF 1
	ENDSELECT
;十分な拡張と阴茎の尺寸が必要
CASE "腹部变形"
	SIF SIZE("阴茎", PLAYER) < 4
		RETURNF 0
	SELECTCASE ABL:ARG:Ｖ拡張
	CASE IS >= 5
		RETURNF 1
	CASE 4
		;完全挿入と同じ条件
		SIF EXP:ARG:Ｖ性交経験 >= 20 && CALCF("阴茎好き度", ARG) >= SIZE("阴茎", PLAYER)
			RETURNF 1
		SIF COND("陶酔", ARG)
			RETURNF 1
	CASE 3
		SIF COND("陶酔", ARG) && EXP:ARG:Ｖ性交経験 >= 50 && CALCF("阴茎好き度", ARG) >= SIZE("阴茎", PLAYER)
			RETURNF 1
	ENDSELECT
CASE "焦躁中"
	SIF TEQUIP:ARG:手下留情 == 0
		RETURNF 0
	SIF BASE:ARG:絶頂 >= MAXBASE:ARG:絶頂 || BASE:快感許容値男性 >= MAXBASE:快感許容値男性
		RETURNF 1

CASE "手下留情中"
	;手下留情の影響が及ばない指令
	SELECTCASE SELECTCOM
	CASE TNUM("自慰")
		RETURNF 0
	ENDSELECT

	SIF TEQUIP:ARG:手下留情
		RETURNF 1

CASE "手下留情失敗"
	SIF NOWEX:PLAYER:Luxurious
		RETURNF 1
	SIF NOWEX:骤停数合計 > CALCF("寸止め可能絶頂数")
		RETURNF 1
	SIF BASE:快感許容値女性 >= MAXBASE:快感許容値女性 && RAND:(NOWEX:骤停数合計 + 3) >= 3
		RETURNF 1
	SIF MAX(CUP:快Ｃ, CUP:快Ｖ, CUP:快Ａ, CUP:快Ｂ, CUP:快Ｍ, CUP:快尿) >= 30000
		RETURNF 1
	SIF PENIS(TARGET) && BASE:快感許容値男性 >= MAXBASE:快感許容値男性 * 3
		RETURNF 1
CASE "射精禁止中"
	IF ARG == TARGET
		SIF TEQUIP:ARG:导管 || TEQUIP:ARG:尿道振動棒
			RETURNF 1
		SIF COND("尿道使用中", ARG)
			RETURNF 1
	ENDIF
	SIF TEQUIP:ARG:手下留情
		RETURNF 1
	SIF COND("Ｐバインド弱体フラグ", ARG)
		RETURNF 0
	SIF BASE:ARG:快感許容値男性 >= MAX(MAXBASE:ARG:快感許容値男性*2, MAXBASE:ARG:絶頂*4)
		RETURNF 0
	SIF STATE("バインド：Ｐ", ARG)
		RETURNF 1
CASE "体位を変えた"
	SIF PREVPLAY("挿入",ARG) == 0
		RETURNF 0
	SIF PREVPLAY(CONDS("体位", ARG), ARG)
		RETURNF 0
	RETURNF 1
CASE "喜欢的体位中"
	SIF GETBIT(TALENT:ARG:喜欢的体位, 9)
		RETURNF 0
	SIF GETBIT(TALENT:ARG:喜欢的体位, 19) && SELECTCOM == 80
		RETURNF 1
	IF INSERT("Ｖ挿入", ARG)
		IF GETBIT(TALENT:ARG:喜欢的体位, 0) && INSERT("正常位", ARG)
			RETURNF 1
		ELSEIF GETBIT(TALENT:ARG:喜欢的体位, 1) && INSERT("後背位", ARG)
			RETURNF 1
		ELSEIF GETBIT(TALENT:ARG:喜欢的体位, 2) && INSERT("屈曲位", ARG)
			RETURNF 1
		ELSEIF GETBIT(TALENT:ARG:喜欢的体位, 3) && INSERT("対面座位", ARG)
			RETURNF 1
		ELSEIF GETBIT(TALENT:ARG:喜欢的体位, 4) && INSERT("背面座位", ARG)
			RETURNF 1
		ELSEIF GETBIT(TALENT:ARG:喜欢的体位, 5) && INSERT("騎乗位", ARG) && TEQUIP:ARG:推倒 == 0
			RETURNF 1
		ELSEIF GETBIT(TALENT:ARG:喜欢的体位, 6) && INSERT("騎乗位", ARG) && TEQUIP:ARG:推倒
			RETURNF 1
		ENDIF
	ENDIF
	IF INSERT("Ａ挿入", ARG)
		IF GETBIT(TALENT:ARG:喜欢的体位, 10) && INSERT("正常位", ARG)
			RETURNF 1
		ELSEIF GETBIT(TALENT:ARG:喜欢的体位, 11) && INSERT("後背位", ARG)
			RETURNF 1
		ELSEIF GETBIT(TALENT:ARG:喜欢的体位, 12) && INSERT("屈曲位", ARG)
			RETURNF 1
		ELSEIF GETBIT(TALENT:ARG:喜欢的体位, 13) && INSERT("対面座位", ARG)
			RETURNF 1
		ELSEIF GETBIT(TALENT:ARG:喜欢的体位, 14) && INSERT("背面座位", ARG)
			RETURNF 1
		ELSEIF GETBIT(TALENT:ARG:喜欢的体位, 15) && INSERT("騎乗位", ARG) && TEQUIP:ARG:推倒 == 0
			RETURNF 1
		ELSEIF GETBIT(TALENT:ARG:喜欢的体位, 16) && INSERT("騎乗位", ARG) && TEQUIP:ARG:推倒
			RETURNF 1
		ENDIF
	ENDIF
	IF INSERT("尿道挿入", ARG)
		IF GETBIT(TALENT:ARG:喜欢的体位, 20) && INSERT("正常位", ARG)
			RETURNF 1
		ELSEIF GETBIT(TALENT:ARG:喜欢的体位, 21) && INSERT("後背位", ARG)
			RETURNF 1
		ELSEIF GETBIT(TALENT:ARG:喜欢的体位, 22) && INSERT("屈曲位", ARG)
			RETURNF 1
		ELSEIF GETBIT(TALENT:ARG:喜欢的体位, 23) && INSERT("対面座位", ARG)
			RETURNF 1
		ELSEIF GETBIT(TALENT:ARG:喜欢的体位, 24) && INSERT("背面座位", ARG)
			RETURNF 1
		ELSEIF GETBIT(TALENT:ARG:喜欢的体位, 25) && INSERT("騎乗位", ARG) && TEQUIP:ARG:推倒 == 0
			RETURNF 1
		ELSEIF GETBIT(TALENT:ARG:喜欢的体位, 26) && INSERT("騎乗位", ARG) && TEQUIP:ARG:推倒
			RETURNF 1
		ENDIF
	ENDIF
;中出し後精液掻き出しイベントで使う。ということでTARGETとPLAYERは固定
CASE "中出され量"
	IF SHOOT("膣内", PLAYER)
		RETURNF EXP_GAIN("膣内精液経験", TARGET)
	ELSEIF SHOOT("肛門", PLAYER)
		LOCAL = EXP_GAIN("肛内精液経験", TARGET)
	ELSE
		RETURNF 0
	ENDIF
	RETURNF LOCAL
CASE "３Ｐ"
	SIF SELECTCOM:2 >= 0
		RETURNF 1
CASE "助手"
	SIF ASSI == ARG && TARGET != ARG
		RETURNF 1
CASE "助手ではない"
	SIF ASSI != ARG
		RETURNF 1
CASE "人里"
	SIF GETBIT(TEQUIP:野外PLAY, 0) || (GETBIT(TFLAG:地の文分岐, 0) && SELECTCOM == 171)
		RETURNF 1
CASE "森林"
	SIF GETBIT(TEQUIP:野外PLAY, 1) || (GETBIT(TFLAG:地の文分岐, 1) && SELECTCOM == 171)
		RETURNF 1
CASE "花園"
	SIF GETBIT(TEQUIP:野外PLAY, 2) || (GETBIT(TFLAG:地の文分岐, 2) && SELECTCOM == 171)
		RETURNF 1
CASE "水辺"
	SIF GETBIT(TEQUIP:野外PLAY, 3) || (GETBIT(TFLAG:地の文分岐, 3) && SELECTCOM == 171)
		RETURNF 1
CASE "海"
	SIF GETBIT(TEQUIP:野外PLAY, 4) || (GETBIT(TFLAG:地の文分岐, 4) && SELECTCOM == 171)
		RETURNF 1
CASE "室内"
	SIF TEQUIP:ARG:室内露出PLAY + TEQUIP:ARG:野外PLAY + TEQUIP:ARG:浴室PLAY == 0
		RETURNF 1
CASE "調教側"
	;封印中
	RETURNF 0

CASE "露茎"
	SIF TALENT:ARG:包茎 == 0
		RETURNF 1
CASE "假性包茎"
	SIF TALENT:ARG:包茎 == 1
		RETURNF 1
CASE "真性包茎"
	SIF TALENT:ARG:包茎 == 2
		RETURNF 1

CASE "乳頭肥大"
	SIF CONFIG(ARGS) == 0
		RETURNF 0
	RETURNF TALENT:ARG:乳頭肥大

CASE "陥没乳頭"
	SIF CONFIG(ARGS) == 0
		RETURNF 0
	SIF TALENT:ARG:陥没乳頭 >= 2
		RETURNF 2
	SIF TALENT:ARG:乳环
		RETURNF 0
	SIF TALENT:ARG:陥没乳頭
		RETURNF 1
CASE "假性陥没乳頭"
	SIF CONFIG("陥没乳頭") == 0
		RETURNF 0
	SIF TALENT:ARG:乳环
		RETURNF 0
	SIF TALENT:ARG:陥没乳頭
		RETURNF 1
CASE "真性陥没乳頭"
	SIF CONFIG("陥没乳頭") == 0
		RETURNF 0
	SIF TALENT:ARG:陥没乳頭 >= 2
		RETURNF 1

CASE "巨乳輪"
	SIF CONFIG(ARGS) == 0
		RETURNF 0
	RETURNF TALENT:ARG:巨乳輪

CASE "陰核肥大"
	SIF CONFIG(ARGS) == 0
		RETURNF 0
	RETURNF TALENT:ARG:陰核肥大
CASE "陰核包茎"
	SIF CONFIG(ARGS) == 0
		RETURNF 0
	;陰蒂環だと包茎にはならない
	SIF TALENT:ARG:陰蒂環
		RETURNF 0
	SIF TALENT:ARG:陰核包茎
		RETURNF 1
CASE "陰核露出"
	SIF TALENT:ARG:陰蒂環
		RETURNF 1
	RETURNF 0

CASE "陰毛年齢"
	SIF TALENT:ARG:陰毛年齢
		RETURNF TALENT:ARG:陰毛年齢
	RETURNF AGE(ARG)

;性器の見栄え詳細
CASE "黑木耳"
	SIF CONFIG("性器年齢") == 0 || TALENT:ARG:男性
		RETURNF 0
	SIF TALENT:ARG:性器年齢 >= 5
		RETURNF 1
CASE "色素沉淀(強)", "色素沉淀（強）"
	SIF CONFIG("性器年齢") == 0 || TALENT:ARG:男性
		RETURNF 0
	SIF TALENT:ARG:性器年齢 == 4
		RETURNF 1
CASE "色素沉淀", "色素沉淀"
	SIF CONFIG("性器年齢") == 0 || TALENT:ARG:男性
		RETURNF 0
	SIF TALENT:ARG:性器年齢 == 3
		RETURNF 1
CASE "色素沉淀(弱)", "色素沉淀（弱）"
	SIF CONFIG("性器年齢") == 0 || TALENT:ARG:男性
		RETURNF 0
	SIF TALENT:ARG:性器年齢 == 2
		RETURNF 1
CASE "美穴", "美穴"
	SIF CONFIG("性器年齢") == 0 || TALENT:ARG:男性 || TALENT:ARG:性器年齢 >= 4
		RETURNF 0
	SIF TALENT:ARG:外見年齢 > TALENT:ARG:性器年齢 || TALENT:ARG:性器年齢 == 1
		RETURNF 1
;美穴が先に判定されるので、TALENT:外見年齢 >= 2なら萝莉小穴にはならない
CASE "萝莉小穴", "萝莉小穴"
	SIF CONFIG("性器年齢") == 0 || TALENT:ARG:男性
		RETURNF 0
	SIF TALENT:ARG:外見年齢 >= 2
		RETURNF 0
	SIF TALENT:ARG:性器年齢 == 1
		RETURNF 1

CASE "乳頭奸"
	SIF CONFIG("乳頭奸") == 0
		RETURNF 0
	SIF TALENT:ARG:巨乳 == 0
		RETURNF 0
	SIF TALENT:ARG:淫乳
		RETURNF 1
CASE "子宮口弛緩度"
	;妊婦はNG
	SIF TALENT:ARG:妊娠
		RETURNF 0

	;子宮口に筋弛緩剤
	IF GETBIT(TEQUIP:ARG:筋弛緩剤, 3)
		RETURNF 3
	;直前に子宮に挿入済み
	ELSEIF EXP_GAIN("子宮姦経験", ARG) || (EXP:ARG:子宮口経験 >= 100 && EXP:ARG:子宮姦経験 >= 10)
		RETURNF 2
	;淫壷で出産経験有
	ELSEIF TALENT:ARG:淫壷 && TALENT:ARG:出産経験
		IF EXP:ARG:子宮口経験 >= 50 && EXP:ARG:子宮姦経験
			RETURNF 2
		ELSEIF EXP:ARG:子宮口経験 >= 50 || (EXP:ARG:子宮口経験 >= 20 && TEQUIP:ARG:弛緩 >= 2)
			SIF MARK:ARG:淫紋 >= 4
				RETURNF 2
			RETURNF 1
		ENDIF
	;淫壷または出産経験有
	ELSEIF TALENT:ARG:淫壷 || TALENT:ARG:出産経験
		IF EXP:ARG:子宮口経験 >= 100 && (EXP_GAIN("子宮姦経験", ARG) || EXP:ARG:子宮姦経験 >= 5)
			RETURNF 2
		ELSEIF EXP:ARG:子宮口経験 >= 100 || (TALENT:ARG:淫壷 && EXP:ARG:子宮口経験 >= 50 && TEQUIP:ARG:弛緩 >= 2)
			SIF MARK:ARG:淫紋 >= 4
				RETURNF 2
			RETURNF 1
		ENDIF
	ENDIF
	SIF MARK:ARG:淫紋 >= 4
		RETURNF 1

CASE "伪娘"
	SIF TALENT:ARG:男性 && TALENT:ARG:伪娘 && TALENT:ARG:高大 == 0
		RETURNF 1
CASE "池面"
	SIF TALENT:ARG:男性 && TALENT:ARG:伪娘 == 0
		RETURNF 1

CASE "精飲可能"
	SIF ABL:ARG:精液中毒 >= 3 && (ABL:ARG:精液中毒 >= 5 || MARK:ARG:屈服刻印 == 3 || ABL:ARG:奉仕精神 >= 5)
		RETURNF 3
	SIF ABL:ARG:精液中毒 && (ABL:ARG:精液中毒 >= 3 || ABL:ARG:奉仕精神 >= 5 || TALENT:ARG:精液嗜好)
		RETURNF 2
	SIF ABL:ARG:精液中毒 || ABL:ARG:奉仕精神 >= 5 || TALENT:ARG:精液嗜好
		RETURNF 1

;你を犯す際に避孕套没有でもＯＫ！かを判定します
CASE "女性主導生性交"
	;方針決定済み
	SIF TCVAR:ARG:Ｖ生挿入許可 || TCVAR:ARG:取消避孕套
		RETURNF 1
	;Ｈ的奖励中
	SIF TCVAR:ARG:獎勵生H
		RETURNF 1
	;そもそも生性交が嫌い
	SIF COND("中出し嫌い", ARG)
		RETURNF 0
	;人妻は厳しい
	SIF COND("人妻", ARG) && TALENT:ARG:恋慕 == 0
		RETURNF 0
	;安全日or避妊不要な状態
	SIF COND("安全日", ARG) || COND("避妊不要", ARG) || COND("受精確認", ARG) || COND("着床確認", ARG)
		RETURNF 1
	;难以妊娠人は危険日以外ならＯＫだしてくれたり
	IF TALENT:ARG:难以妊娠
		SIF COND("危険日", ARG) == 0 && COND("受精確率", ARG) < 80
			RETURNF 1
	ENDIF
	SIF MARK:ARG:淫紋 >= 4 && COND("欲求不満", ARG) >= 3
		RETURNF 1
	RETURNF 0

;避孕套派の人は中出しを嫌う
CASE "中出し嫌い"
	SIF ABL:ARG:精液中毒 >= 3 || TALENT:ARG:恋慕
		RETURNF 0
	SIF COND("避孕套派", ARG)
		RETURNF 1
;避孕套切れちゃったけど１回だけなら生で良いですよさせてくれるかの判定。凄い名前だ
CASE "再次生插入可能"
	;許可後に一回射精したらおしまい
	SIF TCVAR:ARG:再次生插入終了
		RETURNF 0
	SIF ABL:ARG:精液中毒 == 0
		RETURNF 0
	;超危険日は厳しい
	SIF COND("排卵中", ARG) && TALENT:ARG:难以妊娠 == 0
		RETURNF 0
	SIF COND("危険日", ARG) && TALENT:ARG:难以妊娠 == 0 && ABL:ARG:精液中毒 < 3
		RETURNF 0
	;そもそも生挿入ＯＫな状態
	SIF COND("女性主導生性交", ARG) || COND("合意：危険日生性交", ARG) || COND("避妊不要", ARG) || COND("讨厌避孕套", ARG)
		RETURNF 0
	;避孕套使ってないor已中出or中出し嫌いだとアウト
	SIF COND("避孕套使用数", ARG) == 0 || EXP_GAIN("膣内精液経験", ARG) || COND("中出し嫌い", ARG)
		RETURNF 0
	SIF TALENT:ARG:难以妊娠 && ABL:ARG:奉仕精神 >= 5
		RETURNF 1
	SIF (TALENT:ARG:温柔 && TALENT:ARG:接受快感) || TALENT:ARG:淫乱 || TALENT:ARG:不在乎貞操
		RETURNF 1
	SIF CONDS("精液弱点", ARG) == "膣内射精弱点"
		RETURNF 1
CASE "再次生插入実行済"
	SIF TCVAR:ARG:再次生插入終了
		RETURNF 1
;本当は駄目だけど生でして良いよイベントの発生フラグ。見た後はTCVAR:特別に生挿入イベ閲覧済 がONになる
CASE "特別に生挿入許可"
	SIF TCVAR:ARG:特別に生挿入イベ閲覧済
		RETURNF 0
	SIF TALENT:ARG:男性 || TALENT:ARG:贞操重视
		RETURNF 0
	;もう生挿入でやってます
	SIF TCVAR:ARG:Ｖ生挿入許可
		RETURNF 0
	;陶酔が前提
	SIF COND("陶酔", ARG) == 0
		RETURNF 0
	;生挿入は嫌い
	SIF COND("中出し嫌い", ARG)
		RETURNF 0
	;危険日はやっぱだめです
	SIF COND("危険日", ARG)
		RETURNF 0
	;そもそも生挿入ＯＫな状態
	SIF COND("女性主導生性交", ARG) || COND("合意：危険日生性交", ARG) || COND("避妊不要", ARG) || COND("讨厌避孕套", ARG)
		RETURNF 0
	RETURNF 1

CASE "无崩しでＡ挿入可"
	;そもそも可能な状態
	SIF COND("合意：肛門性交", ARG) || TEQUIP:ARG:拘束
		RETURNF 0
	;陶酔が前提
	SIF COND("陶酔", ARG) == 0
		RETURNF 0
	;サイズが厳しい
	SIF ABL:ARG:Ａ拡張  < SIZE("阴茎", PLAYER)
		RETURNF 0
	;既にＡ性交済み
	SIF CHOSECOMS("Ａ挿入", ARG)
		RETURNF 0
	;角色側で禁止している
	SIF CEVENT("合意禁止：肛門性交", ARG)
		RETURNF 0
	RETURNF 1

CASE "性転換可能"
	;妊娠中
	SIF TALENT:ARG:妊娠 || BASE:ARG:胎児
		RETURNF 0
	RETURNF 1
;避妊方法
CASE "口服避孕薬派"
	SIF TALENT:ARG:口服避孕薬派 > 0
		RETURNF 1
CASE "讨厌口服避孕薬"
	SIF TALENT:ARG:口服避孕薬派 < 0
		RETURNF 1
CASE "避孕套派"
	SIF TALENT:ARG:避孕套派 > 0
		RETURNF 1
CASE "讨厌避孕套"
	SIF TALENT:ARG:避孕套派 < 0
		RETURNF 1

CASE "安全日"
	;难以妊娠3LVの人は危険日・安全日が無い
	SIF TALENT:ARG:难以妊娠 == 3
		RETURNF 0
	SIF COND("妊娠可能", ARG) == 0
		RETURNF 0
	SIF MARK:ARG:淫紋 && BASE:ARG:胎児
		RETURNF 0
	SIF GETBIT(BASE:ARG:バイオリズム, 10)
		RETURNF 1
CASE "危険日存在"
	;难以妊娠3LVの人は危険日・安全日が無い
	SIF TALENT:ARG:难以妊娠 == 3
		RETURNF 0
	SIF COND("妊娠可能", ARG) == 0
		RETURNF 0
	RETURNF 1
CASE "危険日"
	SIF COND("危険日存在", ARG) == 0
		RETURNF 0
	SIF COND("避妊中", ARG) || TALENT:ARG:妊娠
		RETURNF 0
	SIF MARK:ARG:淫紋 && BASE:ARG:胎児
		RETURNF 0
	SIF GETBIT(BASE:ARG:バイオリズム, 11)
		RETURNF 1
CASE "排卵中", "超危険日"
	;妊娠できない身体
	SIF COND("妊娠可能", ARG) == 0
		RETURNF 0
	;难以妊娠3LVの人は危険日・安全日が無い
	SIF TALENT:ARG:难以妊娠 == 3
		RETURNF 0
	SIF MARK:ARG:淫紋 && BASE:ARG:胎児
		RETURNF 0
	SIF GETBIT(BASE:ARG:バイオリズム, 12)
		RETURNF 1
CASE "排卵誘発剤使用中"
	SIF MARK:ARG:淫紋 && BASE:ARG:胎児
		RETURNF 0
	SIF GETBIT(BASE:ARG:バイオリズム, 13)
		RETURNF 1
CASE "妊娠確実"
	SIF GETBIT(BASE:ARG:バイオリズム, 14)
		RETURNF 1
CASE "発情期"
	SIF CEVENT("発情スイッチ", MASTER)
		RETURNF 1
	SIF GETBIT(BASE:ARG:バイオリズム, 20)
		RETURNF 1
CASE "発情中"
	SIF CEVENT("発情スイッチ", MASTER)
		RETURNF 1
	SIF COND("発情期", ARG) == 0
		RETURNF 0
	SIF COND("欲求不満", ARG) || CFLAG:ARG:躁动难忍
		RETURNF 1

;***着床判定追加パッチで追加。済と確認の違いは、本人がはっきりわかっているかどうか
CASE "受精済"
	SIF TALENT:ARG:避妊の護符 || TALENT:ARG:事后避孕药
		RETURNF 0
	SIF BASE:ARG:受精
		RETURNF 1
CASE "受精確認"
	;護符、事后避孕药は確実に着床を防ぐので受精は無意味になる
	SIF TALENT:ARG:避妊の護符 || TALENT:ARG:事后避孕药
		RETURNF 0
	SIF MARK:ARG:淫紋 && BASE:ARG:受精
		RETURNF 1
CASE "着床確認"
	SIF MARK:ARG:淫紋 && BASE:ARG:胎児
		RETURNF 1
CASE "着床済"
	SIF BASE:ARG:胎児
		RETURNF 1

CASE "胎内の精液量"
	RETURNF BASE:ARG:胎内精子量+BASE:ARG:胎内精液量
CASE "Ａ胎内の精液量"
	RETURNF BASE:ARG:Ａ胎内精子量 + BASE:ARG:Ａ胎内精液量
CASE "受精確率"
	;***着床判定追加パッチで変更　着床判定有効時、受精時には受精確率を0と返すように
	SIF BASE:ARG:精液の優勢 == 0 || BASE:ARG:受精 > 0
		RETURNF 0

	;Ｖ妊娠かＡ妊娠かで分岐
	IF TALENT:ARG:Ａ妊娠体質
		SIF COND("Ａ妊娠可能", ARG) == 0 || BASE:ARG:Ａ胎内精子量 == 0
			RETURNF 0
	ELSE
		SIF COND("Ｖ妊娠可能", ARG) == 0 || BASE:ARG:胎内精子量 == 0
			RETURNF 0
	ENDIF

	;だいたい排卵中の日に100ぐらいあれば妊娠するのが目安
	IF TALENT:ARG:Ａ妊娠体質 == 0
		LOCAL = BASE:ARG:胎内精子量
	ELSEIF TALENT:ARG:Ａ妊娠体質
		LOCAL = BASE:ARG:Ａ胎内精子量
	ENDIF

	;妊娠確実
	IF GETBIT(BASE:ARG:バイオリズム, 14)
		RETURNF 100
	;排卵誘発剤使用中
	ELSEIF GETBIT(BASE:ARG:バイオリズム, 13)
		LOCAL *= 15
	;排卵中or発情期
	ELSEIF GETBIT(BASE:ARG:バイオリズム, 12) || GETBIT(BASE:ARG:バイオリズム, 20)
		LOCAL *= 10
	;危険日
	ELSEIF GETBIT(BASE:ARG:バイオリズム, 11)
		LOCAL *= 3
	;安全日
	ELSEIF GETBIT(BASE:ARG:バイオリズム, 10)
		LOCAL /= 10
	ENDIF

	;难以妊娠LV2
	SIF TALENT:ARG:难以妊娠 == 2
		LOCAL /= 10

	LOCAL = MIN(LOCAL/10, 100)

	;受胎祝福による強化
	SIF CADV("受胎祝福")
		RETURNF 100

	RETURNF LOCAL

;***着床判定追加パッチで追加
;精子が相手を孕ませやすくする強度です
;現状、影響するのは着床確率のみです。受精確率は変化しません。
CASE "精子強度"
	;男性側に子づくり強化の素質を追加した場合、ここで格子して精子強度を上げるといいでしょう
	;***種付け強化パッチで追加
	;基本強度は1
	LOCAL = 1
	;孕ませ素質・経験による精子強度BOUNS
	IF TALENT:ARG:小种马
		;孕ませた回数が10回以上の場合、更に10回ごとにBOUNS
		LOCAL += MAX(0, (EXP:ARG:孕ませ経験 - 10) / 10)
		;素質によるBOUNS
		IF TALENT:ARG:小种马 >= 2
			LOCAL += 3
		ELSEIF TALENT:ARG:小种马
			LOCAL += 1
		ENDIF
	ENDIF

	;受胎祝福による強化
	SIF CADV("受胎祝福")
		LOCAL *= 1000

	;最低値は1
	RETURNF MAX(1, LOCAL)
;***着床判定追加パッチで追加
CASE "着床確率"
	;護符、事后避孕药は確実に着床を防ぐ
	SIF TALENT:ARG:避妊の護符 || TALENT:ARG:事后避孕药
		RETURNF 0
	;当然だが受精していないと確率は0
	SIF BASE:ARG:受精 == 0
		RETURNF 0

	SIF CFLAG:ARG:着床確実
		RETURNF 100

	;基礎着床率は40％
	LOCAL = 40

	;受精強度の影響。受精強度が很强場合、通常より着床確率が上がります。
	LOCAL = LOCAL * MIN(500, 50 + 50 * BASE:ARG:受精) / 100

	;难以妊娠持ちは着床確率が通常の60-10%に低下。素質強度が高いほど低下
	IF TALENT:ARG:难以妊娠
		LOCAL = LOCAL * MAX(10, 60 - TALENT:ARG:难以妊娠 * 10) / 100
	;容易妊娠持ちは着床確率が通常の150-350%に上昇。素質強度が高いほど上昇
	ELSEIF TALENT:ARG:容易妊娠
		LOCAL = LOCAL * MIN(350, 100 + TALENT:ARG:容易妊娠 * 50) / 100
	ENDIF

	;着床確率は最低でも1%
	RETURNF MAX(1, LOCAL)
CASE "一般にＶ妊娠不能"
	SIF TALENT:ARG:男性 || TALENT:ARG:未成熟 || COND("種族：人形", ARG) || COND("種族：自动人形", ARG)
		RETURNF 1
	RETURNF 0
;これは体質として妊娠可能かのみを見る。避妊中だろうと妊娠中だろうと妊娠できる体質なら1が返回のに注意
CASE "妊娠可能"
	SIF TALENT:ARG:Ａ妊娠体質
		RETURNF 1
	SIF TALENT:ARG:Ｖ妊娠不能 == 0
		RETURNF 1
	RETURNF 0
;現在妊娠可能かはＡ妊娠とＶ妊娠で分ける
CASE "Ｖ妊娠可能", "Ａ妊娠可能"
	SELECTCASE ARGS
	CASE "Ｖ妊娠可能"
		SIF TALENT:ARG:Ｖ妊娠不能
			RETURNF 0
	CASE "Ａ妊娠可能"
		SIF TALENT:ARG:Ａ妊娠体質 == 0
			RETURNF 0
	ENDSELECT
	;妊娠中or避妊中
	SIF TALENT:ARG:妊娠 || BASE:ARG:胎児
		RETURNF 0
	SIF COND("避妊中", ARG) && COND("避妊中だが妊娠可能", ARG) == 0
		RETURNF 0
	RETURNF 1

CASE "避妊中"
	SIF TALENT:ARG:避妊の護符 || CFLAG:ARG:口服避孕薬
		RETURNF 1

;***着床判定追加パッチで追加
;避妊中ではあるが完全には妊娠を防げない状態
CASE "避妊中だが妊娠可能"
	;口服避孕薬を飲んでいる場合は妊娠不可能
	SIF CFLAG:ARG:口服避孕薬
		RETURNF 0
	;護符をもっている場合も妊娠不可能
	SIF TALENT:ARG:避妊の護符
		RETURNF 0
	RETURNF 1

;避妊処置をしなくて良い事が角色に分かっている状態
CASE "避妊不要"
	SIF COND("妊娠可能", ARG) == 0
		RETURNF 1
	;避妊中or妊娠発覚済
	SIF COND("避妊中", ARG) || COND("妊娠中：妊娠発覚済み", ARG)
		RETURNF 1
	SIF COND("受精確認", ARG) || COND("着床確認", ARG)
		RETURNF 1

CASE "妊娠確率極低"
	;难以妊娠人は危険日以外なら大体ＯＫだしてくれたり
	SIF TALENT:ARG:难以妊娠 && COND("危険日", ARG) == 0 && COND("受精確率", ARG) < 40
		RETURNF 1

CASE "妊娠中"
	RETURNF BASE:ARG:胎児
CASE "妊娠中：妊娠発覚直前"
	RETURNF GETBIT(BASE:ARG:胎児, 6)
CASE "妊娠中：妊娠発覚済み"
	SIF GETBIT(BASE:ARG:胎児, 7) || GETBIT(BASE:ARG:胎児, 8) || GETBIT(BASE:ARG:胎児, 9)
		RETURNF 1
;下の　妊娠中：各イベント進行度　が11以上で臨月となる
CASE "妊娠中：臨月"
	RETURNF GETBIT(BASE:ARG:胎児, 8)
CASE "妊娠中：分娩直前"
	RETURNF GETBIT(BASE:ARG:胎児, 9)
CASE "妊娠中：分娩"
	RETURNF GETBIT(BASE:ARG:胎児, 10)
CASE "妊娠中：息子"
	RETURNF GETBIT(BASE:ARG:胎児, 20)
CASE "妊娠中：各イベント進行度"
	RETURNF GETBITS(BASE:ARG:胎児, 0, 5)
CASE "妊娠初期"
	SIF COND("妊娠中：妊娠発覚済み", ARG) == 0
		RETURNF 0
	SIF GETBITS(BASE:ARG:胎児, 0, 5) <= 4
		RETURNF 1
CASE "妊娠中期"
	SIF COND("妊娠中：妊娠発覚済み", ARG) == 0
		RETURNF 0
	SELECTCASE GETBITS(BASE:ARG:胎児, 0, 5)
	CASE 5 TO 8
		RETURNF 1
	ENDSELECT
CASE "妊娠後期"
	IF COND("妊娠中：臨月", ARG) || COND("妊娠中：分娩直前", ARG)
		RETURNF 1
	ELSEIF COND("妊娠中：妊娠発覚済み", ARG)
		SIF GETBITS(BASE:ARG:胎児, 0, 5) >= 9
			RETURNF 1
	ENDIF

CASE "妊娠イベント中"
	;妊娠確定、臨月、出産、子育て
	SIF BASE:ARG:胎児 || BASE:ARG:育児中 || TALENT:ARG:妊娠
		RETURNF 1

CASE "育児中：兒童が大きくなった"
	SIF GETBITS(BASE:ARG:育児中, 0, 5) >= 14
		RETURNF 1
CASE "育児中：育児終了"
	RETURNF GETBIT(BASE:ARG:育児中, 6)

CASE "育児中：孵化中";つまり今は卵の状態で温めています
	RETURNF GETBIT(BASE:ARG:育児中, 19)
CASE "育児中：孵化";卵が割れて兒童が出てきました
	SIF GETBITS(BASE:ARG:育児中, 0, 5) >= 6
		RETURNF 1

CASE "育児中：息子"
	RETURNF GETBIT(BASE:ARG:育児中, 20)

CASE "哺乳可能"
	SIF CHOSE_DEVENT("哺乳", ARG) >= 3 && BASE:ARG:育児中
		RETURNF 0
	SIF ABL:ARG:信頼 >= 3 && TALENT:ARG:母乳体質 && BASE:ARG:母乳 >= 3000
		RETURNF 1

CASE "兒童に胸部可能"
	SIF CHOSE_DEVENT("兒童に胸部", ARG)
		RETURNF 0
	SIF TALENT:ARG:母乳体質 && BASE:ARG:母乳 >= 3000 && BASE:ARG:育児中
		RETURNF 1
;禁断的知識
CASE "淫紋の刻印可能"
	SIF TALENT:ARG:禁断的知識
		RETURNF 1
CASE "具現可能"
	SIF TALENT:ARG:具現 && PENIS(TARGET) == 0
		RETURNF 1
	SIF TALENT:ARG:禁断的知識 >= 2
		RETURNF 1
CASE "認識阻害可能"
	SIF TALENT:ARG:禁断的知識 >= 3
		RETURNF 1

CASE "人外度"
	;人外度を返す
	SIF COND("種族：拉米亚", ARG) + COND("種族：人形", ARG)
		RETURNF 3

CASE "前Ｔ調教者"
	RETURNF TFLAG:前Ｔ調教者
CASE "前Ｔ対象"
	RETURNF TFLAG:前Ｔ対象
CASE "前Ｔと同ペア"
	SIF TFLAG:前Ｔ対象 == TARGET && TFLAG:前Ｔ調教者 == PLAYER
		RETURNF 1
CASE "前Ｔから対象のみ変更"
	SIF TFLAG:前Ｔ対象 != TARGET && TFLAG:前Ｔ調教者 == PLAYER
		RETURNF 1
CASE "前Ｔから調教者のみ変更"
	SIF TFLAG:前Ｔ対象 == TARGET && TFLAG:前Ｔ調教者 != PLAYER
		RETURNF 1
CASE "連続実行"
	;前回指令が違うor調教中で無いなら連続とはみなさない
	SIF PREVCOM != SELECTCOM || SELECTCOM < 0 || COND("調教中", ARG) == 0
		RETURNF 0
	;連続実行の例外
	SELECTCASE SELECTCOM
	CASE 8
		SIF CHECK_COM("玩弄Ｇ点")
			RETURNF 0
	CASE 31, 106
		SIF TEQUIP:振動棒 == 0
			RETURNF 0
	CASE 33, 107
		SIF TEQUIP:肛用振動棒 == 0
			RETURNF 0
	CASE 152
		SIF TEQUIP:尿道振動棒 == 0
			RETURNF 0
	CASE 60 TO 79
		SIF INSERT("狂野摇摆")
			RETURNF 0
	CASE 136, 207
		SIF TEQUIP:浣腸 == 0
			RETURNF 0
	ENDSELECT
	RETURNF 1

CASE "精飲弱点"
	RETURNF GETBIT(TALENT:ARG:精液弱点, 0)
CASE "膣内射精弱点"
	RETURNF GETBIT(TALENT:ARG:精液弱点, 1)
CASE "肛内射精弱点"
	RETURNF GETBIT(TALENT:ARG:精液弱点, 2)
CASE "乳内射精弱点"
	RETURNF GETBIT(TALENT:ARG:精液弱点, 3)
CASE "尿道内射精弱点"
	RETURNF GETBIT(TALENT:ARG:精液弱点, 4)

CASE "全部弱点"
	SIF STRCOUNT(CSTR:ARG:弱点, "/") >= NUM("弱点")
		RETURNF 1
CASE "手弱点", "口弱点", "胸弱点", "脚弱点", "♀弱点", "接吻弱点", "肛門弱点", "♂弱点", "尿道弱点", "气味弱点"
	RETURNF STRCOUNT(CSTR:ARG:弱点, ARGS)

;調教知識"
CASE "愛撫・奉仕知識"
	RETURNF GETBIT(TALENT:ARG:調教知識, 0)
CASE "教育擅長"
	RETURNF GETBIT(TALENT:ARG:調教知識, 1)
CASE "ＳＭ知識"
	RETURNF GETBIT(TALENT:ARG:調教知識, 2)
CASE "Ａ調教知識"
	RETURNF GETBIT(TALENT:ARG:調教知識, 3)
CASE "性器拡張知識"
	RETURNF GETBIT(TALENT:ARG:調教知識, 4)
CASE "道具使"
	RETURNF GETBIT(TALENT:ARG:調教知識, 5)
CASE "露出知識"
	RETURNF GETBIT(TALENT:ARG:調教知識, 6)

CASE "朝"
	SIF TIME == 0
		RETURNF 1
CASE "昼"
	SIF TIME == 1
		RETURNF 1
CASE "夜"
	SIF TIME == 2
		RETURNF 1
CASE "夕"
	SIF TIME == 3
		RETURNF 1

CASE "体育"
	SIF DAYEV("文化祭") || COND("朝") + COND("昼") == 0
		RETURNF 0
	SIF (DAY - 1)%7 == 2 || (DAY - 1)%7 == 5
		RETURNF 1
CASE "水泳"
	SIF DAYEV("文化祭") || COND("朝") + COND("昼") == 0
		RETURNF 0
	SIF (DAY - 1)%7 == 3
		RETURNF 1

CASE "学園"
	SIF TEXTS("曜日") == "日"
		RETURNF 0
	SIF TIME == 1
		RETURNF 1

CASE "春", "夏", "秋", "冬"
	SIF TEXTS("季節") == ARGS
		RETURNF 1
CASE "初夏", "初秋", "晩秋"
	SIF TEXTS("季節詳細") == ARGS
		RETURNF 1

CASE "周日", "日"
	SIF (DAY - 1)%7 == 0
		RETURNF 1
CASE "周一", "月"
	SIF (DAY - 1)%7 == 1
		RETURNF 1
CASE "周二", "火"
	SIF (DAY - 1)%7 == 2
		RETURNF 1
CASE "周三", "水"
	SIF (DAY - 1)%7 == 3
		RETURNF 1
CASE "周四", "木"
	SIF (DAY - 1)%7 == 4
		RETURNF 1
CASE "周五", "金"
	SIF (DAY - 1)%7 == 5
		RETURNF 1
CASE "周六", "土"
	SIF (DAY - 1)%7 == 6
		RETURNF 1

;その日独特の衣装がある日
CASE "Cosplay日"
	SIF DAYEV("新年") || DAYEV("女仆の日") || DAYEV("比基尼の日") || DAYEV("兔女郎の日")
		RETURNF 1

CASE "調教終了可能"
	SIF CONFIG("指令过滤器")
		RETURNF 0

	SIF TEQUIP:推倒 == 0
		RETURNF 1
	SIF COND("性処理契約", TARGET)
		RETURNF 1
	IF TEQUIP:Ｗ推倒 && TARGET:1
		SIF COND("満足", TARGET) && COND("満足", TARGET:1)
			RETURNF 1
	ELSEIF COND("満足", TARGET) || COND("疲労") || BASE:精力 == 0
		RETURNF 1
	ENDIF
;誰をpartnerに選んで調教に入ったか、などで参照できる
CASE "第一対象"
	RETURNF GETBITS(FLAG:状況判定, 0, 9)
CASE "調教中"
	RETURNF GETBIT(FLAG:状況判定, 10)
CASE "主導権没有"
	RETURNF GETBIT(FLAG:状況判定, 11)
CASE "紹介文既読"
	RETURNF GETBIT(FLAG:状況判定, 12)
CASE "角色メイク中"
	RETURNF GETBIT(FLAG:状況判定, 13)
CASE "朝拘束発生"
	RETURNF GETBIT(FLAG:状況判定, 14)
CASE "手動ABLUP"
	RETURNF GETBIT(FLAG:状況判定, 15)
CASE "授業中"
	RETURNF GETBIT(FLAG:状況判定, 16)
CASE "休み時間中"
	SIF GETBIT(FLAG:状況判定, 16) == 0
		RETURNF 1
CASE "授業直前"
	RETURNF GETBIT(FLAG:状況判定, 17)
CASE "授業直後"
	RETURNF GETBIT(FLAG:状況判定, 18)
CASE "予鈴"
	RETURNF GETBIT(FLAG:状況判定, 19)
CASE "遅刻"
	RETURNF GETBIT(FLAG:状況判定, 20)
CASE "買い物中"
	RETURNF GETBIT(FLAG:状況判定, 21)
CASE "買い物同伴中"
	RETURNF GETBIT(FLAG:状況判定, 22)
CASE "買い物胖次没収中"
	RETURNF GETBIT(FLAG:状況判定, 23)
CASE "買い物胖次返却中"
	RETURNF GETBIT(FLAG:状況判定, 24)
CASE "買い物同伴相手が購入"
	RETURNF GETBIT(FLAG:状況判定, 25)
CASE "髪型変更のお願い中"
	RETURNF GETBIT(FLAG:状況判定, 26)
CASE "買い物内衣姿"
	RETURNF GETBIT(FLAG:状況判定, 27)
CASE "買い物全裸中"
	RETURNF GETBIT(FLAG:状況判定, 28)
CASE "询问有什么想买的东西"
	RETURNF GETBIT(FLAG:状況判定, 29)
CASE "胖次交易中"
	RETURNF GETBIT(FLAG:状況判定, 30)
CASE "内衣姿取引中"
	RETURNF GETBIT(FLAG:状況判定, 31)
CASE "全裸交易中"
	RETURNF GETBIT(FLAG:状況判定, 32)
CASE "KOJO_DAILY台詞中"
	RETURNF GETBIT(FLAG:状況判定, 33)
CASE "部員同士の交流中"
	RETURNF GETBIT(FLAG:状況判定, 34)
CASE "归途"
	RETURNF GETBIT(FLAG:状況判定, 35)
CASE "性欲解消実行中"
	RETURNF GETBIT(FLAG:状況判定, 36)
CASE "性処理実行中"
	RETURNF GETBIT(FLAG:状況判定, 37)
CASE "オートイベント中"
	RETURNF GETBIT(FLAG:状況判定, 38)
CASE "自动调戏中"
	RETURNF GETBIT(FLAG:状況判定, 39)
CASE "约会中"
	RETURNF GETBIT(FLAG:状況判定, 40)
CASE "自撮り中"
	RETURNF GETBIT(FLAG:状況判定, 41)
CASE "放課後约会中"
	RETURNF GETBIT(FLAG:状況判定, 42)
CASE "夜袭中"
	RETURNF GETBIT(FLAG:状況判定, 43)
CASE "淫紋設定中"
	RETURNF GETBIT(FLAG:状況判定, 44)
CASE "角色介绍中"
	RETURNF GETBIT(FLAG:状況判定, 45)
CASE "お友達紹介イベント中"
	RETURNF GETBIT(FLAG:状況判定, 46)
CASE "登校中"
	RETURNF GETBIT(FLAG:状況判定, 47)
CASE "颜绘シミュ中"
	RETURNF GETBIT(FLAG:状況判定, 48)
CASE "圓圈中"
	RETURNF GETBIT(FLAG:状況判定, 49)
CASE "颜绘パネル中"
	RETURNF GETBIT(FLAG:状況判定, 50)
CASE "颜绘セーブロード中"
	RETURNF GETBIT(FLAG:状況判定, 51)
CASE "胖次花绳中"
	RETURNF GETBIT(FLAG:状況判定, 52)

;FLAG:メイン画面
CASE "CIP縮小中"
	RETURNF GETBIT(FLAG:メイン画面, 10)

CASE "阴蒂ック指令表示中"
	RETURNF GETBIT(FLAG:メイン画面, 20)

CASE "満足"
	RETURNF GETBIT(CFLAG:ARG:満足度, 1) + GETBIT(CFLAG:ARG:満足度, 2) + GETBIT(CFLAG:ARG:満足度, 3) + GETBIT(CFLAG:ARG:満足度, 4)
CASE "大満足"
	SIF GETBIT(CFLAG:ARG:満足度, 2) && GETBIT(CFLAG:ARG:満足度, 4)
		RETURNF 1
CASE "体力限界"
	RETURNF GETBIT(CFLAG:ARG:満足度, 0)
CASE "性欲満足"
	RETURNF GETBIT(CFLAG:ARG:満足度, 1) + GETBIT(CFLAG:ARG:満足度, 2)
CASE "性欲大満足"
	RETURNF GETBIT(CFLAG:ARG:満足度, 2)
CASE "精液欲満足"
	RETURNF GETBIT(CFLAG:ARG:満足度, 3) + GETBIT(CFLAG:ARG:満足度, 4)
CASE "精液欲大満足"
	RETURNF GETBIT(CFLAG:ARG:満足度, 4)

CASE "手一杯"
	RETURNF GETBIT(CFLAG:ARG:行動, 0)
CASE "同衾イベント"
	RETURNF GETBIT(CFLAG:ARG:行動, 3)

CASE "一緒に寝た"
	RETURNF CFLAG:ARG:一緒に寝た
CASE "前回Ｈ日"
	RETURNF CFLAG:ARG:前回Ｈ日
CASE "調教空白期間"
	SIF CFLAG:ARG:前回Ｈ日 == 0 || DAY - CFLAG:ARG:前回Ｈ日 - 1 < 0
		RETURNF 0
	;前日に相手にした場合は空白は０になるべきだろう
	RETURNF DAY - CFLAG:ARG:前回Ｈ日 - 1

;条件を緩く
CASE "夜袭可能"
	SIF CEVENT("夜袭禁止", ARG)
		RETURNF 0
	;Ｈしてないとしてこない
	SIF EXP:ARG:Ｈ回数 == 0
		RETURNF 0
	SIF TALENT:ARG:Ｖ損傷 || TALENT:ARG:Ａ損傷
		RETURNF 0
	SIF CALCF("同居格子", ARG) == 0
		RETURNF 0
	SIF BASE:ARG:欲求不満 < 50
		RETURNF 0
	SIF TALENT:ARG:恋慕 || TALENT:ARG:淫乱
		RETURNF 1
	SIF ABL:ARG:信頼 + ABL:ARG:欲望 + MAX(ABL:ARG:Ｖ感覚, ABL:ARG:Ａ感覚) + ABL:ARG:奉仕精神 > 10
		RETURNF 1
CASE "朝袭可能"
	SIF CEVENT("朝袭禁止", ARG)
		RETURNF 0
	;Ｈしてないとしてこない
	SIF EXP:ARG:Ｈ回数 == 0
		RETURNF 0
	SIF TALENT:ARG:Ｖ損傷 || TALENT:ARG:Ａ損傷
		RETURNF 0
	;周日朝だけは同居相手のみ
	SIF TEXTS("曜日") == "日" && CALCF("同居格子", ARG) == 0
		RETURNF 0
	SIF TALENT:ARG:恋慕 || TALENT:ARG:淫乱 || ABL:ARG:欲望 >= 5 || ABL:ARG:奉仕精神 >= 5
		RETURNF 1
	SIF TALENT:ARG:炮友 + TALENT:ARG:相思相愛 && ABL:ARG:欲望 >= 3 && ABL:ARG:奉仕精神 >= 3
		RETURNF 1
CASE "Ｗ朝口交可能"
	;まずは部員間ＨがＯＫか
	SIF CONFIG("部員間Ｈ") == 0
		RETURNF 0
	;COND("只和你Ｈ")と同条件
	SIF CFLAG:ARG:ＮＴＲ禁止 == 1
		RETURNF 0
	SIF PENIS(MASTER) == 0 || CANTRAIN("口交", ARG) == 0
		RETURNF 0
	SIF TALENT:ARG:好色 + TALENT:ARG:淫乱 + TALENT:ARG:恋慕 + TALENT:ARG:献身 + TALENT:ARG:小悪魔 == 0 && COND("精飲弱点", ARG) == 0
		RETURNF 0
	;経験やABLの要求値
	SIF EXP:ARG:口交経験 >= 20 && MAX(ABL:ARG:欲望, ABL:ARG:奉仕精神) >= 3 && (ABL:ARG:精液中毒 >= 1 || ABL:ARG:奉仕精神 >= 5)
		RETURNF 1

CASE "助手可能"
	RETURNF CFLAG:ARG:助手可能 + COND("種族：悪魔", ARG)

CASE "欲求不満"
	SELECTCASE BASE:ARG:欲求不満
	CASE IS >= 90
		RETURNF 3
	CASE IS >= 75
		RETURNF 2
	CASE IS >= 50
		RETURNF 1
	ENDSELECT
CASE "ご無沙汰"
	SIF EXP:ARG:Ｈ回数 == 0
		RETURNF 0
	SELECTCASE COND("調教空白期間", ARG)
	CASE IS >= MAX(CHARANUM - 1, 14)
		RETURNF 1
	ENDSELECT

CASE "豐腴"
	SIF 100*BASE:ARG:腰圍/BASE:ARG:身高 >= CALCF("豐腴倍数", ARG)
		RETURNF 1
CASE "苗条"
	SIF 100*BASE:ARG:腰圍/BASE:ARG:身高 <= CALCF("苗条倍数", ARG)
		RETURNF 1

CASE "巨尻"
	;巨尻の鑑定については身高比と腰圍比両方を算出し、小さい方を選択する
	;身高比では100*臀圍/身高の値で(細い, 普通, 巨尻, 爆尻, 超尻) = (50以下, 51～53, 54～56, 57～59, 60以上)
	;腰圍比では100*腰圍/臀圍で(細い, 普通, 大きい, 爆尻, 超尻) = (74以上, 73～70, 69～66, 65～62、61以下)

	;身高が0の事は無いが念のため
	SIF BASE:ARG:身高 == 0
		RETURNF 0

	;とりあえず臀圍サイズがＳ以下だと巨尻の資格没有
	SELECTCASE BASE:ARG:臀圍
	CASE IS <= 86
		SIF TALENT:ARG:娇小 == 0
			RETURNF 0
	ENDSELECT

	SELECTCASE 100*BASE:ARG:臀圍/BASE:ARG:身高
	;超尻
	CASE IS >= 60
		LOCAL = 3
	;爆尻
	CASE IS >= 57
		LOCAL = 2
	;巨尻
	CASE IS >= 54
		LOCAL = 1
	;普通
	CASE IS >= 51
		LOCAL = 0
	;細め
	CASEELSE
		RETURNF 0
	ENDSELECT

	SELECTCASE 100 * BASE:ARG:腰圍 / BASE:ARG:臀圍
	;超尻
	CASE IS <= 61
		RETURNF LIMIT(LOCAL, 1, 3)
	;爆尻
	CASE IS <= 65
		RETURNF LIMIT(LOCAL, 1, 2)
	;巨尻
	CASE IS <= 69
		RETURNF MIN(LOCAL, 1)
	;其他
	CASEELSE
		RETURNF 0
	ENDSELECT
CASE "小尻"
	;小尻の鑑定については身高比のみで判定する
	;身高比では100*臀圍/身高の値で(細い, 普通, 巨尻, 爆尻) = (50以下, 51～53, 54～56, 57以上)

	;身高が0の事は無いが念のため
	SIF BASE:ARG:身高 == 0
		RETURNF 0

	SELECTCASE 100*BASE:ARG:臀圍/BASE:ARG:身高
	CASE IS <= 50
		RETURNF 1
	CASEELSE
		RETURNF 0
	ENDSELECT
CASE "剃毛可能"
	SELECTCASE CONDS("陰毛", ARG)
	CASE "白虎", "無毛", "脱毛処理", "光滑无毛"
	CASEELSE
		SIF COND("陰毛", ARG)
			RETURNF 1
	ENDSELECT
CASE "剃过留痕露出"
	SELECTCASE CONDS("陰毛", ARG)
	CASE "保养完毕"
		SIF BASE:ARG:陰毛%100 >= 10
			RETURNF 1
	ENDSELECT
CASE "还没長出来露出"
	SELECTCASE CONDS("陰毛", ARG)
	CASE "保养完毕"
		SIF BASE:ARG:陰毛%100 >= 20
			RETURNF 1
	ENDSELECT
CASE "陰毛"
	RETURNF BASE:ARG:陰毛/100
CASE "腋毛"
	RETURNF BASE:ARG:腋毛/100
CASE "陰毛の設定"
	IF GETBIT(FLAG:陰毛, 4)
		RETURNF 0
	ELSEIF GETBIT(FLAG:陰毛, 3)
		SIF AGE(ARG) >= 4
			RETURNF 1
	ELSEIF GETBIT(FLAG:陰毛, 2)
		SIF AGE(ARG) >= 3
			RETURNF 1
	ELSEIF GETBIT(FLAG:陰毛, 1)
		SIF AGE(ARG) >= 2
			RETURNF 1
	ELSEIF GETBIT(FLAG:陰毛, 0)
		RETURNF 1
	ENDIF
CASE "陰毛と腋毛の状態ほぼ一緒"
	SELECTCASE COND("陰毛", ARG)
	CASE COND("腋毛", ARG)
		RETURNF 1
	CASE 1, 3
		SELECTCASE COND("腋毛", ARG)
		CASE 1, 3
			RETURNF 1
		ENDSELECT
	CASE IS >= 6
		SELECTCASE COND("腋毛", ARG)
		CASE IS >= 6
			RETURNF 1
		ENDSELECT
	ENDSELECT

CASE "无胸罩主義"
	VARSET LOCALS
	SPLIT CSTR:ARG:喜欢的胸罩, "/", LOCALS
	LOCAL = 0
	FOR LCOUNT, 0, 100
		SELECTCASE LOCALS:LCOUNT
		CASE ""
			BREAK
		CASE "无胸罩"
			LOCAL = 1
		CASEELSE
			RETURNF 0
		ENDSELECT
	NEXT
	RETURNF LOCAL
CASE "剃毛者"
	SIF CFLAG:ARG:剃毛者 == 0
		RETURNF ARG
	RETURNF TO_NUMBER(CFLAG:ARG:剃毛者)
CASE "自己剃った"
	SIF CFLAG:ARG:剃毛者 == 0 || TO_NUMBER(CFLAG:ARG:剃毛者) == ARG
		RETURNF 1
CASE "身嗜み：陰毛"
	IF GETBIT(CFLAG:ARG:身嗜み, 1)
		RETURNF 3
	ELSEIF GETBIT(CFLAG:ARG:身嗜み, 2)
		RETURNF 5
	ELSEIF GETBIT(CFLAG:ARG:身嗜み, 3)
		RETURNF 7
	ENDIF
CASE "身嗜み：腋毛"
	IF GETBIT(CFLAG:ARG:身嗜み, 6)
		RETURNF 3
	ELSEIF GETBIT(CFLAG:ARG:身嗜み, 7)
		RETURNF 7
	ENDIF
CASE "身嗜み：Ｖ拡張"
	SIF TALENT:ARG:男性
		RETURNF 0
	IF GETBIT(CFLAG:ARG:身嗜み, 11)
		RETURNF 1
	ELSEIF GETBIT(CFLAG:ARG:身嗜み, 12)
		RETURNF 2
	ELSEIF GETBIT(CFLAG:ARG:身嗜み, 13)
		RETURNF 3
	ELSEIF GETBIT(CFLAG:ARG:身嗜み, 14)
		RETURNF 4
	ENDIF
CASE "身嗜み：Ａ拡張"
	IF GETBIT(CFLAG:ARG:身嗜み, 16)
		RETURNF 1
	ELSEIF GETBIT(CFLAG:ARG:身嗜み, 17)
		RETURNF 2
	ELSEIF GETBIT(CFLAG:ARG:身嗜み, 18)
		RETURNF 3
	ELSEIF GETBIT(CFLAG:ARG:身嗜み, 19)
		RETURNF 4
	ENDIF
CASE "身嗜み：Ａ準備"
	IF GETBIT(CFLAG:ARG:身嗜み, 21) && GETBIT(CFLAG:ARG:身嗜み, 22)
		RETURNF 3
	ELSEIF GETBIT(CFLAG:ARG:身嗜み, 21)
		RETURNF 1
	ELSEIF GETBIT(CFLAG:ARG:身嗜み, 22)
		RETURNF 2
	ELSEIF GETBIT(CFLAG:ARG:身嗜み, 23)
		RETURNF 3
	ENDIF
CASE "身嗜み：腸洗浄"
	SIF GETBIT(CFLAG:ARG:身嗜み, 21) || GETBIT(CFLAG:ARG:身嗜み, 23)
		RETURNF 1
CASE "身嗜み：Ａ潤滑液"
	SIF GETBIT(CFLAG:ARG:身嗜み, 22) || GETBIT(CFLAG:ARG:身嗜み, 23)
		RETURNF 1
CASE "身嗜み：Ｐ準備"
	SIF PENIS(ARG) == 0
		RETURNF 0
	IF GETBIT(CFLAG:ARG:身嗜み, 26)
		RETURNF 1
	ENDIF
CASE "身嗜み：Ｐ掃除"
	SIF PENIS(ARG) == 0
		RETURNF 0
	SIF COND("真性包茎", ARG)
		RETURNF 0
	SIF GETBIT(CFLAG:ARG:身嗜み, 26) == 0
		RETURNF 1
CASE "Ｐ不潔"
	SIF PENIS(ARG) == 0
		RETURNF 0
	SIF GETBIT(BASE:ARG:老廃物, 0)
		RETURNF 1
CASE "身嗜み：Ｖ準備"
	IF GETBIT(CFLAG:ARG:身嗜み, 28)
		RETURNF 1
	ENDIF
CASE "身嗜み：Ｖ掃除"
	SIF TALENT:ARG:男性
		RETURNF 0
	SIF GETBIT(CFLAG:ARG:身嗜み, 28) == 0
		RETURNF 1
CASE "Ｖ不潔"
	SIF TALENT:ARG:男性
		RETURNF 0
	SIF GETBIT(BASE:ARG:老廃物, 1)
		RETURNF 1
;服装については、今のところ阴茎があるなら無視
CASE "身嗜み：服装"
	SIF PENIS(ARG)
		RETURNF 0
	IF GETBIT(CFLAG:ARG:身嗜み, 31)
		RETURNF 1
	ENDIF
CASE "身嗜み：没穿内褲"
	SIF PENIS(ARG)
		RETURNF 0
	SIF GETBIT(CFLAG:ARG:身嗜み, 31)
		RETURNF 1
CASE "身嗜み：尿道拡張"
	IF GETBIT(CFLAG:ARG:身嗜み, 36)
		RETURNF 1
	ELSEIF GETBIT(CFLAG:ARG:身嗜み, 37)
		RETURNF 2
	ELSEIF GETBIT(CFLAG:ARG:身嗜み, 38)
		RETURNF 3
	ELSEIF GETBIT(CFLAG:ARG:身嗜み, 39)
		RETURNF 4
	ELSEIF GETBIT(CFLAG:ARG:身嗜み, 40)
		RETURNF 5
	ENDIF

CASE "身嗜み：性行為の制限"
	SELECTCASE GETBITS(CFLAG:ARG:身嗜み, 41, 45)
	CASE 0
		RETURNF 0
	;1p41～1p45と等しいのは一箇所だけ独占している状態の判定に用いる
	CASE 1p41
		RETURNF 1
	CASE 1p42
		RETURNF 2
	CASE 1p43
		RETURNF 3
	CASE 1p44
		RETURNF 4
	CASE 1p45
		RETURNF 5
	CASE 1p41 + 1p42 + 1p43 + 1p44 + 1p45
		RETURNF 100
	CASEELSE
		RETURNF 6
	ENDSELECT
CASE "身嗜み：Ｖ独占"
	SIF TALENT:ARG:男性
		RETURNF 0
	SIF GETBIT(CFLAG:ARG:身嗜み, 41)
		RETURNF 1
CASE "身嗜み：Ａ独占"
	SIF GETBIT(CFLAG:ARG:身嗜み, 42)
		RETURNF 1
CASE "身嗜み：口独占"
	SIF GETBIT(CFLAG:ARG:身嗜み, 43)
		RETURNF 1
CASE "身嗜み：接吻独占"
	SIF GETBIT(CFLAG:ARG:身嗜み, 44)
		RETURNF 1
CASE "身嗜み：Ｐ独占"
	;SIF PENIS(ARG) == 0
	;	RETURNF 0
	SIF GETBIT(CFLAG:ARG:身嗜み, 45)
		RETURNF 1
CASE "身嗜み：完全独占"
	SIF COND("身嗜み：性行為の制限", ARG) == 100
		RETURNF 1

;自慰指令の実行中は無視する
CASE "身嗜み：性欲の管理"
	SELECTCASE GETBITS(CFLAG:ARG:身嗜み, 46, 50)
	CASE 0
		RETURNF 0
	;1p46～1p50と等しいのは一箇所だけ独占している状態の判定に用いる
	CASE 1p46
		RETURNF 1
	CASE 1p47
		RETURNF 2
	CASE 1p48
		RETURNF 3
	CASE 1p49
		RETURNF 4
	CASE 1p50
		RETURNF 5
	CASE 1p46 + 1p47 + 1p48 + 1p49 + 1p50
		RETURNF 100
	CASEELSE
		RETURNF 6
	ENDSELECT
CASE "身嗜み：自慰禁止"
	SIF GETBIT(CFLAG:ARG:身嗜み, 46)
		RETURNF 1

CASE "所持内衣数"
	RETURNF STRCOUNT(CSTR:ARG:所持内衣, "＠")

CASE "内衣穿き替え領帯ミング"
	SIF EQUIP:ARG:贴身制服 || CHECK_PANTIES("脱衣不可", ARG)
		RETURNF 0
	SIF COND("夜", ARG) && TALENT:ARG:容易濕 == 0
		RETURNF 0
	RETURNF 1
CASE "電源BOX装着可能"
	SIF TALENT:ARG:常時Ｖ振動棒 == 0 || ABL:ARG:欲望 < 3 || ABL:ARG:露出癖 < 3 || ABL:ARG:自慰中毒 == 0
		RETURNF 0
	SIF CHECK_CLO("電源BOX保持可能", ARG) == 0
		RETURNF 0
	SIF COND("欲求不満", ARG) == 0 && ABL:ARG:自慰中毒 < 3
		RETURNF 0
	RETURNF 1
CASE "電源BOX"
	RETURNF GETBIT(CFLAG:ARG:電源BOX, 0)
CASE "電源BOX発覚"
	RETURNF GETBIT(CFLAG:ARG:電源BOX, 1)

;主に日常イベントの台詞分岐で使う
CASE "Ｖ振動棒引き抜き"
	SIF TFLAG:Ｖ振動棒引き抜き && TALENT:常時Ｖ振動棒
		RETURNF 1
CASE "Ａ塞子引き抜き"
	SIF TFLAG:Ａ塞子引き抜き && TALENT:常時Ａ肛塞
		RETURNF 1

;値が引き抜いたものの尺寸になっている
CASE "常時拡張：引き抜き発生"
	SELECTCASE SELECTCOM
	CASE 60 TO 69
		RETURNF TALENT:ARG:常時Ｖ振動棒
	CASE 70 TO 79
		RETURNF TALENT:ARG:常時Ａ肛塞
	CASE 83 TO 88
		RETURNF TALENT:ARG:常時尿道塞
	ENDSELECT
CASE "挿入余裕度"
	SELECTCASE SELECTCOM
	CASE 60 TO 69
		SIF ABL:ARG:Ｖ拡張 >= SIZE("阴茎", PLAYER)
			RETURNF (ABL:ARG:Ｖ拡張 - SIZE("阴茎", PLAYER) + 1)
	CASE 70 TO 79
		SIF ABL:ARG:Ａ拡張 >= SIZE("阴茎", PLAYER)
			RETURNF (ABL:ARG:Ａ拡張 - SIZE("阴茎", PLAYER) + 1)
	CASE 83 TO 88
		SIF ABL:ARG:尿道拡張 >= SIZE("阴茎", PLAYER)
			RETURNF (ABL:ARG:尿道拡張 - SIZE("阴茎", PLAYER) + 1)
	ENDSELECT

CASE "夜袭相手"
	SIF CSTR:ARG:夜袭 != ""
		RETURNF 1
CASE "朝袭相手"
	SIF CSTR:ARG:朝袭 != ""
		RETURNF 1
CASE "昼Ｈの相手"
	SIF CFLAG:ARG:前回Ｈ日 == DAY
		RETURNF 1

;時間の変わり目に主人と一緒に入室してくるかの判定
CASE "同伴可能"
	SIF ARG == 0
		RETURNF 0
	SIF CFLAG:ARG:睡眠
		RETURNF 0
	SIF CEVENT("归途イベント禁止", ARG) || CEVENT("同伴禁止", ARG)
		RETURNF 0
	IF COND("昼", ARG)
		;昼は朝エッチをした相手
		SIF CSTR:ARG:朝袭 != ""
			RETURNF 1
	ELSEIF COND("夜", ARG)
		;夜は昼にエッチした相手…つまりCFLAG:前回Ｈ日がDAYと同じ
		SIF CFLAG:ARG:前回Ｈ日 == DAY || CFLAG:ARG:一緒に帰宅
			RETURNF 1
	ENDIF
CASE "同伴中"
	SIF NAMES("同伴者") == ""
		RETURNF 0
	SELECTCASE ARG
	CASE MASTER
		SIF CALLNAME:MASTER != NAMES("同伴者")
			RETURNF 1
	CASEELSE
		SIF CALLNAME:ARG == NAMES("同伴者")
			RETURNF 1
	ENDSELECT

CASE "Ｖ完美契合"
	RETURNF GETBIT(TALENT:ARG:完美契合, 0)
CASE "Ａ完美契合"
	RETURNF GETBIT(TALENT:ARG:完美契合, 1)
CASE "尿道完美契合"
	RETURNF GETBIT(TALENT:ARG:完美契合, 2)
CASE "Ｖ熟達"
	SIF TALENT:ARG:男性 || TALENT:ARG:処女 || TALENT:ARG:Ｖ損傷
		RETURNF 0
	SIF EXP:ARG:Ｖ経験 < 100 || EXP:ARG:Ｖ性交経験 < 50
		RETURNF 0

	IF TALENT:ARG:淫壷
		SIF TALENT:ARG:尻穴狂い == 0
			RETURNF 5
		SIF ABL:ARG:Ｖ感覚 > ABL:ARG:Ａ感覚
			RETURNF 4
		RETURNF 3
	ELSEIF TALENT:ARG:Ｖ性向
		RETURNF 2
	ENDIF
	RETURNF 1
CASE "Ａ熟達"
	SIF TALENT:ARG:Ａ処女 || TALENT:ARG:Ａ損傷 || ABL:ARG:Ａ拡張 < 2
		RETURNF 0
	SIF EXP:ARG:Ａ経験 < 100 || EXP:ARG:Ａ性交経験 < 50
		RETURNF 0

	IF TALENT:ARG:尻穴狂い
		SIF TALENT:ARG:淫壷 == 0
			RETURNF 5
		SIF ABL:ARG:Ａ感覚 > ABL:ARG:Ｖ感覚
			RETURNF 4
		RETURNF 3
	ELSEIF TALENT:ARG:Ａ性向
		RETURNF 2
	ENDIF
	RETURNF 1
CASE "Ｂ熟達"
	SIF EXP:ARG:Ｂ性交経験 < 5
		RETURNF 0

	IF TALENT:ARG:淫乳
		RETURNF 3
	ELSEIF TALENT:ARG:Ｂ性向
		RETURNF 2
	ENDIF
	RETURNF 1
CASE "尿道熟達"
	SIF ABL:ARG:尿道拡張 < 2 || TALENT:ARG:尿道性感 == 0
		RETURNF 0
	SIF EXP:ARG:尿道経験 < 100 || EXP:ARG:尿道性交経験 < 50
		RETURNF 0

	IF TALENT:ARG:尿道狂
		SIF TALENT:ARG:尻穴狂い == 0 && TALENT:ARG:淫壷 == 0
			RETURNF 5
		SIF ABL:ARG:尿道感覚 > MAX(ABL:ARG:Ａ感覚, ABL:ARG:Ｖ感覚)
			RETURNF 4
		RETURNF 3
	ELSEIF TALENT:ARG:尿道性感
		RETURNF 2
	ENDIF
	RETURNF 1

CASE "接吻魔"
	SIF TALENT:ARG:Ｍ性向 == 0 && TALENT:ARG:蕩唇 == 0
		RETURNF 0
	SIF ABL:ARG:信頼 < 3 || ABL:ARG:欲望 < 3 || ABL:ARG:露出癖 < 3 || ABL:ARG:Ｍ感覚 < 3
		RETURNF 0
	SIF COND("合意：接吻", ARG)
		RETURNF 1

;CIP淫紋に使う
CASE "淫紋おめでた"
	SIF MARK:ARG:淫紋 == 0 || TALENT:ARG:事后避孕药
		RETURNF 0
	SIF BASE:ARG:受精 || BASE:ARG:胎児
		RETURNF 1
CASE "淫紋贴纸"
	SIF MARK:ARG:淫紋 == 1
		RETURNF 1
CASE "淫紋刻印可能"
	;刻印できない期間中
	SIF MARK:ARG:淫紋時計
		RETURNF 0
	;とりあえず今のところは４画まで
	SIF MARK:ARG:淫紋 >= 4
		RETURNF 0
	;角色ごとに素質等によらずOKという場合。你の場合もＯＫ
    SIF CEVENT("淫紋刻印可能", ARG) || ARG == MASTER
        RETURNF 2

	;有男朋友は厳しい
	IF TALENT:ARG:有男朋友
		;ＯＫ
		SIF ABL:ARG:欲望 >= 5 && ABL:ARG:受虐属性 >= 3 && MARK:ARG:屈服刻印 >= 3
			RETURNF 2
		;シールならＯＫ
		SIF ABL:ARG:欲望 >= 3 && MARK:ARG:屈服刻印 && MARK:ARG:淫紋 == 0
			RETURNF 1
	ELSE
		;ＯＫ
		SIF TALENT:ARG:淫乱 || ABL:ARG:受虐属性 >= 3 || MARK:ARG:屈服刻印 >= 3
			RETURNF 2
		;シールならＯＫ
		SIF (ABL:ARG:欲望 >= 3 || MARK:ARG:屈服刻印) && MARK:ARG:淫紋 == 0
			RETURNF 1
	ENDIF

CASE "恋慕と淫乱の自動獲得可能"
	SIF TALENT:ARG:恋慕 || TALENT:ARG:淫乱
		RETURNF 0
	SIF CONFIG("恋慕と淫乱の任意獲得") == 0
		RETURNF 1
CASE "恋慕取得可能"
	SIF TALENT:ARG:恋慕
		RETURNF 0
	;信頼5LV＆好感度が2500以上で恋慕
	SIF ABL:ARG:信頼 >= 5 && CFLAG:ARG:好感度 >= 2500
		RETURNF 1
CASE "淫乱取得可能"
	SIF TALENT:ARG:淫乱
		RETURNF 0
	;欲望が5以上、自慰中毒or精液中毒のどれかが3以上、今回の絶頂数が10以上で淫乱
	SIF ABL:ARG:欲望 >= 5 && MAX(ABL:ARG:自慰中毒, ABL:ARG:精液中毒) >= 3 && EX:ARG:絶頂数合計 >= 10
		RETURNF 1
CASE "淫核取得可能"
	SIF TALENT:ARG:淫核
		RETURNF 0
	SIF JUEL:ARG:快Ｃ >= NUM("宝珠：淫核取得", ARG) && ABL:ARG:Ｃ感覚 >= 4 && EX:ARG:Ｃ絶頂 >= 10
		RETURNF 1
CASE "淫壷取得可能"
	SIF TALENT:ARG:淫壷
		RETURNF 0
	SIF JUEL:ARG:快Ｖ >= NUM("宝珠：淫壷取得", ARG) && ABL:ARG:Ｖ感覚 >= 4 && EX:ARG:Ｖ絶頂 >= 10
		RETURNF 1
CASE "尻穴狂い取得可能"
	SIF TALENT:ARG:尻穴狂い
		RETURNF 0
	SIF JUEL:ARG:快Ａ >= NUM("宝珠：尻穴狂い取得", ARG) && ABL:ARG:Ａ感覚 >= 4 && EX:ARG:Ａ絶頂 >= 10
		RETURNF 1
CASE "淫乳取得可能"
	SIF TALENT:ARG:淫乳
		RETURNF 0
	SIF JUEL:ARG:快Ｂ >= NUM("宝珠：淫乳取得", ARG) && ABL:ARG:Ｂ感覚 >= 4 && EX:ARG:Ｂ絶頂 >= 10
		RETURNF 1
CASE "蕩唇取得可能"
	SIF TALENT:ARG:蕩唇
		RETURNF 0
	SIF JUEL:ARG:快Ｍ >= NUM("宝珠：蕩唇取得", ARG) && ABL:ARG:Ｍ感覚 >= 4 && EX:ARG:Ｍ絶頂 >= 10
		RETURNF 1
CASE "尿道狂取得可能"
	SIF TALENT:ARG:尿道狂
		RETURNF 0
	SIF JUEL:ARG:快尿 >= NUM("宝珠：尿道狂取得", ARG) && ABL:ARG:尿道感覚 >= 4 && EX:ARG:尿道絶頂 >= 10
		RETURNF 1

CASE "素質獲得可能"
	SIF EXP:経験値 < NUM("経験値：素質獲得")
		RETURNF 0
	RETURNF 1

CASE "人妻"
	SIF TALENT:ARG:有男朋友 == 2
		RETURNF 1
CASE "精液の優勢", "胎児の父親"
	IF BASE:ARG:ARGS > 0
		RETURNF TO_NUMBER(BASE:ARG:ARGS)
	ELSE
		RETURNF BASE:ARG:ARGS
	ENDIF

;主人限定
;これは你の妹弟兄姉のどれか、という意味です
CASE "兄弟"
	SIF TALENT:ARG:妹 || TALENT:ARG:弟 || TALENT:ARG:姉 || TALENT:ARG:兄
		RETURNF 1
CASE "血縁"
	SIF TALENT:ARG:母親 || TALENT:ARG:父親
		RETURNF 1
	SIF TALENT:ARG:妹 || TALENT:ARG:弟 || TALENT:ARG:姉 || TALENT:ARG:兄
		RETURNF 1

CASE "初吻之前先口交を経験"
	SIF EXP:ARG:接吻経験 == 0 && EXP:ARG:口交経験
		RETURNF 1

	;初口交記録済み
	IF STRCOUNT(CSTR:ARG:初行為相手, "初口交")
		;CSTR:ARG:初行為相手の初口交より左に初接吻が無ければＯＫ
		SIF STRCOUNT(EXTSTR(CSTR:ARG:初行為相手, "", "初口交"), "初接吻") == 0
			RETURNF 1
	;初接吻のみ記録済み
	ELSEIF STRCOUNT(CSTR:ARG:初行為相手, "初接吻")
		;初口交記録がないのに口交経験持ち = 角色作成時で既に口交経験持ち
		SIF EXP:ARG:口交経験
			RETURNF 1
	ENDIF

;各種フラグ(特別経験判定などで使う)
CASE "処女喪失フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 0)
CASE "処女簒奪フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 1)
CASE "童貞喪失フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 2)
CASE "童貞狩猎フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 3)
CASE "清洁口交フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 4)
CASE "Ａ清洁口交フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 5)
CASE "自慰フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 6)
CASE "清洁舔阴フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 7)
CASE "子宮責めフラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 8)
CASE "Ａ奉仕FLAG"
	RETURNF GETBIT(TCVAR:ARG:イベント, 9)
CASE "精液清洁舔阴フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 10)

CASE "陰蒂環フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 11)
CASE "陰唇環フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 12)
CASE "恥丘穿環フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 13)
CASE "乳环フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 14)
CASE "尿道穿環フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 15)
CASE "肚脐环フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 16)

CASE "穿環ＯＮフラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 19)
CASE "鎮痛麻酔フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 20)
CASE "ボトムを露出させた"
	RETURNF GETBIT(TCVAR:ARG:イベント, 21)
CASE "Ａ処女喪失フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 22)
CASE "Ａ処女簒奪フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 23)
CASE "喝母乳フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 24)
CASE "飲尿フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 25)
CASE "ながら自慰フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 26)
CASE "打屁股性交フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 27)
CASE "マーキングフラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 28)
CASE "うっかり子宮挿入フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 29)
CASE "腋舐めフラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 30)
CASE "腋見せフラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 31)
CASE "膣内浴尿フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 32)
CASE "子宮内浴尿フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 33)
CASE "温泉浣腸フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 34)
CASE "乳内浴尿フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 35)
CASE "深喉フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 36)
CASE "挿入前暴発フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 37)
CASE "具現化ＯＮフラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 38)
CASE "阴茎陰核化フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 39)
CASE "尿道性感フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 40)
CASE "膀胱内浴尿フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 41)
CASE "追加接吻フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 42)
CASE "清洁舔Aフラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 43)
CASE "尿清洁口交フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 44)
CASE "おしっこ清洁舔阴フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 45)
CASE "恥垢清洁口交フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 46)
CASE "恥垢清洁舔阴フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 47)
CASE "足舐めフラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 48)
CASE "受精確認フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 49)
CASE "套套内射精フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 50)
CASE "喝套内精液フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 51)
CASE "性転換フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 52)
CASE "締め付けフラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 53)
CASE "阴茎接吻フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 54)
CASE "展示肉棒フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 55)
CASE "万謝的亲吻フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 56)
CASE "尿道処女喪失フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 57)
CASE "尿道処女簒奪フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 58)
CASE "口交フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 59)
CASE "舔足奉仕FLAG"
	RETURNF GETBIT(TCVAR:ARG:イベント, 60)
CASE "結腸責めフラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント, 61)

CASE "自我颜射フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント２, 0)
CASE "自我口内射精フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント２, 1)
CASE "尿飲み干しフラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント２, 2)
CASE "初中出し受け入れフラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント２, 3)
CASE "肛門拉珠拔出FLAG"
	RETURNF GETBIT(TCVAR:ARG:イベント２, 4)
CASE "尿道布ル引き抜きフラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント２, 5)
CASE "剃毛フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント２, 6)
CASE "Ｐバインド弱体フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント２, 7)
CASE "子宮挿入フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント２, 8)
CASE "擦拭フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント２, 9)
CASE "腹部变形フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント２, 10)
CASE "子宮口露出フラグ"
	RETURNF GETBIT(TCVAR:ARG:イベント２, 11)

;相性格子
CASE "相性☆"
	SIF TARGET <= 0 || ARG <= 0
		RETURNF 0
	SIF MIN(RELATION:ARG:(NO:TARGET), RELATION:(NO:ARG) ) >= 200
		RETURNF 1
CASE "相性◎"
	SIF TARGET <= 0 || ARG <= 0
		RETURNF 0
	SIF MIN(RELATION:ARG:(NO:TARGET), RELATION:(NO:ARG) ) >= 150
		RETURNF 1
;"漢数字の〇"と"記号の○"は分かりづら過ぎる
CASE "相性○", "相性〇"
	SIF TARGET <= 0 || ARG <= 0
		RETURNF 0
	SIF MIN(RELATION:ARG:(NO:TARGET), RELATION:(NO:ARG) ) >= 120
		RETURNF 1

;日常イベントでよく使う条件
CASE "约会可能"
	;ここも要望次第で考える
	;IF COND("归途", ARG)
	;	SIF CEVENT("放課後Ｈ的邀请禁止", ARG)
	;		RETURNF 0
	;ENDIF
	SIF ABL:ARG:信頼 >= 3 || TALENT:ARG:恋慕 || MARK:ARG:屈服刻印 >= 1
		RETURNF 1
CASE "约会のお誘い可能"
	;すでに约会相手が決まっていたり、约会にお誘い済みだとしない
	SIF CFLAG:ARG:约会的约定 < 0
		RETURNF 0
	SIF CHARA_NUM("约会的约定")
		RETURNF 0
	SIF ABL:ARG:信頼 < 5 && TALENT:ARG:恋慕 == 0
		RETURNF 0
	SIF TALENT:ARG:恋慕 + TALENT:ARG:開朗 + TALENT:ARG:強気
		RETURNF 1
CASE "约会お誘い済み"
	SIF CFLAG:ARG:约会的约定 < 0
		RETURNF 1
CASE "约会的约定"
	SIF CFLAG:MASTER:ARGS == BASE:ARG:識別番号
		RETURNF 1

CASE "约会の予定有"
	SIF DAYEV("约会領帯ム") == 0
		RETURNF 0
	SIF CHARA_NUM("约会的约定") == 0
		RETURNF 0
	RETURNF 1
CASE "今年の泳装選択済"
	SIF CFLAG:ARG:泳装選び >= FLAG:年 && SWIM(CSTR:ARG:今年の泳装) != ""
		RETURNF 1
CASE "Ｈ的泳装選択可能"
	SIF COND("合意：露出PLAY", ARG)
		RETURNF 2
	SIF ABL:ARG:露出癖 >= 3 || TALENT:ARG:不知羞恥
		RETURNF 1
CASE "選んだ泳装が一緒"
	SIF SWIM(STR:選んだ泳装, "種類") == SWIM(CSTR:ARG:今年の泳装, "種類")
		RETURNF 1
CASE "晒痕"
	;色白と普通肌以外は晒痕しない
	SELECTCASE CONDS("肤色", ARG)
	CASE "青肌", "色黒", "褐色肌"
		RETURNF 0
	ENDSELECT
	SIF CFLAG:ARG:晒痕強度 || TALENT:ARG:常時晒痕
		RETURNF 1
CASE "晒痕可能"
	SIF CFLAG:ARG:晒痕強度 || TALENT:ARG:常時晒痕
		RETURNF 0
	SIF COND("種族：人形", ARG) || COND("種族：自动人形", ARG)
		RETURNF 0
	;色白と普通肌以外は晒痕しない
	SELECTCASE CONDS("肤色", ARG)
	CASE "青肌", "色黒", "褐色肌"
		RETURNF 0
	ENDSELECT

	;標語
	SELECTCASE SAVESTR:標語
	CASE "晒痕最高"
		SIF CFLAG:ARG:標語実践
			RETURNF 1
	CASE "注意晒痕"
		SIF CFLAG:ARG:標語実践
			RETURNF 0
	ENDSELECT

	;それ以外は素質などで判定
	SIF TALENT:ARG:伪娘
		RETURNF 0
	SIF (TALENT:ARG:高贵 + TALENT:ARG:聰慧 + TALENT:ARG:清楚) - (TALENT:ARG:粗野 + TALENT:ARG:笨蛋 + TALENT:ARG:好色 + TALENT:ARG:喜歡引人注目) >= 0
		RETURNF 0
	RETURNF 1
CASE "買上品数"
	RETURNF MAX(STRCOUNT(CSTR:SHOP_BUY履歴, "/") - 1, 0)
CASE "巨大振動棒購入"
	SIF STRCOUNTS(CSTR:SHOP_BUY履歴, "極太", "腕", "馬")
		RETURNF 1
CASE "Ｈ的サプライズ可能"
	SIF TALENT:ARG:恋慕 || TALENT:ARG:淫乱 || TALENT:ARG:好色
		RETURNF 1
	SIF MIN(ABL:ARG:欲望, ABL:ARG:奉仕精神, ABL:ARG:露出癖) < 3 && MARK:ARG:屈服刻印 < 3
		RETURNF 0
	SIF MAX(ABL:ARG:欲望, ABL:ARG:奉仕精神, ABL:ARG:露出癖) >= 5
		RETURNF 1

CASE "Ｈ最中の取引"
	RETURNF CFLAG:ARG:Ｈ最中の取引
CASE "悪魔の取引可能"
	SIF STRCOUNT(CSTR:ARG:種族, ARGS)
		RETURNF 1
	SIF STRCOUNT(CSTR:ARG:種族, "取引不能")
		RETURNF 0
	SIF COND("種族：悪魔", ARG)
		RETURNF 1
CASE "天使の取引可能"
	SIF STRCOUNT(CSTR:ARG:種族, ARGS)
		RETURNF 1
	SIF STRCOUNT(CSTR:ARG:種族, "取引不能")
		RETURNF 0
	SIF COND("種族：天使", ARG) || COND("種族：死神", ARG)
		RETURNF 1
CASE "魂の取引可能"
	SIF STRCOUNT(CSTR:ARG:種族, ARGS)
		RETURNF 1
	SIF STRCOUNT(CSTR:ARG:種族, "取引不能")
		RETURNF 0
	SIF COND("種族：悪魔", ARG) || COND("種族：驱魔人", ARG)
		RETURNF 1

CASE "目上"
	SELECTCASE CSTR:ARG:学年
	CASE "初等部", "中等部", "１年生", "２年生"
		RETURNF 0
	CASEELSE
		SIF COND("教員", ARG)
			RETURNF 0
		SIF AGE(ARG) >= 3
			RETURNF 0
	ENDSELECT
	RETURNF 1
CASE "学園在籍"
	SIF COND("学生", ARG) || COND("教師", ARG)
		RETURNF 1
CASE "学生"
	SELECTCASE CSTR:ARG:学年
	CASE "初等部", "中等部", "１年生", "２年生", "３年生", "研究生"
		RETURNF 1
	ENDSELECT
;教師や司書など、生徒ではない人たち
CASE "教員", "教師"
	SIF STRCOUNTS(CSTR:ARG:学年, "教師", "司書")
		RETURNF 1
;CSTR:ARG:学年に対応した数字
CASE "学年"
	SELECTCASE CSTR:ARG:学年
	CASE "初等部"
		RETURNF 1
	CASE "中等部"
		RETURNF 2
	CASE "１年生"
		RETURNF 3
	CASE "２年生"
		RETURNF 4
	CASE "３年生"
		RETURNF 5
	CASE "研究生"
		RETURNF 6
	CASEELSE
		IF COND("教員", ARG)
			RETURNF 7
		;学生でも教員でもない
		ELSE
			RETURNF 0
		ENDIF
	ENDSELECT

CASE "学校食堂勤め"
	SIF STRCOUNTS(CSTR:ARG:学年, "学校食堂")
		RETURNF 1
CASE "便当可能"
	SIF CEVENT("合意禁止：便当", ARG)
		RETURNF 0
	SIF COND("部室出現可能", ARG) == 0
		RETURNF 0
	SIF TALENT:ARG:恋慕 || MARK:ARG:屈服刻印 >= 1 || ABL:ARG:奉仕精神 >= 3
		RETURNF 1
CASE "便当の約束"
	RETURNF CFLAG:ARG:便当
CASE "便当相手"
	RETURNF TO_NUMBER(CFLAG:MASTER:便当)
CASE "お昼ご飯のお誘い可能"
	SIF COND("部室出現可能", ARG) == 0
		RETURNF 0
	SIF CEVENT("お昼ご飯のお誘い禁止", ARG)
		RETURNF 0
	SIF TALENT:ARG:恋慕 || MARK:ARG:屈服刻印 >= 1 || ABL:ARG:信頼 >= 3
		RETURNF 1
;同居した際に部屋が必要かどうか
CASE "要個室"
	;血縁的房間は既にある
	SIF COND("血縁", ARG) || CFLAG:ARG:初期仲間
		RETURNF 0
	SIF COND("同居可能", ARG)
		RETURNF 1

CASE "叫出来Ｈの合意可能"
	SIF EXP:ARG:Ｈ回数 == 0
		RETURNF 0
	;炮友ならOK
	SIF TALENT:ARG:炮友
		RETURNF 1
	;同居や性処理よりは緩い
	SIF TALENT:ARG:恋慕 || ABL:ARG:信頼 >= 3 || ABL:ARG:欲望 >= 3 || ABL:ARG:奉仕精神 >= 5 || MARK:ARG:屈服刻印 || CFLAG:ARG:初期仲間
		RETURNF 1
CASE "叫出来Ｈ可能"
	;現在居ない人限定
	IF PLACE("居間")
		SIF CFLAG:ARG:不在 == 0
			RETURNF 0
	ELSE
		SIF COND("現在存在", ARG)
			RETURNF 0
	ENDIF
	SIF PLACE("居間") && MONEY < 700
		RETURNF 0
	SIF COND("合意：叫出来Ｈ", ARG)
		RETURNF 1
CASE "同居可能"
	SIF TALENT:ARG:恋慕 || MARK:ARG:屈服刻印 >= 3 || ABL:ARG:信頼 >= 5 || CFLAG:ARG:初期仲間
		RETURNF 1
	SIF COND("血縁", ARG) || CFLAG:ARG:初期同居
		RETURNF 1
CASE "同居解消可能"
	SIF CEVENT("同居解消不可能", ARG)
		RETURNF 0
	RETURNF 1
CASE "同居中"
	RETURNF GETBITS(CFLAG:ARG:同居, 11, 20)
CASE "同居：一直"
	RETURNF GETBIT(CFLAG:ARG:同居, 11)
CASE "同居：一周間"
	RETURNF GETBIT(CFLAG:ARG:同居, 12)
CASE "同居：仅周末"
	RETURNF GETBIT(CFLAG:ARG:同居, 13)
CASE "残り同居日数"
	RETURNF GETBITS(CFLAG:ARG:同居, 0, 9)

CASE "廁所イベント可能"
	SIF TALENT:ARG:男性 || COND("起床中", ARG) == 0 || COND("現在存在", ARG) || CEVENT("做爱部联谊",ARG)
		RETURNF 0
	SIF CALCF("同居格子", ARG)
		RETURNF 1

CASE "入部初日"
	SIF CFLAG:ARG:加入日 == DAY
		RETURNF 1
CASE "在籍日数"
	RETURNF (DAY - CFLAG:ARG:加入日)
;前夜は同居判定or朝袭相手
CASE "朝一緒"
	SIF COND("朝袭相手", ARG)
		RETURNF 1
	SELECTCASE TEXTS("曜日")
	CASE "日", "月"
	CASEELSE
		SIF COND("同居：仅周末", ARG)
			RETURNF 0
	ENDSELECT
	SIF COND("同居中", ARG)
		RETURNF 1

CASE "Ｐ汚れ"
	SIF CSTR:ARG:Ｐ汚れ == ""
		RETURNF 0

	SPLIT CSTR:ARG:Ｐ汚れ, "_", LOCALS
	SIF LOCALS != ""
		RETURNF 1

CASE "Ｐ汚れの相手"
	SIF CSTR:ARG:Ｐ汚れ == ""
		RETURNF 0

	SPLIT CSTR:ARG:Ｐ汚れ, "_", LOCALS
	RETURNF TO_NUMBER(TOINT(LOCALS:1) )

CASE "Ｈ的调戏禁止"
	SIF CEVENT("Ｈ的调戏禁止", ARG)
		RETURNF 1
CASE "邀请一起入浴可能"
	;信頼してない相手には肌を晒さない
	SIF TALENT:ARG:叛逆 || ABL:ARG:信頼 < 5
		RETURNF 0
	SIF CHOSE_DEVENT("邀请一起入浴", ARG)
		RETURNF 0
	SIF COND("夜", ARG) == 0
		RETURNF 0
	SIF PLACE("居間") == 0 && PLACE("自室") == 0 && PLACE("partner的房間") == 0
		RETURNF 0
	;害羞持ちは肌を晒さない
	SIF TALENT:ARG:害羞 && TALENT:ARG:恋慕 == 0
		RETURNF 0
	SIF TALENT:ARG:淫乱 || TALENT:ARG:恋慕 || TALENT:ARG:不知羞恥 || TALENT:ARG:開朗 || TALENT:ARG:不在乎貞操 || TALENT:ARG:小悪魔
		RETURNF 1
	SIF ABL:ARG:露出癖 >= 5 || ABL:ARG:信頼 >= 9
		RETURNF 1
;Ｈ的邀请のさらに上位版のようなもの。くぱぁしたりしつつ露骨に邀请
CASE "Ｈ的おねだり可能"
	SIF COND("Ｈ的邀请可能", ARG) == 0
		RETURNF 0
	SIF COND("合意：检查阴部", ARG) == 0
		RETURNF 0
	SIF TALENT:ARG:害羞 && TALENT:ARG:淫乱 == 0
		RETURNF 0
	SIF TALENT:ARG:淫乱 || TALENT:ARG:好色 || TALENT:ARG:不知羞恥 || TALENT:ARG:開朗 || TALENT:ARG:不在乎貞操 || TALENT:ARG:小悪魔
		RETURNF 1
CASE "Ｈ的邀请可能"
	SIF TALENT:ARG:叛逆
		RETURNF 0
	SIF CHOSE_DEVENT("Ｈ的邀请", ARG) || CHOSE_DEVENT("推倒", ARG) || COND("约会の予定有", ARG)
		RETURNF 0
	SIF TALENT:ARG:炮友 + TALENT:ARG:相思相愛 + TALENT:ARG:接受快感 && (TALENT:ARG:害羞 == 0 || TALENT:ARG:淫乱)
		RETURNF 1
	SIF COND("欲求不満", ARG) >= 2 && EXP:ARG:Ｈ回数 >= 5
		RETURNF 1
	SIF COND("欲求不満", ARG) && EXP:ARG:Ｈ回数 >= 5 && STATE("酔酒", ARG)
		RETURNF 1
CASE "放課後Ｈ的邀请"
	SIF CEVENT("放課後Ｈ的邀请禁止", ARG)
		RETURNF 0
	SIF COND("放課後约会中", ARG)
		RETURNF 1
	SIF EXP:ARG:Ｈ回数 < 5 || COND("Ｈ的邀请可能", ARG) == 0
		RETURNF 0
	SIF COND("欲求不満", ARG) == 0
		RETURNF 0
	SIF COND("同居中", ARG) == 0
		RETURNF 1
	SIF ABL:ARG:精液中毒 >= 5 && CFLAG:ARG:Ｖ已中出 + CFLAG:ARG:Ａ已中出 + CFLAG:ARG:尿道已中出 + CFLAG:ARG:Ｂ已中出 == 0
		RETURNF 1
	SIF COND("欲求不満", ARG) >= 2
		RETURNF 1
CASE "Ｈに誘った"
	SELECTCASE CSTR:ARG:お誘い
	CASE "Ｈ的邀请", "放課後Ｈ的邀请"
		RETURNF 1
	ENDSELECT
;避孕套をいざって時のために持ち歩いているかどうか
CASE "避孕套携帯"
	SIF EXP:ARG:Ｈ回数 < 5
		RETURNF 0
	SIF COND("讨厌避孕套", ARG)
		RETURNF 0
	IF TALENT:ARG:扶她
		SIF (TALENT:MASTER:処女 || EXP:ARG:避孕套挿入経験 < 5) && (TALENT:ARG:処女 || COND("避妊不要", ARG) || EXP:ARG:避孕套性交経験 < 5 || COND("Ｖ熟達", ARG) == 0)
			RETURNF 0
	ELSEIF TALENT:ARG:男性
		SIF TALENT:MASTER:処女 || EXP:ARG:避孕套挿入経験 < 5
			RETURNF 0
	ELSE
		SIF TALENT:ARG:処女 || COND("避妊不要", ARG) || EXP:ARG:避孕套性交経験 < 5 || COND("Ｖ熟達", ARG) == 0
			RETURNF 0
	ENDIF
	RETURNF 1
CASE "闲可能"
	SIF CFLAG:ARG:躁动难忍 || COND("欲求不満", ARG) || COND("電源BOX", ARG)
		RETURNF 0
	SIF COND("浑身是汗", ARG) || STATE("酔酒", ARG)
		RETURNF 0
	RETURNF 1
CASE "撫摸頭髮可能"
	SIF TALENT:ARG:叛逆
		RETURNF 0
	SIF ABL:ARG:信頼 >= 5 || MARK:ARG:屈服刻印 >= 1 || TALENT:ARG:未成熟 || TALENT:ARG:恋慕 || COND("血縁", ARG)
		RETURNF 1
	SELECTCASE CONDS("直前行動", ARG)
	CASE "甜言蜜语"
		SIF CFLAG:ARG:甜言蜜语
			RETURNF 1
	CASE "夸奖"
		SIF CFLAG:ARG:夸奖
			RETURNF 1
	ENDSELECT

CASE "坐在旁邊可能"
	SIF TALENT:ARG:叛逆 || CFLAG:ARG:睡眠 || CFLAG:ARG:刚睡醒 || ABL:ARG:信頼 < 3
		RETURNF 0
	;あまりこういうことやらない素質持ちは欲求不満状態のみ
	SIF TALENT:ARG:内気 + TALENT:ARG:謙虚 + TALENT:ARG:自制心 + TALENT:ARG:臆病 && COND("欲求不満", ARG) == 0
		RETURNF 0
	SIF TALENT:ARG:開朗 + TALENT:ARG:小悪魔 + TALENT:ARG:情熱的 + TALENT:ARG:好色 + TALENT:ARG:恋慕
		RETURNF 1
CASE "出迎え胖次チラ可能"
	SIF EQUIP:ARG:胖次 == 0 || EQUIP:ARG:裙 == 0 || CFLAG:ARG:掀起裙子
		RETURNF 0
	SIF COND("Ｈ的サプライズ可能", ARG)  == 0 || COND("同伴可能", ARG) || COND("合意：检查内褲", ARG) == 0 || CHECK_CLO("掀起裙子の価値无", ARG)
		RETURNF 0
	RETURNF 1
CASE "Ａ清洁口交可能"
	SIF PENIS(MASTER) == 0 || CANTRAIN("口交", ARG) == 0 || STRCOUNT(CSTR:ARG:特別経験, "Ａ清洁口交") == 0
		RETURNF 0
	SIF ABL:ARG:欲望 >= 5 || ABL:ARG:奉仕精神 >= 5 || MARK:ARG:屈服刻印 >= 2
		RETURNF 1

;自発～系はCHARA_NUM("室内の邪魔者")が居ない時に限り行う事とする
CASE "自発口交可能"
	SIF PENIS(MASTER) == 0 || CANTRAIN("口交", ARG) == 0
		RETURNF 0
	;[欲望LV5]or[奉仕精神LV5]or[屈服刻印LV2]（性処理可能と同じ条件）
	SIF ABL:ARG:欲望 >= 5 || ABL:ARG:奉仕精神 >= 5 || MARK:ARG:屈服刻印 >= 2
		RETURNF 1

CASE "自発清洁口交可能"
	SIF PENIS(MASTER) == 0 || CANTRAIN("口交", ARG) == 0 || EXP:ARG:清洁口交経験 < 5 || ABL:ARG:精液中毒 == 0
		RETURNF 0
	;SIF CHOSE_DEVENT("清洁口交", ARG)
	;	RETURNF 0
	IF CONDS("Ｐ汚れ", MASTER) == "Ａ"
		SIF COND("Ａ清洁口交可能", ARG) == 0
			RETURNF 0
	ENDIF
	;[欲望LV5]or[奉仕精神LV5]or[屈服刻印LV2]（性処理可能と同じ条件）
	SIF ABL:ARG:欲望 >= 5 || ABL:ARG:奉仕精神 >= 5 || MARK:ARG:屈服刻印 >= 2
		RETURNF 1

CASE "阴茎接吻可能"
	SIF PENIS(PLAYER) == 0 || CANTRAIN("口交", ARG) == 0
		RETURNF 0
	SIF EXP:ARG:口交経験 < 20 || EXP:ARG:清洁口交経験 == 0
		RETURNF 0
	SIF ABL:ARG:奉仕精神 >= 5 || TALENT:ARG:恋慕 + TALENT:ARG:淫乱 || MARK:ARG:屈服刻印
		RETURNF 1

CASE "自発展示内褲可能"
	SIF CHECK_CLO("贴身制服露出", ARG) || CHECK_CLO("泳装姿", ARG) || CHECK_CLO("胖次視認可能", ARG) == 0
		RETURNF 0
	;とりあえずは裙必須にする
	SIF CHECK_SKIRT("裙", ARG) == 0
		RETURNF 0
	IF ARG == MASTER
		SIF COND("池面", ARG) == 0
			RETURNF 1
	ENDIF
	SIF COND("胖次形状確認", ARG) || CFLAG:ARG:掀起裙子
		RETURNF 0
	SIF TALENT:ARG:叛逆 || CFLAG:ARG:睡眠 || CFLAG:ARG:刚睡醒
		RETURNF 0
	SIF COND("合意：掀起裙子", ARG) == 0 || COND("合意：检查内褲", ARG) == 0
		RETURNF 0
	SIF TALENT:ARG:害羞 == 0 && TALENT:ARG:不知羞恥 + TALENT:ARG:小悪魔 + TALENT:ARG:好色
		RETURNF 1
	SIF BASE:ARG:欲求不満 >= 50 && MAX(ABL:ARG:欲望, ABL:ARG:奉仕精神, ABL:ARG:露出癖) >= 5
		RETURNF 1

CASE "自発胖次送禮可能"
	SIF EQUIP:ARG:胖次 == 0 || CHECK_PANTIES("脱衣不可", ARG) || CHECK_PANTIES("前貼", ARG) || CHECK_CLO("胖次露出", ARG) == 0
		RETURNF 0
	SIF COND("合意：胖次交易", ARG) == 0
		RETURNF 0
	SIF FLAG:二人きり == 0 && COND("合意：露出PLAY", ARG) == 0
		RETURNF 0
	SIF MAX(ABL:ARG:欲望, ABL:ARG:奉仕精神, ABL:ARG:露出癖) < 5
		RETURNF 0
	SIF TALENT:ARG:小悪魔 || TALENT:ARG:不知羞恥 || TALENT:ARG:開朗 || TALENT:ARG:不在乎貞操 || TALENT:ARG:好色 || TALENT:ARG:淫乱 || TALENT:ARG:恋慕
		RETURNF 1

CASE "自発阴部見せ可能"
	SIF COND("合意：掀起裙子", ARG) == 0
		RETURNF 0
	SIF COND("合意：检查阴部", ARG) == 0
		RETURNF 0
	SIF ABL:ARG:欲望 >= 7 || ABL:ARG:奉仕精神 >= 9 || ABL:ARG:露出癖 >= 7
		RETURNF 1

CASE "自発全裸可能"
	SIF COND("合意：全裸化", ARG) == 0
		RETURNF 0

CASE "自発Cosplay可能"
	SIF CSTR:ARG:希望着装履歴 == ""
		RETURNF 0
	SIF COND("希望着装了承", ARG) == 0
		RETURNF 0
	SIF TALENT:ARG:恋慕 || ABL:ARG:奉仕精神 >= 5 || TALENT:ARG:喜歡引人注目
		RETURNF 1

CASE "撩起裙子可能"
	SIF CFLAG:ARG:睡眠 || EQUIP:ARG:裙 == 0 || CFLAG:ARG:掀起裙子 || CHECK_CLO("掀起裙子の価値无", ARG)
		RETURNF 0
	SIF ABL:ARG:露出癖 >= 3 || ABL:ARG:奉仕精神 >= 5
		RETURNF 1

CASE "外套脱衣発生"
	SIF TALENT:ARG:体寒
		RETURNF 0
	SIF	PLACE("野外")
		RETURNF 0
	SIF EQUIP:ARG:服 == 0 && COND("合意：全裸化", ARG) == 0
		RETURNF 0
	SIF CHECK_OTHER("外套", ARG)
		RETURNF 1

;理想としては服ごとに判定させたい
CASE "希望着装了承"
	SIF TALENT:ARG:叛逆 || ABL:ARG:信頼 < 3
		RETURNF 0
	SIF ABL:ARG:露出癖 < 3 && TALENT:ARG:不知羞恥 == 0 && ABL:ARG:奉仕精神 < 5
		RETURNF 0
	RETURNF 1

CASE "無自覚腋チラ可能"
	SIF CHOSE_DEVENT("無自覚腋チラ", ARG)
		RETURNF 0
	;腋が見える格好じゃないとダメ
	SIF CHECK_CLO("腋露出", ARG) == 0
		RETURNF 0
	;信頼してない相手には豐腴しない
	SIF TALENT:ARG:叛逆 || ABL:ARG:信頼 < 3
		RETURNF 0
	;腋毛をしっかりケアしていない場合は素質が必要
	SIF COND("腋毛", ARG) > 3 && TALENT:ARG:不知羞恥 + TALENT:ARG:粗野 + TALENT:ARG:笨蛋 + TALENT:ARG:好色 == 0
		RETURNF 0
	RETURNF 1
CASE "無自覚腋見せ可能"
	;害羞or臆病な人は信頼がかなり必要
	SIF TALENT:ARG:害羞 + TALENT:ARG:臆病 && ABL:ARG:信頼 < 5
		RETURNF 0
	;ある程度の、こういうことをする素質が必要
	SIF TALENT:ARG:小悪魔 || TALENT:ARG:不知羞恥 || TALENT:ARG:開朗 || TALENT:ARG:不在乎貞操 || TALENT:ARG:好色 || TALENT:ARG:淫乱 || ABL:ARG:露出癖 >= 5
		RETURNF 1

CASE "脱掉衣服露出胸部てきた可能"
	;二人きりじゃないと条件が必要
	IF FLAG:二人きり == 0 && TALENT:ARG:淫乱 == 0
		SIF TALENT:ARG:害羞 || TALENT:ARG:内気 || TALENT:ARG:臆病
			RETURNF 0
	ENDIF
	SIF EQUIP:ARG:贴身制服 || CHECK_CLO("乳頭露出", ARG) || CHECK_CLO("半脱可", ARG) == 0
		RETURNF 0
	SIF CHECK_SHIRT("半脱可", ARG)
		RETURNF 1
	SIF EQUIP:ARG:胸罩 && CHECK_BRA("乳頭露出") == 0
		RETURNF 1

CASE "ながら胖次穿き替え可能"
	SIF CHOSE_DEVENT("ながら胖次穿き替え", ARG)
		RETURNF 0
	SIF PLACE("野外")
		RETURNF 0
	SELECTCASE CONDS("直前行動", ARG)
	CASE "Talk", "夸奖", "甜言蜜语"
	CASEELSE
		RETURNF 0
	ENDSELECT
	;薄着時は脱がない
	SIF CFLAG:ARG:薄着变成了
		RETURNF 0
	;裙と胖次を着用している時のみ
	SIF EQUIP:ARG:裙 == 0 || CHECK_SKIRT("裙", ARG) == 0 || CHECK_CLO("胖次を脱掉のが難儀", ARG)
		RETURNF 0
	SIF COND("胖次形状確認", ARG) || CHECK_CLO("開洞見せ可能", ARG) == 0
		RETURNF 0
	SIF CHECK_PANTIES("前貼", ARG) || CHECK_PANTIES("Ｃ胖次", ARG)
		RETURNF 0
	;汗状態で胖次が汗で汚れている時のみ
	SIF CFLAG:ARG:汗 == 0 || CHECK_STAIN(STAIN:ARG:胖次, "汗") == 0
		RETURNF 0
	;自制心持ちはこういうことしない
	SIF TALENT:ARG:自制心
		RETURNF 0
	;臆病な人は淫乱か露出癖が必要
	SIF TALENT:ARG:臆病 && TALENT:ARG:淫乱 == 0 && ABL:ARG:露出癖 < 5
		RETURNF 0
	;信頼してない相手には肌を晒さない
	SIF TALENT:ARG:叛逆 || ABL:ARG:信頼 < 3
		RETURNF 0
	;害羞持ちは肌を晒さない
	SIF TALENT:ARG:害羞 && STATE("酔酒", ARG) == 0
		RETURNF 0
	;ある程度の露出癖に加えて、こういうことをする素質が必要
	SIF ABL:ARG:露出癖 >= 5 && (TALENT:ARG:小悪魔 || TALENT:ARG:不知羞恥 || TALENT:ARG:開朗 || TALENT:ARG:不在乎貞操)
		RETURNF 1
	;それはそれとして淫乱は全てを解決する
	SIF TALENT:ARG:淫乱 && ABL:ARG:露出癖 >= 10
		RETURNF 1
CASE "薄着化可能"
	;Cosplay＆薄着時は脱がない
	SIF CFLAG:ARG:Cosplay中 || CFLAG:ARG:薄着变成了
		RETURNF 0
	;冬は起きない
	SIF COND("冬", ARG)
		RETURNF 0
	;体が火照っている時のみ
	SIF COND("易出汗", ARG) + STATE("酔酒", ARG) + CFLAG:ARG:躁动难忍 == 0
		RETURNF 0
	;薄着になれるのか？
	SIF EQUIP:ARG:服 == 0 || CHECK_PANTIES("布鲁马", ARG) || CHECK_OUTER("布鲁马", ARG)
		RETURNF 0
	SIF EQUIP:ARG:胸罩 == 0 && TALENT:ARG:男性 == 0
		RETURNF 0
	;自制心持ちはこういうことしない
	SIF TALENT:ARG:自制心
		RETURNF 0
	;臆病な人は淫乱か露出癖が必要
	SIF TALENT:ARG:臆病 && TALENT:ARG:淫乱 == 0 && ABL:ARG:露出癖 < 5
		RETURNF 0
	;信頼してない相手には肌を晒さない
	SIF TALENT:ARG:叛逆 || ABL:ARG:信頼 < 3
		RETURNF 0
	;害羞持ちは肌を晒さない
	SIF TALENT:ARG:害羞 && STATE("酔酒", ARG) == 0
		RETURNF 0
	SIF TALENT:ARG:不知羞恥 || TALENT:ARG:開朗 || TALENT:ARG:不在乎貞操 || ABL:ARG:露出癖 >= 5 || CADV("原生主义者", ASSI:1)
		RETURNF 1
;これは上の"薄着化可能"が前提
CASE "内衣化可能"
	SIF EQUIP:ARG:胖次 == 0
		RETURNF 0
	SIF CHECK_SHIRT("連衣裙", ARG) || CHECK_SKIRT("裙", ARG) || EQUIP:ARG:外套
		RETURNF 1
CASE "性処理後没穿下衣持続可能"
	SIF CFLAG:ARG:性処理の格好变成了 == 0
		RETURNF 0
	;自制心持ちはこういうことしない
	SIF TALENT:ARG:自制心
		RETURNF 0
	;臆病な人は淫乱か露出癖が必要
	SIF TALENT:ARG:臆病 && TALENT:ARG:淫乱 == 0 && ABL:ARG:露出癖 < 5
		RETURNF 0
	;信頼してない相手には肌を晒さない
	SIF TALENT:ARG:叛逆 || ABL:ARG:信頼 < 3
		RETURNF 0
	;害羞持ちは肌を晒さない
	SIF TALENT:ARG:害羞 && STATE("酔酒", ARG) == 0
		RETURNF 0
	SIF TALENT:ARG:不知羞恥 || TALENT:ARG:開朗 || TALENT:ARG:不在乎貞操 || ABL:ARG:露出癖 >= 5 || CADV("原生主义者", ASSI:1)
		RETURNF 1

CASE "全裸状態終了可能"
	SIF CSTR:ARG:脱掉的衣服一览 == ""
		RETURNF 0
	SIF CHECK_CLO("裸体", ARG) == 0
		RETURNF 0
	RETURNF 1
CASE "薄着状態終了可能"
	SIF CFLAG:ARG:薄着变成了 == 0
		RETURNF 0
	SIF CSTR:ARG:脱掉的衣服一览 == ""
		RETURNF 0
	;汗が原因でないなら着ません
	SIF STATE("酔酒", ARG) || CFLAG:ARG:躁动难忍
		RETURNF 0
	SIF CFLAG:ARG:汗 >= 2
		RETURNF 0
	RETURNF 1
CASE "性処理の格好終了可能"
	SIF CFLAG:ARG:性処理の格好变成了 == 0
		RETURNF 0
	SIF CSTR:ARG:脱掉的衣服一览 == ""
		RETURNF 0
	SIF COND("Ｈ的いちゃつき中", ARG) || CFLAG:ARG:PREV_DAILYCATE == 5
		RETURNF 0
	RETURNF 1

CASE "股間に扇風機可能"
	;夏限定イベント
	SIF COND("夏", ARG) == 0
		RETURNF 0
	;易出汗必須
	SIF COND("易出汗", ARG) == 0
		RETURNF 0
	SIF CHOSE_DEVENT("股間に扇風機", ARG)
		RETURNF 0
	SIF COND("合意：检查内褲", ARG) == 0
		RETURNF 0
	SIF CHECK_PANTIES("前貼", ARG) || CHECK_PANTIES("Ｃ胖次", ARG)
		RETURNF 0
	SIF CHECK_SKIRT("裙") == 0
		RETURNF 0
	SIF TALENT:ARG:男性
		RETURNF 0
	;自制心持ちはこういうことしない
	SIF TALENT:ARG:自制心
		RETURNF 0
	;臆病な人は淫乱か露出癖が必要
	SIF TALENT:ARG:臆病 && TALENT:ARG:淫乱 == 0 && ABL:ARG:露出癖 < 5
		RETURNF 0
	SIF TALENT:ARG:粗野 + TALENT:ARG:開朗 + TALENT:ARG:小悪魔 && (TALENT:ARG:不知羞恥 || ABL:ARG:露出癖 >= 3)
		RETURNF 1

CASE "推倒騎乗位実行可能"
	SIF CANTRAIN("推倒騎乗位", ARG) || CANTRAIN("推倒肛門騎乗位", ARG) || CANTRAIN("推倒尿道騎乗位", ARG)
		RETURNF 1

CASE "性欲解消指令実行可能"
	;手交や阴部愛撫や指挿入や乳交は舐陰口交と並行して行う
	SIF CANSS("舐陰", ARG) || CANSS("舐陰莖", ARG) || CANSS("口交", ARG)
		RETURNF 1
	SIF CANSS("正常位", ARG) || CANSS("肛門後背位", ARG) || CANSS("尿道正常位", ARG)
		RETURNF 1
	SIF CANSS("正常位奉仕", ARG) || CANSS("Ａ正常位奉仕", ARG)
		RETURNF 1
	;SIF CANSS("六九式", ARG)
	;	RETURNF 1

CASE "帮忙消除性欲可能"
	;欲望3LVが必要
	SIF ABL:ARG:欲望 < 3 || TALENT:ARG:叛逆 || EXP:ARG:Ｈ回数 == 0
		RETURNF 0
	SIF CFLAG:ARG:性欲解消済
		RETURNF 0
	SIF COND("性欲解消指令実行可能", ARG) == 0
		RETURNF 0
	IF COND("合意：露出PLAY", ARG) == 0
		;他に人がいるorお外だと普通は嫌がる
		SIF FLAG:二人きり == 0 || PLACE("野外")
			RETURNF 0
	ENDIF
	SIF CFLAG:ARG:躁动难忍 || COND("発情期", ARG) || COND("欲求不満", ARG) >= 2
		RETURNF 2
	SIF TALENT:ARG:接受快感 && TALENT:ARG:不知羞恥 && BASE:ARG:欲求不満 >= 1
		RETURNF 1
	SIF TALENT:ARG:淫乱
		RETURNF 1

CASE "性処理指令実行可能"
	FOR LCOUNT, 0, 10
		SIF CANSS(NAMES("性処理の採用指令", LCOUNT), ARG)
			RETURNF 1
	NEXT
CASE "性処理可能"
	;SIF COND("部室出現可能", ARG) == 0
	;	RETURNF 0
	SIF COND("性処理指令実行可能", ARG) == 0
		RETURNF 0
	;[欲望LV5]or[奉仕精神LV5]or[屈服刻印LV2]（自発口交可能と同じ条件）
	SIF ABL:ARG:欲望 >= 5 || ABL:ARG:奉仕精神 >= 5 || MARK:ARG:屈服刻印 >= 2
		RETURNF 1
CASE "Ｖ性処理可能"
	SIF COND("性処理可能", ARG) == 0 || COND("女性主導生性交", ARG) == 0
		RETURNF 0
	SIF CANSS("正常位", ARG)
		RETURNF 1
	RETURNF 0
CASE "Ａ性処理可能"
	SIF COND("性処理可能", ARG) == 0
		RETURNF 0
	SIF CANSS("肛門後背位", ARG)
		RETURNF 1
	RETURNF 0

CASE "性処理中"
	SIF COND("性処理可能", ARG) == 0
		RETURNF 0
	SIF COND("性処理指名中", ARG)
		RETURNF 1
CASE "性処理指名中"
	SIF CFLAG:ARG:性処理
		RETURNF 1

;なにこれ？→你と一緒にシコる要員です。相手は女とする。
;相手はPARTNER()で参照できる
CASE "汁男優可能"
	;まずは部員間ＨがＯＫか
	SIF CONFIG("部員間Ｈ") == 0
		RETURNF 0
	;COND("只和你Ｈ")と同条件
	SIF CFLAG:ARG:ＮＴＲ禁止 == 1 || CFLAG:PARTNER():ＮＴＲ禁止 == 1
		RETURNF 0
	SIF CFLAG:ARG:レ阴蒂エーション中
		RETURNF 0
	;ちんこが無くては始まらない
	SIF PENIS(ARG) == 0 || EXP:ARG:射精経験 == 0
		RETURNF 0
	;優先順位５位内
	SIF CFLAG:ARG:優先順位 > 5
		RETURNF 0
	;相性〇相当が必要
	SIF MIN(RELATION:ARG:(NO:PARTNER() ), RELATION:PARTNER():(NO:ARG) ) < 120
		RETURNF 0
	;立つシチュかどうか
	SIF TALENT:ARG:討厭女人
		RETURNF 0
	SIF TALENT:ARG:男性 == 0 && TALENT:ARG:兩面通吃 == 0
		RETURNF 0
	SIF MAX(ABL:ARG:欲望, ABL:ARG:露出癖) < 5
		RETURNF 0
	IF TALENT:ARG:淫乱 == 0
		;淫乱でない場合に持っていたら駄目な素質
		SIF TALENT:ARG:贞操重视 + TALENT:ARG:否定快感 + TALENT:ARG:自制心
			RETURNF 0
		SIF TALENT:ARG:害羞 && MIN(ABL:ARG:欲望, ABL:ARG:露出癖) < 5
			RETURNF 0
	ENDIF
	SIF CFLAG:ARG:躁动难忍
		RETURNF 1
	SIF TALENT:ARG:好色 + TALENT:ARG:接受快感 + TALENT:ARG:倒錯的 && COND("欲求不満", ARG)
		RETURNF 1
CASE "見抜きＯＫ"
	;とりあえず女だけ
	SIF PENIS(ARG)
		RETURNF 0
	SIF COND("性処理意欲", ARG) == 0
		RETURNF 0
	SIF COND("合意：检查内褲", ARG) == 0
		RETURNF 0
	;休闲褲履いている場合はものによってはダメ
	IF CHECK_CLO("外套露出", ARG)
		SIF CHECK_OUTER("布鲁马", ARG) + CHECK_OUTER("连褲襪", ARG) == 0
			RETURNF 0
	ENDIF
	SIF TALENT:ARG:害羞 == 0 && TALENT:ARG:不知羞恥 + TALENT:ARG:小悪魔 + TALENT:ARG:好色
		RETURNF 1
	SIF ABL:ARG:奉仕精神 >= 5
		RETURNF 1
	SIF COND("合意：检查阴部", ARG)
		RETURNF 1

;仕組み的にここでのARGは性処理に参加していない第三者。実際に性処理をした相手はPARTNER()で参照できる
CASE "性処理後のお掃除可能"
	;まずはPARTNER()とARGの二人ともが、エロいことを你以外と出来るか格子
	;COND("只和你Ｈ")と同条件
	SIF CFLAG:ARG:ＮＴＲ禁止 == 1 || CFLAG:PARTNER():ＮＴＲ禁止 == 1
		RETURNF 0

	;お掃除の必要な性処理直後か
;	SELECTCASE NAMES("性処理")
;	CASE "Ｖ性交", "Ａ性交", "尿道性交"
;		SELECTCASE SAVESTR:PREV_日常イベント名
;		;今のところは进行性処理のみ。干劲性処理の場合に参加するとなんか水さす感じになるかなって
;		CASE "进行性処理"
;		CASEELSE
;			RETURNF 0
;		ENDSELECT
;	CASEELSE
;		RETURNF 0
;	ENDSELECT

	SIF COND("自発清洁口交可能", ARG) == 0
		RETURNF 0
	SIF PENIS(MASTER) == 0 || CONDS("Ｐ汚れ", MASTER) == ""
		RETURNF 0
	SIF CFLAG:ARG:喧嘩中
		RETURNF 0
	SIF COND("助手", ARG) || ABL:ARG:奉仕精神 >= 5
		RETURNF 1

;性処理して给けど、干劲はないよって状態
CASE "进行性処理"
	SIF COND("性処理意欲", ARG) != 1
		RETURNF 0
	SIF CANSS("手淫", ARG)
		RETURNF 1
	SIF CANSS("正常位", ARG)
		RETURNF 1
	SIF CANSS("肛門後背位", ARG)
		RETURNF 1
	SIF CANSS("尿道正常位", ARG)
		RETURNF 1
	;ここからは女你用
	;	SIF CANSS("騎乗位侵犯", ARG)
	;		RETURNF 1

CASE "干劲性処理"
	SIF COND("性処理意欲", ARG) != 2
		RETURNF 0
	SIF CANSS("口交", ARG) || CANSS("乳交", ARG)
		RETURNF 1
	SIF CANSS("正常位", ARG) || CANSS("肛門後背位", ARG) || CANSS("尿道正常位", ARG) || CANSS("乳頭奸", ARG)
		RETURNF 1

;１=进行性処理。2=干劲有。
CASE "性処理意欲"
	IF CFLAG:ARG:性処理済
		;CEVENTによる例外指定
		SIF CEVENT("何度でも性処理可能", ARG) == 0
			RETURNF 0
	ENDIF

	SIF COND("合意：性処理", ARG) == 0
		RETURNF 0
	SIF CFLAG:ARG:喧嘩中
		RETURNF 0
	IF COND("合意：露出PLAY", ARG) == 0
		;他に人がいるorお外だと普通は嫌がる
		SIF FLAG:二人きり == 0 || PLACE("野外")
			RETURNF 0
	ENDIF

	;CEVENTによる性処理指定
	SIF CEVENT("性処理意欲：干劲", ARG)
		RETURNF 2
	SIF CEVENT("性処理意欲：ながら", ARG)
		RETURNF 1

	;进行性処理をしない素質
	;SIF TALENT:ARG:献身
	;	RETURNF 2

	;进行性処理をしない場所
	SIF PLACE("Ｈ目的")
		RETURNF 2
	SIF CFLAG:ARG:躁动难忍 || CFLAG:ARG:夸奖 || CFLAG:ARG:甜言蜜语
		RETURNF 2
	SIF COND("発情期", ARG) || COND("欲求不満", ARG) >= 2
		RETURNF 2

	SIF EXP:ARG:性処理経験 >= 3
		RETURNF 1

CASE "性処理：Ａ挿入直後"
	SIF STRCOUNTS(CSTR:ARG:PREV_DAILYCOM, "性処理", "性欲解消") == 0
		RETURNF 0
	SIF STRCOUNTS(CSTR:ARG:DAILYCOM履歴, "Ａ性交性処理", "Ａ性交性欲解消")
		RETURNF 1
CASE "性処理：Ｖ挿入直後"
	SIF STRCOUNTS(CSTR:ARG:PREV_DAILYCOM, "性処理", "性欲解消") == 0
		RETURNF 0
	SIF STRCOUNTS(CSTR:ARG:DAILYCOM履歴, "Ｖ性交性処理", "Ｖ性交性欲解消")
		RETURNF 1
CASE "性処理：挿入直後"
	SIF STRCOUNTS(CSTR:ARG:PREV_DAILYCOM, "性処理", "性欲解消") == 0
		RETURNF 0
	SIF STRCOUNTS(CSTR:ARG:DAILYCOM履歴, "性交性処理", "性交性欲解消")
		RETURNF 1
CASE "性処理：生挿入直後"
	SIF STRCOUNT(CSTR:ARG:DAILYCOM履歴, "避孕套射精")
		RETURNF 0
	SIF COND("性処理：挿入直後", ARG)
		RETURNF 1
CASE "性処理直後"
	SIF CFLAG:ARG:性処理済 && STRCOUNT(SAVESTR:PREV_日常イベント名, "性処理") && STRCOUNT(CSTR:ARG:PREV_DAILYCOM, "性処理")
		RETURNF 1
	SIF CFLAG:ARG:性欲解消済 && STRCOUNT(SAVESTR:PREV_日常イベント名, "性欲解消") && STRCOUNT(CSTR:ARG:PREV_DAILYCOM, "性欲解消")
		RETURNF 1

CASE "干劲性処理直後"
	SIF STRCOUNT(SAVESTR:PREV_日常イベント名, "性処理") == 0
		RETURNF 0
	SIF STRCOUNT(CSTR:ARG:PREV_DAILYCOM, "拜托処理性欲") == 0
		RETURNF 0
	SIF CFLAG:ARG:性処理済
		RETURNF 1
CASE "他の人の性処理直後"
	SIF STRCOUNT(SAVESTR:PREV_日常イベント名, "性処理") == 0
		RETURNF 0
	SIF CFLAG:ARG:性処理済
		RETURNF 0
	RETURNF 1

CASE "尾巴隠蔽中"
	SIF CFLAG:ARG:尾巴を出す
		RETURNF 0
	SIF COND("種族：妖狐", ARG) || COND("種族：悪魔", ARG) || COND("種族：淫魔", ARG)
		RETURNF 1
CASE "尾巴露呈可能"
	SIF ABL:ARG:信頼 < 5 && MARK:ARG:屈服刻印 == 0 && TALENT:ARG:恋慕 == 0
		RETURNF 0
	SIF COND("種族：妖狐", ARG) || COND("種族：悪魔", ARG) || COND("種族：淫魔", ARG)
		RETURNF 1

CASE "髪型変更可能"
	SIF CFLAG:ARG:髪型変更のお願い中
		RETURNF 0
	RETURNF 1
CASE "髪型変更のお願い可能"
	SIF TALENT:ARG:叛逆
		RETURNF 0
	;髪は女の命なので、結構敷居高い
	SELECTCASE TRUE_SEX(ARG)
	CASE "扶她", "女性"
		SIF ABL:ARG:信頼 >= 5 || MARK:ARG:屈服刻印 >= 3 || TALENT:ARG:恋慕
			RETURNF 1
	CASE "男性"
		SIF ABL:ARG:信頼 >= 3 || MARK:ARG:屈服刻印 || TALENT:ARG:恋慕
			RETURNF 1
	ENDSELECT

;基本的には巨根までは抵抗が单薄的。腕並以上はちょっと
CASE "巨根化して可能"
	SIF TALENT:ARG:叛逆 || EXP:ARG:Ｈ回数 == 0
		RETURNF 0
	;本来のサイズに戻す方向ならＯＫ
	SIF SIZE("基本阴茎尺寸", ARG) < SIZE("初期阴茎尺寸", ARG)
		RETURNF 1

	;男性は抵抗薄め
	SELECTCASE TRUE_SEX(ARG)
	CASE "扶她", "女性"
		SIF ABL:ARG:信頼 < 5 && ABL:ARG:欲望 < 5 && MARK:ARG:屈服刻印 < 3 && TALENT:ARG:恋慕 == 0
			RETURNF 0
	CASE "男性"
		SIF ABL:ARG:信頼 < 3 && ABL:ARG:欲望 < 3 && MARK:ARG:屈服刻印 == 0 && TALENT:ARG:恋慕 == 0
			RETURNF 0
	ENDSELECT

	;これは大きくなる前のサイズ
	SELECTCASE SIZE("基本阴茎尺寸", ARG)
	CASE 0, 1
		RETURNF 1
	;本来のサイズにより難易度が変わる
	CASE IS <= SIZE("初期阴茎尺寸", ARG)
		RETURNF 1
	;これ以上のでかさは難易度ＵＰ
	CASEELSE
		SIF ABL:ARG:信頼 >= 5 && ABL:ARG:欲望 >= 5 && (MARK:ARG:屈服刻印 >= 3 || TALENT:ARG:恋慕 || TALENT:ARG:淫乱)
			RETURNF 1
	ENDSELECT
CASE "短小化して可能"
	SIF TALENT:ARG:叛逆 || EXP:ARG:Ｈ回数 == 0
		RETURNF 0
	;本来のサイズに戻す方向ならＯＫ
	SIF SIZE("基本阴茎尺寸", ARG) > SIZE("初期阴茎尺寸", ARG)
		RETURNF 1

	;男性は抵抗強め
	SELECTCASE TRUE_SEX(ARG)
	CASE "扶她", "女性"
		SIF ABL:ARG:信頼 < 3 && ABL:ARG:欲望 < 3 && MARK:ARG:屈服刻印 == 0 && TALENT:ARG:恋慕 == 0
			RETURNF 0
	CASE "男性"
		SIF ABL:ARG:信頼 < 5 && ABL:ARG:欲望 < 5 && MARK:ARG:屈服刻印 < 3 && TALENT:ARG:恋慕 == 0
			RETURNF 0
	ENDSELECT

	;これは小さくなる前のサイズ
	SELECTCASE SIZE("基本阴茎尺寸", ARG)
	CASE IS >= 3
		RETURNF 1
	;本来のサイズにより難易度が変わる
	CASE IS >= SIZE("初期阴茎尺寸", ARG)
		RETURNF 1
	;これ以上の小ささにするのは難易度ＵＰ（主に短小化）
	CASEELSE
		SIF ABL:ARG:信頼 >= 5 && ABL:ARG:欲望 >= 5 && (MARK:ARG:屈服刻印 >= 3 || TALENT:ARG:恋慕 || TALENT:ARG:淫乱)
			RETURNF 1
	ENDSELECT

CASE "昼のお仕事"
	SIF STRCOUNT(CSTR:ARG:仕事, "_昼")
		RETURNF 1
	SIF CSTR:ARG:仕事 != "" && STRCOUNTS(CSTR:ARG:仕事, "_傍晚", "_夜") == 0
		RETURNF 1
CASE "傍晚のお仕事"
	;一緒に帰った場合はしない
	SIF CFLAG:ARG:一緒に帰宅
		RETURNF 0
	SIF STRCOUNT(CSTR:ARG:仕事, "_傍晚")
		RETURNF 1
CASE "夜のお仕事"
	SIF STRCOUNT(CSTR:ARG:仕事, "_夜")
		RETURNF 1

CASE "打招呼前"
	SIF CFLAG:ARG:打招呼された == 0 && COND("DAILYCOM回数", ARG) <= 1
		RETURNF 1
CASE "入室打招呼中"
	SIF CFLAG:ARG:入室打招呼中
		RETURNF 1

CASE "直前行動"
	SIF STRCOUNT(SAVESTR:PREV_直前行動, CALLNAME:ARG)
		RETURNF 1
;主に日常イベントで時間経過が起きるかの格子に用いる
CASE "気付いていない"
	SIF CFLAG:ARG:睡眠 || STR:日常イベント名 == "用手机拍照"
		RETURNF 1

CASE "DAILYCOM回数"
	RETURNF STRCOUNT(CSTR:ARG:DAILYCOM履歴, "/")
CASE "行動参加中"
	RETURNF CFLAG:ARG:行動参加中
CASE "闲を持て余すイベント可能"
	SIF TALENT:ARG:叛逆 || CFLAG:ARG:睡眠 || CFLAG:ARG:闲を持て余す || CFLAG:ARG:行動参加中 || CFLAG:ARG:レ阴蒂エーション中
		RETURNF 0
	SIF COND("現在存在", ARG) == 0
		RETURNF 0
	SIF COND("DAILYCOM回数", ARG) <= 0 || CSTR:ARG:PREV_DAILYCOM == ""
		RETURNF 1
CASE "レ阴蒂エーション可能"
	SIF CFLAG:ARG:睡眠 || CFLAG:ARG:行動参加中 || CFLAG:ARG:レ阴蒂エーション中
		RETURNF 0
	;ある程度馴染んでいないと参加しない
	SIF TALENT:ARG:叛逆 || ABL:ARG:信頼 == 0 || CFLAG:ARG:好感度 < 100
		RETURNF 0
	SIF COND("現在存在", ARG) == 0
		RETURNF 0
	RETURNF 1

CASE "新規入室"
	SIF CFLAG:ARG:入室までの所要時間 == 1
		RETURNF 1
CASE "対話可能"
	SIF CFLAG:ARG:交流中
		RETURNF 1
	;部員同士の交流中はCFLAG:交渉中 = 0だとダメ
	SIF COND("部員同士の交流中", ARG)
		RETURNF 0
	SIF CFLAG:ARG:行動参加中
		RETURNF 0
	SIF COND("現在存在", ARG)
		RETURNF 1
CASE "部員同士の交流可能"
	;すでに交流面子に選ばれている
	SIF CFLAG:ARG:交流中
		RETURNF 0
	SELECTCASE ARG
	CASE TARGET
		SIF COND("現在存在", ARG)
			RETURNF 0
	CASE ASSI
		SIF COND("現在存在", ARG) && FLAG:休憩 == 0
			RETURNF 0
	ENDSELECT
	SIF COND("現在存在", ARG) || COND("出現予定", ARG)
		RETURNF 1

CASE "現在存在"
	SIF CFLAG:ARG:不在
		RETURNF 0
	IF CEVENT("做爱部联谊", ARG)
		RETURNF 0
	ELSEIF PLACE("自宅")
		SIF CSTR:ARG:現在位置 == SAVESTR:現在位置
			RETURNF 1
	ELSEIF COND("约会中", ARG)
		SIF ARG == TARGET
			RETURNF 1
	ELSE
		SIF CFLAG:ARG:入室までの所要時間 < 2
			RETURNF 1
	ENDIF
CASE "現在不在"
	SIF COND("現在存在", ARG) == 0
		RETURNF 1
CASE "自室に一人"
	SIF CFLAG:ARG:不在
		RETURNF 0
	SIF PLACE("自宅") && CSTR:ARG:現在位置 != SAVESTR:現在位置 && CSTR:ARG:現在位置 == @"%CSVCALLNAME(NO:ARG)%的房間"
		RETURNF 1
CASE "出現予定"
	SIF COND("昼", ARG) == 0
		RETURNF 0
	SIF CFLAG:ARG:入室までの所要時間 >= 1 && CFLAG:ARG:不在 == 0
		RETURNF 1
CASE "归途イベント可能"
	SIF CEVENT("归途イベント禁止", ARG)
		RETURNF 0
	SIF COND("部室出現可能", ARG)
		RETURNF 1
CASE "部室出現可能"
	SIF CONDS("学園の居場所", ARG) != "" && CONDS("学園の居場所", ARG) != "部室"
		RETURNF 0
	SIF	CFLAG:ARG:夜型 == 0
		RETURNF 1
CASE "居間出現可能"
	SIF CONDS("自宅の居場所", ARG) != "" && CONDS("自宅の居場所", ARG) != "居間" || CEVENT("做爱部联谊",ARG)
		RETURNF 0
	SIF COND("同居中", ARG)
		RETURNF 1
CASE "初期位置不在"
	SELECTCASE SAVESTR:現在位置
	CASE "居間"
		SIF CONDS("自宅の居場所", ARG) != "" && CONDS("自宅の居場所", ARG) != SAVESTR:現在位置
			RETURNF 1
	CASE "部室"
		SIF CONDS("学園の居場所", ARG) != "" && CONDS("学園の居場所", ARG) != SAVESTR:現在位置
			RETURNF 1
	ENDSELECT
CASE "初期対象可能"
	SIF ARG == MASTER || CFLAG:ARG:不在 || COND("初期位置不在", ARG)
		RETURNF 0
	RETURNF 1
CASE "一緒に登校可能"
	SIF	CFLAG:ARG:夜型
		RETURNF 0
	SIF COND("朝袭相手", ARG)
		RETURNF 1
	SELECTCASE TEXTS("曜日")
	CASE "月"
	CASEELSE
		SIF COND("同居：仅周末", ARG)
			RETURNF 0
	ENDSELECT
	SIF COND("同居中", ARG)
		RETURNF 1
	RETURNF 0

CASE "自宅出現可能"
	SELECTCASE TEXTS("曜日")
	CASE "土", "日"
	CASEELSE
		SIF COND("同居：仅周末", ARG)
			RETURNF 0
	ENDSELECT
	SIF COND("同居中", ARG)
		RETURNF 1
	RETURNF 0
CASE "場所移動可能"
	IF CFLAG:ARG:睡眠
		SIF PLACE("部室")
			RETURNF 0
		RETURNF 1
	ELSEIF PLACE("自宅") || PLACE("部室") || PLACE("野外")
		RETURNF 1
	ENDIF
	RETURNF 0
CASE "抜け出された"
	SIF CFLAG:ARG:不在 == 2 && CFLAG:ARG:睡眠 == 0
		RETURNF 1
CASE "Ｈ的いちゃつき中"
	SELECTCASE CFLAG:ARG:PREV_DAILYCATE
	;Ｈ的事しかしない指令
	CASE 4, 6, 7
		RETURNF 1
	CASEELSE
		SELECTCASE CSTR:ARG:PREV_DAILYCOM
		CASE "打招呼舐陰", "打招呼口交"
			RETURNF 1
		CASE "托一托胸部", "撫摸股間", "给对方剃毛"
			RETURNF 1
		CASE "裙下撮影", "股間撮影", "内褲摄影", "阴部摄影"
			RETURNF 1
		ENDSELECT
	ENDSELECT
CASE "いちゃいちゃ"
	RETURNF CFLAG:ARG:PREV_DAILYCATE
CASE "お誘い"
	SIF CSTR:ARG:お誘い != ""
		RETURNF 1
CASE "浑身是汗"
	SIF CFLAG:ARG:汗 >= 6
		RETURNF 1
CASE "易出汗"
	SIF CFLAG:ARG:汗 >= 2
		RETURNF 1
CASE "汗"
	RETURNF CFLAG:ARG:汗
CASE "胸罩透け"
	SIF CHECK_SHIRT("透明", ARG)
		RETURNF 1
	SIF CHECK_SHIRT("汗水浸湿的", ARG) == 0
		RETURNF 0
	SIF CFLAG:ARG:湿透
		RETURNF 1
	SIF CFLAG:ARG:汗 && CHECK_STAIN(STAIN:ARG:服, "汗") + COND("浑身是汗", ARG)
		RETURNF 1

CASE "湿透"
	SIF CFLAG:ARG:湿透
		RETURNF 1
CASE "起床中"
	SIF CFLAG:ARG:睡眠 == 0
		RETURNF 1
CASE "熟睡"
	SIF CFLAG:ARG:睡眠 >= 6
		RETURNF 1
CASE "打瞌睡"
	SIF CFLAG:ARG:睡眠 >= 3
		RETURNF 1
CASE "快要醒了"
	SIF CFLAG:ARG:睡眠 == 2 || CFLAG:ARG:睡眠 == 1
		RETURNF 1
CASE "躁动难忍"
	SIF CFLAG:ARG:躁动难忍
		RETURNF 1
CASE "闲"
	SIF CFLAG:ARG:闲
		RETURNF 1

CASE "居睡眠可能"
	SIF CFLAG:ARG:日常事件回数 == 0 || CFLAG:ARG:一緒に帰宅
		RETURNF 0
	SIF COND("初期対象可能", ARG) == 0
		RETURNF 0
	IF COND("夜", ARG)
		SIF CHARA_NUM("同居中") >= 2
			RETURNF 0
	ENDIF
	RETURNF 1

CASE "Ｈ的奖励"
	SIF CFLAG:ARG:ご褒美権
		RETURNF 1
CASE "Ｈ的約定可能"
	SIF ABL:ARG:信頼 < 3 || TALENT:ARG:叛逆
		RETURNF 0
	SIF DAYEV("周考") == 0
		RETURNF 0
	SIF CFLAG:ARG:Ｈ的約定
		RETURNF 0
	RETURNF 1
CASE "Ｈ的約定"
	SIF CFLAG:ARG:Ｈ的約定 <= 0
		RETURNF 0
	RETURNF 1
CASE "夸奖可能"
	SIF CFLAG:ARG:夸奖 == 0
		RETURNF 1
CASE "甜言蜜语可能"
	SIF CFLAG:ARG:甜言蜜语
		RETURNF 0
	SIF TALENT:ARG:单相思 || TALENT:ARG:恋慕 || TALENT:ARG:相思相愛 || TALENT:MASTER:甜言蜜语
		RETURNF 1
CASE "勉強可能"
	;SIF DAYEV("周考") == 0
	;	RETURNF 0
	SIF CHARA_NUM("一起学习") || CHARA_NUM("勉強") || TALENT:ARG:叛逆
		RETURNF 0
	SIF CEVENT("一起学习禁止", ARG)
		RETURNF 0
	;信頼か好感度が必要
	SIF ABL:ARG:信頼 < 3 && CFLAG:ARG:好感度 < 500
		RETURNF 0
	;SIF COND("学生", ARG) || COND("教員", ARG)
	RETURNF 1
CASE "成績上昇率"
	RETURNF CFLAG:ARG:勉強時間*10
CASE "成績：学年上位"
	SIF CFLAG:ARG:試験結果 >= 90
		RETURNF 1
CASE "成績：優秀"
	SIF CFLAG:ARG:試験結果 >= 80
		RETURNF 1
CASE "成績：赤点"
	SIF COND("学生", ARG) == 0
		RETURNF 0
	SIF CFLAG:ARG:試験結果 && CFLAG:ARG:試験結果 < 30
		RETURNF 1
CASE "淋浴可能"
	SIF CFLAG:ARG:日常事件回数 == 0 || CFLAG:ARG:淋浴済 || CFLAG:ARG:一緒に帰宅
		RETURNF 0
	SIF COND("初期対象可能", ARG) == 0
		RETURNF 0
	IF COND("夜", ARG)
		SIF CHARA_NUM("同居中") >= 2
			RETURNF 0
	ENDIF
	SIF CFLAG:ARG:汗 && EQUIP:ARG:服 && EQUIP:ARG:胖次
		RETURNF 1
CASE "淋浴：人物判定"
	IF PLACE("自宅")
		RETURNF 1
	ELSE
		SIF GETBIT(CFLAG:ARG:淋浴中, 1)
			RETURNF 1
	ENDIF
CASE "淋浴：内衣漁り"
	SIF GETBIT(CFLAG:ARG:淋浴中, 2)
		RETURNF 1
CASE "淋浴：内衣漁りバレ"
	SIF GETBIT(CFLAG:ARG:淋浴中, 3)
		RETURNF 1

CASE "廁所可能"
	;出歩けない格好だと無理
	SIF CFLAG:ARG:薄着变成了 || CFLAG:ARG:性処理の格好变成了
		RETURNF 0
	SIF BASE:ARG:尿意 >= 9000 || (BASE:ARG:尿意 >= 5000 && CFLAG:ARG:行動参加中 == 0)
		RETURNF 1
CASE "居家服に着替えた"
	SIF CEVENT("着替えをした：居家服", ARG)
		RETURNF 1
CASE "便装に着替えた"
	SIF CEVENT("着替えをした：便装", ARG)
		RETURNF 1
CASE "约会衣装に着替えた"
	SIF CEVENT("着替えをした：约会衣装", ARG)
		RETURNF 1
CASE "外出装に着替えた"
	SIF CEVENT("着替えをした：外出装", ARG)
		RETURNF 1

CASE "居家服着替え可能"
	SIF CSTR:ARG:移動履歴 == @"%CSVCALLNAME(NO:ARG)%的房間\/"
		RETURNF 1

;主に睡眠姦で汚したりするとONになる
CASE "着衣の乱れ"
	SIF CFLAG:ARG:掀起裙子 || CFLAG:ARG:胖次没収
		RETURNF 1
	SIF CHECK_STAIN(STAIN:ARG:Ｍ, "精液") || CHECK_STAIN(STAIN:ARG:Ｐ, "精液") || CHECK_STAIN(STAIN:ARG:Ｖ, "精液") || CHECK_STAIN(STAIN:ARG:Ａ, "精液") || CHECK_STAIN(STAIN:ARG:Ｂ, "精液") || CHECK_STAIN(STAIN:ARG:Ａ, "精液")
		RETURNF 1

CASE "性騷擾雑談可能"
	SIF FLAG:二人きり == 0 && COND("合意：露出PLAY", ARG) == 0
		RETURNF 0
	SIF TALENT:ARG:炮友 || COND("Ｈ的邀请可能", ARG)
		RETURNF 1

CASE "胖次没収実行可能"
	SIF CFLAG:ARG:胖次没収 || CFLAG:ARG:睡眠
		RETURNF 0
	;明らかに胖次を穿いていない格好
	SIF EQUIP:ARG:贴身制服 || CHECK_CLO("裸体", ARG)
		RETURNF 0
	IF COND("身嗜み：没穿内褲", ARG)
		SIF EQUIP:ARG:胖次 && COND("胖次形状確認", ARG)
			RETURNF 1
	ELSE
		SIF EQUIP:ARG:胖次 || COND("胖次形状確認", ARG) == 0
			RETURNF 1
	ENDIF

CASE "你の胖次に興味有"
	;你が池面
	SIF TALENT:MASTER:男性 && TALENT:MASTER:伪娘 == 0
		RETURNF 0
	;恋慕持ちならOK
	SIF TALENT:ARG:恋慕
		RETURNF 1
	SIF TALENT:ARG:扶她
		RETURNF 1
	IF TALENT:MASTER:男性 || TALENT:MASTER:扶她
		SIF TALENT:ARG:討厭男人
			RETURNF 0
		SIF TALENT:ARG:男性 && TALENT:ARG:性反転 + TALENT:ARG:兩面通吃
			RETURNF 1
		SIF TALENT:ARG:女性 && TALENT:ARG:兩面通吃
			RETURNF 1
	ELSE
		SIF TALENT:ARG:討厭女人
			RETURNF 0
		SIF TALENT:ARG:男性
			RETURNF 1
		SIF TALENT:ARG:女性 && TALENT:ARG:性反転 + TALENT:ARG:兩面通吃
			RETURNF 1
	ENDIF

CASE "胖次ドーピング"
	SIF STRCOUNT(@"\/%SAVESTR:胖次ドーピング%", @"\/%CALLNAME:ARG%\/")
		RETURNF 1

;胖次チラなどで僅かに見えた場合
CASE "胖次おぼろげ確認"
	SIF ARG == MASTER
		RETURNF 1
	RETURNF GETBIT(CFLAG:ARG:内衣確認済, 0)
;胖次の色までは見えた場合
CASE "胖次色確認"
	SIF ARG == MASTER
		RETURNF 1
	RETURNF GETBIT(CFLAG:ARG:内衣確認済, 1)
;胖次の全貌を見た場合
CASE "胖次形状確認"
	SIF ARG == MASTER
		RETURNF 1
	RETURNF GETBIT(CFLAG:ARG:内衣確認済, 2)
;检查内褲した場合
CASE "胖次詳細確認"
	SIF ARG == MASTER
		RETURNF 1
	RETURNF GETBIT(CFLAG:ARG:内衣確認済, 3)

;胸罩の全貌を見た場合
CASE "胸罩形状確認"
	SIF ARG == MASTER
		RETURNF 1
	RETURNF GETBIT(CFLAG:ARG:内衣確認済, 12)

CASE "胖次チラ直後"
	SIF CSTR:ARG:PREV_DAILYCOM == "露脐装超短裙胖次チラ"
		RETURNF 1
;これはあくまで日常シーンでのお浴室上がりの判定
CASE "出浴"
	SIF CSTR:ARG:PREV_DAILYCOM == "淋浴" || TEQUIP:ARG:出浴
		RETURNF 1

CASE "给对方剃毛出現"
	;检查阴部の合意が前提
	SIF COND("合意：检查阴部", ARG) == 0 || CFLAG:ARG:检查阴部 == 0
		RETURNF 0
	;前回检查阴部
	SELECTCASE CSTR:ARG:PREV_DAILYCOM
	CASE "检查阴部", "阴部摄影"
	CASEELSE
		RETURNF 0
	ENDSELECT
	SIF EXP:ARG:剃毛経験 == 0 || FIRSTCOM(TNUM("剃毛") ) == 0
		RETURNF 0
	SELECTCASE CONDS("陰毛", ARG)
	;どっちかって言うと半端な状態であることが条件
	CASE "剃过留痕", "刺啦刺啦", "無髭"
		;常に剃り整えておくようにお願いしている場合はその状態に至る途中なのでスルー
		SIF COND("身嗜み：陰毛", ARG) == 5
			RETURNF 0
	CASE "还没長出来"
		;外見年齢が１の場合はこれがMAXなので問題ない
		SIF AGE(ARG) == 1
			RETURNF 0
		;常に剃り整えておくようにお願いしている場合はその状態に至る途中なのでスルー
		SIF COND("身嗜み：陰毛", ARG) == 5
			RETURNF 0
	CASE "保养完毕"
		SIF COND("剃过留痕露出", ARG) == 0
			RETURNF 0
	CASEELSE
		RETURNF 0
	ENDSELECT
	SIF TALENT:ARG:不知羞恥 || FLAG:二人きり || COND("合意：露出PLAY", ARG)
		RETURNF 1

CASE "检查菊穴出現"
	SIF COND("合意：检查阴部", ARG) == 0
		RETURNF 0
	SIF TALENT:ARG:縦深菊穴 || COND("Ａ熟達", ARG) || COND("性処理：Ａ挿入直後", ARG)
		RETURNF 1
;気づかれていたら不可能
CASE "隐秘摄影可能"
	;直前に撮影したばかり
	SIF CFLAG:ARG:PREV_DAILYCATE == 5
		RETURNF 0
	SIF STRCOUNTS(CSTR:ARG:DAILYCOM履歴, "隐秘摄影失敗", "POSE撮影")
		RETURNF 0
	RETURNF 1
CASE "阴部のチラ見せ撮影可能"
	SIF CFLAG:ARG:睡眠 || CFLAG:ARG:刚睡醒
		RETURNF 0
	;ちんこのある人は肛門チラ見せのみ
	SIF PENIS(ARG)
		RETURNF 0
	;この時間帯に既にやってたらやらない
	SIF CHOSE_DEVENT("阴部のチラ見せ撮影", ARG) || CHOSE_DEVENT("肛門のチラ見せ撮影", ARG)
		RETURNF 0
	SIF COND("身嗜み：Ｖ拡張", ARG) == 0 && CHOSE_DEVENT("阴部の見せつけ撮影", ARG)
		RETURNF 0
	SIF COND("合意：内衣写真", ARG) == 0 || COND("合意：检查阴部", ARG) == 0
		RETURNF 0
	SIF TALENT:ARG:傲慢 + TALENT:ARG:好色 + TALENT:ARG:小悪魔 + TALENT:ARG:淫核 && TALENT:ARG:害羞 == 0
		RETURNF 1
	SIF TALENT:ARG:淫核 + TALENT:ARG:淫乱
		RETURNF 1
	SIF ABL:ARG:露出癖 >= 5 && (CFLAG:ARG:夸奖 || CFLAG:ARG:躁动难忍 || COND("欲求不満", ARG) >= 3)
		RETURNF 1
CASE "肛門の見せつけ撮影可能"
	SIF CFLAG:ARG:睡眠 || CFLAG:ARG:刚睡醒
		RETURNF 0
	SIF COND("自撮り中", ARG)
		RETURNF 0
	;この時間帯に既にやってたらやらない
	SIF CHOSE_DEVENT("阴部の見せつけ撮影", ARG) || CHOSE_DEVENT("肛門の見せつけ撮影", ARG)
		RETURNF 0
	SIF COND("合意：检查阴部", ARG) == 0 || ABL:ARG:露出癖 < 5
		RETURNF 0

	SIF COND("Ａ熟達", ARG) == 0
		RETURNF 0
	SIF TALENT:ARG:尻穴狂い || COND("身嗜み：Ａ拡張", ARG)
		RETURNF 1
	SIF TALENT:ARG:好色 + TALENT:ARG:小悪魔 && TALENT:ARG:害羞 == 0
		RETURNF 1
	SIF ABL:ARG:露出癖 >= 7 && (CFLAG:ARG:夸奖 || CFLAG:ARG:躁动难忍 || COND("欲求不満", ARG) >= 3)
		RETURNF 1

CASE "阴部の見せつけ撮影可能"
	SIF CFLAG:ARG:睡眠 || CFLAG:ARG:刚睡醒
		RETURNF 0
	SIF COND("自撮り中", ARG)
		RETURNF 0
	;この時間帯に既にやってたらやらない
	SIF CHOSE_DEVENT("阴部の見せつけ撮影", ARG) || CHOSE_DEVENT("肛門の見せつけ撮影", ARG)
		RETURNF 0
	SIF COND("合意：检查阴部", ARG) == 0 || ABL:ARG:露出癖 < 5
		RETURNF 0

	SIF TALENT:ARG:男性
		RETURNF 0
	SIF COND("身嗜み：Ｖ拡張", ARG) == 0 && CHOSE_DEVENT("阴部のチラ見せ撮影", ARG)
		RETURNF 0
	SIF TALENT:ARG:淫核 || TALENT:ARG:淫壷 || COND("身嗜み：Ｖ拡張", ARG)
		RETURNF 1
	SIF TALENT:ARG:好色 + TALENT:ARG:小悪魔 && TALENT:ARG:害羞 == 0
		RETURNF 1
	SIF ABL:ARG:露出癖 >= 7 && (CFLAG:ARG:夸奖 || CFLAG:ARG:躁动难忍 || COND("欲求不満", ARG) >= 3)
		RETURNF 1
CASE "透け胸罩撮影可能"
	SIF CFLAG:ARG:睡眠 || CFLAG:ARG:刚睡醒
		RETURNF 0
	;各時間帯で一回だけ
	SIF CHOSE_DEVENT("透け乳頭を隠し撮る", ARG) || CHOSE_DEVENT("透け胸罩を隠し撮る", ARG)
		RETURNF 0
	SIF DEVENT("初回台詞", ARG) == 0 || CSTR:ARG:PREV_DAILYCOM == "甜言蜜语"
		RETURNF 0
	SIF COND("易出汗", ARG) == 0
		RETURNF 0
	SIF COND("隐秘摄影可能") == 0
		RETURNF 0
	SIF COND("胸罩透け", ARG)
		RETURNF 1

CASE "自撮り可能"
	;自撮り済み
	SIF STRCOUNT(SAVESTR:自撮り写真, @"_%CALLNAME:ARG%")
		RETURNF 0
	SIF COND("合意：Ｈ的写真", ARG) == 0
		RETURNF 0
	;SIF COND("欲求不満", ARG) == 0
	;	RETURNF 0
	;少々Ｈさを要求
	SIF EXP:ARG:Ｈ回数 >= 3 && ABL:ARG:欲望 >= 3 && ABL:ARG:露出癖 >= 3
		RETURNF 1

;自撮り可能との合わせ技で判定する
CASE "胖次自撮り可能"
	SIF EQUIP:ARG:裙 == 0 || CFLAG:ARG:掀起裙子 || CHECK_CLO("掀起裙子の価値无", ARG)
		RETURNF 0
	SIF EQUIP:ARG:胖次 == 0 || COND("胖次形状確認", ARG) || CHECK_CLO("胖次視認可能", ARG) == 0
		RETURNF 0
	SIF CHECK_PANTIES("男物", ARG)
		RETURNF 0
	;開放型開洞系は胖次というよりもその下がメイン
	SIF CHECK_PANTIES("開洞", ARG) == 0 || CHECK_PANTIES("Ａ開洞", ARG) == 0
		RETURNF 0
	RETURNF 1
;自撮り可能との合わせ技で判定する
CASE "阴部自撮り可能"
	SIF TALENT:ARG:男性
		RETURNF 0
	;同じ部屋に居ないならOK
	SIF COND("現在不在", ARG)
		RETURNF 1
	;同じ部屋にいる場合には检查阴部前かつ裙が必要
	SIF EQUIP:ARG:裙 && CFLAG:ARG:检查阴部 == 0
		RETURNF 1
CASE "胖次自撮り送信可能"
	SELECTCASE SAVESTR:PREV_日常イベント名
	CASE "掀起裙子", "撩起裙子", "裙下撮影"
	CASEELSE
		RETURNF 0
	ENDSELECT
	SIF CFLAG:ARG:睡眠
		RETURNF 0
	SIF COND("現在不在", ARG)
		RETURNF 0
	SIF COND("自撮り送信済み", ARG)
		RETURNF 0
	SIF TALENT:ARG:害羞 && (TALENT:ARG:淫乱 == 0 || BASE:ARG:欲求不満 < 50)
		RETURNF 0
	SIF TALENT:ARG:傲慢 + TALENT:ARG:不知羞恥 + TALENT:ARG:小悪魔 + TALENT:ARG:好色 == 0 && MIN(ABL:ARG:欲望, ABL:ARG:露出癖) < 5
		RETURNF 0
	SIF CHECK_SELFIE(ARG, "胖次")
		RETURNF 1

CASE "自撮り送信可能"
	SIF CFLAG:ARG:睡眠
		RETURNF 0
	SIF COND("現在不在", ARG) && COND("昼", ARG)
		RETURNF 0
	SIF COND("自撮り送信済み", ARG)
		RETURNF 0
	SIF STRCOUNT(SAVESTR:自撮り写真, @"_%CALLNAME:ARG%") && BASE:ARG:欲求不満 >= 50
		RETURNF 1
CASE "自撮り送信済み"
	SIF STRCOUNT(SAVESTR:送信済み自撮り写真, @"_%CALLNAME:ARG%")
		RETURNF 1
CASE "自撮りと同じ胖次"
	VARSET LOCALS
	SPLIT SAVESTR:送信済み自撮り胖次, "/", LOCALS
	FOR LCOUNT, 0, 10
		SIF LOCALS:LCOUNT == ""
			BREAK
		;ARGの自撮りを尋找
		SIF STRCOUNT(LOCALS:LCOUNT, @"_%CALLNAME:ARG%") == 0
			CONTINUE
		;_の左側が胖次
		SIF EXTSTR(LOCALS:LCOUNT, "", "_") != PANTIES(ARG)
			RETURNF 0
		RETURNF 1
	NEXT

CASE "POSE撮影中脱衣可能"
	SIF MENU_PHOTO_DATUI(ARG) != ""
		RETURNF 1
CASE "POSE撮影進行度"
	;妊娠中は母体にやさしく
	SIF COND("妊娠中")
		RETURNF 0

	;心情とか欲求でゆるくなる
	SELECTCASE CHOSE_DEVENT("POSE撮影", ARG)
	CASE IS >= 3
		SIF CHOSE_DEVENT("POSE撮影", ARG) >= 5 || CFLAG:ARG:夸奖 || COND("欲求不満", ARG) || COND("合意：Ｈ的写真", ARG)
			RETURNF 3
		RETURNF 2
	CASE 2
		SIF CFLAG:ARG:夸奖 || COND("欲求不満", ARG)
			RETURNF 2
		RETURNF 1
	CASE 1
		RETURNF 1
	CASE 0
		RETURNF 0
	ENDSELECT

CASE "未読ＥＮＤ選択可能"
	VARSET LOCALS
	SPLIT STR:エンディング, "/", LOCALS
	FOR LCOUNT, 0, 60
		SIF LOCALS:LCOUNT == ""
			BREAK
		SIF CEVENT(EXTSTR(LOCALS:LCOUNT, "_"), ARG)
			CONTINUE
		RETURNF 1
	NEXT
CASE "エンディング選択可能"
	;目標金額阴蒂アのENDなら日数関係无
	SIF MONEY >= NUM("目標金額")
		RETURNF 1
	;周回でのDAY初期化を止めたので、BADEND条件の日数は90+周回数*30日とする
	SIF DAY >= 90 + (30 * FLAG:周回数)
		RETURNF 1
CASE "你の颜绘表示"
	SIF CONFIG("MASTER颜绘") == 0
		RETURNF 0
	SIF CFLAG:MASTER:颜绘
		RETURNF 1
CASE "颜绘表示中"
	SIF CFLAG:ARG:颜绘
		RETURNF 1

CASE "CIP発生"
	SIF CFLAG:ARG:CIP発生済
		RETURNF 0
	SIF CHECK_CLO("CIP発生", ARG)
		RETURNF 1
CASE "点心有"
	SIF PLACE("部室") == 0
		RETURNF 0
	SIF SAVESTR:点心 != ""
		RETURNF 1
CASE "点心当番"
	SIF ARG == TO_NUMBER(FLAG:点心当番)
		RETURNF 1
CASE "点心当番の人"
	RETURNF TO_NUMBER(FLAG:点心当番)
CASE "亲手自制点心"
	SIF STRCOUNT(SAVESTR:点心, "亲手自制")
		RETURNF 1
CASE "点心の作り手が料理擅長"
	SIF STRCOUNT(SAVESTR:点心, "亲手自制") == 0
		RETURNF 0
	SIF TALENT:TO_NUMBER(FLAG:点心当番):料理擅長
		RETURNF 1
;点心当番＆亲手自制点心
CASE "点心を亲手自制した"
	SIF STRCOUNT(SAVESTR:点心, "亲手自制") == 0
		RETURNF 0
	SIF ARG == TO_NUMBER(FLAG:点心当番)
		RETURNF 1
CASE "电车乘坐可能"
	SIF CEVENT("电车乘坐可能",ARG)
		RETURNF 1

;文化祭用
CASE "女仆咖啡厅", "執事咖啡厅", "恐怖屋敷", "乐队演奏", "演劇"
	SIF CEVENT("学園祭：出演済", ARG)
		RETURNF 0
	SIF COND("学園在籍", ARG)
		RETURNF 1
CASE "烦悩相談室"
	SIF COND("学園在籍", ARG) == 0 || CEVENT("学園祭：出演済", ARG)
		RETURNF 0
	SIF COND("種族：驱魔人", ARG) || COND("種族：天使", ARG) || COND("種族：死神", ARG)
		RETURNF 1
CASE "占卜館"
	SIF COND("学園在籍", ARG) == 0 || CEVENT("学園祭：出演済", ARG)
		RETURNF 0
	SIF COND("種族：魔法使", ARG)
		RETURNF 1
CASE "西式料理店"
	SIF COND("学園在籍", ARG) == 0 || CEVENT("学園祭：出演済", ARG)
		RETURNF 0
	SIF TALENT:ARG:料理擅長
		RETURNF 1
CASE "PaFuPaFu屋"
	SIF COND("学園在籍", ARG) == 0 || CEVENT("学園祭：出演済", ARG)
		RETURNF 0
	SIF TALENT:ARG:淫乱 && TALENT:ARG:巨乳
		RETURNF 1

;これと下の勧誘関係はARGにTARGETではなく 角色番号 が入っている
CASE "勧誘可能角色"
	;存在する角色なのか判定
	SIF EXISTCSV_EX(ARG) == 0
		RETURNF 0
	;CSVの名前が設定してあるかで勧誘可能かどうか確かめる
	SELECTCASE CSVNAME(ARG)
	CASE "", "你", "ドッペル你"
		RETURNF 0
	ENDSELECT
	RETURNF 1

CASE "勧誘画面表示"
	SIF COND("勧誘可能角色", ARG) == 0
		RETURNF 0

	;その角色が既にいるかで判定
	SIF FINDCHARA(NO, ARG) >= 0
		RETURNF 0

	IF CONFIG("永久過濾")
		SELECTCASE CSVCALLNAME(ARG)
		CASE "阿丽努", "千穂", "恭子"
			RETURNF 0
		ENDSELECT
	ENDIF

	;男过滤器
	SIF TFLAG:过滤器 == 206 && CSVTALENT(ARG, GETNUM(TALENT, "男性") ) == 0
		RETURNF 0

	SELECTCASE CSVCSTR(ARG, GETNUM(CSTR, "学年") )
	CASE "初等部", "中等部"
		SELECTCASE TFLAG:过滤器
		CASE 201 TO 205
			RETURNF 0
		ENDSELECT
	CASE "１年生"
		SELECTCASE TFLAG:过滤器
		CASE 200, 202 TO 205
			RETURNF 0
		ENDSELECT
	CASE "２年生"
		SELECTCASE TFLAG:过滤器
		CASE 200 TO 201, 203 TO 205
			RETURNF 0
		ENDSELECT
	CASE "３年生"
		SELECTCASE TFLAG:过滤器
		CASE 200 TO 202, 204 TO 205
			RETURNF 0
		ENDSELECT
	CASEELSE
		;教員
		IF STRCOUNTS(CSVCSTR(ARG, GETNUM(CSTR, "学年") ), "教師", "司書")
			SELECTCASE TFLAG:过滤器
			CASE 200 TO 203, 205
				RETURNF 0
			ENDSELECT
		ELSE
			SELECTCASE TFLAG:过滤器
			CASE 200 TO 204
				RETURNF 0
			ENDSELECT
		ENDIF
	ENDSELECT
	RETURNF 1

;次の周に移るための条件
CASE "周回可能"
	;初めての周回は条件が厳しい
	IF FLAG:周回数 == 0
		;１年目は駄目
		SIF FLAG:年 < 2 || FLAG:この周での陥落人数 < 3
			RETURNF 0
		;弗理希艾尔の"收集的魂"が30.00以上ないと駄目
		SIF FINDCHARA(NO, 1) && BASE:FINDCHARA(NO, 1):魂 < 3000
			RETURNF 0
	ENDIF
	;この周での攻略人数が３人or２年目であることが条件
	SIF FLAG:この周での陥落人数 >= 3 || FLAG:年 >= 2
		RETURNF 1
;前の周で陥落済みの角色
CASE "２周目", "二周目", "2周目"
	SIF STRCOUNT(@"/%SAVESTR:前周まででの陥落角色%", @"/%CSVCALLNAME(NO:ARG)%/")
		RETURNF 1
;名前が複数ある例外
CASE "白色死神", "アーリャ"
	SELECTCASE CALLNAME:ARG
	CASE "白色死神", "アーリャ"
		RETURNF 1
	ENDSELECT
CASEELSE
	;空文字列なら無条件で0
	IF STRLENS(ARGS) == 0
		RETURNF 0
	;性処理履歴の回数
	ELSEIF STRCOUNT(ARGS, "性処理回数")
		ARGS = %EXTSTR(ARGS, "：")%×
		RETURNF TOINT(EXTSTR(CSTR:ARG:性処理履歴, ARGS, "/") )
	;合意はここで確認
	ELSEIF STRCOUNT(ARGS, "合意")
		RETURNF STRCOUNT(CSTR:ARG:合意, @"\/%EXTSTR(ARGS, "：")%\/")
	;初期变量参照
	ELSEIF STRCOUNT(ARGS, "初期")
		;特殊な名称が通説の物か？
		SELECTCASE ARGS
		CASE "初期爆乳"
			SIF TOINT(EXTSTR(CSTR:ARG:初期变量, "巨乳_", "/") ) >= 2
				RETURNF 1
		CASE "初期超乳"
			SIF TOINT(EXTSTR(CSTR:ARG:初期变量, "巨乳_", "/") ) >= 3
				RETURNF 1
		CASEELSE
			SIF STRCOUNT(CSTR:ARG:初期变量, @"\/%SUBSTRING(ARGS, 4)%_") == 0
				RETURNF 0
			RETURNF TOINT(EXTSTR(CSTR:ARG:初期变量, @"\/%SUBSTRING(ARGS, 4)%_", "/") )
		ENDSELECT

	;性転換前的素質参照
	ELSEIF STRCOUNT(ARGS, "性転換前的素質：")
		SIF STRCOUNT(CSTR:ARG:性転換前的素質, @"\/%SUBSTRING(ARGS, 16)%_") == 0
			RETURNF 0
		RETURNF TOINT(EXTSTR(CSTR:ARG:性転換前的素質, @"\/%SUBSTRING(ARGS, 16)%_", "/") )
	;最強パラ参照
	ELSEIF STRCOUNT(ARGS, "最強")
		SIF STRCOUNT(SAVESTR:最強パラ, @"\/%SUBSTRING(ARGS, 4)%_") == 0
			RETURNF 0
		RETURNF TOINT(EXTSTR(SAVESTR:最強パラ, @"\/%SUBSTRING(ARGS, 4)%_", "/") )
	;初めてフラグ
	ELSEIF ARGS != "第一次的对象" && STRCOUNT(ARGS, "初")
		SIF STRCOUNT(CSTR:ARG:初行為相手, ARGS) == 0
			RETURNF 0
		VARSET LOCALS
		;記録を分解する。LOCALS:XX = 行為：人＃{日期}＠{尺寸}＊場所 となる
		SPLIT CSTR:ARG:初行為相手, "/", LOCALS

		FOR LCOUNT, 0, 50
			SIF LOCALS:LCOUNT == ""
				BREAK
			SIF STRCOUNT(LOCALS:LCOUNT, ARGS) == 0
				CONTINUE
			RETURNF (TO_NUMBER(TOINT(EXTSTR(LOCALS:LCOUNT, "：", "＃") ) ) )
		NEXT
	;種族格子
	ELSEIF STRCOUNT(ARGS, "種族：")
		ARGS = %EXTSTR(ARGS, "：")%
		VARSET LOCALS
		SPLIT CSTR:ARG:種族, "_", LOCALS
		FOR LCOUNT, 0, 10
			SELECTCASE LOCALS:LCOUNT
			CASE ""
				BREAK
			CASE ARGS
				RETURNF 1
			ENDSELECT
		NEXT
	;変更禁止
	ELSEIF STRCOUNT(ARGS, "変更禁止")
		;とりあえずはCEVENT(ARGS)がONなら1を返す
		SIF CEVENT(ARGS, ARG)
			RETURNF 1
		RETURNF 0
	;素質確認その１(素質の否定)
	ELSEIF SUBSTRING(ARGS, 0, 1) == "!"
		ARGS = %SUBSTRING(ARGS, 1, STRLENS(ARGS) )%
		RETURNF !(TALENT:ARG:ARGS)
	;素質確認之２
	ELSEIF GETNUM(TALENT, ARGS) >= 0
		RETURNF TALENT:ARG:ARGS
	;それ以外は角色名
	ELSE
		SIF CALLNAME:ARG == ARGS || CSVCALLNAME(NO:ARG) == ARGS
			RETURNF 1
	ENDIF
ENDSELECT
RETURNF 0

;-------------------------------------------------
;上のCONDの条件の組み合わせに耐える角色を選出する
;ただし、TARGETは除取下る
;-------------------------------------------------
@FIND_COND(ARGS:0, ARGS:1, ARGS:2, ARGS:3)
#FUNCTION
#DIM LCOUNT
;該当する角色の人数
#DIM NUM_FIND

;条件が空なら0
SIF ARGS:0 == "" && ARGS:1 == "" && ARGS:2 == "" && ARGS:3 == ""
	RETURNF 0

VARSET LOCAL
NUM_FIND = 0

FOR LCOUNT, 2, CHARANUM
	SIF LCOUNT == TARGET
		CONTINUE
	SIF ARGS:0 != "" && COND(ARGS:0, LCOUNT) == 0
		CONTINUE
	SIF ARGS:1 != "" && COND(ARGS:1, LCOUNT) == 0
		CONTINUE
	SIF ARGS:2 != "" && COND(ARGS:2, LCOUNT) == 0
		CONTINUE
	SIF ARGS:3 != "" && COND(ARGS:3, LCOUNT) == 0
		CONTINUE

	NUM_FIND += 1

	SIF RAND:NUM_FIND == 0
		LOCAL = LCOUNT
NEXT
RETURNF LOCAL

;-------------------------------------------------
;頻繁に使う条件のまとめ 之２
;ARGのARGSが何か、文字列で返す
;-------------------------------------------------
@CONDS(ARGS, ARG)
#FUNCTIONS
#DIM LCOUNT
#DIMS CHOICES
#DIM ACTOR
#DIM MEMO

VARSET LOCALS

SIF ARG == 0 && TARGET
	ARG = TARGET

SELECTCASE ARGS
CASE "部員間Ｈ条件"
	SELECTCASE CALLNAME:ARG
	CASE "槞彁", "棗"
		;槞彁酱棗酱は恋慕付くと拒否しそう
		RETURNF "非[恋慕]"
	CASE "焰", "静菜"
		;焰桑と静菜桑は家庭持ちなので淫乱つくまではスルー
		RETURNF "[淫乱]"
	CASE "維吹"
		;作者様から建议をいただいたので相思相愛ではエロ突入无
		;ご意見有がとうございます……
		RETURNF "非[相思相愛]"
	CASE "紬希"
		;紬希君酱はハッピーエンド時は部員間交流展開絶対なさそう
		RETURNF "没有到达HAPPY END"
	CASE "万音"
		;覚醒前万音酱はOKしなさそう
		SIF CEVENT("淫魔覚醒：万音", ARG) == 0
			RETURNF "淫魔覚醒完成"
	CASE "南実"
		;りっか桑（南実酱作者桑）の案に従い好感度が一定以上（とりあえず1500で）、诺伊君と南実酱の相性が◎以上、かつ処女でないときにOKとのことだったのでそうする
		RETURNF "非[処女]＆[相性◎]＆好感度1500以上"
	ENDSELECT
CASE "自宅の居場所", "学園の居場所"
	RETURNF CEVENTS(ARGS, ARG)
;ARGの尾巴等がどの尾巴かを返す。基本的には種族対応
CASE "尾巴", "角", "翼", "動物足", "頭羽"
	SIF TALENT:ARG:ARGS == 0
		RETURNF ""
	IF COND("種族：猫", ARG)
		LOCALS = 猫
	ELSEIF COND("種族：狼", ARG)
		LOCALS = 狼
	ELSEIF COND("種族：狐", ARG) || COND("種族：妖狐", ARG)
		LOCALS = 狐
	ELSEIF COND("種族：兎", ARG)
		LOCALS = 兎
	ELSEIF COND("種族：馬", ARG)
		LOCALS = 馬
	ELSEIF COND("種族：鼠", ARG)
		LOCALS = 鼠
	ELSEIF COND("種族：魔界人", ARG)
		LOCALS = 魔界人
	ELSEIF COND("種族：悪魔", ARG)
		LOCALS = 悪魔
	ELSEIF COND("種族：鬼", ARG)
		LOCALS = 鬼
	ELSEIF COND("種族：竜", ARG) || COND("種族：火精灵", ARG)
		LOCALS = 竜
	ENDIF

CASE "動物耳"
	SIF TALENT:ARG:ARGS == 0
		RETURNF ""
	;特徴的な物のみ
	IF COND("種族：猫", ARG)
		LOCALS = 猫耳
	ELSEIF COND("種族：狼", ARG)
		LOCALS = 狼耳
	ELSEIF COND("種族：狐", ARG) || COND("種族：妖狐", ARG)
		LOCALS = 狐耳
	ELSEIF COND("種族：兎", ARG)
		LOCALS = 兔耳
	ELSEIF COND("種族：馬", ARG)
		LOCALS = 馬耳
	ELSEIF COND("種族：鼠", ARG)
		LOCALS = 鼠耳
	ELSE
		LOCALS = 獣耳
	ENDIF

CASE "角の形"
	SIF CEVENT("正体偽装", ARG)
		RETURNF ""
	SELECTCASE TALENT:ARG:角
	CASE 1
		LOCALS = 悪魔
	CASE 2 TO 9
		LOCALS = 悪魔%TOFULL(TOSTR(TALENT:ARG:角) )%

	;10～19は左右分割角
	CASE 10
		LOCALS = 魔界人

	;20～29は前のみの角
	CASE 20
		LOCALS = 額短
	CASE 21
		LOCALS = 額長
	ENDSELECT

CASE "角の色"
	SELECTCASE NONUM(CONDS("角の形", ARG) )
	CASE "額短"
		SELECTCASE CONDS("髪色の種類", ARG)
		CASE "青"
			RETURNF "茶"
		CASE "黒", "銀", "緑"
			RETURNF "桃"
		CASE "金", "赤", "茶", "桃", "桃金"
			RETURNF "青"
		CASEELSE
			RETURNF "黒"
		ENDSELECT
	CASE "額長"
		SELECTCASE CONDS("髪色の種類", ARG)
		CASE "青"
			RETURNF "茶"
		CASE "黒", "銀", "緑"
			RETURNF "桃"
		CASE "金", "赤", "茶", "桃", "桃金"
			RETURNF "青"
		CASEELSE
			RETURNF "黒"
		ENDSELECT
	CASEELSE
		SELECTCASE CONDS("髪色の種類", ARG)
		CASE "青", "紺"
			RETURNF "棕"
		CASE "黒", "焦茶", "槞"
			RETURNF "赤"
		CASE "金", "緑"
			RETURNF "桃"
		CASEELSE
			RETURNF "黒"
		ENDSELECT
	ENDSELECT

CASE "頭羽の形"
	SIF CEVENT("正体偽装", ARG)
		RETURNF ""
	SELECTCASE TALENT:ARG:頭羽
	CASE IS > 0
		LOCALS = 悪魔羽
	ENDSELECT

CASE "翼の色", "頭羽の色"
	SELECTCASE CONDS("髪色の種類", ARG)
	CASE "青", "紺"
		RETURNF "茶"
	CASE "黒", "金", "緑", "焦茶", "槞", "墨"
		RETURNF "紫"
	CASEELSE
		RETURNF "黒"
	ENDSELECT
;喜欢的体位の指令番号を返す。複数あるなら随机。これはTARGET限定なのに注意
CASE "好きなＶ性交", "好きなＡ性交", "好きな尿道性交"
	MEMO = TEQUIP:推倒
	TEQUIP:推倒 = 0

	SELECTCASE ARGS
	CASE "好きなＶ性交"
		LOCAL = 60
	CASE "好きなＡ性交"
		LOCAL = 70
	CASE "好きな尿道性交"
		LOCAL = 83
	ENDSELECT

	FOR LCOUNT, LOCAL, LOCAL+6
		SELECTCASE LCOUNT
		CASE LOCAL+5
			IF CHECK_COM("喜欢的体位", LCOUNT) == 0
				TEQUIP:推倒 = 1
				SIF CHECK_COM("喜欢的体位", LCOUNT) == 0
					CONTINUE
			ENDIF
		CASEELSE
			SIF CHECK_COM("喜欢的体位", LCOUNT) == 0
				CONTINUE
		ENDSELECT
		SIF LOCALS == "" || RAND:2
			LOCALS = %TRAINNAME:LCOUNT%
	NEXT
	TEQUIP:推倒 = MEMO
CASE "仕事名"
	SPLIT CSTR:ARG:仕事, "_", LOCALS

CASE "直前行動"
	;你の場合には一番左側の行為
	SIF ARG == MASTER
		RETURNF EXTSTR(SAVESTR:PREV_直前行動, "：", "（")

	VARSET LOCALS
	SPLIT SAVESTR:PREV_直前行動, "/", LOCALS
	CHOICES =
	FOR LCOUNT, 0, CHARANUM
		SIF LOCALS:LCOUNT == ""
			BREAK
		SIF STRCOUNT(LOCALS:LCOUNT, CALLNAME:ARG)
			CHOICES = %EXTSTR(LOCALS:LCOUNT, "：", "（")%
	NEXT
	RETURNF CHOICES
CASE "種族"
	VARSET LOCALS
	SPLIT CSTR:ARG:種族, "_", LOCALS
	RETURNF LOCALS
CASE "Ｐ汚れの相手"
	SIF CSTR:ARG:Ｐ汚れ == ""
		RETURNF LOCALS

	SPLIT CSTR:ARG:Ｐ汚れ, "_", LOCALS
	RETURNF CALLNAME:TO_NUMBER(TOINT(LOCALS:1) )
CASE "Ｐ汚れ"
	SPLIT CSTR:ARG:Ｐ汚れ, "_", LOCALS
CASE "精液弱点"
	LOCALS = 精液弱点
	SIF COND("精飲弱点", ARG)
		LOCALS = 精飲弱点
	SIF COND("膣内射精弱点", ARG)
		LOCALS = 膣内射精弱点
	SIF COND("肛内射精弱点", ARG)
		LOCALS = 肛内射精弱点
	SIF COND("乳内射精弱点", ARG)
		LOCALS = 乳内射精弱点
	SIF COND("尿道内射精弱点", ARG)
		LOCALS = 尿道内射精弱点
CASE "背景"
	IF COND("登校中")
		IF DAYEV("夏服期間")
			LOCALS = 0c1
		ELSE
			LOCALS = 0c0
		ENDIF
	ELSEIF PLACE("部室")
		SELECTCASE ARG:1
		CASE 1
			SELECTCASE TEXTS("季節")
			CASE "春"
				LOCALS = 0部室1
			CASE "夏"
				LOCALS = 0部室3
			CASE "秋"
				LOCALS = 0部室1
			CASE "冬"
				LOCALS = 0部室2
			ENDSELECT
		CASEELSE
			LOCALS = 0部室
		ENDSELECT
	ELSEIF PLACE("情人旅館")
		LOCALS = 0e
	ELSEIF PLACE("Ｈ目的") && PLACE("学園内")
		LOCALS = 0部室
	ELSEIF COND("夜")
		SELECTCASE ARG:1
		CASE 1
			LOCALS = 0b
		CASEELSE
			LOCALS = 0b1
		ENDSELECT
	ELSEIF COND("归途")
		;雨に降られた
		IF STRCOUNT(SAVESTR:現在位置, "阵雨")
			LOCALS = 0f2
		ELSE
			LOCALS = 0f1
		ENDIF
	ELSE
		SELECTCASE ARG:1
		CASE 1
			IF DAYEV("夏服期間")
				LOCALS = 0c1
			ELSE
				LOCALS = 0c0
			ENDIF
		CASEELSE
			IF DAYEV("夏服期間")
				LOCALS = 0c3
			ELSE
				LOCALS = 0c2
			ENDIF
		ENDSELECT
	ENDIF
	IF CFLAG:ARG:Cosplay中
		IF CHECK_BODYS("兔", ARG)
			LOCALS = 0h%TOSTR(RAND:4)%
		ELSEIF CHECK_SHIRT("旗袍", ARG)
			LOCALS = 0g
		ENDIF
	ENDIF

CASE "挑染の種類"
	VARSET LOCALS
	SPLIT CSTR:ARG:挑染, "_", LOCALS
	SELECTCASE LOCALS
	CASE ""
		RETURNF "挑染无"
	CASEELSE
		RETURNF LOCALS
	ENDSELECT
CASE "挑染の色"
	VARSET LOCALS
	SPLIT CSTR:ARG:挑染, "_", LOCALS
	RETURNF LOCALS:1
CASE "挑染の種類と色"
	SELECTCASE CONDS("挑染の種類", ARG)
	CASE "", "挑染无"
		RETURNF "挑染无"
	CASEELSE
		RETURNF @"%CONDS("挑染の種類", ARG)%%CONDS("挑染の色", ARG)%"
	ENDSELECT

CASE "陰毛の色"
	SELECTCASE CONDS("髪色の種類", ARG)
	;とりあえずしっかりできるまでは暫定
	CASE "槞"
		RETURNF "黒"
	CASEELSE
		RETURNF CONDS("髪色の種類", ARG)
	ENDSELECT

CASE "髪色"
	RETURNF CSTR:ARG:髪色
CASE "髪色の種類"
	LOCALS = %EXTSTR(CONDS("髪色", ARG), "", "髪")%
	SIF STRCOUNT(@"\/%TEXTS("髪色の種類", ARG)%\/", @"\/%LOCALS%\/")
		RETURNF LOCALS

	IF STRCOUNT(LOCALS, "栗")
		LOCALS = 茶
	ELSEIF STRCOUNT(LOCALS, "ネイビー")
		LOCALS = 青
	ELSEIF STRCOUNT(LOCALS, "粉紅")
		LOCALS = 桃
	ELSEIF STRCOUNT(LOCALS, "白金")
		LOCALS = 白金
	ELSEIF STRCOUNT(LOCALS, "金")
		LOCALS = 金
	ELSEIF STRCOUNT(LOCALS, "銀")
		LOCALS = 銀
	ELSEIF STRCOUNT(LOCALS, "赤")
		LOCALS = 赤
	ELSEIF STRCOUNT(LOCALS, "青")
		LOCALS = 青
	ELSEIF STRCOUNT(LOCALS, "緑")
		LOCALS = 緑
	ELSEIF STRCOUNT(LOCALS, "茶")
		LOCALS = 茶
	ELSEIF STRCOUNT(LOCALS, "紫")
		LOCALS = 紫
	ELSEIF STRCOUNT(LOCALS, "桃")
		LOCALS = 桃
	ELSEIF STRCOUNT(LOCALS, "紅")
		LOCALS = 紅
	ELSEIF STRCOUNT(LOCALS, "白")
		LOCALS = 白
	ELSEIF STRCOUNT(LOCALS, "紺")
		LOCALS = 紺
	ELSEIF STRCOUNT(LOCALS, "焦茶")
		LOCALS = 焦茶
	ELSEIF STRCOUNT(LOCALS, "深緑")
		LOCALS = 深緑
	ELSEIF STRCOUNT(LOCALS, "棕")
		LOCALS = 棕
	ELSEIF STRCOUNT(LOCALS, "槞")
		LOCALS = 槞
	ELSEIF STRCOUNT(LOCALS, "カスタム")
		LOCALS = カスタム
	;指定无は黒髪になる
	ELSE
		LOCALS = 黒
	ENDIF
CASE "渐变颜色"
	RETURNF CSTR:ARG:渐变颜色

CASE "普段の髪型"
	VARSET LOCALS
	SPLIT CSTR:ARG:普段の髪型, "/", LOCALS
	RETURNF LOCALS
CASE "髪型の種類", "髪型"
	STR:髪長 =

	SELECTCASE ARGS
	CASE "髪型"
		STR:髪長 = %CONDS("髪長", ARG)%
	ENDSELECT

	;よくある髪型に分類できるなら改名。改髪→前髪→後髪→長さの順に名前が付く
	SELECTCASE CONDS("改髪", ARG)
	CASE "", "无特殊髪型"
		SELECTCASE NONUM(CONDS("前髪", ARG) )
		CASE "長鬓角"
			LOCALS = 長鬓角
		CASE "齐刘海", "露额頭", "单眼遮盖", "双眼遮盖"
			LOCALS = %NONUM(CONDS("前髪", ARG) )%%STR:髪長%
		CASEELSE
			SELECTCASE CONDS("後髪", ARG)
			CASE "编起来"
				LOCALS = %CONDS("後髪", ARG)%%STR:髪長%
			CASE "外八"
				SELECTCASE NONUM(CONDS("前髪", ARG) )
				CASE "外八刘海"
					SELECTCASE CONDS("髪長", ARG)
					CASE "長", "超長"
						LOCALS = 伸出っぱ无
					CASEELSE
						LOCALS = 外卷髪尾
					ENDSELECT
				CASEELSE
					LOCALS = %CONDS("後髪", ARG)%%STR:髪長%
				ENDSELECT
			CASE "直髪", "卷髪"
				LOCALS = %CONDS("後髪", ARG)%%STR:髪長%
			CASEELSE
				LOCALS = %CONDS("髪長", ARG)%
			ENDSELECT
		ENDSELECT
	CASEELSE
		LOCALS = %NONUM(CONDS("改髪", ARG) )%
	ENDSELECT

	STR:髪長 =

CASE "髪長"
	SELECTCASE CSTR:ARG:髪長
	;CASE ""
	;	RETURNF "不明"
	;顎より上
	CASE "坊主"
		RETURNF "坊主"
	CASE "短"
		RETURNF "短"
	;顎～肩上ぐらい
	CASE "巻髪", "中短髪"
		RETURNF "巻髪"
	;肩上～鎖骨ぐらい
	CASE "中等長度"
		RETURNF "中等長度"
	;鎖骨～胸上まで。中長髪＝中等長度より長い＝披肩の事
	CASE "披肩", "中長髪", "马尾辫", "外卷髪尾"
		RETURNF "披肩"
	;披肩より長い
	CASE "長", "光滑柔顺", "ぼさぼさ長", "長卷髪"
		RETURNF "長"
	CASE "超長"
		RETURNF "超長"
	;それ以外は暫定的に決定
	CASEELSE
		IF TALENT:ARG:男性
			RETURNF "短"
		ELSE
			RETURNF "披肩"
		ENDIF
	ENDSELECT
CASE "前髪"
	SELECTCASE CSTR:ARG:前髪
	CASE ""
		RETURNF "自然刘海"
	CASEELSE
		RETURNF CSTR:ARG:前髪
	ENDSELECT
CASE "後髪"
	SELECTCASE CSTR:ARG:後髪
	CASE ""
		RETURNF "自然"
	CASEELSE
		RETURNF CSTR:ARG:後髪
	ENDSELECT
CASE "改髪"
	;夜袭中は改髪解除
	SIF COND("夜袭中", ARG)
		RETURNF ""

	SELECTCASE CSTR:ARG:改髪
	CASE ""
		RETURNF "无特殊髪型"
	CASEELSE
		RETURNF CSTR:ARG:改髪
	ENDSELECT
CASE "呆毛"
	SELECTCASE CSTR:ARG:呆毛
	CASE ""
		RETURNF "无呆毛"
	CASEELSE
		RETURNF CSTR:ARG:呆毛
	ENDSELECT
CASE "蝴蝶結"
	SELECTCASE CSTR:ARG:蝴蝶結
	CASE "", "无蝴蝶結"
		IF CHECK_OTHER("髪飾蝴蝶結", ARG)
			SELECTCASE CONDS("改髪", ARG)
			CASE "団子頭", "長双马尾ール", "双马尾", "短双马尾ール", "团子頭双马尾ール", "細双马尾", "三股辫双马尾ール"
				RETURNF "両側蝴蝶結"
			CASEELSE
				RETURNF "頭後蝴蝶結"
			ENDSELECT
		ELSE
			RETURNF "无蝴蝶結"
		ENDIF
	CASEELSE
		RETURNF CSTR:ARG:蝴蝶結
	ENDSELECT
CASE "眼鏡"
	IF CHECK_OTHER("頭上太阳鏡", ARG)
		RETURNF "无眼鏡"
	ELSEIF CHECK_OTHER("眼罩", ARG)
		IF CHECK_CLOCOLOR(OTHER(ARG, "眼鏡") ) == "黒"
			RETURNF "眼罩黒"
		ELSE
			RETURNF "眼罩白"
		ENDIF
	ELSEIF CHECK_OTHER("太阳鏡", ARG)
		RETURNF "太阳鏡"
	ELSEIF CHECK_OTHER("瓶底胡须眼鏡", ARG)
		RETURNF "瓶底胡须眼鏡"
	ELSEIF CHECK_OTHER("瓶底眼鏡", ARG)
		RETURNF "瓶底眼鏡"
	ELSEIF CHECK_OTHER("圈圈胡须眼鏡", ARG)
		RETURNF "圈圈胡须眼鏡"
	ELSEIF CHECK_OTHER("圈圈眼鏡", ARG)
		RETURNF "圈圈眼鏡"
	ELSEIF CHECK_OTHER("金丝眼鏡", ARG)
		RETURNF "金丝眼鏡"
	ELSEIF CHECK_OTHER("玳瑁眼鏡", ARG)
		RETURNF "玳瑁眼鏡"
	ELSEIF CHECK_OTHER("专家眼鏡", ARG)
		RETURNF "专家眼鏡"
	ELSEIF CHECK_OTHER("黑框眼鏡", ARG)
		RETURNF "黑框眼鏡"
	ELSEIF CHECK_OTHER("眼鏡", ARG)
		RETURNF "眼鏡"
	ELSE
		RETURNF "无眼鏡"
	ENDIF
CASE "顔効果"
	SELECTCASE CSTR:ARG:顔効果
	CASE ""
		RETURNF ""
	CASEELSE
		RETURNF CSTR:ARG:顔効果
	ENDSELECT
CASE "右瞳色", "左瞳色"
	SELECTCASE CSTR:ARG:瞳色
	CASE ""
		;黒青紫緑赤金
		SELECTCASE CONDS("髪色の種類", ARG)
		CASE "金"
			LOCALS = 青
		CASE "銀"
			LOCALS = 赤
		CASE "緑"
			LOCALS = 金
		CASE "赤"
			LOCALS = 緑
		CASE "茶"
			LOCALS = 茶
		CASE "桃", "桃金"
			LOCALS = 紫
		;それ以外の指定无は黒になる
		CASEELSE
			LOCALS = 黒
		ENDSELECT
	CASEELSE
		VARSET LOCALS
		SPLIT CSTR:ARG:瞳色, "_", LOCALS
		SELECTCASE ARGS
		CASE "右瞳色"
			RETURNF LOCALS:0
		CASEELSE
			SELECTCASE LOCALS:1
			CASE ""
				RETURNF LOCALS:0
			CASEELSE
				RETURNF LOCALS:1
			ENDSELECT
		ENDSELECT
	ENDSELECT
CASE "右眼形", "左眼形", "眼形"
	SELECTCASE CSTR:ARG:眼形
	CASE ""
		IF TALENT:ARG:強気 || (AGE(ARG) >= 3 && TALENT:ARG:冷静)
			RETURNF "吊眼"
		ELSEIF TALENT:ARG:温柔 && TALENT:ARG:内気 && TALENT:ARG:堅強 == 0
			RETURNF "垂眼"
		ELSEIF TALENT:ARG:好奇心 && TALENT:ARG:坦率
			RETURNF "水灵眼"
		ELSEIF TALENT:ARG:冷静 && TALENT:ARG:堅強 == 0
			RETURNF "斜眼"
		ELSE
			RETURNF "普通眼"
		ENDIF
	CASEELSE
		VARSET LOCALS
		SPLIT CSTR:ARG:眼形, "_", LOCALS
		SELECTCASE ARGS
		CASE "右眼形"
			RETURNF LOCALS:0
		CASEELSE
			SELECTCASE LOCALS:1
			CASE ""
				RETURNF LOCALS:0
			CASEELSE
				RETURNF LOCALS:1
			ENDSELECT
		ENDSELECT
	ENDSELECT
;数字が添えられた派生形は全部同じものとカウントする
CASE "眼形の種類"
	VARSET LOCALS
	LOCALS = %TOHALF(CONDS("眼形", ARG) )%
	FOR LCOUNT, 0, 10
		SPLIT LOCALS, TOSTR(LCOUNT), LOCALS
	NEXT
	RETURNF TOFULL(LOCALS)
CASE "眼形の番号"
	FOR LCOUNT, 1, 10
		SIF STRCOUNT(CONDS("眼形", ARG), TOFULL(TOSTR(LCOUNT) ) )
			RETURNF TOFULL(TOSTR(LCOUNT) )
	NEXT
	RETURNF ""
;現在は目の番号は５まで
CASE "笑颜目の対応番号"
	SELECTCASE CONDS("眼形の番号", ARG)
	CASE "", "１"
		RETURNF ""
	CASE "２"
		RETURNF "２"
	CASE "３", "４", "５"
		RETURNF "４"
	ENDSELECT
	RETURNF ""
CASE "閉じた目の対応番号"
	SELECTCASE CONDS("眼形の番号", ARG)
	CASE "", "１"
		RETURNF ""
	CASE "２", "３", "４", "５"
		RETURNF "２"
	ENDSELECT
	RETURNF ""
CASE "右白眼", "左白眼", "右白瞳色", "左白瞳色"
	VARSET LOCALS
	SPLIT CSTR:ARG:白眼, "_", LOCALS
	SELECTCASE ARGS
	CASE "左白眼", "左白瞳色"
		SELECTCASE LOCALS:1
		CASE ""
		CASEELSE
			LOCALS = %LOCALS:1%
		ENDSELECT
	ENDSELECT

	SELECTCASE LOCALS
	CASE "无眼白", ""
		SELECTCASE ARGS
		CASE "右白瞳色", "左白瞳色"
			RETURNF ""
		CASEELSE
			RETURNF "无眼白"
		ENDSELECT
	CASE "白眼", "有眼白"
		SELECTCASE ARGS
		CASE "右白瞳色", "左白瞳色"
			RETURNF "白"
		CASEELSE
			RETURNF "白眼"
		ENDSELECT
	CASE "黒目", "黑眼白"
		IF CEVENT("正体偽装", ARG)
			SELECTCASE ARGS
			CASE "右白瞳色", "左白瞳色"
				RETURNF "白"
			CASEELSE
				RETURNF "白眼"
			ENDSELECT
		ELSE
			SELECTCASE ARGS
			CASE "右白瞳色", "左白瞳色"
				RETURNF "黒"
			CASEELSE
				RETURNF "黒目"
			ENDSELECT
		ENDIF
	ENDSELECT
CASE "右爱心眼の色"
	RETURNF "白"
	SELECTCASE CONDS("右瞳色", ARG)
	CASE "焦茶", "赤", "茶", "紅"
		RETURNF "白"
	CASEELSE
		RETURNF ""
	ENDSELECT
CASE "左爱心眼の色"
	RETURNF "白"
	SELECTCASE CONDS("左瞳色", ARG)
	CASE "焦茶", "赤", "茶", "紅"
		RETURNF "白"
	CASEELSE
		RETURNF ""
	ENDSELECT
CASE "目の変化"
	IF STRCOUNT(CSTR:ARG:眼形, "飘忽")
		RETURNF "飘忽"
	ELSEIF STRCOUNT(CSTR:ARG:眼形, "半目")
		RETURNF "半目"
	ENDIF
	RETURNF "无"

CASE "右高光", "左高光"
	VARSET LOCALS
	;CSTR:高光 = 左目の高光_右目の高光 となっているのでまず分解し、LOCALSに求める物を入れる
	SPLIT CSTR:ARG:高光, "_", LOCALS
	SELECTCASE ARGS
	CASE "左高光"
		SELECTCASE LOCALS:1
		CASE ""
		CASEELSE
			LOCALS = %LOCALS:1%
		ENDSELECT
	ENDSELECT

	SELECTCASE LOCALS
	CASE "高光无", "无"
		RETURNF "无"
	CASE "高光有", "有", ""
		RETURNF "有"
	ENDSELECT
CASE "眉形"
	SELECTCASE CSTR:ARG:眉形
	CASE ""
		IF TALENT:ARG:内気 && TALENT:ARG:好奇心 == 0 && TALENT:ARG:堅強 == 0
			RETURNF "斜眉"
		ELSE
			RETURNF "通常眉"
		ENDIF
	CASEELSE
		RETURNF CSTR:ARG:眉形
	ENDSELECT
CASE "眉の長さ"
	IF STRCOUNT(CSTR:ARG:眉形, "短")
		RETURNF "短"
	ELSE
		RETURNF ""
	ENDIF
CASE "眉の色"
	SELECTCASE CONDS("髪色の種類", ARG)
	;暗い色の場合は眉の色を濃くする
	CASE "墨"
		RETURNF "墨"
	CASE "黒", "焦茶", "紺", "深緑"
		RETURNF "黒"
	CASE "金", "棕", "赤", "茶", "桃", "紅", "桃金", "真紅", "栗"
		RETURNF "茶"
	CASE "紫"
		RETURNF "紫"
	CASE "緑"
		RETURNF "緑"
	CASE "氷水"
		RETURNF "氷水"
	CASE "空"
		RETURNF "空"
	CASE "青"
		RETURNF "青"
	CASE "銀", "白"
		RETURNF "灰色"
	CASE "槞"
		RETURNF "槞"
	CASE "亜麻"
		RETURNF "亜麻"
	CASE "白金"
		RETURNF "白金"
	CASEELSE
		RETURNF "黒"
	ENDSELECT
CASE "まつ毛の色"
	SIF CSTR:ARG:まつ毛の色 != ""
		RETURNF CSTR:ARG:まつ毛の色
	RETURNF "黒茶"
CASE "嘴形"
	SELECTCASE CSTR:ARG:嘴形
	CASE ""
		IF TALENT:ARG:開朗 && TALENT:ARG:高贵 == 0
			RETURNF "大口"
		ELSEIF TALENT:ARG:聰慧 + TALENT:ARG:高慢 && TALENT:ARG:強気 + TALENT:ARG:冷静 && TALENT:ARG:坦率 + TALENT:ARG:献身 == 0
			RETURNF "△"
		ELSEIF TALENT:ARG:好奇心 && TALENT:ARG:害羞 == 0
			RETURNF "笑顔"
		ELSE
			RETURNF "微笑"
		ENDIF
	CASEELSE
		RETURNF CSTR:ARG:嘴形
	ENDSELECT
;数字が添えられた派生形は全部同じものとカウントする
CASE "嘴形の種類"
	VARSET LOCALS
	LOCALS = %TOHALF(CONDS("嘴形", ARG) )%
	FOR LCOUNT, 0, 10
		SPLIT LOCALS, TOSTR(LCOUNT), LOCALS
	NEXT
	RETURNF TOFULL(LOCALS)
CASE "痣"
	SELECTCASE CSTR:ARG:痣
	CASE ""
		RETURNF "痣无"
	CASEELSE
		RETURNF CSTR:ARG:痣
	ENDSELECT

CASE "頬化粧"
	IF STRCOUNT(CSTR:ARG:頬, "光滑")
		RETURNF "光滑"
	ELSEIF STRCOUNT(CSTR:ARG:頬, "战妆")
		RETURNF "战妆"
	ELSEIF STRCOUNT(CSTR:ARG:頬, "脸谱赤")
		RETURNF "脸谱赤"
	ELSEIF STRCOUNT(CSTR:ARG:頬, "脸谱青")
		RETURNF "脸谱青"
	ELSE
		RETURNF "没有"
	ENDIF
CASE "頬傷"
	SIF STRCOUNT(CSTR:ARG:頬, "頬傷左")
		LOCALS += "左"
	SIF STRCOUNT(CSTR:ARG:頬, "頬傷右")
		LOCALS += "右"
	IF STRCOUNT(CSTR:ARG:頬, "頬傷鼻")
		SIF LOCALS != ""
			LOCALS += "＆"
		LOCALS += "鼻"
	ENDIF
	SIF LOCALS == ""
		RETURNF "没有"
CASE "頬創口貼"
	SIF STRCOUNT(CSTR:ARG:頬, "頬創口貼左")
		LOCALS += "左"
	SIF STRCOUNT(CSTR:ARG:頬, "頬創口貼右")
		LOCALS += "右"
	IF STRCOUNT(CSTR:ARG:頬, "頬創口貼鼻")
		SIF LOCALS != ""
			LOCALS += "＆"
		LOCALS += "鼻"
	ENDIF
	SIF LOCALS == ""
		RETURNF "没有"

CASE "動物耳の形"
	SELECTCASE TALENT:ARG:動物耳
	CASE 10
		RETURNF "人鱼耳"
	CASE IS >= 2
		RETURNF @"動物耳%TOFULL(TOSTR(TALENT:ARG:動物耳) )%"
	CASE 1
		RETURNF "動物耳"
	ENDSELECT
CASE "普通耳の形"
	SELECTCASE TALENT:ARG:精灵耳
	CASE 1
		LOCALS = 精灵耳
	CASE 2
		LOCALS = 魔族耳
	CASEELSE
		LOCALS = 人类耳
	ENDSELECT

CASE "耳の形"
	SELECTCASE TALENT:ARG:動物耳
	CASE 10
		RETURNF "人鱼耳"
	CASE IS >= 2
		RETURNF @"動物耳%TOFULL(TOSTR(TALENT:ARG:動物耳) )%"
	CASE 1
		RETURNF "動物耳"
	ENDSELECT

	SELECTCASE TALENT:ARG:精灵耳
	CASE 1
		LOCALS = 精灵耳
	CASE 2
		LOCALS = 魔族耳
	CASEELSE
		LOCALS = 人类耳
	ENDSELECT

CASE "CIP肤色"
	RETURNF CONDS("肤色", ARG)

CASE "肤色"
	SIF CEVENT("正体偽装", ARG)
		RETURNF "普通"
	SELECTCASE TALENT:ARG:肤色
	CASE 1
		LOCALS = 褐色肌
	CASE 2
		LOCALS = 色白
	CASE 3
		LOCALS = 青肌
	CASE 4
		LOCALS = 色黒
	CASEELSE
		LOCALS = 普通
	ENDSELECT

CASE "お腹の見た目"
	IF COND("豐腴", ARG)
		LOCALS = 豐腴
	ELSEIF TALENT:ARG:筋肉
		LOCALS = 筋肉
	ELSEIF COND("苗条", ARG)
		LOCALS = 苗条
	ELSE
		LOCALS = 普通
	ENDIF
CASE "淫紋の種類"
	LOCALS = %CEVENTS("淫紋", ARG)%
	SIF LOCALS == ""
		LOCALS = 基本
CASE "淫紋の段階"
	SIF MARK:ARG:淫紋 == 0
		RETURNF ""
	IF COND("淫紋おめでた", ARG)
		IF COND("淫紋設定中", ARG) && COND("仮想角色", ARG) == 0
			LOCALS = {MARK:ARG:淫紋}
		ELSE
			LOCALS = おめでた
		ENDIF
	ELSE
		LOCALS = {MARK:ARG:淫紋}
	ENDIF
CASE "淫紋の様子"
	IF CFLAG:ARG:Ｖ已中出 || (TALENT:ARG:男性 + TALENT:ARG:尻穴狂い && CFLAG:ARG:Ａ已中出)
		RETURNF "満足"
	ELSEIF CFLAG:ARG:躁动难忍 || COND("欲求不満", ARG) >= 2
		RETURNF "欲求不満"
	ELSE
		RETURNF "平常"
	ENDIF
;上の淫紋の様子と分岐条件が一致する
CASE "淫紋の色"
	IF CFLAG:ARG:Ｖ已中出 || (TALENT:ARG:男性 + TALENT:ARG:尻穴狂い && CFLAG:ARG:Ａ已中出)
		RETURNF "粉紅"
	ELSE
		RETURNF "黒"
	ENDIF

;晒痕関連
CASE "晒痕トップ"
	SIF STRCOUNTS(CSTR:ARG:晒痕, "競泳泳装", "死库水") && STRCOUNT(CSTR:ARG:晒痕, "＆") == 0
		RETURNF CSTR:ARG:晒痕

	VARSET LOCALS
	SPLIT CSTR:ARG:晒痕, "＆", LOCALS
	RETURNF LOCALS:1
CASE "晒痕ボトム"
	VARSET LOCALS
	SPLIT CSTR:ARG:晒痕, "＆", LOCALS
	RETURNF LOCALS:0
;括弧表示なことが多いのでそれも考慮
CASE "晒痕", "(晒痕)"
	SIF CFLAG:ARG:晒痕強度 == 0 && TALENT:ARG:常時晒痕 == 0
		RETURNF ""
	SELECTCASE CSTR:ARG:晒痕
	CASE "", "＆"
		RETURNF "全身"
	CASEELSE
		VARSET LOCALS
		SPLIT CSTR:ARG:晒痕, "＆", LOCALS
		;基本は下半身の晒痕を見る
		IF LOCALS != ""
			CHOICES = %LOCALS%
		ELSE
			CHOICES = %LOCALS:1%
		ENDIF
		SELECTCASE ARGS
		CASE "(晒痕)"
			CHOICES = (%CHOICES%)
		ENDSELECT
		RETURNF CHOICES
	ENDSELECT

CASE "顔の色", "顔の色晒痕有"
	SIF ARGS == "顔の色晒痕有" && COND("晒痕", ARG)
		RETURNF "晒痕"
	SIF CEVENT("正体偽装", ARG)
		RETURNF "普通"

	SELECTCASE TALENT:ARG:肤色
	CASE 1
		RETURNF "褐色肌"
	CASE 2
		RETURNF "色白"
	CASE 3
		RETURNF "青肌"
	CASE 4
		RETURNF "色黒"
	CASEELSE
		RETURNF "普通"
	ENDSELECT
CASE "手の色"
	IF EQUIP:ARG:手套 && CHECK_GLOVE("手露出", ARG) == 0
		IF CHECK_GLOVE("黒", ARG)
			RETURNF "黒"
		ELSE
			RETURNF "白"
		ENDIF
	ENDIF
	RETURNF CONDS("顔の色晒痕有", ARG)
CASE "前腕から先の色"
	;前腕全体が手套に包まれている場合
	IF EQUIP:ARG:手套 && CHECK_GLOVE("手露出", ARG) == 0 && CHECK_GLOVE("前腕露出", ARG) == 0
		IF CHECK_GLOVE("黒", ARG)
			RETURNF "黒"
		ELSE
			RETURNF "白"
		ENDIF
	ENDIF
	RETURNF CONDS("顔の色晒痕有", ARG)
CASE "手首から先の色"
	IF EQUIP:ARG:手套 && CHECK_GLOVE("手露出", ARG) == 0
		IF CHECK_GLOVE("黒", ARG)
			RETURNF "黒"
		ELSE
			RETURNF "白"
		ENDIF
	ENDIF
	RETURNF ""
CASE "脸颊カラー"
	SELECTCASE CONDS("顔の色", ARG)
	CASE "褐色肌", "色黒"
		RETURNF "赤"
	CASEELSE
		SIF COND("晒痕", ARG)
			RETURNF "赤"
		RETURNF "桃"
	ENDSELECT
CASE "颜绘コンディション"
	;上のものが優先される
	SIF STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/重置/")
		RETURNF "重置"

	SIF TFLAG:王様游戏
		RETURNF "王様游戏"
	SIF CFLAG:ARG:睡眠 || STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/睡眠/")
		RETURNF "睡眠"
	SIF CFLAG:ARG:刚睡醒 || STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/刚睡醒/")
		RETURNF "刚睡醒"
	SIF STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/青ざめ/")
		RETURNF "青ざめ"
	SIF STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/目陰効果/")
		RETURNF "目陰効果"
	SIF STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/目陰/")
		RETURNF "目陰"
	SIF STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/空洞/")
		RETURNF "空洞"
	SIF STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/红潮恍惚/")
		RETURNF "红潮恍惚"
	SIF STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/惊嚇/")
		RETURNF "惊嚇"
	SIF CFLAG:ARG:憤怒 || STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/憤怒/")
		RETURNF "憤怒"
	SIF STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/小悪魔/")
		RETURNF "小悪魔"
	SIF CFLAG:ARG:害羞 || STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/害羞/")
		RETURNF "害羞"
	SIF (CFLAG:ARG:心情差 && TALENT:ARG:叛逆 == 0) || STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/心情差/")
		RETURNF "心情差"
	SIF CFLAG:ARG:甜言蜜语 || STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/甜言蜜语/")
		RETURNF "甜言蜜语"
	SIF CFLAG:ARG:夸奖 || STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/夸奖/")
		RETURNF "夸奖"
	SIF CFLAG:ARG:躁动难忍 || STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/躁动难忍/")
		RETURNF "躁动难忍"
	SIF STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/小悪魔/")
		RETURNF "小悪魔"
	SIF CFLAG:ARG:闲 || STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/闲/")
		RETURNF "闲"
	SIF STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/过电/")
		RETURNF "过电"
	SIF STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/爱心眼/")
		RETURNF "爱心眼"
	SIF STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/混乱/")
		RETURNF "混乱"
	SIF TALENT:ARG:叛逆 || STRCOUNT(@"/%CSTR:ARG:颜绘変化%/", "/叛逆/")
		RETURNF "叛逆"

CASE "変Ｔの文字"
	IF CHECK_SHIRT("英字１", ARG)
		LOCALS += "変Ｔ英字１"
	ELSEIF CHECK_SHIRT("英字２", ARG)
		LOCALS += "変Ｔ英字２"
	ELSEIF CHECK_SHIRT("英字", ARG)
		;黑色方はたまにでいいか
		IF (DAY + NO:ARG)%4 == 0
			LOCALS += "変Ｔ英字２"
		ELSE
			LOCALS += "変Ｔ英字１"
		ENDIF
	ELSEIF CHECK_SHIRT("ＡＡ", ARG)
		LOCALS += "変ＴＡＡ１"
	ELSE
		LOCALS += "変Ｔ漢字１"
	ENDIF
	;文字の色はＴ恤の色に合わせて自動決定
	SELECTCASE CLOCOLOR_MAIDFACE("Ｔ恤", CHECK_CLOCOLOR(CSTR:ARG:服), ARG)
	CASE "黄色", "白", "緑色", "橙色", "桃色"
		LOCALS += "黒"
	CASEELSE
		LOCALS += "白"
	ENDSELECT
	RETURNF LOCALS
;あだ名を呼ぶ際にでもどうぞ。ARGSは全角想定です
CASE "略称"
	ARGS = %CALLNAME:ARG%
	SIF STRLENS(ARGS) <= 6
		RETURNF ARGS
	FOR LCOUNT, 0, 3
		SELECTCASE SUBSTRINGU(ARGS, 0, 1)
		CASE ""
			BREAK
		CASE "ァ", "ィ", "ゥ", "ェ", "ォ", "ッ", "ャ", "ュ", "ョ", "ヮ", "ぁ", "ぃ", "ぅ", "ぇ", "ぉ", "っ", "ゃ", "ゅ", "ょ", "ゎ"
			LOCALS = %LOCALS%%SUBSTRINGU(ARGS, 0, 1)%
			SIF LCOUNT != 2
				LCOUNT -= 1
		;３文字目がーの時は例外的に加える
		CASE "ー"
			LOCALS = %LOCALS%%SUBSTRINGU(ARGS, 0, 1)%
		CASEELSE
			SIF LCOUNT != 2
				LOCALS = %LOCALS%%SUBSTRINGU(ARGS, 0, 1)%
		ENDSELECT
		ARGS = %SUBSTRINGU(ARGS, 1)%
	NEXT
CASE "短縮名"
	;角色ごとに設定した方が矛盾少なさそう
	SELECTCASE CALLNAME:ARG
	CASE "弗理希艾尔"
		RETURNF "フェリ"
	CASE "濡烏の君"
		RETURNF "濡烏"
	CASE "西西莉亚"
		RETURNF "ツェツィ"
	CASE "麦莉爱娜"
		RETURNF "メリィ"
	;名前のままでＯＫ
	CASEELSE
		RETURNF CALLNAME:ARG
	ENDSELECT

;CSTR:ARG:学年に対応した文字列。主にCOND("教員")を満たす角色を教員と返すのが役目
CASE "学年"
	;例外文字列
	IF COND("教員", ARG)
		RETURNF "教員"
	;学生でも教員でもない
	ELSE
		RETURNF CSTR:ARG:学年
	ENDIF

;返り値は下級生,上級生,老师,同級生,同僚。など。RELATION次第で親友とかもいいかも
CASE "間柄"
	VARSET LOCAL
	FOR LCOUNT, 1 , CHARANUM
		LOCAL:LCOUNT = COND("学年", LCOUNT)
	NEXT

	SELECTCASE ARG
	;TARGETからみたPLAYER
	CASE PLAYER
		IF TALENT:母親 + TALENT:父親 && PLAYER == MASTER
			LOCALS = \@ TRUE_SEX(MASTER) == "男性" ? 儿子 # 女儿 \@
		ELSEIF TALENT:姉 + TALENT:兄 && PLAYER == MASTER
			LOCALS = \@ TRUE_SEX(MASTER) == "男性" ? 弟 # 妹 \@
		ELSEIF TALENT:妹 + TALENT:弟 && PLAYER == MASTER
			LOCALS = \@ TRUE_SEX(MASTER) == "男性" ? 兄 # 姐 \@
		ELSE
			SELECTCASE LOCAL:TARGET
			;借住とかの際の你の立場
			CASE 0
				SELECTCASE CONDS("関係", TARGET)
				CASE "女仆"
					RETURNF "主人様"
				CASEELSE
					RETURNF "家主"
				ENDSELECT
			CASE 7
				SELECTCASE LOCAL:PLAYER
				CASE 0
					RETURNF CSTR:PLAYER:学年
				CASE 7
					RETURNF "同僚"
				CASEELSE
					RETURNF "教的孩子"
				ENDSELECT
			CASEELSE
				SELECTCASE LOCAL:PLAYER
				CASE 0
					RETURNF CSTR:PLAYER:学年
				CASE IS >= 6
					RETURNF CSTR:PLAYER:学年
				CASE IS > LOCAL:TARGET
					RETURNF "上級生"
				CASE LOCAL:TARGET
					RETURNF "同級生"
				CASEELSE
					RETURNF "下級生"
				ENDSELECT
			ENDSELECT
		ENDIF
	;PLAYERからみたARG
	CASEELSE
		IF TALENT:ARG:母親 && PLAYER == MASTER
			LOCALS = 母親
		ELSEIF TALENT:ARG:父親 && PLAYER == MASTER
			LOCALS = 父親
		ELSEIF TALENT:ARG:姉 && PLAYER == MASTER
			LOCALS = 姉
		ELSEIF TALENT:ARG:兄 && PLAYER == MASTER
			LOCALS = 兄
		ELSEIF TALENT:ARG:妹 && PLAYER == MASTER
			LOCALS = 妹
		ELSEIF TALENT:ARG:弟 && PLAYER == MASTER
			LOCALS = 弟
		ELSE
			SELECTCASE LOCAL:PLAYER
			CASE 7
				SELECTCASE LOCAL:ARG
				CASE 0
					RETURNF CSTR:ARG:学年
				CASE 7
					RETURNF "同僚"
				CASEELSE
					RETURNF "教的孩子"
				ENDSELECT
			CASEELSE
				SELECTCASE LOCAL:ARG
				CASE 0
					RETURNF CSTR:関係
				CASE IS >= 6
					RETURNF CSTR:ARG:学年
				CASE IS > LOCAL:PLAYER
					RETURNF "上級生"
				CASE LOCAL:PLAYER
					RETURNF "同級生"
				CASEELSE
					RETURNF "下級生"
				ENDSELECT
			ENDSELECT
		ENDIF
	ENDSELECT
CASE "関係"
	;恋人とか炮友とか…まだ試行錯誤中
	;候補："性のpartner", "性処理係", "肉便器", 悪友、射精管理係、逆の立場で"主人様"とか
	SELECTCASE ARG
	CASE MASTER
		IF TALENT:相思相愛
			LOCALS = 恋人
		ELSEIF TALENT:母親 + TALENT:父親
			LOCALS = 実の\@ TRUE_SEX(ARG) == "男性" ? 儿子 # 女儿 \@
		ELSEIF TALENT:姉 + TALENT:兄
			LOCALS = \@ TRUE_SEX(ARG) == "男性" ? 弟 # 妹 \@
		ELSEIF TALENT:妹 + TALENT:弟
			LOCALS = \@ TRUE_SEX(ARG) == "男性" ? 兄 # 姐 \@
		ELSE
			SELECTCASE CSTR:関係
			CASE "主人様"
				LOCALS = 下僕
			CASE "女仆"
				LOCALS = 主人様
			CASEELSE
				LOCALS = 部長
			ENDSELECT
		ENDIF
	CASEELSE
		IF TALENT:ARG:相思相愛
			LOCALS = 恋人
		ELSEIF CSTR:ARG:関係 != ""
			LOCALS = %CSTR:ARG:関係%
		ENDIF
	ENDSELECT
CASE "精液の優勢", "胎児の父親"
	LOCAL = COND(ARGS, ARG)
	SELECTCASE LOCAL
	CASE IS > 0
		LOCALS = %CALLNAME:LOCAL%
	CASE -4
		LOCALS = 不认识的人
	CASE -101
		LOCALS = 便利店店员
	CASE -102
		LOCALS = 公园厕所中不认识的男人
	CASE -103
		LOCALS = 公园露出中只有一面之缘的男人
	CASE -104
		LOCALS = 教会的孩子
	CASE -105
		LOCALS = 学校的老师
	CASE -106
		LOCALS = 不认识的同学
	CASE -107
		LOCALS = 高年级的学长
	CASE -108
		LOCALS = 体育课的助教
	CASE -109
		LOCALS = 生理课老师
	CASE -110
		LOCALS = 做爱部的大叔
	CASE -111
		LOCALS = 做爱部的部员
	CASEELSE
		LOCALS = 定義されていない相手（バグです！これを見た人は報告してください）
	ENDSELECT

CASE "尿道拡張度"
	;どっちの尿道か
	IF PENIS(ARG)
		LOCALS = %CSTR:ARG:Ｐ尿道拡張度%
	ELSE
		LOCALS = %CSTR:ARG:Ｖ尿道拡張度%
	ENDIF
CASE "Ｖ尿道の初期拡張度"
	LOCALS = 10/10/10/10/10/10/10/10/10/10/

	SIF COND("種族：人形", ARG)
		LOCALS = %ADDNUM_STR(LOCALS, 2)%

CASE "Ｐ尿道の初期拡張度"
	LOCALS = 5/5/5/5/5/5/5/5/5/5/

	SIF COND("種族：人形", ARG)
		LOCALS = %ADDNUM_STR(LOCALS, 1)%

CASE "調教知識"
	SELECTCASE TALENT:ARG:調教知識
	CASE 1p0
		LOCALS = 愛撫・奉仕知識
	CASE 1p1
		LOCALS = 教育擅長
	CASE 1p2
		LOCALS = ＳＭ知識
	CASE 1p3
		LOCALS = Ａ調教知識
	CASE 1p4
		LOCALS = 性器拡張知識
	CASE 1p5
		LOCALS = 道具使
	CASE 1p6
		LOCALS = 露出知識
	ENDSELECT

CASE "体型"
	SIF BASE:ARG:身高 == 0 || BASE:ARG:胸圍 == 0 || BASE:ARG:腰圍 == 0 || BASE:ARG:臀圍 == 0
		RETURNF ""
	;まずは娇小かどうかで大きく分け、腰圍、臀圍、胸の尺寸で細かく分ける
	;腰圍の太さについては100*腰圍/身高の値で(細い, 普通, 粗大的, 肥満) = (38以下, 39～45, 46以上)
	;臀圍の尺寸については100*臀圍/身高の値で(細い, 普通, 大きい) = (50以下, 51～53, 54以上)
	;COND("巨尻")とCOND("小尻")で臀圍判定も
	IF TALENT:ARG:男性 && COND("伪娘", ARG) == 0
		RETURNF "男性"
	ELSEIF TALENT:ARG:娇小 && AGE(ARG) >= 2 && TALENT:ARG:巨乳
		RETURNF "娇小豐满"
	ELSEIF TALENT:ARG:娇小 && AGE(ARG) == 1
		IF TALENT:ARG:巨乳
			RETURNF "萝莉巨乳"
		ELSEIF COND("巨尻", ARG)
			RETURNF "巨尻萝莉"
		ELSEIF TALENT:ARG:貧乳
			SELECTCASE 100*BASE:ARG:腰圍/BASE:ARG:身高
			;腰圍太め
			CASE IS >= CALCF("豐腴倍数", ARG)
				RETURNF "兒童体型"
			;腰圍普通以下
			CASEELSE
				IF COND("陰毛", ARG) == 1
					RETURNF "光滑飞机场"
				ELSE
					RETURNF "飞机场"
				ENDIF
			ENDSELECT
		ELSE
			SELECTCASE 100*BASE:ARG:腰圍/BASE:ARG:身高
			;腰圍太め
			CASE IS >= CALCF("豐腴倍数", ARG)
				RETURNF "兒童体型"
			;腰圍普通以下
			CASEELSE
				IF AGE(ARG) >= 2
					RETURNF "小小的"
				ELSE
					RETURNF "有待発展"
				ENDIF
			ENDSELECT
		ENDIF
	ELSE
		SELECTCASE COND("巨尻", ARG)
		;超尻
		CASE IS >= 3
			SELECTCASE 100*BASE:ARG:腰圍/BASE:ARG:身高
			;腰圍太め
			CASE IS >= CALCF("豐腴倍数", ARG)
				IF TALENT:ARG:巨乳
					RETURNF "超豊満"
				ELSE
					RETURNF "肉感"
				ENDIF
			;腰圍細い
			CASE IS <= CALCF("苗条倍数", ARG)
				IF TALENT:ARG:巨乳
					RETURNF "玩偶身材"
				ELSE
					RETURNF "高挑超尻"
				ENDIF
			;腰圍普通
			CASEELSE
				IF TALENT:ARG:巨乳
					RETURNF "超尻S型"
				ELSEIF TALENT:ARG:筋肉
					RETURNF "筋肉"
				ELSE
					RETURNF "超尻"
				ENDIF
			ENDSELECT
		;爆尻
		CASE 2
			SELECTCASE 100*BASE:ARG:腰圍/BASE:ARG:身高
			;腰圍太め
			CASE IS >= CALCF("豐腴倍数", ARG)
				IF TALENT:ARG:巨乳
					RETURNF "豊満"
				ELSE
					RETURNF "肉感"
				ENDIF
			;腰圍細い
			CASE IS <= CALCF("苗条倍数", ARG)
				IF TALENT:ARG:巨乳
					RETURNF "玩偶身材"
				ELSE
					RETURNF "苗条爆尻"
				ENDIF
			;腰圍普通
			CASEELSE
				IF TALENT:ARG:巨乳
					RETURNF "爆尻S型"
				ELSEIF TALENT:ARG:筋肉
					RETURNF "筋肉"
				ELSE
					RETURNF "爆尻"
				ENDIF
			ENDSELECT
		;巨尻
		CASE 1
			SELECTCASE 100*BASE:ARG:腰圍/BASE:ARG:身高
			;腰圍太め
			CASE IS >= CALCF("豐腴倍数", ARG)
				IF TALENT:ARG:巨乳
					RETURNF "豊満"
				ELSE
					RETURNF "肉感"
				ENDIF
			;腰圍細い
			CASE IS <= CALCF("苗条倍数", ARG)
				IF TALENT:ARG:巨乳
					RETURNF @"苗条%TALENT_NAME(GETNUM(TALENT, "巨乳"), TALENT:ARG:巨乳, ARG)%"
				ELSEIF TALENT:ARG:筋肉
					RETURNF "筋肉高挑"
				ELSE
					RETURNF "蜂腰肥臀"
				ENDIF
			;腰圍普通
			CASEELSE
				IF TALENT:ARG:巨乳
					RETURNF "S型"
				ELSEIF TALENT:ARG:筋肉
					RETURNF "筋肉"
				ELSE
					RETURNF "大臀"
				ENDIF
			ENDSELECT
		CASE 0
			SELECTCASE 100*BASE:ARG:腰圍/BASE:ARG:身高
			;腰圍太め
			CASE IS >= CALCF("豐腴倍数", ARG)
				IF TALENT:ARG:巨乳
					RETURNF @"%TALENT_NAME(GETNUM(TALENT, "巨乳"), TALENT:ARG:巨乳, ARG)%"
				ELSE
					RETURNF "豐腴"
				ENDIF
			;腰圍細い
			CASE IS <= CALCF("苗条倍数", ARG)
				IF TALENT:ARG:巨乳
					RETURNF @"苗条%TALENT_NAME(GETNUM(TALENT, "巨乳"), TALENT:ARG:巨乳, ARG)%"
				ELSEIF TALENT:ARG:筋肉
					RETURNF "精瘦健壮"
				ELSE
					RETURNF "高挑"
				ENDIF
			;腰圍普通
			CASEELSE
				IF TALENT:ARG:巨乳
					RETURNF @"%TALENT_NAME(GETNUM(TALENT, "巨乳"), TALENT:ARG:巨乳, ARG)%"
				ELSEIF TALENT:ARG:筋肉
					RETURNF "筋肉"
				ELSEIF TALENT:ARG:貧乳
					IF TALENT:ARG:高大
						RETURNF "高大貧乳"
					ELSE
						RETURNF "貧乳"
					ENDIF
				ELSEIF TALENT:ARG:高大
					RETURNF "高大"
				ELSE
					RETURNF "平衡型"
				ENDIF
			ENDSELECT
		ENDSELECT
	ENDIF
CASE "腰圍"
	SELECTCASE 100*BASE:ARG:腰圍/BASE:ARG:身高
	;腰圍太め
	CASE IS >= CALCF("豐腴倍数", ARG)
		LOCALS = 丰满
	;腰圍細い
	CASE IS <= CALCF("苗条倍数", ARG)
		LOCALS = 纤细
	;腰圍普通
	CASEELSE
		LOCALS = 普通
	ENDSELECT
CASE "胸部"
	IF TALENT:ARG:男性
		LOCALS = 男性
	ELSEIF TALENT:ARG:巨乳 >= 3
		LOCALS = 超乳
	ELSEIF TALENT:ARG:巨乳 == 2
		LOCALS = 爆乳
	ELSEIF TALENT:ARG:巨乳
		LOCALS = 巨乳
	ELSEIF TALENT:ARG:貧乳
		LOCALS = 貧乳
	ELSE
		LOCALS = 並乳
	ENDIF
CASE "罩杯"
	SELECTCASE BASE:ARG:罩杯
	CASE IS < 0
		RETURNF "---"
	CASE IS >= 28
		RETURNF "Z"
	CASEELSE
		VARSET LOCALS
		SPLIT "---, AAA, AA, Ａ, Ｂ, Ｃ, Ｄ, Ｅ, Ｆ, Ｇ, Ｈ, Ｉ, Ｊ, Ｋ, Ｌ, Ｍ, Ｎ, Ｏ, Ｐ, Ｑ, Ｒ, Ｓ, Ｔ, Ｕ, Ｖ, Ｗ, Ｘ, Ｙ, Ｚ", ", ", LOCALS
		RETURNF LOCALS:(BASE:ARG:罩杯)
	ENDSELECT
CASE "お尻"
	IF TALENT:ARG:男性
		LOCALS =
	ELSEIF TALENT:ARG:巨尻 >= 3
		LOCALS = 超尻
	ELSEIF TALENT:ARG:巨尻 == 2
		LOCALS = 爆尻
	ELSEIF TALENT:ARG:巨尻
		LOCALS = 巨尻
	ELSEIF TALENT:ARG:小尻
		LOCALS = 小尻
	ELSE
		LOCALS = 並尻
	ENDIF
CASE "臀圍サイズ"
	SELECTCASE BASE:ARG:臀圍
	CASE IS <= 71
		LOCALS = XS
	CASE 72 TO 76
		LOCALS = 3S
	CASE 77 TO 81
		LOCALS = SS
	CASE 82 TO 86
		LOCALS = Ｓ
	CASE 87 TO 91
		LOCALS = Ｍ
	CASE 92 TO 96
		LOCALS = Ｌ
	CASE 97 TO 101
		LOCALS = LL
	CASE 102 TO 106
		LOCALS = 3L
	CASE 107 TO 111
		LOCALS = 4L
	CASE 112 TO 116
		LOCALS = 5L
	CASEELSE
		LOCALS = XL
	ENDSELECT
CASE "皮の状態"
	IF COND("露茎", ARG)
		LOCALS = 露茎
	ELSEIF COND("假性包茎", ARG)
		LOCALS = 假性包茎
	ELSEIF COND("真性包茎", ARG)
		LOCALS = 真性包茎
	ENDIF
CASE "阴茎尺寸"
	SELECTCASE SIZE("阴茎", ARG)
	CASE 0
		LOCALS = 短小
	CASE 1
		LOCALS = 普通
	CASE 2
		LOCALS = 巨根
	CASE 3
		LOCALS = 馬根
	CASE 4
		LOCALS = 腕粗
	CASEELSE
		LOCALS = 規格外
	ENDSELECT
CASE "潜在的含む阴茎尺寸"
	SELECTCASE SIZE("基本阴茎尺寸", ARG)
	CASE 0
		LOCALS = 短小
	CASE 1
		LOCALS = 普通
	CASE 2
		LOCALS = 巨根
	CASE 3
		LOCALS = 馬根
	CASE 4
		LOCALS = 腕粗
	CASEELSE
		LOCALS = 規格外
	ENDSELECT

CASE "体位"
	IF STRCOUNT(TRAINNAME_EX(SELECTCOM), "正常位")
		LOCALS = 正常位
	ELSEIF STRCOUNT(TRAINNAME_EX(SELECTCOM), "後背位")
		LOCALS = 後背位
	ELSEIF STRCOUNT(TRAINNAME_EX(SELECTCOM), "屈曲位")
		LOCALS = 屈曲位
	ELSEIF STRCOUNT(TRAINNAME_EX(SELECTCOM), "対面座位")
		LOCALS = 対面座位
	ELSEIF STRCOUNT(TRAINNAME_EX(SELECTCOM), "背面座位")
		LOCALS = 背面座位
	ELSEIF STRCOUNT(TRAINNAME_EX(SELECTCOM), "騎乗位")
		LOCALS = 騎乗位
	ELSE
		SELECTCASE GETBITS(INSERT("挿入", ARG), 0, 9)
		CASE 1p0
			LOCALS = 正常位
		CASE 1p1
			LOCALS = 後背位
		CASE 1p2
			LOCALS = 屈曲位
		CASE 1p3
			LOCALS = 対面座位
		CASE 1p4
			LOCALS = 背面座位
		CASE 1p5
			LOCALS = 騎乗位
		CASEELSE
			IF PREVPLAY("正常位", ARG)
				LOCALS = 正常位
			ELSEIF PREVPLAY("後背位", ARG)
				LOCALS = 後背位
			ELSEIF PREVPLAY("屈曲位", ARG)
				LOCALS = 屈曲位
			ELSEIF PREVPLAY("対面座位", ARG)
				LOCALS = 対面座位
			ELSEIF PREVPLAY("背面座位", ARG)
				LOCALS = 背面座位
			ELSEIF PREVPLAY("騎乗位", ARG)
				LOCALS = 騎乗位
			ENDIF
		ENDSELECT
	ENDIF
	IF CFLAG:睡眠
		SELECTCASE LOCALS
		CASE "後背位"
			LOCALS = 后背位睡姦
		CASEELSE
			LOCALS = 睡眠姦
		ENDSELECT
	ELSEIF CONFIG("立位")
		SELECTCASE LOCALS
		CASE "正常位"
			LOCALS = 対面立位
		CASE "後背位"
			LOCALS = 立后背位
		CASE "対面座位"
			LOCALS = 火车便当位
		CASE "背面座位"
			LOCALS = 背面火车便当位
		ENDSELECT
	ENDIF
CASE "身嗜み：陰毛"
	SELECTCASE COND(ARGS, ARG)
	CASE 3
		LOCALS = 光滑无毛
	CASE 5
		LOCALS = 保养完毕
	CASE 7
		LOCALS = 随意生長
	ENDSELECT
CASE "陰毛の形"
	SELECTCASE BASE:ARG:陰毛/100
	CASE 5
		SIF CEVENT("陰毛の名称", ARG)
			RETURNF CEVENTS("陰毛の名称", ARG)
		RETURNF CONDS("陰毛", ARG)
	CASE IS >= 1
		RETURNF CONDS("陰毛", ARG)
	ENDSELECT
CASE "陰毛"
	SELECTCASE BASE:ARG:陰毛/100
	CASE 1
		LOCALS = 白虎
	CASE 2
		LOCALS = 脱毛処理
	CASE 3
		SIF BASE:ARG:陰毛%100 >= 6
			RETURNF "剃过留痕"
		LOCALS = 光滑无毛
	CASE 4
		IF COND("陰毛年齢", ARG) >= 4
			LOCALS = 無髭
		ELSE
			LOCALS = 还没長出来
		ENDIF
	CASE 5
		LOCALS = 保养完毕
	CASE 6
		LOCALS = 自然
	CASE 7
		LOCALS = 随意生長
	ENDSELECT

;保养完毕みだと光滑无毛になります
CASE "Ａ陰毛"
	SELECTCASE BASE:ARG:陰毛/100
	CASE 1
		LOCALS = 無毛
	CASE 2
		LOCALS = 脱毛処理
	CASE 3 TO 5
		LOCALS = 光滑无毛
	CASE 6
		LOCALS = 自然
	CASE 7
		LOCALS = 随意生長
	ENDSELECT

CASE "腋毛"
	SELECTCASE BASE:ARG:腋毛/100
	CASE 1
		LOCALS = 無毛
	CASE 2
		LOCALS = 脱毛処理
	CASE 3
		SELECTCASE COND("陰毛年齢", ARG)
		CASE IS >= 4
			SIF BASE:ARG:腋毛%100 >= 1
				RETURNF "剃过留痕"
		CASE 3
			SIF BASE:ARG:腋毛%100 >= 8
				RETURNF "剃过留痕"
		CASE 2
			SIF BASE:ARG:腋毛%100 >= 10
				RETURNF "剃过留痕"
		CASE 1
			SIF BASE:ARG:腋毛%100 >= 12
				RETURNF "剃过留痕"
		ENDSELECT
		LOCALS = 光滑无毛
	CASE 4
		IF COND("陰毛年齢", ARG) >= 4
			LOCALS = 刺啦刺啦
		ELSE
			LOCALS = 还没長出来
		ENDIF
	CASE 5
		LOCALS = 保养完毕
	CASE 6
		LOCALS = 自然
	CASE 7
		LOCALS = 随意生長
	ENDSELECT
CASEELSE
	;初めてフラグ
	IF ARGS != "第一次的对象" && STRCOUNT(ARGS, "初")
		VARSET LOCALS
		;記録を分解する。LOCALS:XX = 行為：人＃{日期}＠{尺寸}＊場所 となる
		SPLIT CSTR:ARG:初行為相手, "/", LOCALS

		IF STRCOUNT(ARGS, "サイズ")
			ARGS = %SUBSTRINGU(ARGS, 0, STRLENSU(ARGS) - 3)%

			FOR LCOUNT, 0, 50
				SIF LOCALS:LCOUNT == ""
					BREAK
				SIF STRCOUNT(LOCALS:LCOUNT, ARGS) == 0
					CONTINUE
				RETURNF EXTSTR(LOCALS:LCOUNT, "＠", "＊")
			NEXT
		ELSEIF STRCOUNT(ARGS, "場所")
			ARGS = %SUBSTRINGU(ARGS, 0, STRLENSU(ARGS) - 2)%

			FOR LCOUNT, 0, 50
				SIF LOCALS:LCOUNT == ""
					BREAK
				SIF STRCOUNT(LOCALS:LCOUNT, ARGS) == 0
					CONTINUE
				RETURNF EXTSTR(LOCALS:LCOUNT, "＊")
			NEXT
		ELSE
			FOR LCOUNT, 0, 50
				SIF LOCALS:LCOUNT == ""
					BREAK
				SIF STRCOUNT(LOCALS:LCOUNT, ARGS) == 0
					CONTINUE
				RETURNF CALLNAME:TO_NUMBER(TOINT(EXTSTR(LOCALS:LCOUNT, "：", "＃") ) )
			NEXT
		ENDIF
		RETURNF ""
	ENDIF
ENDSELECT
RETURNF LOCALS

;-------------------------------------------------
;TALENT:ARG:外見年齢に体形などによる補正を加えたもの
;-------------------------------------------------
@AGE(ARG)
#FUNCTION

LOCAL = TALENT:ARG:外見年齢

IF NO:ARG
	;もともとは娇小角色ではない
	SIF TALENT:ARG:娇小 && CSVTALENT(NO:ARG, GETNUM(TALENT, "娇小") ) == 0
		LOCAL -= 1
ENDIF

IF COND("伪娘", ARG)
	LOCAL = LIMIT(LOCAL, 1, 2)
ELSE
	LOCAL = LIMIT(LOCAL, 1, 4)
ENDIF

RETURNF LOCAL

;性器年齢
@VAGE(ARG)
#FUNCTION
SIF CONFIG("性器年齢") == 0
	RETURNF AGE(ARG)
RETURNF TALENT:ARG:性器年齢

@TRUE_SEX(ARG)
#FUNCTIONS
;まずはレアケースである"扶她"かの判定
IF COND("初期扶她", ARG) == 1
	RETURNF "扶她"
;以下は男性or女性
ELSEIF TALENT:ARG:男性
	IF TALENT:ARG:性反転
		RETURNF "女性"
	ELSE
		RETURNF "男性"
	ENDIF
ELSE
	IF TALENT:ARG:性反転
		RETURNF "男性"
	ELSE
		RETURNF "女性"
	ENDIF
ENDIF

;-------------------------------------------------
;全員の関係をARGだけ変動させる
;-------------------------------------------------
@CHANGE_RELATION_ALL, ARG
#DIM LCOUNT
#DIM LCOUNT2

FOR LCOUNT, 2, CHARANUM
	FOR LCOUNT2, 2, CHARANUM
		SIF NO:LCOUNT == NO:LCOUNT2
			CONTINUE

		;RELATIONの初期値は０なので、その場合には100にする
		SIF RELATION:LCOUNT:(NO:LCOUNT2) == 0
			RELATION:LCOUNT:(NO:LCOUNT2) = 100

		;PRINTFORM RELATION:{LCOUNT}:{NO:LCOUNT2} = {RELATION:LCOUNT:(NO:LCOUNT2)} →

		RELATION:LCOUNT:(NO:LCOUNT2) += ARG

		;関係が○→◎→☆になるためには一定以上の値の補正値が必要
		;SELECTCASE RELATION:LCOUNT:(NO:LCOUNT2)
		;CASE IS < 120
		;	SIF ARG >= 2 || RELATION:LCOUNT:(NO:LCOUNT2) + ARG < 120
		;		RELATION:LCOUNT:(NO:LCOUNT2) += ARG
		;CASE IS < 150
		;	SIF ARG >= 5 || RELATION:LCOUNT:(NO:LCOUNT2) + ARG < 150
		;		RELATION:LCOUNT:(NO:LCOUNT2) += ARG
		;CASE IS < 200
		;	SIF ARG >= 10 || RELATION:LCOUNT:(NO:LCOUNT2) + ARG < 200
		;		RELATION:LCOUNT:(NO:LCOUNT2) += ARG
		;ENDSELECT

		;PRINTFORML {RELATION:LCOUNT:(NO:LCOUNT2)}

		;MAXは200
		SIF RELATION:LCOUNT:(NO:LCOUNT2) > 200
			RELATION:LCOUNT:(NO:LCOUNT2) = 200
	NEXT
NEXT

;-------------------------------------------------
;ARG:1～ARG:4の角色の相性をARGだけ加算する(ARGが負の値なら減算)
;ちょっとしたイベントなら+1～+2で良いでしょう
;協力して何かを行ったぐらいで+5とか、+10は一大イベントぐらいです
;-------------------------------------------------
@CHANGE_RELATION, ARG, ARG:1, ARG:2, ARG:3, ARG:4, ARG:5
#DIM LCOUNT
#DIM LCOUNT2

FOR LCOUNT, 1, 6
	SIF ARG:LCOUNT <= 0
		CONTINUE
	FOR LCOUNT2, 1, 6
		SIF LCOUNT == LCOUNT2
			CONTINUE
		SIF ARG:LCOUNT2 <= 0
			CONTINUE
		;RELATIONの初期値は０なので、その場合には100にする
		SIF RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) == 0
			RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) = 100

		;PRINTFORM RELATION:{ARG:LCOUNT}:{NO:(ARG:LCOUNT2)} = {RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) )} →

		RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) += ARG

		;関係が○→◎→☆になるためには一定以上の値の補正値が必要
		;SELECTCASE RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) )
		;CASE IS < 120
		;	SIF ARG >= 2 || RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) + ARG < 120
		;		RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) += ARG
		;CASE IS < 150
		;	SIF ARG >= 5 || RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) + ARG < 150
		;		RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) += ARG
		;CASE IS < 200
		;	SIF ARG >= 10 || RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) + ARG < 200
		;		RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) += ARG
		;ENDSELECT

		;PRINTFORML {RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) )}

		;MAXは200
		SIF RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) > 200
			RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) = 200
	NEXT
NEXT

;-------------------------------------------------
;@CHANGE_RELATIONの数値指定版。
;ARGSには○、◎、☆が入り、それぞれ相性を120,150,200にする
;-------------------------------------------------
@CHANGE_RELATION_MARK, ARGS, ARG, ARG:1, ARG:2, ARG:3
#DIM LCOUNT
#DIM LCOUNT2

;PRINTFORML ARG:0 = {ARG:0}, ARG:1 = {ARG:1}, ARG:2 = {ARG:2}, ARG:3 = {ARG:3}
;PRINTL

FOR LCOUNT, 0, 4
	SIF ARG:LCOUNT <= 0
		CONTINUE
	FOR LCOUNT2, 0, 4
		SIF LCOUNT == LCOUNT2
			CONTINUE
		SIF ARG:LCOUNT2 <= 0
			CONTINUE
		;RELATIONの初期値は０なので、その場合には100にする
		SIF RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) == 0
			RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) = 100

		;PRINTFORM RELATION:{ARG:LCOUNT}:{NO:(ARG:LCOUNT2)} = {RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) )} →

		SELECTCASE ARGS
		CASE "○"
			SIF RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) < 120
				RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) = 120
		CASE "◎"
			SIF RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) < 150
				RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) = 150
		CASE "☆"
			SIF RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) < 200
				RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) = 200
		ENDSELECT

		;PRINTFORML {RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) )}

		;MAXは200
		SIF RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) > 200
			RELATION:(ARG:LCOUNT):(NO:(ARG:LCOUNT2) ) = 200
	NEXT
NEXT

;-------------------------------------------------
;@CEVENTのDAYEV特化版
;例えばCDAYEV("圣诞节")は"游戏内のその年の圣诞节"or"現実時間のその年の圣诞节"を自動で参照する
;-------------------------------------------------
@CDAYEV(ARGS, ARG)
#FUNCTION
;現実の年
#DIM RYEAR

SIF ARG < 0
	RETURNF 0
SIF ARG == 0 && TARGET
	ARG = TARGET
;まずはイベント当日に既に起こしてあるかの判定
IF DAYEV(ARGS)
	SIF STRCOUNT(CSTR:ARG:CDAYEV, @"＠%ARGS%：{FLAG:年}/")
		RETURNF 1
ELSEIF DAYEV(ARGS, "リアル日時")
	GETTIME
	RYEAR = (RESULT / 10000000000000) % 10000

	SIF STRCOUNT(CSTR:ARG:CDAYEV, @"＠%ARGS%：AD{RYEAR}/")
		RETURNF 2
;イベント当日でない場合には、その年(not現実)のイベントを既に起こしたかで判定
;厳密には年度or発生日からXX日などで判定が良いかもだが、ぶっちゃけ白色情人節しか関係ないだろうという事で気にしない
ELSE
	SIF STRCOUNT(CSTR:ARG:CDAYEV, @"＠%ARGS%：{FLAG:年}/")
		RETURNF 3
ENDIF
RETURNF 0

@SET_CDAYEV, ARGS, ARG
;現実の年
#DIM RYEAR

SIF ARGS == ""
	RETURN 0
SIF ARG == 0 && TARGET
	ARG = TARGET

;経験していないなら追加
;もしも現実日時の情人節に游戏内でも情人節だった場合には２度同じイベントが起きないように両方ともフラグを埋める
IF DAYEV(ARGS)
	SIF CDAYEV(ARGS, ARG) == 0 && STRCOUNT(CSTR:ARG:CDAYEV, @"＠%ARGS%：{FLAG:年}_NOW\/") == 0
		CSTR:ARG:CDAYEV += @"＠%ARGS%：{FLAG:年}_NOW\/"
ENDIF
IF DAYEV(ARGS, "リアル日時")
	GETTIME
	RYEAR = (RESULT / 10000000000000) % 10000

	SIF CDAYEV(ARGS, ARG) == 0 && STRCOUNT(CSTR:ARG:CDAYEV, @"＠%ARGS%：AD{RYEAR}_NOW\/") == 0
		CSTR:ARG:CDAYEV += @"＠%ARGS%：AD{RYEAR}_NOW\/"
ENDIF

;-------------------------------------------------
;主に現実の日期を参照するイベント全般の判定をする
;ARGS:1には"リアル日時"、"游戏内"などが代入される
;-------------------------------------------------
@DAYEV(ARGS, ARGS:1)
#FUNCTION

;現実の年
#DIM RYEAR
;現実の日期時刻
#DIM MONTH_DAY
;現実の日(曜日計算でのみ使用)
#DIM RDAY
;現実の時刻
#DIM RTIME
;現実の曜日
#DIM WEEKDAY

GETTIME

RYEAR = (RESULT / 10000000000000) % 10000
;現実の日期時刻が02/05の4時ならMONTH_DAY = 20504
MONTH_DAY = (RESULT / 10000000) % 1000000
;現実の日
RDAY = (RESULT / 1000000000) % 100
;現実の時間0～23
RTIME = MONTH_DAY%100

;曜日の算出（1-2月の時は計算式が別）
SELECTCASE MONTH_DAY/10000
CASE 1, 2
	WEEKDAY = (RYEAR - 1 + (RYEAR - 1)/4 - (RYEAR - 1)/100 + (RYEAR - 1)/400 + (13*(MONTH_DAY/10000 + 12) + 8)/5 + RDAY)%7
CASEELSE
	WEEKDAY = (RYEAR + RYEAR/4 - RYEAR/100 + RYEAR/400 + (13*MONTH_DAY/10000 + 8)/5 + RDAY)%7
ENDSELECT

;それぞれのイベント日は翌日の深夜まではＯＫとする
SELECTCASE ARGS
;日期イベント
CASE "試験返却日"
	SELECTCASE FLAG:日
	CASE 2
		;１年目は没有
		SIF FLAG:年 < 2
			RETURNF 0
		SIF CFLAG:MASTER:試験結果
			RETURNF 1
	CASE 23, 37
		SIF CFLAG:MASTER:試験結果
			RETURNF 1
	ENDSELECT
CASE "試験当日"
	SELECTCASE FLAG:日
	CASE 21, 35, 56
		RETURNF 1
	ENDSELECT
CASE "試験前日"
	SELECTCASE FLAG:日
	CASE 20, 34, 55
		RETURNF 1
	ENDSELECT
CASE "試験間近"
	SELECTCASE FLAG:日
	CASE 18 TO 20, 32 TO 34, 53 TO 55
		RETURNF 1
	ENDSELECT
CASE "周考"
	SELECTCASE FLAG:日
	CASE 16 TO 20, 30 TO 34, 51 TO 55
		RETURNF 1
	ENDSELECT
CASE "即将到来文化祭"
	SELECTCASE FLAG:日
	CASE 23 TO 28
		RETURNF 1
	ENDSELECT
CASE "文化祭"
	SIF COND("夜")
		RETURNF 0
	SIF FLAG:日 == 29
		RETURNF 1
CASE "白色情人節"
	SELECTCASE ARGS:1
	CASE "リアル日時"
		SIF MONTH_DAY >= 31400 && MONTH_DAY <= 31503
			RETURNF 1
	CASEELSE
		;１年目は没有
		SIF FLAG:年 < 2
			RETURNF 0
		SIF FLAG:日 == 3
			RETURNF 1
	ENDSELECT
CASE "女仆の日"
	SELECTCASE ARGS:1
	CASE "リアル日時"
		SIF MONTH_DAY >= 51000 && MONTH_DAY <= 51103
			RETURNF 1
	CASEELSE
		SIF FLAG:日 == 13
			RETURNF 1
	ENDSELECT
CASE "比基尼の日"
	SELECTCASE ARGS:1
	CASE "リアル日時"
		SIF MONTH_DAY >= 70500 && MONTH_DAY <= 70603
			RETURNF 1
	CASEELSE
		SIF FLAG:日 == 19
			RETURNF 1
	ENDSELECT
CASE "七夕"
	SELECTCASE ARGS:1
	CASE "リアル日時"
		SIF MONTH_DAY >= 70700 && MONTH_DAY <= 70703
			RETURNF 1
	CASEELSE
		SIF FLAG:日 == 20
			RETURNF 1
	ENDSELECT
CASE "海の日"
	SELECTCASE ARGS:1
	CASE "リアル日時"
		SIF MONTH_DAY >= 71600 && MONTH_DAY <= 71703
			RETURNF 1
	CASEELSE
		SIF FLAG:日 == 22
			RETURNF 1
	ENDSELECT
CASE "兔女郎の日"
	SELECTCASE ARGS:1
	CASE "リアル日時"
		SIF MONTH_DAY >= 82300 && MONTH_DAY <= 82403
			RETURNF 1
	CASEELSE
		SIF FLAG:日 == 27
			RETURNF 1
	ENDSELECT
CASE "万圣节"
	SELECTCASE ARGS:1
	CASE "リアル日時"
		SIF MONTH_DAY >= 103100 && MONTH_DAY <= 110103
			RETURNF 1
	CASEELSE
		SIF FLAG:日 == 34
			RETURNF 1
	ENDSELECT
CASE "圣诞节前夕"
	SELECTCASE ARGS:1
	CASE "リアル日時"
		SIF MONTH_DAY >= 121800 && MONTH_DAY <= 121903
			RETURNF 1
	CASEELSE
		SIF FLAG:日 >= 41 && FLAG:日 <= 42
			RETURNF 1
	ENDSELECT
CASE "圣诞节"
	SELECTCASE ARGS:1
	CASE "リアル日時"
		;サービスで24と25両方ＯＫ
		SIF MONTH_DAY >= 122400 && MONTH_DAY <= 122603
			RETURNF 1
	CASEELSE
		SIF FLAG:日 == 43
			RETURNF 1
	ENDSELECT
CASE "圣诞节翌日"
	SELECTCASE ARGS:1
	CASE "リアル日時"
		SIF MONTH_DAY >= 122604 && MONTH_DAY <= 122703
			RETURNF 1
	CASEELSE
		SIF FLAG:日 == 44
			RETURNF 1
	ENDSELECT
CASE "圣诞节期間"
	SELECTCASE ARGS:1
	CASE "リアル日時"
		SIF MONTH_DAY >= 121800 && MONTH_DAY <= 122703
			RETURNF 1
	CASEELSE
		SIF FLAG:日 >= 41 && FLAG:日 <= 44
			RETURNF 1
	ENDSELECT
CASE "大晦日"
	SELECTCASE ARGS:1
	CASE "リアル日時"
		SIF MONTH_DAY >= 123100 && MONTH_DAY <= 10103
			RETURNF 1
	CASEELSE
		SIF FLAG:日 == 49
			RETURNF 1
	ENDSELECT
CASE "新年"
	SELECTCASE ARGS:1
	CASE "リアル日時"
		SIF MONTH_DAY >= 10104 && MONTH_DAY <= 10203
			RETURNF 1
	CASEELSE
		SIF FLAG:日 == 50
			RETURNF 1
	ENDSELECT
CASE "情人節前日"
	SELECTCASE ARGS:1
	CASE "リアル日時"
		SIF MONTH_DAY >= 21300 && MONTH_DAY <= 21323
			RETURNF 1
	CASEELSE
		SIF FLAG:日 == 53
			RETURNF 1
	ENDSELECT
CASE "情人節"
	SELECTCASE ARGS:1
	CASE "リアル日時"
		SIF MONTH_DAY >= 21400 && MONTH_DAY <= 21503
			RETURNF 1
	CASEELSE
		SIF FLAG:日 == 54
			RETURNF 1
	ENDSELECT
CASE "情人節翌日"
	SELECTCASE ARGS:1
	CASE "リアル日時"
		SIF MONTH_DAY >= 21504 && MONTH_DAY <= 21603
			RETURNF 1
	CASEELSE
		SIF FLAG:日 == 55
			RETURNF 1
	ENDSELECT
CASE "猫の日"
	SELECTCASE ARGS:1
	CASE "リアル日時"
		SIF MONTH_DAY >= 22200 && MONTH_DAY <= 22303
			RETURNF 1
	CASEELSE
		SIF FLAG:日 == 56
			RETURNF 1
	ENDSELECT
CASE "イースター", "復活祭", "生誕祭"
	;両方ＯＫとする
	;SELECTCASE ARGS:1
	;CASE "リアル日時"
		SIF MONTH_DAY >= 40400 && MONTH_DAY <= 40600
			RETURNF 1
	;CASEELSE
		SIF FLAG:日 == 4
			RETURNF 1
	;ENDSELECT
;初夏初日
CASE "夏服開始"
	SIF TEXTS("季節詳細") != "初夏"
		RETURNF 0
	FLAG:日 -= 1
	IF TEXTS("季節詳細") != "初夏"
		FLAG:日 += 1
		RETURNF 1
	ELSE
		FLAG:日 += 1
		RETURNF 0
	ENDIF
CASE "夏服期間"
	SELECTCASE TEXTS("季節詳細")
	CASE "初夏", "夏", "初秋", "秋"
		RETURNF 1
	ENDSELECT
;晩秋初日
CASE "夏服終了"
	SIF TEXTS("季節詳細") != "晩秋"
		RETURNF 0
	FLAG:日 -= 1
	IF TEXTS("季節詳細") != "晩秋"
		FLAG:日 += 1
		RETURNF 1
	ELSE
		FLAG:日 += 1
		RETURNF 0
	ENDIF
;時間区分
CASE "约会領帯ム"
	SIF (DAY - 1)%7 == 0 && TIME == 1
		RETURNF 1
CASE "早朝"
	SIF RTIME >= 4 && RTIME <= 5
		RETURNF 1
CASE "朝"
	SIF RTIME >= 4 && RTIME <= 10
		RETURNF 1
CASE "昼"
	SELECTCASE ARGS:1
	CASE "游戏内"
		SIF TIME == 1
			RETURNF 1
	CASEELSE
		SIF RTIME >= 11 && RTIME <= 14
			RETURNF 1
	ENDSELECT
CASE "午后"
	SIF RTIME == 13
		RETURNF 1
CASE "夕"
	;SELECTCASE ARGS:1
	;CASE "游戏内"
	;	SIF COND("夕")
	;		RETURNF 1
	;CASEELSE
		SIF RTIME >= 15 && RTIME <= 18
			RETURNF 1
	;ENDSELECT
CASE "夜"
	SELECTCASE ARGS:1
	CASE "游戏内"
		SIF TIME == 2
			RETURNF 1
	CASEELSE
		SIF RTIME >= 18 && RTIME <= 23
			RETURNF 1
	ENDSELECT
CASE "深夜"
	SIF RTIME < 23
		RTIME += 24
	SIF RTIME >= 23 && RTIME <= 27
		RETURNF 1

;季節の詳細
CASE "春"
	SIF MONTH_DAY >= 30100 && MONTH_DAY <= 53124
		RETURNF 1

CASE "初夏"
	SIF MONTH_DAY >= 51000 && MONTH_DAY <= 60924
		RETURNF 1
CASE "夏"
	SIF MONTH_DAY >= 60100 && MONTH_DAY <= 83124
		RETURNF 1

CASE "初秋"
	SIF MONTH_DAY >= 80800 && MONTH_DAY <= 90624
		RETURNF 1
CASE "秋"
	SIF MONTH_DAY >= 90100 && MONTH_DAY <= 113124
		RETURNF 1
CASE "晩秋"
	SIF MONTH_DAY >= 110100 && MONTH_DAY <= 120924
		RETURNF 1

CASE "冬"
	SIF MONTH_DAY < 120100
		RTIME += 120000
	SIF MONTH_DAY >= 120100 && MONTH_DAY <= 143124
		RETURNF 1

;曜日判定
CASE "周日"
	SELECTCASE ARGS:1
	CASE "游戏内"
		SIF (DAY - 1)%7 == 0
			RETURNF 1
	CASEELSE
		SIF WEEKDAY == 0
			RETURNF 1
	ENDSELECT
CASE "周一"
	SELECTCASE ARGS:1
	CASE "游戏内"
		SIF (DAY - 1)%7 == 1
			RETURNF 1
	CASEELSE
		SIF WEEKDAY == 1
			RETURNF 1
	ENDSELECT
CASE "周二"
	SELECTCASE ARGS:1
	CASE "游戏内"
		SIF (DAY - 1)%7 == 2
			RETURNF 1
	CASEELSE
		SIF WEEKDAY == 2
			RETURNF 1
	ENDSELECT
CASE "周三"
	SELECTCASE ARGS:1
	CASE "游戏内"
		SIF (DAY - 1)%7 == 3
			RETURNF 1
	CASEELSE
		SIF WEEKDAY == 3
			RETURNF 1
	ENDSELECT
CASE "周四"
	SELECTCASE ARGS:1
	CASE "游戏内"
		SIF (DAY - 1)%7 == 4
			RETURNF 1
	CASEELSE
		SIF WEEKDAY == 4
			RETURNF 1
	ENDSELECT
CASE "周五"
	SELECTCASE ARGS:1
	CASE "游戏内"
		SIF (DAY - 1)%7 == 5
			RETURNF 1
	CASEELSE
		SIF WEEKDAY == 5
			RETURNF 1
	ENDSELECT
CASE "周六"
	SELECTCASE ARGS:1
	CASE "游戏内"
		SIF (DAY - 1)%7 == 6
			RETURNF 1
	CASEELSE
		SIF WEEKDAY == 6
			RETURNF 1
	ENDSELECT
CASE "週末"
	SELECTCASE ARGS:1
	CASE "游戏内"
		SIF (DAY - 1)%7 == 0 || (DAY - 1)%7 == 6
			RETURNF 1
	CASEELSE
		SIF WEEKDAY == 0 || WEEKDAY == 6
			RETURNF 1
	ENDSELECT
;道端の菠萝包加筆分
;年から十二支を算出する。リアルだけを見る
CASE "ねずみ", "子年"
	;ねずみ年、あるいは子年
	IF RYEAR % 12 == 4
		RETURNF 1
	ELSE
		RETURNF 0
	ENDIF
CASE "うし", "丑年"
	;うし年、あるいは丑年
	IF RYEAR % 12 == 5
		RETURNF 1
	ELSE
		RETURNF 0
	ENDIF
CASE "とら", "寅年"
	;とら年、あるいは寅年
	IF RYEAR % 12 == 6
		RETURNF 1
	ELSE
		RETURNF 0
	ENDIF
CASE "うさぎ", "卯年"
	;うさぎ年、あるいは卯年
	IF RYEAR % 12 == 7
		RETURNF 1
	ELSE
		RETURNF 0
	ENDIF
CASE "たつ", "辰年"
	;たつ年、あるいは辰年
	IF RYEAR % 12 == 8
		RETURNF 1
	ELSE
		RETURNF 0
	ENDIF
CASE "へび", "巳年"
	;へび年、あるいは巳年
	IF RYEAR % 12 == 9
		RETURNF 1
	ELSE
		RETURNF 0
	ENDIF
CASE "うま", "午年"
	;うま年、あるいは午年
	IF RYEAR % 12 == 10
		RETURNF 1
	ELSE
		RETURNF 0
	ENDIF
CASE "ひつじ", "未年"
	;ひつじ年、あるいは未年
	IF RYEAR % 12 == 11
		RETURNF 1
	ELSE
		RETURNF 0
	ENDIF
CASE "さる", "申年"
	;さる年、あるいは申年
	IF RYEAR % 12 == 0
		RETURNF 1
	ELSE
		RETURNF 0
	ENDIF
CASE "とり", "酉年"
	;とり年、あるいは酉年
	IF RYEAR % 12 == 1
		RETURNF 1
	ELSE
		RETURNF 0
	ENDIF
CASE "いぬ", "戌年"
	;いぬ年、あるいは戌年
	IF RYEAR % 12 == 2
		RETURNF 1
	ELSE
		RETURNF 0
	ENDIF
CASE "いのしし", "亥年"
	;いのしし年、あるいは亥年
	IF RYEAR % 12 == 3
		RETURNF 1
	ELSE
		RETURNF 0
	ENDIF
ENDSELECT

RETURNF 0

;-------------------------------------------------
;単語1/単語2/…/単語n の書式で書かれたARGS:0～の単語のどれかを等確率で返す
;(ARGSが複数あるのは関数などが突っ込まれることを想定しているため)
;＿は何も出力しない選択とする
;-------------------------------------------------
@TEXTR(ARGS, ARGS:1, ARGS:2, ARGS:3, ARGS:4, ARGS:5, ARGS:6)
#FUNCTIONS
#DIM LCOUNT
#DIM NUM_CHOICE
#DIMS CHOICES

;まず一つにまとめる
ARGS = %ARGS%\/%ARGS:1%\/%ARGS:2%\/%ARGS:3%\/%ARGS:4%\/%ARGS:5%\/%ARGS:6%

VARSET CHOICES
VARSET LOCALS
SPLIT ARGS, "/", LOCALS

NUM_CHOICE = 1
FOR LCOUNT, 0, 100
	SELECTCASE LOCALS:LCOUNT
	CASE ""
		CONTINUE
	CASEELSE
		SIF RAND:NUM_CHOICE == 0
			CHOICES = %LOCALS:LCOUNT%

		NUM_CHOICE += 1
	ENDSELECT
NEXT
SIF CHOICES == "＿"
	CHOICES =
RETURNF CHOICES

;-------------------------------------------------
;文字列ARGSからいくつかの記号や単語などを除外してからSTRLENSを行う関数
;-------------------------------------------------
@STRLENS_EX(ARGS)
#FUNCTION
#DIM LCOUNT
#DIM TEXTLEN

TEXTLEN = 0
VARSET LOCALS
SPLIT ARGS, "_", LOCALS

FOR LCOUNT, 0, 100
	SELECTCASE LOCALS:LCOUNT
	CASE "", "BUTTON", "NOBUTTON", "太字", "斜体", "取り消し", "下線", "-", "L", "W", "NW"
		CONTINUE
	CASE "H", "WH", "BH", "BBH", "HH", "WHH", "BHH", "BBHH"
		TEXTLEN += 2
	CASE "／／／", "／"
		TEXTLEN += 3
	;一部PRINT_IMGしている物を使えるようにする
	CASE "U便当", "Uドラゴン", "U創口貼", "U男性", "U女性", "U扶她", "U伪娘", "UH"
		TEXTLEN += 2
	;パラレル日本語
	CASE "Uそそ", "Uつん", "Uなお", "Uまふ", "Uはよ", "Uひに", "Uやよ", "Uゐに", "Uゐん", "U逆あ", "Uにす", "Uもむ", "Uをね", "U小ゐ", "U亜漢字1", "U亜漢字2", "U亜漢字3", "U亜漢字4"
		TEXTLEN += 2
	CASE "UNI"
		CONTINUE
	CASE "茶色", "ショッキング粉紅", "粉紅", "爱心粉紅", "赤", "紅", "黄色", "暗黄色", "イエロー", "緑", "青", "水色", "藍色", "暗灰色", "灰色", "明灰色", "白"
		CONTINUE
	CASEELSE
		TEXTLEN += STRLENS(LOCALS:LCOUNT)
	ENDSELECT
NEXT
RETURNF TEXTLEN

;-------------------------------------------------
;特殊な書式の文字列ARGSを読める文章に直す
;行や命令は_で区切る事。そしてLOCALSは99までなので手下留情してくれ
;CASEを増やして、そのうち文字列を別作成しないで済むようにしたい
;改行する時とWAITを付けて改行する時は、それぞれ以下のPRINT_STRL, PRINT_STRWを用いると間違いが少なくなるのでおすすめです
;-------------------------------------------------
@PRINT_STR, ARGS, ARGS:1, ARGS:2, ARGS:3, ARGS:4, ARGS:5, ARGS:6, ARGS:7, ARGS:8, ARGS:9
#DIM LCOUNT
#DIM TEXT_COLOR
#DIM INITIAL_COLOR
#DIM MEMO_TEXTCOUNT

MEMO_TEXTCOUNT = 0
TEXT_COLOR = GETCOLOR()
INITIAL_COLOR = GETCOLOR()

FOR LCOUNT, 1, 10
	SIF ARGS:LCOUNT != ""
		ARGS = %ARGS%_%ARGS:LCOUNT%
NEXT

VARSET LOCALS

;文字列を分解する
SPLIT ARGS, "_", LOCALS

FOR LCOUNT, 0, 100

	;#TEXTC=RGBで始まっているとその色が默认になる
	IF SUBSTRING(LOCALS:LCOUNT, 0, 7) == "#TEXTC="
		LOCALS:LCOUNT = 0x%SUBSTRING(LOCALS:LCOUNT, 7, -1)%
		IF ISNUMERIC(LOCALS:LCOUNT)
			TEXT_COLOR = TOINT(LOCALS:LCOUNT)
		ELSE
			PRINT エラー！
		ENDIF
		SETCOLOR TEXT_COLOR
		PRINTL
		CLEARLINE 1
		LOCALS:LCOUNT =
		LCOUNT = 0
	;その場でWAITさせるための処理
	ELSEIF LOCALS:LCOUNT == "NW"
		PRINTW
		CLEARLINE 1
		LOCALS:LCOUNT =
		LCOUNT = 0
		MEMO_TEXTCOUNT = 0
	ENDIF

	;特殊な操作
	SELECTCASE LOCALS:LCOUNT
	;CASE ""
	;	BREAK
	;CSVでの喜欢的东西で、你を指定するために使う
	CASE "CALLNAME:MASTER"
		PRINTFORM %CALLNAME:MASTER%
		MEMO_TEXTCOUNT += STRLENS(CALLNAME:MASTER)
		CONTINUE
	CASE "BUTTON"
		;次の文字をボタンにする
		LCOUNT += 1
		IF NUMBER_BUTTON(LOCALS:LCOUNT) < 0
			PRINTBUTTON LOCALS:LCOUNT, LOCALS:LCOUNT
		ELSE
			PRINTBUTTON LOCALS:LCOUNT, NUMBER_BUTTON(LOCALS:LCOUNT)
		ENDIF
		;RESETCOLOR
		SETCOLOR TEXT_COLOR
		MEMO_TEXTCOUNT += STRLENS(LOCALS:LCOUNT)
		CONTINUE
	CASE "NOBUTTON"
		;次の文字をボタンにしない
		LCOUNT += 1
		PRINTPLAINFORM %LOCALS:LCOUNT%
		;RESETCOLOR
		SETCOLOR TEXT_COLOR
		MEMO_TEXTCOUNT += STRLENS(LOCALS:LCOUNT)
		CONTINUE
	CASE "太字"
		;次の文字を太字
		FONTBOLD
		CONTINUE
	CASE "斜体"
		;次の文字を斜体
		FONTITALIC
		CONTINUE
	CASE "取り消し"
		;次の文字に取り消し線を引く
		FONTSTYLE 4
		CONTINUE
	CASE "下線"
		;次の文字に下線を引く
		FONTSTYLE 8
		CONTINUE
	CASE "-"
		;次の文字に打消し線を引く
		FONTSTYLE 4
		CONTINUE
	CASE "L"
		PRINTL
		MEMO_TEXTCOUNT = 0
		CONTINUE
	CASE "W"
		PRINTW
		MEMO_TEXTCOUNT = 0
		CONTINUE
	CASE "NW"
		PRINTW
		CLEARLINE 1
		LOCALS:LCOUNT =
		MEMO_TEXTCOUNT = 0
		LCOUNT = 0
	;爱心は下の方に記述されている"UH"も有ます(RESOURCESフォルダにある爱心画像を出す)
	CASE "H"
		CALL HEARTMARK
		MEMO_TEXTCOUNT += 2
		CONTINUE
	CASE "WH"
		CALL WHITE_HEARTMARK
		MEMO_TEXTCOUNT += 2
		CONTINUE
	CASE "BH"
		CALL BIG_HEARTMARK
		MEMO_TEXTCOUNT += 2
		CONTINUE
	CASE "BBH"
		CALL BIG_BLACK_HEARTMARK
		MEMO_TEXTCOUNT += 2
		CONTINUE
	CASE "HH"
		SETCOLOR DEF_COLOR("爱心粉紅")
		CALL HEARTMARK
		SETCOLOR TEXT_COLOR
		;RESETCOLOR
		MEMO_TEXTCOUNT += 2
		CONTINUE
	CASE "WHH"
		SETCOLOR DEF_COLOR("爱心粉紅")
		CALL WHITE_HEARTMARK
		SETCOLOR TEXT_COLOR
		;RESETCOLOR
		MEMO_TEXTCOUNT += 2
		CONTINUE
	CASE "BHH"
		SETCOLOR DEF_COLOR("爱心粉紅")
		CALL BIG_HEARTMARK
		SETCOLOR TEXT_COLOR
		;RESETCOLOR
		MEMO_TEXTCOUNT += 2
		CONTINUE
	CASE "BBHH"
		SETCOLOR DEF_COLOR("爱心粉紅")
		CALL BIG_BLACK_HEARTMARK
		SETCOLOR TEXT_COLOR
		;RESETCOLOR
		MEMO_TEXTCOUNT += 2
		CONTINUE
	CASE "／／／", "／"
		SETCOLOR DEF_COLOR("粉紅")
		PRINT ///
		SETCOLOR TEXT_COLOR
		;RESETCOLOR
		MEMO_TEXTCOUNT += 3
		CONTINUE
	;一部PRINT_IMGしている物を使えるようにする
	CASE "U便当", "Uドラゴン", "U創口貼", "U男性", "U女性", "U扶她", "U伪娘", "UH"
		PRINTFORM %UNI(SUBSTRING(LOCALS:LCOUNT, 1, -1))%
		SETCOLOR TEXT_COLOR
		MEMO_TEXTCOUNT += 2
		CONTINUE
	;パラレル日本語
	CASE "Uそそ", "Uつん", "Uなお", "Uまふ", "Uはよ", "Uひに", "Uやよ", "Uゐに", "Uゐん", "U逆あ", "Uにす", "Uもむ", "Uをね", "U小ゐ", "U亜漢字1", "U亜漢字2", "U亜漢字3", "U亜漢字4"
		PRINTFORM %UNI(SUBSTRING(LOCALS:LCOUNT, 1, -1))%
		SETCOLOR TEXT_COLOR
		MEMO_TEXTCOUNT += 2
		CONTINUE
	CASE "UNI"
		;次の文字をPRINT_IMG対応にする
		LCOUNT += 1
		PRINTFORM %UNI(LOCALS:LCOUNT)%
		SETCOLOR TEXT_COLOR
		MEMO_TEXTCOUNT += 2
		CONTINUE
	CASE "茶色", "ショッキング粉紅", "粉紅", "爱心粉紅", "赤", "紅", "黄色", "暗黄色", "イエロー", "緑", "青", "水色", "藍色", "暗灰色", "灰色", "明灰色", "白"
		SETCOLOR DEF_COLOR(LOCALS:LCOUNT)
		CONTINUE
	ENDSELECT

	PRINTFORM %LOCALS:LCOUNT%
	SETCOLOR TEXT_COLOR
	;RESETCOLOR
	FONTSTYLE 0
	MEMO_TEXTCOUNT += STRLENS(LOCALS:LCOUNT)
	CONTINUE
NEXT

TFLAG:表示文字長 = MEMO_TEXTCOUNT

;RESETCOLOR
SETCOLOR INITIAL_COLOR
FONTSTYLE 0

;-------------------------------------------------
;PRINT_STRの最後の_Lと_Wを関数に織り込んだver
;-------------------------------------------------
@PRINT_STRL, ARGS, ARGS:1, ARGS:2, ARGS:3, ARGS:4, ARGS:5, ARGS:6, ARGS:7, ARGS:8, ARGS:9
CALL PRINT_STR, ARGS, ARGS:1, ARGS:2, ARGS:3, ARGS:4, ARGS:5, ARGS:6, ARGS:7, ARGS:8, ARGS:9
PRINTL

@PRINT_STRW, ARGS, ARGS:1, ARGS:2, ARGS:3, ARGS:4, ARGS:5, ARGS:6, ARGS:7, ARGS:8, ARGS:9
CALL PRINT_STR, ARGS, ARGS:1, ARGS:2, ARGS:3, ARGS:4, ARGS:5, ARGS:6, ARGS:7, ARGS:8, ARGS:9
WAIT

@PRINT_STRFW, ARGS, ARGS:1, ARGS:2, ARGS:3, ARGS:4, ARGS:5, ARGS:6, ARGS:7, ARGS:8, ARGS:9
CALL PRINT_STR, ARGS, ARGS:1, ARGS:2, ARGS:3, ARGS:4, ARGS:5, ARGS:6, ARGS:7, ARGS:8, ARGS:9
FORCEWAIT

;-------------------------------------------------
;単語を/で区切られたARGSを[]で囲いつつ羅列する際に用いる
;小さいフォントを使っているので、横幅が足りないものの表示に向く
;単語_数字の形式で記述された部分は押すと数字を返すボタンになる
;単語1/&/単語2と記述された部分は[単語1 単語2]となる
;ARGS:1 = 拡大表示 の時にはフォントを弄らない
;-------------------------------------------------
@PRINT_LIST, ARGS, ARGS:1
#DIM LCOUNT
#DIMS MEMOS, 2
;まさか100以上になるとはな
#DIMS SPLIT_STR, 301

VARSET SPLIT_STR
SPLIT ARGS, "/", SPLIT_STR

FOR LCOUNT, 0, 300
	SELECTCASE SPLIT_STR:LCOUNT
	CASE ""
		CONTINUE
	CASE "ショッキング粉紅", "粉紅", "爱心粉紅", "赤", "紅", "黄色", "暗黄色", "イエロー", "緑", "青", "水色", "暗灰色", "灰色", "明灰色", "白"
		SETCOLOR DEF_COLOR(SPLIT_STR:LCOUNT)
		CONTINUE
	CASE "＆"
		CONTINUE
	CASEELSE
		SIF LCOUNT == 0 || SPLIT_STR:(LCOUNT - 1) != "＆"
			PRINT [

		IF ARGS:1 != "拡大表示"
			GETFONT
			CHKFONT "Microsoft Himalaya"
			SIF RESULT
				SETFONT "Microsoft Himalaya"
		ENDIF

		;ボタン化させる？
		VARSET MEMOS
		SPLIT SPLIT_STR:LCOUNT, "_", MEMOS
		IF MEMOS:1 != ""
			IF ISNUMERIC(MEMOS:1)
				PRINTBUTTON MEMOS, TOINT(MEMOS:1)
			ELSE
				PRINTBUTTON MEMOS, MEMOS:1
			ENDIF
		ELSE
			PRINTFORM %SPLIT_STR:LCOUNT%
		ENDIF
		SIF ARGS:1 != "拡大表示"
			SETFONT RESULTS
		IF SPLIT_STR:(LCOUNT + 1) == "＆"
			PRINT
		ELSE
			PRINT ]
		ENDIF
		RESETCOLOR
	ENDSELECT
NEXT
RESETCOLOR

;-------------------------------------------------
;ARGSに指定した色ARGをつけて出力する
;-------------------------------------------------
@PRINT_COLORTEXT, ARGS, ARG
SETCOLOR ARG
PRINTFORM %ARGS%
RESETCOLOR
;-------------------------------------------------
;PRINT_COLORTEXTの改行版
;-------------------------------------------------
@PRINTL_COLORTEXT, ARGS, ARG
SETCOLOR ARG
PRINTFORML %ARGS%
RESETCOLOR
;-------------------------------------------------
;PRINT_COLORTEXTのウェイト有版
;-------------------------------------------------
@PRINTW_COLORTEXT, ARGS, ARG
SETCOLOR ARG
PRINTFORMW %ARGS%
RESETCOLOR

;ARGに応じた適当な値を返す
@NORM(ARG, ARG:1)
#FUNCTION

SIF ARG:1 <= 0 && TARGET > 0
	ARG:1 = TARGET
SIF ARG <= 0
	ARG = 2

;ARG:1の識別番号を2乗させるので上限を設ける
LOCAL = (POWER((BASE:(ARG:1):識別番号 + ARG)%10000000, 2) / 100) % 1000000000000

RETURNF LOCAL

;-------------------------------------------------
;角色ARGの情報を隠して文字列を出す。ARGSが入力されている場合は文字列の前に付ける
;-------------------------------------------------
@PRINT_MASK, ARG, ARGS
#DIMS MASKTEXT

IF CEVENTS("マスク文言", ARG) != ""
	MASKTEXT = 【%CEVENTS("マスク文言", ARG)%】
ELSE
	MASKTEXT = 【无法确认】
ENDIF
SIF CEVENT("マスク太字", ARG)
	MASKTEXT = %MASKTEXT%
SIF CEVENT("マスク色", ARG)
	MASKTEXT = %MASKTEXT%

MASKTEXT = %ARGS%%MASKTEXT%

HTML_PRINT MASKTEXT

@PRINT_MASK_DRAWLINE, ARG, ARGS
#DIMS MASKTEXT

IF CEVENTS("マスク文言", ARG) != ""
	MASKTEXT = ！%CEVENTS("マスク文言", ARG)%！
ELSE
	MASKTEXT = ！无法确认！
ENDIF
MASKTEXT =
%MASKTEXT%

IF CEVENT("マスク太字", ARG)
	FONTBOLD
	MASKTEXT = %MASKTEXT%
ENDIF
IF CEVENT("マスク色", ARG)
	SETCOLOR DEF_COLOR(CEVENTS("マスク色", ARG) )
	MASKTEXT = %MASKTEXT%
ENDIF
MASKTEXT = %ARGS%%MASKTEXT%

CUSTOMDRAWLINE ＝
PRINTL
HTML_PRINT MASKTEXT
PRINTL
CUSTOMDRAWLINE ＝

FONTREGULAR
RESETCOLOR

;-------------------------------------------------
;0の場合に真になるRAND
;-------------------------------------------------
@RANDR(ARG)
#FUNCTION
SIF ARG <= 0
	RETURNF 0
SIF RAND:ARG == 0
	RETURNF 1
RETURNF 0

;-------------------------------------------------
;条件分岐用のRAND
;ARGには最低分岐数を入れる
;nを正の整数とすると RANDIF(n, TALENT:強気, ABL:欲望 >= 3) は、
;RAND:(n + LIMIT(TALENT:強気, 0, 1) + (ABL:欲望 >= 3) ) == 0 に等しい
;主に、IF TALENT:高慢 && RANDIF(2, TALENT:強気, ABL:欲望 >= 3) 等のように用いる
;-------------------------------------------------
@RANDIF(ARG, ARG:1, ARG:2, ARG:3, ARG:4, ARG:5, ARG:6, ARG:7, ARG:8, ARG:9)
#FUNCTION
#DIM LCOUNT
SIF ARG <= 0
	RETURNF 0

LOCAL = ARG
FOR LCOUNT, 1, 10
	SIF ARG:LCOUNT > 0
		LOCAL += 1
NEXT
SIF RAND:LOCAL == 0
	RETURNF 1
RETURNF 0

;-------------------------------------------------
;角色ARG:1の識別番号、游戏内の日期、時間帯の格子領帯ミングによって同じ数値を返すRAND:ARG
;-------------------------------------------------
@RANDC(ARG, ARG:1)
#FUNCTION
SIF ARG:1 <= 0 && TARGET > 0
	ARG:1 = TARGET
SIF ARG <= 0
	ARG = 3

LOCAL = (POWER(BASE:(ARG:1):識別番号%1000000000 + (DAY*2 + TIME + ARG)*10, 2) / 100) % 1000000000000

RETURNF LOCAL%ARG

;-------------------------------------------------
;游戏内の日期、時間帯、現実時間の格子領帯ミングによって同じ数値を返すRAND
;FLAG:現実時間 は現実時間に応じて値が変わり、SHOP画面と調教中の１ターンごとに取得します
;ARG:1に一つ確率に影響の出る変数を入れることが出来るので工夫してください
;性質上、随意使うのは非推奨。死に分岐ができるぞ！
;-------------------------------------------------
@RANDF(ARG, ARG:1)
#FUNCTION

SIF ARG <= 1
	RETURNF 0

;ARG:1を10倍して2乗させるので上限を設ける
ARG:1 %= 10000000

LOCAL = (POWER(FLAG:現実時間 + (DAY*2 + TIME + ARG:1)*10, 2) / 100) % 1000000000000

RETURNF LOCAL%ARG

@GET_REALTIMEFORFLAG
#DIM LCOUNT

FOR LCOUNT, 1, CHARANUM
	CFLAG:LCOUNT:カ胸罩ンド_DAILY初期値 = CFLAG:LCOUNT:カ胸罩ンド_DAILY
NEXT
FLAG:現実時間 = GETMILLISECOND() % 1000000000
RANDOMIZE FLAG:現実時間

@RESET_RANDOMIZE
#DIM LCOUNT

FOR LCOUNT, 1, CHARANUM
	CFLAG:LCOUNT:カ胸罩ンド_DAILY = CFLAG:LCOUNT:カ胸罩ンド_DAILY初期値
NEXT
RANDOMIZE FLAG:現実時間
;角色ごとに乱数をずらす
FOR LCOUNT, 0, MAX(TARGET, 1)
	SIF RAND:2
		CONTINUE
NEXT

;-------------------------------------------------
;地の文調整用
;-------------------------------------------------
@TEXT_CONJ(ARGS)
#FUNCTIONS
IF ARGS == "す"
	LOCALS = して
ELSEIF ARGS == "む"
	LOCALS = んで
ELSEIF ARGS == "る"
	LOCALS = て
ENDIF
RETURNF LOCALS

;-------------------------------------------------
;ARGを(ARG:1 / 100)倍する
;ARG = MULTIPLY(ARG, 150)　は　TIMES ARG, 1.50　と等しい。
;ARG:2はARG:1の最大値
;-------------------------------------------------
@MULTIPLY(ARG, ARG:1, ARG:2)
#FUNCTION
;0以下の数をかけたときには ARG:1 = 0 とする
SELECTCASE ARG:1
CASE IS <= 0
	RETURNF 0
CASE IS > ARG:2
	SIF ARG:2 > 0
		ARG:1 = ARG:2
ENDSELECT
RETURNF ARG * ARG:1 / 100

;-------------------------------------------------
;ARGを(100/ARG:1)倍する
;ARG = DIVIDE(ARG, 150)　は　TIMES ARG, 0.66　と大体等しく、ARG = ARG * 100 / 150　と等しい
;ARG:2はARG:1の最大値
;-------------------------------------------------
@DIVIDE(ARG, ARG:1, ARG:2)
#FUNCTION
;0以下の数では割れない
SELECTCASE ARG:1
CASE IS <= 0
	RETURNF ARG
CASE IS > ARG:2
	SIF ARG:2 > 0
		ARG:1 = ARG:2
ENDSELECT
RETURNF ARG * 100 / ARG:1

;-------------------------------------------------
;3桁ごとにカンマの入った所持金表示
;ARG:1には桁を揃える最大値を定めても良い
;-------------------------------------------------
@MONEY_C(ARG, ARG:1)
#FUNCTIONS
VARSET LOCALS
FOR LOCAL, 0, 10
	LOCALS = {ARG%1000}%LOCALS%
	IF ARG/1000
		SELECTCASE ARG%1000
		CASE IS < 10
			LOCALS = ,00%LOCALS%
		CASE IS < 100
			LOCALS = ,0%LOCALS%
		CASEELSE
			LOCALS = ,%LOCALS%
		ENDSELECT
		ARG /= 1000
	ELSE
		BREAK
	ENDIF
NEXT
IF ARG:1
	FOR LOCAL, 0, 10
		LOCALS:1 = {ARG:1%1000}%LOCALS:1%
		IF ARG:1/1000
			SELECTCASE ARG:1%1000
			CASE IS < 10
				LOCALS:1 = ,00%LOCALS:1%
			CASE IS < 100
				LOCALS:1 = ,0%LOCALS:1%
			CASEELSE
				LOCALS:1 = ,%LOCALS:1%
			ENDSELECT
			ARG:1 /= 1000
		ELSE
			BREAK
		ENDIF
	NEXT
	LOCALS = %BL(STRLENS(LOCALS:1) - STRLENS(LOCALS))%%LOCALS%
ENDIF
LOCALS = \$%LOCALS%
RETURNF LOCALS
;-------------------------------------------------
;半角スペースの出力
;-------------------------------------------------
@BL(ARG)
#FUNCTIONS
#DIM LCOUNT

LOCALS =
SIF ARG <= 0
	RETURNF LOCALS
FOR LCOUNT, 0, ARG/2
	LOCALS += "　"
NEXT
SIF ARG%2
	LOCALS += " "

RETURNF LOCALS

@DRAW(ARGS)
#FUNCTIONS
#DIM LCOUNT

SIF ARGS == ""
	ARGS = -
LOCALS =
FOR LCOUNT, 0, NUM("折り返し文字数")
	LOCALS += @"%ARGS%"
NEXT
RETURNF LOCALS

;-------------------------------------------------
;色々フラグを考慮したDELCHARA
;角色番号ARGの角色を削除する
;eramakerの命令DELCHARAと異なりTARGETとASSIを保つ
;-------------------------------------------------
@DELETE_CHARA, ARG

CALL DEL_CHARAFLAG, ARG

DELCHARA ARG

;TARGETとASSIの番号調整
IF ARG == TARGET
	TARGET = 0
ELSEIF ARG < TARGET
	TARGET -= 1
ENDIF
IF ARG == ASSI
	ASSI = 0
ELSEIF ARG < ASSI
	ASSI -= 1
ENDIF
;優先順位の整合性をとる
CALL CHECK_POSITION

;-------------------------------------------------
;TO_NUMBERを用いて角色ARGを指定しているフラグを消去する
;-------------------------------------------------
@DEL_CHARAFLAG, ARG
#DIM LCOUNT

SIF TO_NUMBER(FLAG:昼の相手) == ARG
	FLAG:昼の相手 = 0
SIF TO_NUMBER(FLAG:夜の相手) == ARG
	FLAG:夜の相手 = 0
SIF TO_NUMBER(FLAG:点心当番) == ARG
	FLAG:点心当番 = 0
SIF TO_NUMBER(CFLAG:MASTER:便当) == ARG
	CFLAG:MASTER:便当 = 0
SIF TO_NUMBER(CFLAG:MASTER:约会的约定) == ARG
	CFLAG:MASTER:约会的约定 = 0

FOR LCOUNT, 1, CHARANUM
	SIF CFLAG:LCOUNT:剃毛者 == ARG
		CFLAG:LCOUNT:剃毛者 = 0
NEXT

;この角色が写っている写真を消す
CALL DEL_CHARA_PHOTO, ARG

;-------------------------------------------------
;色々フラグを考慮した角色番号の交換関数
;角色番号ARGとARG:1の角色を交換する
;Emueraの命令SWAPCHARAと異なりTARGETとASSIとASSI:1を保つ
;-------------------------------------------------
@SWAP_CHARA, ARG, ARG:1
;並び変えで齟齬が生じるものを記録しておく
#DIM MEMO_TARGET
#DIM MEMO_ASSI, 2
MEMO_TARGET = BASE:TARGET:識別番号
SIF ASSI > 0
	MEMO_ASSI = BASE:ASSI:識別番号
SIF ASSI:1 > 0
	MEMO_ASSI:1 = BASE:(ASSI:1):識別番号

SWAPCHARA ARG, ARG:1

TARGET = TO_NUMBER(MEMO_TARGET)
SIF ASSI > 0
	ASSI = TO_NUMBER(MEMO_ASSI)
SIF ASSI:1 > 0
	ASSI:1 = TO_NUMBER(MEMO_ASSI:1)

@TALENTNAMES(ARGS, ARG)
#FUNCTIONS
SIF ARG == 0 && TARGET > 0
	ARG = TARGET
RETURNF TALENT_NAME(GETNUM(TALENT, ARGS), TALENT:ARG:ARGS, ARG)

;-------------------------------------------------
;数値によって変化する素質を加味したTALENTNAME
;ARGには素質番号、ARG:1にはその値、ARG:2には参照する角色が代入される
;-------------------------------------------------
@TALENT_NAME(ARG, ARG:1, ARG:2)
#FUNCTIONS
#DIM LCOUNT
#DIM ACTOR
#DIM VALUE
#DIM MEMO_VALUE

VALUE = ARG:1
ACTOR = ARG:2

VARSET LOCALS
LOCALS = %TALENTNAME:ARG%
SIF ACTOR == 0 && TARGET > 0
	ACTOR = TARGET

SELECTCASE TALENTNAME:ARG
CASE "処女"
	SIF VALUE == 2
		LOCALS = 処女(再生)
CASE "性反転"
	LOCALS = 元%TRUE_SEX(ACTOR)%
CASE "阴茎"
	SELECTCASE TALENT:ACTOR:阴茎
	CASE IS >= 5
		LOCALS = 規格外
	CASE 4
		LOCALS = 腕並
	CASE 3
		LOCALS = 馬根
	CASE 2
		LOCALS = 巨根
	CASE 1
		LOCALS = 普通
	CASE 0
		LOCALS = 短小
	ENDSELECT
	IF COND("真性包茎", ACTOR)
		LOCALS = %LOCALS%(真性)
	ELSEIF COND("假性包茎", ACTOR)
		LOCALS = %LOCALS%(假性)
	ELSE
		LOCALS = %LOCALS%(露茎)
	ENDIF
	SIF TALENT:ACTOR:具現 && PENIS(ACTOR) == 0
		LOCALS = 具現：%LOCALS%
CASE "陰毛年齢"
	SELECTCASE VALUE
	CASE IS >= 3
		SIF VALUE > AGE(ACTOR)
			LOCALS = 剛毛
	CASE 1, 2
		SIF VALUE < AGE(ACTOR)
			LOCALS = 薄毛
	ENDSELECT
CASE "外見年齢"
	SELECTCASE VALUE
	CASE 1
		IF TALENT:ACTOR:男性
			LOCALS = 正太
		ELSE
			LOCALS = 萝莉
		ENDIF
	CASE 2
		IF TALENT:ACTOR:男性
			LOCALS = 少年
		ELSEIF TALENT:ACTOR:娇小 && COND("種族：妖狐", ACTOR)
			LOCALS = 萝莉老太婆
		ELSE
			LOCALS = 少女
		ENDIF
	CASE 3
		IF TALENT:ACTOR:男性
			LOCALS = 青年
		ELSE
			LOCALS = 大姐姐
		ENDIF
	CASE 4
		LOCALS = 大人
	ENDSELECT
CASE "性器年齢"
	SIF CONFIG("性器年齢") == 0 || TALENT:ACTOR:男性
		RETURNF LOCALS
	MEMO_VALUE = TALENT:ACTOR:性器年齢
	TALENT:ACTOR:性器年齢 = VALUE
	IF COND("黑木耳", ACTOR)
		LOCALS = 黑木耳
	ELSEIF COND("萝莉小穴", ACTOR)
		LOCALS = 萝莉小穴
	ELSEIF COND("美穴", ACTOR)
		LOCALS = 美穴
		IF COND("色素沉淀(弱)", ACTOR)
			LOCALS += "(色素沉淀弱)"
		ELSEIF COND("色素沉淀", ACTOR)
			LOCALS += "(色素沉淀)"
		ELSEIF COND("色素沉淀(強)", ACTOR)
			LOCALS += "(色素沉淀強)"
		ENDIF
	ELSEIF COND("色素沉淀(強)", ACTOR)
		LOCALS = 色素沉淀(強)
	ELSEIF COND("色素沉淀", ACTOR)
		LOCALS = 色素沉淀
	ELSEIF COND("色素沉淀(弱)", ACTOR)
		LOCALS = 色素沉淀(弱)
	ENDIF
	TALENT:ACTOR:性器年齢 = MEMO_VALUE

CASE "妊娠不能"

CASE "容易濕"
	IF TALENT:ACTOR:男性
		LOCALS = 前列腺液多
	ELSE
		SIF VALUE >= 2
			LOCALS = 非常容易濕
	ENDIF
CASE "不易濕"
	IF TALENT:ACTOR:男性
		LOCALS = 前列腺液少
	ELSE

	ENDIF
CASE "乳頭肥大", "巨乳輪", "陰核肥大"
	SIF VALUE >= 2
		LOCALS += @"LV{VALUE}"
CASE "陥没乳頭"
	IF COND("真性陥没乳頭", ACTOR)
		LOCALS = 陥没乳頭(真性)
	ELSEIF COND("假性陥没乳頭", ACTOR)
		LOCALS = 陥没乳頭(假性)
	ENDIF
CASE "陰核包茎"
	IF COND("陰核露出", ACTOR)
		LOCALS = 陰核露出
	ELSEIF COND("陰核包茎", ACTOR)
		LOCALS = 陰核包茎
	ENDIF
CASE "完美契合"
	IF GETBIT(VALUE, 0) && GETBIT(VALUE, 1) && GETBIT(VALUE, 2)
		LOCALS = 全穴%LOCALS%
	ELSE
		SIF GETBIT(VALUE, 2)
			LOCALS = 尿道%LOCALS%
		SIF GETBIT(VALUE, 1)
			LOCALS = Ａ%LOCALS%
		SIF GETBIT(VALUE, 0)
			LOCALS = Ｖ%LOCALS%
	ENDIF
CASE "精液弱点"
	SELECTCASE VALUE
	CASE 1p0
		LOCALS = 精飲弱点
	CASE 1p1
		LOCALS = 膣内射精弱点
	CASE 1p2
		LOCALS = 肛内射精弱点
	CASE 1p3
		LOCALS = 乳内射精弱点
	CASE 1p4
		LOCALS = 尿道内射精弱点
	;CASE
	;	LOCALS = 精液ぶっかけに弱い
	ENDSELECT
CASE "巨乳"
	SELECTCASE VALUE
	CASE 2
		LOCALS = 爆乳
	CASE IS >= 3
		LOCALS = 超乳
	ENDSELECT
CASE "扶她"
	SIF VALUE == 1
		LOCALS = %LOCALS%(天然)
CASE "妊娠"
	SIF VALUE == 2
		LOCALS = 臨月
	SIF VALUE == 3
		LOCALS = 出産間近
CASE "出産経験"
	LOCALS = 出産経験:{VALUE}人
CASE "巨尻"
	SELECTCASE VALUE
	CASE 2
		LOCALS = 爆尻
	CASE IS >= 3
		LOCALS = 超尻
	ENDSELECT
CASE "Ｃ性向"
	SIF PENIS(ACTOR)
		LOCALS = Ｐ性向
CASE "有男朋友"
	SELECTCASE VALUE
	CASE 2
		LOCALS = 人妻
	ENDSELECT
CASE "肤色"
	SELECTCASE VALUE
	CASE 1
		LOCALS = 褐色肌
	CASE 2
		LOCALS = 色白
	CASE 3
		LOCALS = 青肌
	CASE 4
		LOCALS = 色黒
	ENDSELECT
;レベルが有る
CASE "娇小", "高大", "难以妊娠", "甜言蜜语", "謎之魅力", "大力士", "性豪", "吸精体質", "射精量強化", "業物", "Ｖ名器", "Ａ名器", "喉名器", "尿道名器"
	SIF VALUE >= 2
		LOCALS = %LOCALS%%TEXTS("ローマ数字", VALUE)%
CASE "復活"
	SIF VALUE > 100
		LOCALS = %LOCALS%%TEXTS("ローマ数字", VALUE/100)%
CASE "禁断的知識"
	LOCALS = [%LOCALS%%TEXTS("ローマ数字", VALUE)%]
	SIF VALUE >= 1
		LOCALS += "[淫紋の刻印]"
	SIF VALUE >= 2
		LOCALS += "[具現]"
	SIF VALUE >= 3
		LOCALS += "[認識阻害]"
	LOCALS = %SUBSTRING(LOCALS, 1, STRLENS(LOCALS) - 2)%
CASE "錬金術"
	LOCALS = %LOCALS%%TEXTS("ローマ数字", VALUE)%
CASE "調教知識"
	SELECTCASE VALUE
	CASE 1p0
		LOCALS = 愛撫・奉仕知識
	CASE 1p1
		LOCALS = 教育擅長
	CASE 1p2
		LOCALS = ＳＭ知識
	CASE 1p3
		LOCALS = Ａ調教知識
	CASE 1p4
		LOCALS = 性器拡張知識
	CASE 1p5
		LOCALS = 道具使
	CASE 1p6
		LOCALS = 露出知識
	ENDSELECT
CASE "性交熟達"
	SELECTCASE VALUE
	CASE 1p0 + 1p1 + 1p2
		LOCALS = ３穴熟達
	CASE 1p0 + 1p1, 1p0 + 1p2, 1p1 + 1p2
		LOCALS = ２穴熟達
	CASE 1p0
		LOCALS = Ｖ熟達
	CASE 1p1
		LOCALS = Ａ熟達
	CASE 1p2
		LOCALS = 尿道熟達
	ENDSELECT
CASE "口服避孕薬派"
	SIF VALUE < 0
		LOCALS = 讨厌口服避孕薬
CASE "避孕套派"
	SIF VALUE < 0
		LOCALS = 讨厌避孕套
CASE "討厭男人"
	SELECTCASE VALUE
	CASE 1
		LOCALS = 男性苦手
	CASEELSE
		LOCALS = 討厭男人
	ENDSELECT
CASE "討厭女人"
	SELECTCASE VALUE
	CASE 1
		LOCALS = 女性苦手
	CASEELSE
		LOCALS = 討厭女人
	ENDSELECT
CASE "喜欢的自慰方式"
	SELECTCASE VALUE
	CASE 1
		IF PENIS(ACTOR)
			LOCALS = 撸竿派
		ELSEIF TALENT:ACTOR:具現 && EXP:ACTOR:射精経験 >= MAX(EXP:ACTOR:絶頂経験*2/3, 1)
			LOCALS = 撸竿派
		ELSE
			LOCALS = 阴蒂派
		ENDIF
	CASE 2
		LOCALS = 扣穴派
	CASE 3
		LOCALS = 插尻派
	CASE 4
		LOCALS = 揉胸派
	CASE 5
		LOCALS = 尿道自慰派
	ENDSELECT
CASE "喜欢的体位"
	LOCALS =
	SIF GETBIT(VALUE, 0)
		LOCALS += "[正常位]"
	SIF GETBIT(VALUE, 1)
		LOCALS += "[後背位]"
	SIF GETBIT(VALUE, 2)
		LOCALS += "[屈曲位]"
	SIF GETBIT(VALUE, 3)
		LOCALS += "[対面座位]"
	SIF GETBIT(VALUE, 4)
		LOCALS += "[背面座位]"
	SIF GETBIT(VALUE, 5)
		LOCALS += "[騎乗位]"
	SIF GETBIT(VALUE, 6)
		LOCALS += "[推倒騎乗位]"

	SIF GETBIT(VALUE, 9)
		LOCALS += "[特に没有]"

	SIF GETBIT(VALUE, 10)
		LOCALS += "[Ａ正常位]"
	SIF GETBIT(VALUE, 11)
		LOCALS += "[Ａ後背位]"
	SIF GETBIT(VALUE, 12)
		LOCALS += "[Ａ屈曲位]"
	SIF GETBIT(VALUE, 13)
		LOCALS += "[Ａ対面座位]"
	SIF GETBIT(VALUE, 14)
		LOCALS += "[Ａ背面座位]"
	SIF GETBIT(VALUE, 15)
		LOCALS += "[Ａ騎乗位]"
	SIF GETBIT(VALUE, 16)
		LOCALS += "[推倒Ａ騎乗位]"

	SIF GETBIT(VALUE, 19)
		LOCALS += "[磨鏡]"

	SIF GETBIT(VALUE, 20)
		LOCALS += "[尿道正常位]"
	SIF GETBIT(VALUE, 21)
		LOCALS += "[尿道後背位]"
	SIF GETBIT(VALUE, 22)
		LOCALS += "[尿道屈曲位]"
	SIF GETBIT(VALUE, 23)
		LOCALS += "[尿道対面座位]"
	SIF GETBIT(VALUE, 24)
		LOCALS += "[尿道背面座位]"
	SIF GETBIT(VALUE, 25)
		LOCALS += "[尿道騎乗位]"
	SIF GETBIT(VALUE, 26)
		LOCALS += "[推倒尿道騎乗位]"

	LOCALS = %SUBSTRING(LOCALS, 1, STRLENS(LOCALS) - 2)%

CASE "動物耳"
	;特徴的な物のみ
	IF COND("種族：猫", ACTOR)
		LOCALS = 猫耳
	ELSEIF COND("種族：狼", ACTOR)
		LOCALS = 狼耳
	ELSEIF COND("種族：狐", ACTOR) || COND("種族：妖狐", ACTOR)
		LOCALS = 狐耳
	ELSEIF COND("種族：兎", ACTOR)
		LOCALS = 兔耳
	ELSEIF COND("種族：馬", ACTOR)
		LOCALS = 馬耳
	ELSEIF COND("種族：鼠", ACTOR)
		LOCALS = 鼠耳
	ENDIF
CASE "陰蒂環"
	SIF PENIS(ACTOR)
		LOCALS = 陰茎穿環
ENDSELECT
RETURNF LOCALS

;-------------------------------------------------
;角色ARGの順番をARG:1に変更します。ARG以外の角色の順番は保つ。
;-------------------------------------------------
@CHANGE_CHARA_NO, ARG, ARG:1
#DIM LCOUNT
#DIMS MEMO_TARGET
#DIMS MEMO_ASSI

;ポジションが同じなら終わり
SIF ARG == ARG:1
	RETURN 0
;ARG,ARG:1の値がおかしくても終わり
SIF MIN(ARG, ARG:1) < 0 || MAX(ARG, ARG:1) >= CHARANUM
	RETURN 0

MEMO_TARGET = %CALLNAME:TARGET%
SIF ASSI
	MEMO_ASSI = %CALLNAME:ASSI%

IF ARG > ARG:1
	SWAPCHARA ARG, ARG:1
	FOR LCOUNT, ARG:1 + 1, ARG
		SWAPCHARA LCOUNT, LCOUNT+1
	NEXT
ELSE
	SWAPCHARA ARG, ARG:1
	FOR LCOUNT, ARG, ARG:1 - 1
		SWAPCHARA LCOUNT, LCOUNT+1
	NEXT
ENDIF

CALL SETFLAG, "対象指定", FIND_NO(MEMO_TARGET)
SIF ASSI
	CALL SETFLAG, "助手指定", FIND_NO(MEMO_ASSI)

;ARGでONとなっているビットの数
@NUM_BIT(ARG)
#FUNCTION
#DIM LCOUNT
LOCAL = 0
FOR LCOUNT, 0, 64
	SIF GETBIT(ARG, LCOUNT)
		LOCAL += 1
NEXT
RETURNF LOCAL

;阴茎の名前
@PENISNAME(ARG)
#FUNCTIONS
;持ち主はPLAYER
IF TALENT:ARG:扶她 || TALENT:ARG:男性
	RESULTS = 阴茎
ELSE
	RESULTS = 穿戴式假陰茎
ENDIF
RETURNF RESULTS

;-------------------------------------------------
;爱心マークの出力…口上テ接吻トには組み込みにくいが、はっきりとした爱心マーク
;-------------------------------------------------
;Lucida Sans Unicode は大きめだが、下の文章をかなり消してしまうんですよねぇ
@HEARTMARK
GETFONT
CHKFONT "Times New Roman"
SIF RESULT
	SETFONT "Times New Roman"
PRINTFORM %UNICODE(0x2665)%
SETFONT RESULTS

;白抜きの爱心
@WHITE_HEARTMARK
GETFONT
CHKFONT "Times New Roman"
SIF RESULT
	SETFONT "Times New Roman"
PRINTFORM %UNICODE(0x2661)%
SETFONT RESULTS

;大号爱心マーク
@BIG_HEARTMARK
GETFONT
CHKFONT "Times New Roman"
SIF RESULT
	SETFONT "Times New Roman"
PRINTFORM %UNICODE(0x2764)%
SETFONT RESULTS

@BIG_BLACK_HEARTMARK
GETFONT
CHKFONT "メイリオ"
SIF RESULT
	SETFONT "メイリオ"
PRINTFORM %UNICODE(0x2764)%
SETFONT RESULTS

;-------------------------------------------------
;ダミーカラーの設定
;SETCOLOR SETCOLOR_DUMMY()　と使う
;元の文字と微妙に違う色の文字にすることでGPI+特有の文字のズレを解消する（ただし工夫や力技必須）
;()の中に値1～127を入れるとさらに微妙に別の色として扱えるが、10程度を超えると目に見えて違う色になってくる
;-------------------------------------------------
@SETCOLOR_DUMMY(ARG)
#FUNCTION
;RESULTの保持
LOCAL = RESULT
;現在的カラーの保持
GETCOLOR
LOCAL:1 = RESULT
RESETCOLOR

;默认ルトカラーの取得
GETCOLOR
IF ARG < 0 || ARG > 127
	LOCAL:2 = RESULT
ELSEIF RESULT%256 >= 255 - ARG
	LOCAL:2 = RESULT-(1+ARG)
ELSE
	LOCAL:2 = RESULT+(1+ARG)
ENDIF

;カラーの復元
SETCOLOR LOCAL:1
;RESULTの復元
RESULT = LOCAL

RETURNF LOCAL:2

;-------------------------------------------------
;色の設定
;-------------------------------------------------
@DEF_COLOR(ARGS)
#FUNCTION
SELECTCASE ARGS
CASE "red"
	RETURNF 0xFF0000
CASE "pink"
	RETURNF 0xFFC0CB
CASE "yellow"
	RETURNF 0xFFFF00
CASE "茶色"
	RETURNF 0x90623C
CASE "ショッキング粉紅"
	RETURNF 0xEF0EEF
CASE "粉紅"
	RETURNF 0xEF857C
CASE "爱心粉紅"
	RETURNF 0xFFC0CB
CASE "赤"
	RETURNF 0xEF5445
CASE "紅"
	RETURNF 0xB815B8
CASE "黄色"
	RETURNF 0xEFD540
CASE "暗黄色"
	RETURNF 0xC4C400
CASE "イエロー"
	RETURNF 0xFFFF00
CASE "緑色", "緑"
	RETURNF 0x70E02C
CASE "青"
	RETURNF 0x4470EF
CASE "藍色"
	RETURNF 0x165E83
CASE "水色"
	RETURNF 0xB0CCEF
CASE "暗灰色"
	RETURNF 0x404040
CASE "灰色"
	RETURNF 0x707070
CASE "明灰色"
	RETURNF 0x909090
CASE "白"
	RETURNF 0xE3E3E3
CASEELSE
	RETURNF 0xE3E3E3
ENDSELECT

;-------------------------------------------------
;BARの色付き等一括版
;ぱ。桑作のぱにめーしょんを参考にさせていただきました
;ARGSにどのゲージかを指示
;ARGにバーにする変数、ARG:1に最大値、ARG:2に文字列としての長さ が入る
;-------------------------------------------------
@PRINT_BAR, ARGS, ARG, ARG:1, ARG:2
#DIM LCOUNT
;バーの要素の色
#DIM BAR_COLOR
;枠[]を表示するか
#DIM IS_BRACKETS = 1
;バーの背景(右側の余白部分といった方が良いかもしれない)の色
#DIM BG_COLOR
;バーの要素
#DIMS BAR_CHARA
;バーに挿入する文字
#DIMS INS_CHARA

SIF ARG < 0
	ARG = 0
SIF ARG:1 < 0
	ARG:1 = 0

IF STRCOUNT(ARGS, "^枠无")
	ARGS = %EXTSTR(ARGS, "枠无")%
	IS_BRACKETS = 0
ENDIF

SIF IS_BRACKETS
	PRINTPLAINFORM [

GETFONT
CHKFONT "ＭＳ 哥特"
SIF RESULT
	SETFONT "ＭＳ 哥特"

VARSET BAR_COLOR

;色と記号の設定
SELECTCASE ARGS
CASE "ＰＡＬＡＭ絶頂"
	BAR_COLOR = DEF_COLOR("ショッキング粉紅")
CASE "ＰＡＬＡＭ"
	BAR_COLOR = ((DEF_COLOR("白")/65536)/10*(10-MIN(10, GET_PALAMLV(ARG))))*65536
	BAR_COLOR += (((DEF_COLOR("白")/256)%256)/10*(10-MIN(10, GET_PALAMLV(ARG))))*256
	BAR_COLOR += ((DEF_COLOR("白")%256)/10*(10-MIN(10, GET_PALAMLV(ARG))))
	BAR_COLOR += ((DEF_COLOR("粉紅")/65536)/10*MIN(10, GET_PALAMLV(ARG)))*65536
	BAR_COLOR += (((DEF_COLOR("粉紅")/256)%256)/10*MIN(10, GET_PALAMLV(ARG)))*256
	BAR_COLOR += ((DEF_COLOR("粉紅")%256)/10*MIN(10, GET_PALAMLV(ARG)))
CASE "赤色ゲージ"
	BAR_COLOR = DEF_COLOR("赤")
CASE "緑色ゲージ"
	BAR_COLOR = DEF_COLOR("緑")
CASE "青色ゲージ"
	BAR_COLOR = DEF_COLOR("青")
CASE "黄色ゲージ"
	BAR_COLOR = DEF_COLOR("黄色")
CASE "白色ゲージ"
	BAR_COLOR = DEF_COLOR("白")
CASE "爱心粉紅ゲージ"
	BAR_COLOR = DEF_COLOR("爱心粉紅")
CASE "桃色ゲージ"
	BAR_COLOR = DEF_COLOR("粉紅")
CASE "魂ゲージ"
	SELECTCASE ARG
	CASE IS >= 101
		BAR_COLOR = DEF_COLOR("緑")
	CASE 1 TO 100
		BAR_COLOR = DEF_COLOR("青")
	CASEELSE
		BAR_COLOR = DEF_COLOR("灰色")
	ENDSELECT
CASE "減少ゲージ"
	SELECTCASE ARG * 100 / ARG:1
	CASE IS >= 75
		BAR_COLOR = DEF_COLOR("緑")
	CASE IS >= 50
		BAR_COLOR = DEF_COLOR("青")
	CASE IS >= 25
		BAR_COLOR = DEF_COLOR("黄色")
	CASE IS >= 1
		BAR_COLOR = DEF_COLOR("紅")
	CASEELSE
		BAR_COLOR = DEF_COLOR("灰色")
	ENDSELECT
CASE "溜めゲージ"
	SELECTCASE ARG * 100 / ARG:1
	CASE IS >= 90
		BAR_COLOR = DEF_COLOR("粉紅")
	CASE IS >= 75
		BAR_COLOR = DEF_COLOR("黄色")
	CASEELSE
		BAR_COLOR = DEF_COLOR("青")
	ENDSELECT
CASE "欲求ゲージ"
	SELECTCASE ARG * 100 / ARG:1
	CASE IS >= 90
		BAR_COLOR = DEF_COLOR("ショッキング粉紅")
	CASE IS >= 75
		BAR_COLOR = DEF_COLOR("粉紅")
	CASE IS >= 50
		BAR_COLOR = DEF_COLOR("黄色")
	CASEELSE
		BAR_COLOR = DEF_COLOR("青")
	ENDSELECT
ENDSELECT

;バーの色を決定
SETCOLOR BAR_COLOR

;バーの背景色
BG_COLOR = (MAX(30, (BAR_COLOR/65536)/5)*65536 + MAX(30, ((BAR_COLOR/256)%256)/5)*256 + MAX(30, (BAR_COLOR%256)/5) )

;基本は長方形のブロック□
BAR_CHARA = %UNICODE(0x2587)%

;PALAM形式のバーの最大値の算出
SELECTCASE ARGS
CASE "ＰＡＬＡＭ", "ＰＡＬＡＭ絶頂"
	IF GET_PALAMLV(ARG) >= 16
		ARG:1 = PALAM_LV(16)
	ELSE
		ARG:1 = PALAM_LV(GET_PALAMLV(ARG) + 1) - PALAM_LV(GET_PALAMLV(ARG) )
		ARG -= PALAM_LV(GET_PALAMLV(ARG) )
	ENDIF
ENDSELECT

SELECTCASE ARG
;値が０以下
CASE IS <= 0
	;バーの色を背景色に変更
	SETCOLOR BG_COLOR
	PRINTPLAINFORM %BAR_CHARA * ARG:2%
;値が最大値以上
CASE IS >= ARG:1
	;挿入する文字列があるか？MAXとか
	VARSET INS_CHARA
	SELECTCASE ARGS
	CASE "黄色ゲージ", "白色ゲージ", "爱心粉紅ゲージ", "桃色ゲージ", "ＰＡＬＡＭ"
		SIF ARG:2 >= 3
			INS_CHARA = MAX
	ENDSELECT
	FOR LCOUNT, 0, ARG:2
		IF INS_CHARA != "" && LCOUNT == ARG:2/2 - STRLENS(INS_CHARA)/2
			SETFONT RESULTS

			PRINTPLAINFORM %INS_CHARA%

			CHKFONT "ＭＳ 哥特"
			SIF RESULT
				SETFONT "ＭＳ 哥特"

			LCOUNT += STRLENS(INS_CHARA) - 1
		ELSE
			PRINTPLAINFORM %BAR_CHARA%
		ENDIF
	NEXT
CASEELSE
	FOR LCOUNT, 0, ARG:2
		SELECTCASE LCOUNT
		CASE (ARG*ARG:2 + ARG:1 - 1) / ARG:1
			;バーの色を背景色に変更
			SETCOLOR BG_COLOR
		ENDSELECT
		PRINTPLAINFORM %BAR_CHARA%
	NEXT
ENDSELECT
RESETCOLOR

SETFONT RESULTS

SIF IS_BRACKETS
	PRINTPLAINFORM ]

;-------------------------------------------------
;ARGに数値、ARG:1に最大値(これ以上だとS)を入れる。ABLの表記に適している。
;-------------------------------------------------
@PRINT_RANK, ARG, ARG:1
SIF ARG < 0
	ARG = 0
SIF ARG:1 < 0
	ARG:1 = 10

RESETCOLOR

PRINTPLAINFORM [

GETFONT
CHKFONT "ＭＳ 哥特"
SIF RESULT
	SETFONT "ＭＳ 哥特"

IF ARG == 0
	CALL PRINT_COLORTEXT, "-", DEF_COLOR("灰色")
ELSE
	IF ARG:1 < 10
		ARG = 1 + ARG*2
		ARG:1 *= 2
	ENDIF

	SELECTCASE ARG
	;最大値以上
	CASE IS >= ARG:1
		CALL PRINT_STR, "爱心粉紅_S"
	;90%
	CASE IS >= MAX(ARG:1 * 90 / 100, 5)
		CALL PRINT_STR, "粉紅_A"
	;70%
	CASE IS >= MAX(ARG:1 * 70 / 100, 4)
		CALL PRINT_STR, "藍色_B"
	;50%
	CASE IS >= MAX(ARG:1 * 50 / 100, 3)
		CALL PRINT_STR, "黄色_C"
	;30%
	CASE IS >= MAX(ARG:1 * 30 / 100, 2)
		CALL PRINT_STR, "水色_D"
	;10%
	CASE IS >= MAX(ARG:1 * 10 / 100, 1)
		CALL PRINT_STR, "緑_E"
	;それ以下
	CASEELSE
		CALL PRINT_COLORTEXT, "-", DEF_COLOR("灰色")
		;CALL PRINT_STR, "灰色_-"
	ENDSELECT
ENDIF

SETFONT RESULTS

PRINTPLAINFORM ]

;-------------------------------------------------
;性転換イベント
;-------------------------------------------------
@CHANGE_SEX, ARG
#DIM LCOUNT
#DIMS MEMOS_TALENT, 2
#DIMS MEMO_CSTR

;まずは性転換後に記録させる素質などをMEMO_CSTRに保存しておく(男性,女性,扶她を記録するので空行列にはならない)
LOCALS = /
FOR LCOUNT, 0, VARSIZE("TALENT")
	;記録させる素質
	SELECTCASE TALENTNAME:LCOUNT
	CASE "処女", "Ｖ損傷", "淫壷", "Ｖ性向", "貧乳", "巨乳", "母乳体質", "子宮性感"
	CASE "遅漏", "早漏", "伪娘"
	CASE "女性", "扶她", "男性", "娇小", "高大", "小尻", "巨尻"
	CASEELSE
		CONTINUE
	ENDSELECT
	SIF TALENT:ARG:LCOUNT
		LOCALS += @"%TALENTNAME:LCOUNT%_{TALENT:ARG:LCOUNT}\/"
NEXT
;排他素質も記録しておく
SIF STRCOUNTS(LOCALS, "娇小", "高大") == 0
	LOCALS += "中背_1/"
SIF STRCOUNTS(LOCALS, "小尻", "巨尻") == 0
	LOCALS += "並尻_1/"
SIF TALENT:ARG:男性 == 0 && STRCOUNTS(LOCALS, "貧乳", "巨乳") == 0
	LOCALS += "並乳_1/"
MEMO_CSTR = %LOCALS%

;男は女に、女or扶她は男に
;バイオリズム重置
BASE:ARG:バイオリズム = 0

;性反転
INVERTBIT TALENT:ARG:性反転, 0

;CSTR:性転換前的素質 が既にあるなら元の性別に戻す
IF CSTR:ARG:性転換前的素質 != ""
	;一部の二者択一な素質は最初に全部0にする
	TALENT:ARG:女性 = 0
	TALENT:ARG:扶她 = 0
	TALENT:ARG:男性 = 0
	TALENT:ARG:高大 = 0
	TALENT:ARG:娇小 = 0
	TALENT:ARG:巨尻 = 0
	TALENT:ARG:小尻 = 0
	TALENT:ARG:巨乳 = 0
	TALENT:ARG:貧乳 = 0

	VARSET LOCALS
	SPLIT CSTR:ARG:性転換前的素質, "/", LOCALS

	;CSTR:性転換前的素質は/から始圆圈からLOCALS:0は空文字なので飛ばす
	FOR LCOUNT, 1, 100
		SELECTCASE LOCALS:LCOUNT
		CASE ""
			BREAK
		ENDSELECT

		VARSET MEMOS_TALENT
		SPLIT LOCALS:LCOUNT, "_", MEMOS_TALENT

		SELECTCASE MEMOS_TALENT
		;二者択一的な素質のうち、実際の素質自体は存在しないもの
		CASE "中背", "並尻", "並乳"
			CONTINUE
		ENDSELECT

		TALENT:ARG:MEMOS_TALENT = TOINT(MEMOS_TALENT:1)
	NEXT
;性転換させる
ELSE
	IF TALENT:ARG:男性
		TALENT:ARG:男性 = 0
		TALENT:ARG:女性 = 1
		;以下は、女性化BOUNS
		IF ABL:ARG:欲望 >= 3
			TALENT:ARG:Ｖ性向 = RAND:2
			TALENT:ARG:容易濕 = RAND:2
		ENDIF

		;胸の尺寸
		IF RAND:3 == 0
			CALL CALC, "貧乳化", ARG
			SIF RAND:3 == 0
				CALL CALC, "娇小化", ARG
		ELSEIF RAND:2
			CALL CALC, "巨乳化", ARG
		ELSE
			CALL CALC, "並乳化", ARG
		ENDIF
		;処女はサービス！w
		IF EXP:ARG:Ｖ経験 == 0
			TALENT:ARG:処女 = 1
		ELSE
			TALENT:ARG:処女 = 2
		ENDIF
	ELSE
		TALENT:ARG:女性 = 0
		TALENT:ARG:扶她 = 0
		TALENT:ARG:男性 = 1
		CALL CALC, "男乳化", ARG
	ENDIF
ENDIF

;元の性別に返回際に必要なものを記録しておく
CSTR:ARG:性転換前的素質 = %MEMO_CSTR%

;性別特有の有えない素質の消去や妊娠素質の調整
IF TALENT:ARG:男性
	FOR LCOUNT, 0, 200
		SIF CALCF("女性特有の素質", LCOUNT)
			TALENT:ARG:LCOUNT = 0
	NEXT
ELSEIF TALENT:ARG:女性
	FOR LCOUNT, 0, 200
		SIF CALCF("男性特有の素質", LCOUNT)
			TALENT:ARG:LCOUNT = 0
	NEXT
ENDIF

TALENT:ARG:Ａ妊娠体質 = 0
IF COND("一般にＶ妊娠不能", ARG)
	TALENT:ARG:Ｖ妊娠不能 = 1
ELSE
	SIF CSVTALENT(NO:ARG, GETNUM(TALENT, "Ｖ妊娠不能") ) == 0
		TALENT:ARG:Ｖ妊娠不能 = 0
ENDIF

;童貞判定など
CALL GET_EXTALENT, ARG

;続いて胸と尻と身高の調整。ここは持っている素質に従う
CALL SETFLAG, "素質から身高と３围を再測定", ARG

CALL CHECK_FAV_ONANIE, ARG
CALL CHECK_FAV_POSITION, ARG
CALL SETFLAG, "性転換フラグ", ARG
CALL RECORD_SP_EXP, ARG

@MEMO_CHANGE_SEX(ARG)
#FUNCTIONS
#DIM LCOUNT
LOCALS = /
FOR LCOUNT, 0, VARSIZE("TALENT")
	;記録させる素質
	SELECTCASE TALENTNAME:LCOUNT
	CASE "処女", "Ｖ損傷", "淫壷", "Ｖ性向", "貧乳", "巨乳", "母乳体質", "子宮性感"
	CASE "遅漏", "早漏", "伪娘", "童貞"
	CASE "女性", "扶她", "男性", "娇小", "高大", "小尻", "巨尻"
	CASEELSE
		CONTINUE
	ENDSELECT
	SIF TALENT:ARG:LCOUNT
		LOCALS += @"%TALENTNAME:LCOUNT%_{TALENT:ARG:LCOUNT}\/"
NEXT
;排他素質も記録しておく
SIF STRCOUNTS(LOCALS, "娇小", "高大") == 0
	LOCALS += "中背_1/"
SIF STRCOUNTS(LOCALS, "小尻", "巨尻") == 0
	LOCALS += "並尻_1/"
SIF TALENT:ARG:男性 == 0 && STRCOUNTS(LOCALS, "貧乳", "巨乳") == 0
	LOCALS += "並乳_1/"
RETURNF LOCALS

;-------------------------------------------------
; メモを作成・表示する関数です
;   ARGS:0 : メモの中に表示する文字列
;          : /で区切ることで複数行渡すことが出来ます
;          : また、以下の特殊処理を行います
;          : ・_T_ タブを挿入します(半角スペース8つ分)
;          :       文字の整列にお使い下さい
;          : ・_H_ 爱心マークを挿入します
;          :       フォントの都合上、爱心マークを挿入すると
;          :       枠が移開ますのでご注意下さい
;   ARGS:1 : メモの色を指定します
;          : 内部でDEF_COLORをコールしていますので、
;          : 使用可能な文字列はDEF_COLORを参照して下さい
;          : 省略した場合、いくつかの中から随机で選択します
;   ARG    : 枠のマージンです
;          : 指定した数の「半角」スペース分だけ、枠の左側に
;          : スペースが設けられます
;          : 省略した場合、６（全角スペース３つ分）となります
;   Note.
;     渡されたテ接吻トの書かれたメモを作成・表示します
;     枠のサイズはテ接吻トによって自動で変化します
;-------------------------------------------------
@PRINT_LETTER, ARGS:0, ARGS:1, ARG
#DIM LINE_COUNT
#DIM LINE_NUM
#DIM LEN
#DIM LEN_TMP
#DIM CNT
#DIMS TMPS, 20
#DIMS COLORS
#DIMS WORKS
	VARSET LOCALS
	VARSET LOCAL
	LEN = 0

	SPLIT ARGS:0, "/", LOCALS
	LINE_NUM = RESULT
	LEN = 0
	FOR LINE_COUNT, 0, LINE_NUM
		; タブを復帰した場合を想定した上で最大文字列長(半角)を得る
		VARSET WORKS
		SPLIT LOCALS:LINE_COUNT, "_", TMPS
		FOR CNT, 0, RESULT
			SELECTCASE TMPS:CNT
				CASE "T"
					WORKS += " "
					WHILE (STRLENS(WORKS) % 8 != 0)
						WORKS += " "
					WEND
			CASEELSE
				WORKS += TMPS:CNT
			ENDSELECT
		NEXT
		SIF STRLENS(WORKS) > LEN
			LEN = STRLENS(WORKS)
	NEXT
	SIF LEN % 2
		LEN += 1

	; 描画
	;   色選択
	COLORS = %ARGS:1%
	IF COLORS == ""
		SELECTCASE RAND:10
			CASE 0
				COLORS = ショッキング粉紅
			CASE 1
				COLORS = 粉紅
			CASE 2
				COLORS = 爱心粉紅
			CASE 3
				COLORS = 黄色
			CASE 4
				COLORS = イエロー
			CASE 5
				COLORS = 緑
			CASE 6
				COLORS = 青
			CASE 7
				COLORS = 水色
		ENDSELECT
	ENDIF
	SETCOLOR DEF_COLOR(COLORS)

	;   上枠
	SIF ARG == 0
		ARG = 6
	;     ヘッダのスペース
	FOR CNT, 0, ARG
		PRINT
	NEXT
	;     枠線(+1 はパディング用、+2 は左右の枠線分)
	FOR CNT, 0, (LEN / 2) + 1 + 2
		IF CNT == 0
			PRINT ┏
		ELSEIF CNT == ((LEN / 2) + 1 + 2) - 1
			PRINTL ┓
		ELSE
			PRINT ━
		ENDIF
	NEXT

	;   本分
	FOR LINE_COUNT, 0, LINE_NUM
		;     ヘッダのスペース
		FOR CNT, 0, ARG
			PRINT
		NEXT
		; 枠線、文字列
		LEN_TMP = 0
		PRINT ┃
		SPLIT LOCALS:LINE_COUNT, "_", TMPS
		LOCAL = RESULT
		FOR CNT, 0, LOCAL
			SELECTCASE TMPS:CNT
				CASE "H"
					CALL HEARTMARK
					LEN_TMP += 1
				CASE "T"
					PRINT
					LEN_TMP += 1
					WHILE ((LEN_TMP % 8) != 0)
						PRINT
						LEN_TMP += 1
					WEND
			CASEELSE
				PRINTFORM %TMPS:CNT%
				LEN_TMP += STRLENS(TMPS:CNT)
			ENDSELECT
		NEXT
		; 後ろ揃え
		WHILE (LEN_TMP < LEN)
			PRINT
			LEN_TMP += 1
		WEND
		PRINTL  ┃
	NEXT

	;   下枠
	;     ヘッダのスペース
	FOR CNT, 0, ARG
		PRINT
	NEXT
	;     枠線
	FOR CNT, 0, (LEN / 2) + 1 + 2
		IF CNT == 0
			PRINT ┗
		ELSEIF CNT == ((LEN / 2) + 1 + 2) - 1
			PRINTL ┛
		ELSE
			PRINT ━
		ENDIF
	NEXT

	RESETCOLOR

RETURN 0

;----------------------------------------------------------------------------------
;精液弱点場合、精液欲が満たされやすい
;ARG  　射精された角色(TARGET or TARGET:1)
;----------------------------------------------------------------------------------
@EJAC_BONUS(ARG)
#FUNCTION
#DIM SPERM
SPERM = 0
SIF COND("精飲弱点", ARG) && (SHOOT("口") || SHOOT("口淫"))
	SPERM += 1

SIF COND("膣内射精弱点", ARG) && (SHOOT("膣内") || SHOOT("Ｖ中出し"))
	SPERM += 2

SIF COND("肛内射精弱点", ARG) && (SHOOT("肛門") || SHOOT("Ａ中出し"))
	SPERM += 2

SIF COND("乳内射精弱点", ARG) && (SHOOT("二プルファック") || SHOOT("乳内中出し"))
	SPERM += 2

SIF COND("尿道内射精弱点", ARG) && SHOOT("尿道中出し")
	SPERM += 3

RETURNF SPERM

;----------------------------------------------------------------------------------
;EXISTCSVの特定番号で0を変えさせる版
;----------------------------------------------------------------------------------
@EXISTCSV_EX(ARG)
#FUNCTION
SELECTCASE ARG
;你とドッペル你
CASE 0, 99
	RETURNF 0
CASEELSE
	RETURNF EXISTCSV(ARG)
ENDSELECT

;----------------------------------------------------------------------------------
;文字列ARGSに含まれているCALLNAMEから角色の番号を返す関数
;----------------------------------------------------------------------------------
@GET_CHARANUM(ARGS)
#FUNCTION
#DIM LCOUNT
FOR LCOUNT, 2, CHARANUM
	SIF STRCOUNT(ARGS, CALLNAME:LCOUNT)
		RETURNF LCOUNT
NEXT
RETURNF 0

;----------------------------------------------------------------------------------
;"/"区切りで要素指定している文字列ARGSの末尾に %ARGS:1%/…%ARGS:4%/ を追加する関数。ARGS:1～4が既にある場合には無視する
;ARGS = %SETSTR(ARGS, ARGS:1)% のように使う
;----------------------------------------------------------------------------------
@SETSTR(ARGS, ARGS:1, ARGS:2, ARGS:3, ARGS:4)
#FUNCTIONS
#DIM LCOUNT
#DIM IS_IGNORE, 5

VARSET LOCALS
SPLIT ARGS, "/", LOCALS

VARSET IS_IGNORE
ARGS =
FOR LCOUNT, 0, 100
	SELECTCASE LOCALS:LCOUNT
	CASE ""
		CONTINUE
	CASE ARGS:1
		IS_IGNORE:1 = 1
	CASE ARGS:2
		IS_IGNORE:2 = 1
	CASE ARGS:3
		IS_IGNORE:3 = 1
	CASE ARGS:4
		IS_IGNORE:4 = 1
	ENDSELECT
	ARGS += @"%LOCALS:LCOUNT%/"
NEXT
FOR LCOUNT, 1, 5
	SIF IS_IGNORE:LCOUNT == 0 && ARGS:LCOUNT != ""
		ARGS += @"%ARGS:LCOUNT%/"
NEXT
RETURNF ARGS

;----------------------------------------------------------------------------------
;SETSTRの文字列消去版
;----------------------------------------------------------------------------------
@CLEARSTR(ARGS, ARGS:1, ARGS:2, ARGS:3, ARGS:4)
#FUNCTIONS
#DIM LCOUNT

VARSET LOCALS
SPLIT ARGS, "/", LOCALS

ARGS =
FOR LCOUNT, 0, 100
	SELECTCASE LOCALS:LCOUNT
	CASE "", ARGS:1, ARGS:2, ARGS:3, ARGS:4
		CONTINUE
	ENDSELECT
	ARGS += @"%LOCALS:LCOUNT%/"
NEXT
RETURNF ARGS

;----------------------------------------------------------------------------------
;SETSTRをSTRCOUNTSで一致させる版
;----------------------------------------------------------------------------------
@CLEARSTRMATCH(ARGS, ARGS:1, ARGS:2, ARGS:3, ARGS:4)
#FUNCTIONS
#DIM LCOUNT

VARSET LOCALS
SPLIT ARGS, "/", LOCALS

ARGS =
FOR LCOUNT, 0, 100
	SELECTCASE LOCALS:LCOUNT
	CASE ""
		CONTINUE
	CASEELSE
		SIF STRCOUNTS(LOCALS:LCOUNT,  ARGS:1, ARGS:2, ARGS:3, ARGS:4)
			CONTINUE
	ENDSELECT
	ARGS += @"%LOCALS:LCOUNT%/"
NEXT
RETURNF ARGS

;----------------------------------------------------------------------------------
;CALLNAMEがARGSの角色の番号を返す
;----------------------------------------------------------------------------------
@FIND_NO(ARGS)
#FUNCTION
#DIM LCOUNT

;まずは現在的CALLNAMEを見る
SIF FINDCHARA(CALLNAME, ARGS) > 0
	RETURNF FINDCHARA(CALLNAME, ARGS)
;次にCSVCALLNAMEを見る
FOR LCOUNT, 1, CHARANUM
	SIF ARGS == CSVCALLNAME(NO:LCOUNT)
		RETURNF LCOUNT
NEXT
RETURNF 0

;-------------------------------------------------
;ARG個改行を挟む
;-------------------------------------------------
@MULTILINE, ARG
#DIM DYNAMIC LCOUNT

SIF ARG <= 0
	RETURN 0

FOR LCOUNT, 0, ARG
	PRINTL
NEXT
;-------------------------------------------------
;画面全体で何行表示されるか調べる関数
;ちょっとでも一番上の行が表示されてるとカウントされるのでほぼ+1に近いかも
;-------------------------------------------------
@WINDOWROWS
#FUNCTION
#DIM DYNAMIC LINE

LINE = CLIENTHEIGHT()/GETCONFIG("一行の高さ")
SIF CLIENTHEIGHT()%GETCONFIG("一行の高さ")
	LINE += 1

RETURNF LINE

@IS_EMPTY(LINENO)
#FUNCTION
#DIM DYNAMIC LINENO

SIF HTML_TOPLAINTEXT(HTML_GETPRINTEDSTR(LINENO)) == " "
	RETURNF 1

RETURNF 0

;-------------------------------------------------
;ARGから表示している文章を取得する
;改行は考慮せず、半角全角空白文字だけの行は無視する
;0から表示すると、とんでもない文字数になるので制限として20行まで
;-------------------------------------------------
@GETPRINTEDSENTENCE(ARG)
#FUNCTIONS
#DIM DYNAMIC LCOUNT
#DIM DYNAMIC LSTART
#DIMS DYNAMIC PRINTED_STR
#DIMS DYNAMIC RETURN_STR

LSTART = MIN(LINECOUNT - ARG, 20)

SIF LSTART <= -1
	RETURNF ""

FOR LCOUNT, LSTART, -1, -1
	PRINTED_STR = %HTML_TOPLAINTEXT(HTML_GETPRINTEDSTR(LCOUNT))%

	SELECTCASE PRINTED_STR
	CASE "", " ", "　"
	CASEELSE
		RETURN_STR += PRINTED_STR
	ENDSELECT
NEXT

RETURNF RETURN_STR