--洩矢諏訪子用ai
--しなうす式/20220710check

require("function_pun_strage.lua")
head_req_list()

function main()
--シード生成、スレッド生成、base_states設定
	set_seedthreadstates()
--キャラ確認
	char_calling()
--ステージが 核融合炉心部 だと超反応モードに
	set_printsabot()

while true do
--スレッド外初期化
	while_top()

--●どちらかが体力無くなったら待機
	if interbattle_condi()==true then
		interbattle_exe()
--▼開幕行動▼
	elseif kaimaku_condi()==true then
		kaimaku_exe()
--▼移動起き上がり
	elseif my_act==97 or my_act==98 then --基本：画面端より遠ざかる。中央では相手から遠ざか…りたいが、設置技警戒のため、相手側に移動起き上がり。
		movedgetup_exe()

--▼簡易受け身▼：攻撃ないし回避いずれの目的であってもリカバリーポイントは限られるが、そういうことはさておき実装したもの
	elseif recovery_condi()==true then
		recovery_exe()

--▼台風になった時、フラグに従って「緋想の剣」を使用
	elseif y==0 and my_act<=10 and card_check(14) and flag_kishitu==1 then
		print("天候フラグＯＮ　⇒　「緋想の剣」使用");
		card_use(14);

--▼台風▼：近接状態からの強引な状況変更を行う行動。スペカなど使用。
	elseif react_rejecttaihu_condi()==true then
		react_rejecttaihu_exe()

--▼起き攻め▼
	elseif setplay_ongetup_condi()==true then
		setplay_ongetup_exe()
--▼ＨＪＣ▼
	--地上HJC
	elseif hjc_ground_condi()==true then
		hjc_ground_exe()
	--空中HJC
	elseif hjc_air_condi()==true then
		hjc_air_exe()

--▼反応行動
--反応：下段
	elseif 	react_lowattack_condi()==true then
		react_lowattack_exe()
--反応：地対空
	elseif react_g2a_condi()==true then
		react_g2a_exe()
--反応：低空飛翔
	elseif react_lowj6d_condi()==true then
		react_lowj6d_exe()
--上空追いかけ
	elseif ueoikake_condi()==true then
		ueoikake_exe()
--霊撃 or 霊撃札
	elseif reigeki_condi()==true then 
		print("拒否行動：霊撃　⇒　可能ならば使用");
		card_use(0)
		
--▼グレイズ：相手行動に対する反射or一定距離内のオブジェクト感知▼
--モーション反応グレイズ
	elseif
	graze_condition_xrange()==true and
	state_nottrueguard()==true and 
	my_airEX>=1 and 
	my_rei>=0 
	then--近距離時のグレイズ。のさばらせておくと、誤結界の原因となる。ガードの硬直間際ならok
		print("check 1 -> graze act X Range");
		graze_action_xrange()
			
--▼ ガード行動：簡易ガードルーチン▼
--▼ ガード反撃、龍魚の羽衣 13
	elseif hagoromo_1st_condi()==true or hagoromo_condi()==true then
		hagoromo_exe()

--回避結界
	elseif kekkai_condi()==true then
		kekkai_exe()

--▼ 宵越しの銭 12
	elseif yoikoshi_1st_condi()==true or yoikoshi_condi()==true then
		yoikoshi_exe()

--▼汎用中下段ガード
--基本は行動に対して後退入れ込み。下段のみ抽出して反応。通常射撃も同じく下段で受ける(けどメンドウだから今回は省き)。フラグを抜けてくるものは別個に対応
	elseif lowattack_aflags_condi()==true then
		guard_backexpectlowattack_exe()
	elseif overheadattack_aflags_condi()==true then
		guard_backoverheadattack_exe()
--下段判定をフィルタ
	elseif lowattack_flaged_condi()==true then
		guard_backexpectlowattack_exe()
--フラグを抜けてくるものをフィルタ
	elseif lowattack_unflaged_condi()==true then
		guard_backexpectlowattack_exe()
--屈状態では低空昇り攻撃には立てない
	elseif notstand_overhead_upjump_condi()==true then
		guard_backexpectlowattack_exe()
--以下、何もフィルタされなかった場合、立ちガード
	elseif guard_pun_condi()==true then
		guard_backoverheadattack_exe()

--[[▼オブジェが至近距離の場合、着地直前にｈｊを仕込む、タッチ＆ゴーグレイズ
	elseif touchandgo_00_condi() then
		touchandgo_00_exe()
--オブジェが至近距離の場合、ガードの前に、離陸
	elseif touchandgo_01_condi() then
		touchandgo_01_exe()
	elseif touchandgo_02_condi() then
		touchandgo_02_exe()
--]]
--オブジェが至近距離の場合、空中から地上へ飛翔　※咲夜：２D：120.0以上、３D：84.9以上必要
	elseif graze_pun_condi()==true then
		graze_pun_exe()
		
--遠距離時のグレイズ
	elseif graze_farground_condi() then
		graze_farground_exe()
	elseif graze_farair_condi() then
		graze_farair_exe()
		
--特定状況におけるガード
	elseif guard_objgimmick_condi()==true then
		guard_backexpectlowattack_exe()
--オブジェが至近距離の場合、ガード:射撃と打撃を重ねられると、しゃがみガードしてしまう。優先順位の変更が必要
	elseif guard_objclosedis_condi()==true then
		guard_backexpectlowattack_exe()
	
--▼起き上がり直後の行動
	elseif move_soonaftergetup_condi()==true then
		move_soonaftergetup_exe()

--離陸後の刺し込み
	elseif (my_act>=208 and my_act<=212 and my_allframe>=3) and enemy_act~=97 and enemy_act~=98 and not(enemy_act>=197 and enemy_act<=199) and ey>0 and ey<200 and dis<=200 and ey<=200 and is_dir_front and ((get_fflags(1,64) and enemy_allframe<=2)or(get_fflags(1,64)==false)) then
		print("テイクオフ＆刺し込みJ6A");
		key_resetEX();
		key_event2(ACT_A,front);

--▼攻撃行動▼
--諏訪キャン:(諏訪清水：暗転前18F、1/5速),(手長足長さま：暗転前12F、1/5速)
	elseif y>0 and (my_act==322 or my_act==332 or (my_act>=540 and my_act<=543)) and my_hitstop<=2 and
	(not(enemy_act>=50 and enemy_act<=89) or (my_act==322 and ((get_skill_lv(0,10)==-1 and card_check(110)==false) or (get_skill_lv(0,10)>=0 and my_rei<200)))) and
	(
	(my_card==201 and my_spell_more(1000)==true and y+(my_yspeed*2)+(2*(1*m_gs)/2)+((my_yspeed+m_gs*2)/5*1)<=0) or 
	(my_card==207 and my_spell_more(2000)==true and y+(my_yspeed*2)+(2*(1*m_gs)/2)+((my_yspeed+m_gs*2)/5*1)<=0)
	) then
		print("諏訪キャン");
		key_event(ACT_BC);
	elseif (my_act==322 or my_act==332 or (my_act>=540 and my_act<=543)) and my_hitstop==0 and card_check(207)==true and my_spell_more(2000)==true and y>0 then
		print("諏訪キャン　準備　⇒　１枚目：土着神「手長足長さま」");
		card_1st(207);
	elseif (my_act==322 or my_act==332 or (my_act>=540 and my_act<=543)) and my_hitstop==0 and card_check(201)==true and my_spell_more(1000)==true and ((card_check(207)==false) or (card_check(207)==true and my_spell_more(2000)==false)) and y>0 then
		print("諏訪キャン　準備　⇒　１枚目：源符「諏訪清水」");
		card_1st(201);
		
--コンボ
	elseif my_act==321 and (enemy_act>=50 and enemy_act<=71) and (((ey<50 or ey>1230) and my_allframe>=33 and my_hitstop<=3 and my_hitstop>=0) or (ey>=50 and ey<=1230 and my_allframe>=27 and my_hitstop<=3 and my_hitstop>=0)) then
		key_resetEX();print("コンボ用Ａ攻撃");
		key_event(ACT_A);
--JA>J6A
	elseif my_act==306 and (enemy_act>=50 and enemy_act<=71) and my_allframe>=30 and my_hitstop<=3 and my_hitstop>=1 and ey>0 and is_dir_front==true then
		key_resetEX();print("コンボ用Ａ攻撃");
		key_event2(ACT_A,front);
--固め
	elseif (my_act==306 or my_act==651 or my_act==657) and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and y>0 and (((y+(my_yspeed*2)+(2*(1*(-0.1))/2)<=1) and my_hitstop==0) or (y+my_yspeed<=1 and (my_hitstop<=2 or my_hitstop>=1))) then
		print("LOCK ON：A"); 
	--近A始動：固め兼コンボ　AA>AAA(4hit)>B>66>JA>JB>66>JA~
		key_resetEX(); key_event(ACT_A); 
	elseif my_act==300 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=1 then
		print("LOCK ON：AA"); 
		key_resetEX(); key_event(ACT_A); 
		elseif my_act==320 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=1 then
			print("LOCK ON：AAA"); 
			key_resetEX(); key_event(ACT_A); 
			
			--elseif my_act==321 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and 
			--my_allframe>=33 and my_rei>=200 and my_hitstop<=3 and my_hitstop>=0 and card_check(201)==true then
			--	print("LOCK ON：AAAA"); 
			--	key_resetEX(); key_event(ACT_A); 
			
			elseif my_act==321 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and my_allframe>=33 and my_rei>=200 and my_hitstop<=3 and my_hitstop>=0 then
				print("LOCK ON：B 1st"); 
				key_resetEX(); key_event(ACT_B); 
				elseif my_act==404 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166) or enemy_act<=10) and my_allframe>=18 and my_allframe<=24 then
					print("LOCK ON：J66");  
					key_resetEX();
					key_event(front); key_event(front);
					elseif my_act==202 and dis<=300 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) then--and my_allframe>=6 and my_allframe<=9 then
						print("LOCK ON：JA");  
						key_resetEX(); key_event(ACT_A); 
						
			elseif my_act==306 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) and my_allframe>=30 and my_rei>=200 and my_hitstop<=3 and my_hitstop>=1 and my_air<=1 then
				print("LOCK ON：B 2nd");  
				key_resetEX(); key_event(ACT_B); 
						--elseif my_act==306 and ey==0 and ((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=166)) then
						--	key_resetEX(); print("着地まで待機");  
	--遠Ａ始動：LA>6C>祟り
	elseif my_act==301 and enemy_act>=50 and enemy_act<=166 and enemy_act~=97 and enemy_act~=98 and my_hitstop<=3 and my_hitstop>=1 and my_rei>=200 then
		print("6C");
		key_resetEX(); key_event2(ACT_C,front);
		elseif my_act==411 and my_allframe<=18 and my_rei>=200 then
			key_resetEX();
			if my_card==103 then
				print("土着神の祟り。スキカ使用でレベルＵＰ");
				key_event(ACT_BC);
			elseif my_card~=103 then
				print("土着神の祟り");
				lvr22(ACT_B);
			print("土着神の祟りじゃないからカード送り");
			key_event(ACT_AB);
			end--
	--６Ａ or ＤＢ始動：〜>Cホールド
	elseif (my_act==302 or my_act==408) and enemy_act>=50 and enemy_act<=166 and enemy_act~=97 and enemy_act~=98 and my_hitstop<=3 and my_hitstop>=0 and my_rei>=200 and is_dir_front==true then
		print("〜＞Ｊ６Ｃ");
		key_resetEX();
		key_event2(ACT_C,front);
	--Ｊ２Ａ始動：〜>J6C
	elseif my_act==308 and enemy_act>=50 and enemy_act<=166 and enemy_act~=97 and enemy_act~=98 and my_hitstop<=3 and my_hitstop>=0 and my_rei>=200 and is_dir_front==true then
		print("〜＞Ｊ６Ｃ");
		key_resetEX();
		key_event2(ACT_C,front);
	--４Ａ始動：4A>6A
	elseif my_act==330 and enemy_act>=50 and enemy_act<=166 and enemy_act~=97 and enemy_act~=98 and my_hitstop<=3 and my_hitstop>=0 then
		print("４Ａ＞６Ａ");
		key_resetEX();
		key_event2(ACT_A,front);

--▼攻撃▼

--▼spell card▼

--※諏訪子のみ、立ち、屈（葉上）、空中、地中ごとにfflagにて判定。orのコメントアウトを忘れずに。
--立ち：		get_fflags(0,1)
--葉上（屈）：	get_fflags(0,2)
--空中：		get_fflags(0,4) 
--地中：		(y==0 and get_fflags(0,1)==false and get_fflags(0,2)==false and get_fflags(0,4)==false)

--▼cost2

--源符「諏訪清水」,201,601,g,l
	--Ground,leaf
		elseif card_check(201)==true and
			my_spell_more(1000) and
			--dis<500 and
			--y==0 and
			dis_y<100 and
			(
				get_fflags(0,1) or --g
				get_fflags(0,2) --or --l
				--get_fflags(0,4) or --a
				--(get_fflags(0,1)==false and get_fflags(0,2)==false and get_fflags(0,4)==false) --ug
			) and
			not(my_act>=50 and my_act<180) and my_act<600 and 
			get_fflags(0,32)==true and
			get_fflags(0,8)==false and get_fflags(1,8)==false and 
			enemy_obj_range_in(150,60)==false and 
			is_dir_front==true and 
			subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
				print("源符「諏訪清水」");
				card_use(201);

--神具「洩矢の鉄の輪」,204,604,654,g,a
	--Ground,air
		elseif card_check(204)==true and
			my_spell_more(1000) and
			--dis<320 and
			--y==0 and
			--ey<50 and
			(
				get_fflags(0,1) or --g
				--get_fflags(0,2) or --l
				get_fflags(0,4) --or --a
				--(get_fflags(0,1)==false and get_fflags(0,2)==false and get_fflags(0,4)==false) --ug
			) and
			not(my_act>=50 and my_act<180) and my_act<600 and 
			get_fflags(0,32)==true and
			get_fflags(0,8)==false and get_fflags(1,8)==false and 
			enemy_obj_range_in(150,60)==false and 
			--is_dir_front==true and 
			subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
				print("神具「洩矢の鉄の輪」");
				card_use(204);

--▼cost3

--土着神「洩矢神」,200,600,g
	--Ground
		elseif card_check(200)==true and
			my_spell_more(1500) and
			dis<400 and
			--y==0 and
			ey<200 and
			(
				get_fflags(0,1) --or --g
				--get_fflags(0,2) or --l
				--get_fflags(0,4) or --a
				--(get_fflags(0,1)==false and get_fflags(0,2)==false and get_fflags(0,4)==false) --ug
			) and
			not(my_act>=50 and my_act<180) and my_act<600 and 
			get_fflags(0,32)==true and
			get_fflags(0,8)==false and get_fflags(1,8)==false and 
			--enemy_obj_range_in(150,60)==false and 
			--is_dir_front==true and 
			subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
				print("土着神「洩矢神」");
				card_use(200);

--開宴「二拝二拍一拝」,202,602,652,g,u
	--Ground,underground
		elseif card_check(202)==true and
			my_spell_more(1500) and
			dis<400 and
			--y==0 and
			dis_y<200 and
			(
				get_fflags(0,1) or --g
				--get_fflags(0,2) or --l
				--get_fflags(0,4) or --a
				(get_fflags(0,1)==false and get_fflags(0,2)==false and get_fflags(0,4)==false) --ug
			) and
			not(my_act>=50 and my_act<180) and my_act<600 and 
			get_fflags(0,32)==true and
			get_fflags(0,8)==false and get_fflags(1,8)==false and 
			enemy_obj_range_in(150,60)==false and 
			--is_dir_front==true and 
			subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
				print("開宴「二拝二拍一拝」");
				card_use(202);

--土着神「ケロちゃん風雨に負けず」,203,603,653,l,a
	--leaf,air
		elseif card_check(203)==true and
			my_spell_more(1500) and
			--dis<300 and
			--y==0 and
			--dis_y<50 and
			(
				--get_fflags(0,1) or --g
				get_fflags(0,2) or --l
				get_fflags(0,4) --or --a
				--(get_fflags(0,1)==false and get_fflags(0,2)==false and get_fflags(0,4)==false) --ug
			) and
			not(my_act>=50 and my_act<180) and my_act<600 and 
			get_fflags(0,32)==true and
			get_fflags(0,8)==false and get_fflags(1,8)==false and 
			enemy_obj_range_in(150,60)==false and 
			--is_dir_front==true and 
			subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
				print("土着神「ケロちゃん風雨に負けず」");
				card_use(203);

--▼cost4

--源符「厭い川の翡翠」,205,605,655,l,ug
	--underground,leaf
		elseif card_check(205)==true and
			my_spell_more(2000) and
			--dis<500 and
			--y==0 and
			--ey<100 and
			(
				--get_fflags(0,1) or --g
				get_fflags(0,2) or --l
				--get_fflags(0,4) or --a
				(get_fflags(0,1)==false and get_fflags(0,2)==false and get_fflags(0,4)==false) --ug
			) and
			not(my_act>=50 and my_act<180) and my_act<600 and 
			get_fflags(0,32)==true and
			get_fflags(0,8)==false and get_fflags(1,8)==false and 
			enemy_obj_range_in(150,60)==false and 
			--is_dir_front==true and 
			subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
				print("源符「厭い川の翡翠」");
				card_use(205);

--蛙狩｢蛙は口ゆえ蛇に呑まるる｣,206,606,656,g,l
	--Ground,leaf
		elseif card_check(206)==true and
			my_spell_more(2000) and
			dis<600 and
			--y==0 and
			--ey<100 and
			(
				get_fflags(0,1) or --g
				get_fflags(0,2) --or --l
				--get_fflags(0,4) or --a
				--(get_fflags(0,1)==false and get_fflags(0,2)==false and get_fflags(0,4)==false) --ug
			) and
			not(my_act>=50 and my_act<180) and my_act<600 and 
			get_fflags(0,32)==true and
			get_fflags(0,8)==false and get_fflags(1,8)==false and 
			enemy_obj_range_in(150,60)==false and 
			is_dir_front==true and 
			subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
				print("蛙狩｢蛙は口ゆえ蛇に呑まるる｣");
				card_use(206);

--土着神「手長足長さま」,207,657,a
	--air
		elseif card_check(207)==true and
			my_spell_more(2000) and
			dis2<400 and
			--y>0 and
			--ey<100 and
			(
				--get_fflags(0,1) or --g
				--get_fflags(0,2) or --l
				get_fflags(0,4) --or --a
				--(get_fflags(0,1)==false and get_fflags(0,2)==false and get_fflags(0,4)==false) --ug
			) and
			not(my_act>=50 and my_act<180) and my_act<600 and 
			get_fflags(0,32)==true and
			get_fflags(0,8)==false and get_fflags(1,8)==false and 
			enemy_obj_range_in(150,60)==false and 
			--is_dir_front==true and 
			subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
				print("土着神「手長足長さま」");
				card_use(207);

--土着神「宝永四年の赤蛙」,209,609,659,l,a
	--leaf,air
		elseif card_check(209)==true and
			my_spell_more(2000) and
			--dis<500 and
			--y>0 and
			--ey<100 and
			(
				--get_fflags(0,1) or --g
				get_fflags(0,2) or --l
				get_fflags(0,4) --or --a
				--(get_fflags(0,1)==false and get_fflags(0,2)==false and get_fflags(0,4)==false) --ug
			) and
			not(my_act>=50 and my_act<180) and my_act<600 and 
			get_fflags(0,32)==true and
			get_fflags(0,8)==false and get_fflags(1,8)==false and 
			enemy_obj_range_in(150,60)==false and 
			--is_dir_front==true and 
			subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
				print("土着神「宝永四年の赤蛙」");
				card_use(209);

--蛙休「オールウェイズ冬眠できます」,212,612,u
	--underground
		elseif card_check(212)==true and
			my_spell_more(2000) and
			--dis<500 and
			--y==0 and
			--ey<100 and
			(
				--get_fflags(0,1) or --g
				--get_fflags(0,2) or --l
				--get_fflags(0,4) or --a
				(get_fflags(0,1)==false and get_fflags(0,2)==false and get_fflags(0,4)==false) --ug
			) and
			not(my_act>=50 and my_act<180) and my_act<600 and 
			get_fflags(0,32)==true and
			get_fflags(0,8)==false and get_fflags(1,8)==false and 
			--enemy_obj_range_in(150,60)==false and 
			--is_dir_front==true and 
			subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
				print("蛙休「オールウェイズ冬眠できます」");
				card_use(212);

--▼cost5

--祟り神「赤口（ミシャグチ）さま」,208,608,g
	--Ground
		elseif card_check(208)==true and
			my_spell_more(2500) and
			dis<500 and
			--y==0 and
			ey<200 and 
			enemy_yspeed<=0 and
			(
				get_fflags(0,1) --or --g
				--get_fflags(0,2) or --l
				--get_fflags(0,4) or --a
				--(get_fflags(0,1)==false and get_fflags(0,2)==false and get_fflags(0,4)==false) --ug
			) and
			not(my_act>=50 and my_act<180) and my_act<600 and 
			get_fflags(0,32)==true and
			get_fflags(0,8)==false and get_fflags(1,8)==false and 
			enemy_obj_range_in(150,60)==false and 
			--is_dir_front==true and 
			subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
				print("祟り神「赤口（ミシャグチ）さま」");
				card_use(208);

--[[
--▼skill card▼

	--▼スキル236

		--博麗アミュレット,100,500,g,a
			--g,a
				elseif get_skill_lv(0,0)>=0 and my_rei>=400 and 
					dis>300 and
					dis_y<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("博麗アミュレット");
						lvr236(ACT_B);
				
				elseif get_skill_lv(0,0)>=0 and my_rei>=400 and 
					dis>450 and
					dis_y<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("博麗アミュレット");
						lvr236(ACT_C);
					
				elseif card_check(100)==true and my_rei>=400 and
					dis>300 and
					dis_y<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("博麗アミュレット");
						card_use(100);
		
		--妖怪バスター,104,505,g,a
			--g,a
				elseif get_skill_lv(0,4)>=0 and my_rei>=400 and 
					dis>200 and
					dis_y<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("妖怪バスター");
						lvr236(ACT_B);
					
				elseif get_skill_lv(0,4)>=0 and my_rei>=400 and 
					dis>300 and
					dis_y<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("妖怪バスター");
						lvr236(ACT_C);
					
				elseif card_check(104)==true and my_rei>=400 and
					dis>300 and
					dis_y<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("妖怪バスター");
						card_use(104);
		
		--拡散アミュレット,108,510,g

				elseif get_skill_lv(0,8)>=0 and my_rei>=400 and 
					dis>300 and
					dis_y<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("拡散アミュレット");
						lvr236(ACT_B);
					
				elseif get_skill_lv(0,8)>=0 and my_rei>=400 and 
					dis>300 and
					dis_y<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("拡散アミュレット");
						lvr236(ACT_C);
					
				elseif card_check(108)==true and my_rei>=400 and
					dis>300 and
					dis_y<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("拡散アミュレット");
						card_use(108);
		
	--▼スキル623

		--昇天脚,103,560,g

				elseif get_skill_lv(0,3)>=0 and my_rei>=400 and 
					dis<150 and
					y==0 and
					ey<200 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("昇天脚");
						lvr623(ACT_B);
					
				elseif get_skill_lv(0,3)>=0 and my_rei>=400 and 
					dis<150 and
					y==0 and
					ey<300 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					--enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("昇天脚");
						lvr623(ACT_C);
					
				elseif card_check(103)==true and my_rei>=400 and
					dis<150 and
					y==0 and
					ey<200 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("昇天脚");
						card_use(103);
		
		--抄地昇天脚,107,565,g
			--g
				elseif get_skill_lv(0,7)>=0 and my_rei>=400 and 
					dis<200 and
					y==0 and
					ey<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("抄地昇天脚");
						lvr623(ACT_B);
					
				elseif get_skill_lv(0,7)>=0 and my_rei>=400 and 
					dis<300 and
					y==0 and
					ey<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("抄地昇天脚");
						lvr623(ACT_C);
					
				elseif card_check(107)==true and my_rei>=400 and
					dis<200 and
					y==0 and
					ey<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("抄地昇天脚");
						card_use(107);
		
		--雨乞祈り,111,570,g,a
			--g,a
				elseif get_skill_lv(0,11)>=0 and my_rei>=400 and 
					dis<200 and
					dis_y<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("雨乞祈り");
						lvr623(ACT_B);
					
				elseif get_skill_lv(0,11)>=0 and my_rei>=400 and 
					dis<200 and
					dis_y<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("雨乞祈り");
						lvr623(ACT_C);
					
				elseif card_check(111)==true and my_rei>=400 and
					dis<200 and
					dis_y<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("雨乞祈り");
						card_use(111);

	--▼スキル421
		--亜空穴,102,540,g,a
			--g,a
				elseif get_skill_lv(0,2)>=0 and my_rei>=400 and 
					not(my_act>=50 and my_act<180) and my_act<600 and
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					--is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("亜空穴");
						lvr421(ACT_B);
					
				elseif get_skill_lv(0,2)>=0 and my_rei>=400 and 
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					--is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("亜空穴");
						lvr421(ACT_C);
					
				elseif card_check(102)==true and my_rei>=400 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					--is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("亜空穴");
						card_use(102);
		
		--封魔亜空穴,106,545,g,a
			--g,a
				elseif get_skill_lv(0,6)>=0 and my_rei>=400 and 
					dis<300 and
					ey<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("封魔亜空穴");
						lvr421(ACT_B);
					
				elseif get_skill_lv(0,6)>=0 and my_rei>=400 and 
					dis>300 and
					ey<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("封魔亜空穴");
						lvr421(ACT_C);
					
				elseif card_check(106)==true and my_rei>=400 and
					dis<300 and
					ey<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("封魔亜空穴");
						card_use(106);
		
		--刹那亜空穴,110,550,g
			--g
				elseif get_skill_lv(0,10)>=0 and my_rei>=400 and 
					dis2<300 and
					y==0 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					enemy_act>300 and
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					--is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("刹那亜空穴");
						lvr421(ACT_B);
					
				elseif get_skill_lv(0,10)>=0 and my_rei>=400 and 
					y==0 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==true and 
					--is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("刹那亜空穴");
						lvr421(ACT_C);
					
				elseif card_check(110)==true and my_rei>=400 and
					dis2<300 and
					y==0 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					enemy_act>300 and
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					--is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("刹那亜空穴");
						card_use(110);

	--▼スキル214
		--警醒陣,101,520,g,a
			--g,a
				elseif get_skill_lv(0,1)>=0 and my_rei>=400 and 
					dis>200 and dis<500 and
					dis_y<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("警醒陣");
						lvr214(ACT_B);
					
				elseif get_skill_lv(0,1)>=0 and my_rei>=400 and 
					dis>300 and dis<600 and
					dis_y<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("警醒陣");
						lvr214(ACT_C);
					
				elseif card_check(101)==true and my_rei>=400 and
					dis>200 and dis<500 and
					dis_y<50 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("警醒陣");
						card_use(101);	
		
		--繋縛陣,105,525,g,a
			--g,a
				elseif get_skill_lv(0,5)>=0 and my_rei>=400 and 
					dis2>300 and
					math.abs(enemy_xspeedEX)>5 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("繋縛陣");
						lvr214(ACT_B);
					
				elseif get_skill_lv(0,5)>=0 and my_rei>=400 and 
					dis2>300 and
					math.abs(enemy_yspeed)>5 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("繋縛陣");
						lvr214(ACT_C);
					
				elseif card_check(105)==true and my_rei>=400 and
					dis2>300 and
					math.abs(enemy_xspeedEX)>5 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("繋縛陣");
						card_use(105);
		
		--常置陣,109,530,g
			--g
				elseif get_skill_lv(0,9)>=0 and my_rei>=400 and 
					dis2>300 and
					y==0 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					--is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("常置陣");
						lvr214(ACT_B);
					
				elseif get_skill_lv(0,9)>=0 and my_rei>=400 and 
					dis2>500 and
					y==0 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("常置陣");
						lvr214(ACT_C);
					
				elseif card_check(109)==true and my_rei>=400 and
					dis2>300 and
					y==0 and
					not(my_act>=50 and my_act<180) and my_act<600 and 
					get_fflags(0,32)==true and
					get_fflags(0,8)==false and get_fflags(1,8)==false and 
					enemy_obj_range_in(150,60)==false and 
					--is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("常置陣");
						card_use(109);
--]]
			
--▼攻撃▼
--空中行動
	--空中打撃
		--JA:x速度そのまま。ｙ速度発生12Fより1/2:12+2
		elseif	y>0 and (my_act<=10 or my_act>=180) and my_act<300 and enemy_obj_range_in(150,60)==false and 
		(y+my_yspeed*12+(12*(11*m_gs))/2)>0 	and
					(ex-x)*my_dir-(my_xspeed+enemy_xspeed)*14		<=	60+30 	and
					(ex-x)*my_dir-(my_xspeed+enemy_xspeed)*14		>=	-60-30 	and
					(ey+enemy_yspeed*12+(12*(12*e_gs))/2)	-	(y+my_yspeed*12+(12*(11*m_gs))/2)	<=	80 		and
					(ey+enemy_yspeed*12+(12*(12*e_gs))/2)	-	(y+my_yspeed*12+(12*(11*m_gs))/2)	>=	10-120 	and subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
						print("JA");
						key_resetEX(); key_event(ACT_A);
		--J6A:x=(my_xspeed*1/5)*10+(my_xspeed*1/5+7)*5,y=(my_yspeed*1/5*15):15+2
		elseif	y>0 and (my_act<=10 or my_act>=180) and my_act<300 and enemy_obj_range_in(150,60)==false and 
		y+(my_yspeed*1/5*15)>0 	and
					(ex-x)*my_dir-((my_xspeed*1/5)*10	+(my_xspeed*1/5+7)*5	+enemy_xspeed*15)		<=	250+30 		and
					(ex-x)*my_dir-((my_xspeed*1/5)*10	+(my_xspeed*1/5+7)*5	+enemy_xspeed*15)		>=	-125-30 	and	
					(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+(my_yspeed*1/5*15))					<=	200 		and
					(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+(my_yspeed*1/5*15))					>=	60-120 		and subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
						print("J6A");
						key_resetEX(); key_event2(ACT_A,frontEX());--
		--J8A（木）:18+2F
		elseif	y>0 and ((my_act>=4 and my_act<=10) or my_act>=180) and is_dir_front==true and enemy_obj_range_in(150,60)==false and 
		((enemy_act>=50 and enemy_act<=71) or (enemy_act>=143 and enemy_act<=145)) and
		y+my_yspeed*2+(2*(1*m_gs))/2>0 and
					(
					(ex-x)*my_dir-(enemy_xspeed)*18		<=	220+30 	and
					(ex-x)*my_dir-(enemy_xspeed)*18		>=	140-30 	and
					(ey+enemy_yspeed*18+(18*(17*e_gs))/2)	-y					<=480 		and
					(ey+enemy_yspeed*18+(18*(17*e_gs))/2)	-y					>=0-120 	and
					(ey+enemy_yspeed*18+(18*(17*e_gs))/2)	-y					<=2*my_dir*((ex-x)-(enemy_xspeed)*18)-200
					) and subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
						print("Ｊ８Ａ（木）");
						key_resetEX(); key_event2(ACT_A,ACT_UP);
		--J8A（頭）:16+2F
		elseif	y>0 and ((my_act>=4 and my_act<=10) or my_act>=180) and my_act<300 and enemy_obj_range_in(150,60)==false and 
		y+my_yspeed*2+(2*(1*m_gs))/2>0 and
					(
					(ex-x)*my_dir-(enemy_xspeed)*16		<=	80+30 	and
					(ex-x)*my_dir-(enemy_xspeed)*16		>=	-80-30 	and
					(ey+enemy_yspeed*16+(16*(15*e_gs))/2)	-y				<=260 		and
					(ey+enemy_yspeed*16+(16*(15*e_gs))/2)	-y				>=140-120
					) and subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
						print("Ｊ８Ａ（頭）");
						key_resetEX(); key_event2(ACT_A,ACT_UP);--
		--J2A:40+2F
		--elseif	y>180 and (my_act<=10 or my_act>=180) and my_act<300 and enemy_obj_range_in(150,60)==false and
		--((enemy_dir==1 and ex<=280) or (enemy_dir==-1 and ex>=1000) or ey>100) and
		--y+my_yspeed*2+(2*(1*m_gs))/2>0 		and
		--			(ex-x)*my_dir-(enemy_xspeed)*40		<=	0+30 	and
		--			(ex-x)*my_dir-(enemy_xspeed)*40		>=	-50-30 	and
		--			(ey+enemy_yspeed*40+(40*(39*e_gs))/2)<=120 and subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
		--				print("J2A");
		--				key_resetEX(); key_event2(ACT_A,ACT_DOWN);--

--地上行動
--236系スキル
	--大地の湖
	--elseif dis<=200 and ey-y<=50 and (enemy_act==200 or enemy_act==209 or(enemy_act>=220 and enemy_act<=226)) and card_check(102)==true and get_skill_lv(0,5)==-1 and card_check(105)==false and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
	--		print("スキルカード：大地の湖　使用");
	--		card_use(102);
	--elseif dis<=200 and ey-y<=50 and (enemy_act==200 or enemy_act==209 or(enemy_act>=220 and enemy_act<=226)) and get_skill_lv(0,2)>=0 and get_skill_lv(0,5)==-1 and card_check(105)==false and my_rei>=200 and is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
	--		print("コマンド：大地の湖　使用");
	--		lvr236(ACT_C);
	--古代翡翠
	elseif (
		(my_act>=200 and my_act<=201) or (y>=10 and dis>=250
		--(my_act>=6 and my_act<=9) or (my_act>=180 and my_act<=181) or (my_act>=202 and my_act<=203) or (my_act>=206 and my_act<=214) or (my_act>=220 and my_act<=222) or (my_act>=225 and my_act<=226) or (my_act>=300 and my_act<=418)
		)
	) and not(my_act>=545 and my_act<=548) and enemy_act<300 and enemy_obj_range_in(150,60)==false and  card_check(106)==true and ((dis<=300 and ey-y<-50 and is_dir_front==true) or ((ey-y)>=(-6/10)*my_dir*(ex-x)+50 and (ey-y)<=(-3/10)*my_dir*(ex-x)+50)) and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			print("スキルカード：古代翡翠　使用");
			card_use(106);
	elseif (
		(my_act>=200 and my_act<=201) or (y>=10 and dis>=250)
	) and not(my_act>=545 and my_act<=548) and enemy_act<300 and enemy_obj_range_in(150,60)==false and my_rei>=200 and get_skill_lv(0,6)>=0 and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			if (dis<=300 and ey-y<-50 and is_dir_front==true) or ((ey-y)>=(-3)*my_dir*(ex-x)+50 and (ey-y)<=(-0.5)*my_dir*(ex-x)+50) and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			print("コマンド：Ｂ古代翡翠　使用");
				lvr236(ACT_B);
			elseif (dis<=300 and ey-y<50 and is_dir_front==true) or ((ey-y)>=(-0.5)*my_dir*(ex-x)+50 and (ey-y)<=(0)*my_dir*(ex-x)+50) and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			print("コマンド：Ｃ古代翡翠　使用");
				lvr236(ACT_C);
			end
	--蛙石神
	elseif my_act==322 and y==0 and (enemy_act>=50 and enemy_act<=89) and is_dir_front==true and 
	--((my_dir==1 and x>=900) or (my_dir==-1 and x<=380)) and 
	card_check(110)==true and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			print("スキルカード：蛙石神　使用");
			card_use(110);
	elseif my_act==322 and y==0 and (enemy_act>=50 and enemy_act<=89) and is_dir_front==true and 
	--((my_dir==1 and x>=600) or (my_dir==-1 and x<=680)) and 
	get_skill_lv(0,10)>=0 and my_rei>=200 and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			print("コマンド：Ｃ蛙石神　使用");
			lvr236(ACT_C);
--623系スキル
	--大蝦蟇神
	elseif (my_act>=200 and my_act<=201 and dis<=20) and enemy_obj_range_in(150,60)==false and card_check(101)==true and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			print("スキルカード：大蝦蟇神　使用");
			card_use(101);
	elseif (my_act>=200 and my_act<=201 and dis<=20) and enemy_obj_range_in(150,60)==false and my_rei>=200 and get_skill_lv(0,1)>=0 and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			print("コマンド：大蝦蟇神　使用");
			lvr623(ACT_C);
	--古の鉄輪：13F、x速度*1、y速度*1/5、空中はＣの方が10F程持続が長い
	elseif (my_act==306 and is_dir_front==false and dis<=300 and 
	((my_xspeed*my_dir>=0 and ex-x>=0)or(my_xspeed*my_dir<=0 and ex-x<=0)) and 
	((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and
		ey+enemy_yspeed*2+(2*(1*e_gs))/2>=1 and
		(ey+enemy_yspeed*13+(13*(12*e_gs))/2)	-	(y+my_yspeed*1/5*13)	<=	220 	and
		(ey+enemy_yspeed*13+(13*(12*e_gs))/2)	-	(y+my_yspeed*1/5*13)	>=	100-120
	) or (
	enemy_act>=200 and enemy_act<=226 and 
	ey+enemy_yspeed*2+(2*(1*e_gs))/2>=1 and
		(ex-x)*my_dir-(my_xspeed+enemy_xspeed)*13	<=	160+30 	and
		(ex-x)*my_dir-(my_xspeed+enemy_xspeed)*13	>=	-80-30 	and
		(ey+enemy_yspeed*13+(13*(12*e_gs))/2)	-	(y+my_yspeed*1/5*13)	<=	220 	and
		(ey+enemy_yspeed*13+(13*(12*e_gs))/2)	-	(y+my_yspeed*1/5*13)	>=	100-120
	) and
	card_check(105)==true and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			print("スキルカード：古の鉄和　使用");
			card_use(105);
	elseif (my_act==306 and is_dir_front==false and dis<=300 and 
	((my_xspeed*my_dir>=0 and ex-x>=0)or(my_xspeed*my_dir<=0 and ex-x<=0)) and 
	((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and
		ey+enemy_yspeed*2+(2*(1*e_gs))/2>=1 and
		(ey+enemy_yspeed*13+(13*(12*e_gs))/2)	-	(y+my_yspeed*1/5*13)	<=	220 	and
		(ey+enemy_yspeed*13+(13*(12*e_gs))/2)	-	(y+my_yspeed*1/5*13)	>=	100-120
	) or (
	enemy_act>=200 and enemy_act<=226 and 
	ey+enemy_yspeed*2+(2*(1*e_gs))/2>=1 and
		(ex-x)*my_dir-(my_xspeed+enemy_xspeed)*13	<=	160+30 	and
		(ex-x)*my_dir-(my_xspeed+enemy_xspeed)*13	>=	-80-30 	and
		(ey+enemy_yspeed*13+(13*(12*e_gs))/2)	-	(y+my_yspeed*1/5*13)	<=	220 	and
		(ey+enemy_yspeed*13+(13*(12*e_gs))/2)	-	(y+my_yspeed*1/5*13)	>=	100-120
	) and
	get_skill_lv(0,5)>=0 and my_rei>=200 and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			print("コマンド：古の鉄和　使用");
			lvr623(ACT_B);
	--手長足長さん
	elseif y>=10 and dis>=350 and card_check(109)==true and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			print("スキルカード：手長足長さん　使用");
			card_use(109);
	elseif y>=10 and dis>=550 and get_skill_lv(0,9)>=0 and my_rei>=200 and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			print("コマンド：手長足長さん　使用");
			lvr623(ACT_C);
	elseif y>=10 and dis>=350 and get_skill_lv(0,9)>=0 and my_rei>=200 and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			print("コマンド：手長足長さん　使用");
			lvr623(ACT_B);
--214系スキル
	--古の間欠泉
	elseif ((my_act>=200 and my_act<=201 and (dis<=20 or math.random(30)==1)) or	(y>=100 and dis<=100 and ey<=y and dis_y>=150 and math.random(1+30)==1)) and -- 
	enemy_obj_range_in(150,60)==false and card_check(100)==true and subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
			print("スキルカード：古の間欠泉　使用");
			card_use(100);
	elseif ((my_act>=200 and my_act<=201 and (dis<=20 or math.random(30)==1)) or	(y>=100 and dis<=100 and ey<=y and dis_y>=150 and math.random(1+30)==1)) and -- 
	enemy_obj_range_in(150,60)==false and my_rei>=200 and get_skill_lv(0,0)>=0 and subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
			print("コマンド：古の間欠泉　使用");
			lvr214(ACT_B);
	--水蛙神：使用にはカエル認識用変数が必要
	elseif y==0 and dis>500 and  card_check(104)==true and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			print("スキルカード：水蛙神　使用");
			card_use(104);
	elseif y==0 and dis>500 and  get_skill_lv(0,4)>=0 and my_rei>=200 and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			print("コマンド：水蛙神　使用");
			lvr214(ACT_B);
	--雨を呼ぶ雨蛙
	elseif y==0 and dis>500 and  card_check(108)==true and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			print("スキルカード：雨を呼ぶ雨蛙　使用");
			card_use(108);
	elseif y==0 and dis>500 and  get_skill_lv(0,8)>=0 and my_rei>=200 and is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			print("コマンド：雨を呼ぶ雨蛙　使用");
			lvr214(ACT_C);
--22系スキル
	--土着神の祟り
	--祟られた大地
	elseif dis<=250 and my_act>=200 and my_act<=201 and enemy_act<300 and enemy_obj_range_in(150,60)==false and card_check(107)==true and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			print("スキルカード：祟られた大地　使用");
			card_use(107);
	elseif dis<=250 and my_act>=200 and my_act<=201 and enemy_act<300 and enemy_obj_range_in(150,60)==false and my_rei>=200 and get_skill_lv(0,7)>=0 and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
			print("コマンド：祟られた大地　使用");
			lvr22(ACT_B);
			
			
--通常攻撃
	--とりあえず最遠距離からはＣ
	elseif ((y==0 and dis>=400 and ey<=50) or (dis2>=400 and ((ey-y)>=(-1/3)*my_dir*(ex-x)+50 and (ey-y)<=(1/3)*my_dir*(ex-x)+50))) and my_rei>=600 and  
	enemy_obj_range_in(150,60)==false and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("Ｃ");
		key_event(ACT_C);
	--とりあえず遠距離からは６Ｃ
	elseif dis2>=150 and my_rei>=600 and my_act~=2 and 
	((ey-y)>=(-1)*my_dir*(ex-x)+50 and (ey-y)<=(1)*my_dir*(ex-x)+50) and
	my_rei>=200 and enemy_obj_range_in(150,60)==false and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("６Ｃ");
		key_event2(ACT_C,frontEX());
	--とりあえず中距離以下、やや下方はＢ
	elseif dis2>=150 and my_rei>=600 and my_act~=2 and 
	((ey-y)>=(-3/2)*my_dir*(ex-x)+50 and (ey-y)<=(-1/2)*my_dir*(ex-x)+50) and
	my_rei>=200 and enemy_obj_range_in(150,60)==false and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("Ｂ");
		key_event(ACT_B);
	--とりあえず中距離以下、正面は６Ｂ
	elseif dis2>=150 and my_rei>=600 and my_act~=2 and 
	((ey-y)>=(-1)*my_dir*(ex-x)+50 and (ey-y)<=(1)*my_dir*(ex-x)+50) and
	my_rei>=200 and enemy_obj_range_in(150,60)==false and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("６Ｂ");
		key_event2(ACT_B,frontEX());
	--とりあえず下、2B
	elseif dis2>=150 and my_rei>=600 and my_act~=2 and
	((ey-y)>=(-10)*my_dir*(ex-x)+50 and (ey-y)<=(-1)*my_dir*(ex-x)+50) and
	my_rei>=200 and enemy_obj_range_in(150,60)==false and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("２Ｂ");
		key_event2(ACT_B,ACT_DOWN);
	--至近距離
	--DC
	elseif my_act==200 and dis>300 and dis<600 and ey<=100 and 
	not(enemy_act>=197 and enemy_act<=199) and not(enemy_act>=97 and enemy_act<=98) and my_limit<100 and is_dir_front and subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
		key_resetEX(); print("ＤＣ");
		key_event2(ACT_C,frontEX());
	--DB
	elseif my_act==200 and dis>0  and dis<=250 and ey<150 and 
	not(enemy_act>=197 and enemy_act<=199) and not(enemy_act>=97 and enemy_act<=98) and my_limit<100 and is_dir_front and subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
		key_resetEX(); print("ＤＢ");
		key_event2(ACT_B,frontEX());
	--DA
	elseif my_act==200 and dis>200  and dis<=300 and ey==0 and 
	not(enemy_act>=197 and enemy_act<=199) and not(enemy_act>=97 and enemy_act<=98) and my_limit<100 and is_dir_front and subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
		key_resetEX(); print("ＤＡ");
		key_event2(ACT_A,frontEX());
	--L6A
	elseif (my_act==2 or (my_act==1 and my_allframe>=13) or (my_act==3 and my_allframe<=11)) and dis>=100 and dis<250 and ey<100 and not(enemy_act>=197 and enemy_act<=199) and not(enemy_act>=97 and enemy_act<=98) and my_limit<100 and is_dir_front and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		key_resetEX(); print("Ｌ６Ａ");
		key_event2(ACT_A,frontEX());
	--L3A
	elseif (my_act==2 or (my_act==1 and my_allframe>=13) or (my_act==3 and my_allframe<=11)) and 
	dis<250 and ey>0 and ey<200 and 
	not(enemy_act>=197 and enemy_act<=199) and not(enemy_act>=97 and enemy_act<=98) and 
	
	my_limit<100 and subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
		key_resetEX(); print("Ｌ３Ａ");
		key_event2(ACT_A,d_frontEX());
	--L5A(2A)
	elseif (my_act==2 or (my_act==1 and my_allframe>=13) or (my_act==3 and my_allframe<=11)) and 
	dis>150 and dis<250 and ey==0 and 
	not(enemy_act>=197 and enemy_act<=199) and not(enemy_act>=97 and enemy_act<=98) and my_limit<100 and is_dir_front and subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
		key_resetEX(); print("Ｌ５Ａ");
		key_event2(ACT_A,ACT_DOWN);
	--6A
	--elseif my_act<=10 and (my_act~=2 or (my_act==1 and my_allframe<=10) or (my_act==3 and my_allframe>=15)) and 
	--dis>0 and dis<250 and ey<150 and 
	--not(enemy_act>=197 and enemy_act<=199) and not(enemy_act>=97 and enemy_act<=98) and 
	--my_limit<100 and is_dir_front and subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
	--	key_resetEX(); print("６Ａ");
	--	key_event2(ACT_A,front);
	--3A
	--elseif my_act<=10 and (my_act~=2 or (my_act==1 and my_allframe<=10) or (my_act==3 and my_allframe>=15)) and 
	--dis>0 and dis<250 and ey==0 and 
	--not(enemy_act>=197 and enemy_act<=199) and not(enemy_act>=97 and enemy_act<=98) and 
	--my_limit<100 and is_dir_front and subs_count>=530 and nega_count ~= 1 and math.random(2)==1 then
	--	key_resetEX(); print("３Ａ");
	--	key_event2(ACT_A,d_front);
	--遠Ａ
	elseif my_act<=10 and (my_act~=2 or (my_act==1 and my_allframe<=5) or (my_act==3 and my_allframe>=20)) and 
	dis>90 and
					(ex-x)*my_dir-(my_xspeed+enemy_xspeed)*15		<=	230+30 	and
					(ex-x)*my_dir-(my_xspeed+enemy_xspeed)*15		>=	30-30 	and
					(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+my_yspeed*15+(15*(14*m_gs))/2)	<=	130 	and
					(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+my_yspeed*15+(15*(14*m_gs))/2)	>=	0-120 	and
					((ey+enemy_yspeed*15+(15*(14*e_gs))/2)-(y+my_yspeed*15+(15*(14*m_gs))/2))<=0.5*my_dir*((ex-x)-(my_xspeed+enemy_xspeed)*15) and
	not(enemy_act>=197 and enemy_act<=199) and not(enemy_act>=97 and enemy_act<=98) and 
	my_limit<100 and is_dir_front and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		key_resetEX(); print("遠Ａ");
		key_event(ACT_A);
	--近距離Ａ：遠距離時は起動しないため、距離制限あり
	elseif my_act<=10 and (my_act~=2 or (my_act==1 and my_allframe<=10) or (my_act==3 and my_allframe>=20)) and 
	dis<=120 and
					(ex-x)*my_dir-(my_xspeed+enemy_xspeed)*9		<=	80+30 	and
					(ex-x)*my_dir-(my_xspeed+enemy_xspeed)*9		>=	20-30 	and
					(ey+enemy_yspeed*9+(9*(8*e_gs))/2)		-	(y+my_yspeed*9+(9*(8*m_gs))/2)		<=	120 	and
					(ey+enemy_yspeed*9+(9*(8*e_gs))/2)		-	(y+my_yspeed*9+(9*(8*m_gs))/2)		>=	50-120 	and
	not(enemy_act>=197 and enemy_act<=199) and not(enemy_act>=97 and enemy_act<=98) and 
	my_limit<100 and is_dir_front and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		key_resetEX(); print("近Ａ");
		key_event(ACT_A);
	--４Ａ:対空目的。また相手の移動を見越した時。
	--elseif my_act<=10 and (my_act~=2 or (my_act==1 and my_allframe<=10) or (my_act==3 and my_allframe>=15)) and 
	--				(ex-x)*my_dir-(my_xspeed+enemy_xspeed)*9		<=	120+30 	and
	--				(ex-x)*my_dir-(my_xspeed+enemy_xspeed)*9		>=	20-30 	and
	--				(ey+enemy_yspeed*9+(9*(8*e_gs))/2)		-	(y+my_yspeed*9+(9*(8*m_gs))/2)		<=	120 	and
	--				(ey+enemy_yspeed*9+(9*(8*e_gs))/2)		-	(y+my_yspeed*9+(9*(8*m_gs))/2)		>=	50-120 	and
	--not(enemy_act>=197 and enemy_act<=199) and not(enemy_act>=300 and enemy_act<700 and enemy_allframe>=2) and not(enemy_act>=97 and enemy_act<=98) and 
	--my_limit<100 and is_dir_front and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
	--	key_resetEX(); print("４Ａ");
	--	key_event2(ACT_A,back);
--対空9HJ>JＡ:14F それなりに機能する。対地上りJAも兼ねる。
	elseif y==0 and 
	(ey>0 or
		(
			(enemy_char~=19 and (enemy_act==0 or (enemy_act>=5 and enemy_act<=10) or (enemy_act>=150 and enemy_act<=153) or (enemy_act>=159 and enemy_act<=162))
			) or
			(enemy_char==19 and ((enemy_act>=1 and enemy_act<=3) or (enemy_act>=154 and enemy_act<=157) or (enemy_act>=163 and enemy_act<=166))
			)
		)
	) and 
	enemy_obj_range_in(150,60)==false and
	my_act<=10 and 
	not(enemy_act>=97 and enemy_act<=98) and 
	not(enemy_act>=197 and enemy_act<=199) and 
	is_dir_front==true and
	(
		(not(enemy_act>=50 and enemy_act<=166)) or (enemy_act>=50 and enemy_act<=166)
	) and 
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 and 
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*15		<=	170+30 	and
				--(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*15		>=	80-30 	and
				(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+my_yspeed*15+(15*(14*m_gs))/2)	<=	150 		and
				(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+my_yspeed*15+(15*(14*m_gs))/2)	>=	110-120 	then
		print("対空9HJ>JＡ");
		key_event2(ACT_D,u_front)
		key_reset()
		wait(2)
		key_event(ACT_A);--]]
--対空8HJ>JＡ:14F
	elseif y==0 and 
	(ey>0 or
		(
			(enemy_char~=19 and (enemy_act==0 or (enemy_act>=5 and enemy_act<=10) or (enemy_act>=150 and enemy_act<=153) or (enemy_act>=159 and enemy_act<=162))
			) or
			(enemy_char==19 and ((enemy_act>=1 and enemy_act<=3) or (enemy_act>=154 and enemy_act<=157) or (enemy_act>=163 and enemy_act<=166))
			)
		)
	) and 
	enemy_obj_range_in(150,60)==false and
	my_act<=10 and 
	not(enemy_act>=97 and enemy_act<=98) and 
	not(enemy_act>=197 and enemy_act<=199) and 
	is_dir_front==true and
	(
		(not(enemy_act>=50 and enemy_act<=166)) or (enemy_act>=50 and enemy_act<=166)
	) and 
	subs_count>=530 and nega_count ~= 1 and math.random(4)==1 and 
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*15		<=	50+30 	and
				--(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*15		>=	-40-30 	and
				(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+my_yspeed*15+(15*(14*m_gs))/2)	<=	181 		and
				(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+my_yspeed*15+(15*(14*m_gs))/2)	>=	121-120 	then
		print("対空8HJ>JＡ");
		key_event2(ACT_D,ACT_UP)
		key_reset()
		wait(2)
		key_event(ACT_A);--]]

--]]
--中距離以上からの８ｈｊ
elseif move_8hjattakeovermidrange_condi()==true then
	print("中距離以上で８ＨＪ");
	key_event2(ACT_D,ACT_UP);
--中距離からのダッシュ
elseif move_6dattakeovermidrange_condi()==true then
	print("ダッシュ接近");
	key_event2(ACT_D,front);
--低空飛翔で接近
elseif move_approachbylowflaying_condi()==true then
	move_approachbylowflaying_exe()
--８８３飛翔
elseif move_approachby883d_condi()==true then
	move_approachby883d_exe()
--▼ 終端運動
--▼ 相手上空へ飛び上がった際の処理
elseif move_attakeoverhead_condi()==true then
	move_attakeoverhead_exe()
--▼ 終端機動
--▼ 対台風時
elseif move_terminationtaihu_condi()==true then
	move_terminationtaihu_exe()
--▼ 終端機動1
--台風じゃない時だが…
elseif move_termination1_condi()==true then
	move_termination1_exe()
--▼ 終端機動2
--ただ動く事で自律性を錯覚させる事が目的の機動。静止やラインの設定に大きな根拠はない。
--霊力が一定の評価を下回った場合、実行しない。
elseif move_termination2_condi()==true then
	move_termination2_exe()
end

yield()
end
end