--霧雨魔理沙用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()

--
--コンボ
--A>6B
	elseif ey>0 and (my_act==300 or my_act==330) and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true and my_rei>=200 then
		print("コンボ：ＡＡ＞６Ｂ");
		key_event2(ACT_B,front);
--AAAAコンボ
	elseif my_act==300 and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true and ((enemy_act>=50 and enemy_act<=89 or enemy_act==143) or (enemy_act>=145 and enemy_act<=166 and math.random(4)<=1)) then
		print("コンボ：ＡＡ");
		key_event(ACT_A);
		elseif ey==0 and my_act==320 and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true and ((enemy_act>=50 and enemy_act<=89 or enemy_act==143) or (enemy_act>=145 and enemy_act<=166 and math.random(8)<=1)) then
			print("コンボ：ＡＡＡ");
			key_event(ACT_A);
		
	--AAAA>DA>スキル
			elseif ey==0 and my_act==321 and enemy_act>=50 and enemy_act<=89 and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true and ((enemy_act>=50 and enemy_act<=89 or enemy_act==143) or (enemy_act>=145 and enemy_act<=166 and math.random(4)<=1)) then
				print("コンボ：ＡＡＡＡ");
				key_event(ACT_A);
				
				elseif my_act==322 and enemy_act>=50 and enemy_act<=89 and card_check(202) and my_spell_more(2500) then
					if my_allframe<=10 then
						card_1st(202);
					end
					if my_hitstop<=3 and my_hitstop>=1 then
						print("コンボ：ＡＡＡＡ＞魔砲「ファイナルスパーク」");
						card_use(202);
					end
				elseif my_act==322 and enemy_act>=50 and enemy_act<=89 and card_check(203) and my_spell_more(2500) then
					if my_allframe<=10 then
						card_1st(203);
					end
					if my_hitstop<=3 and my_hitstop>=1 then
						print("コンボ：ＡＡＡＡ＞星符「ドラゴンメテオ」");
						card_use(203);
					end
				elseif my_act==322 and enemy_act>=50 and enemy_act<=89 and card_check(204) and my_spell_more(2000) then
					if my_allframe<=10 then
						card_1st(204);
					end
					if my_hitstop<=3 and my_hitstop>=1 then
						print("コンボ：ＡＡＡＡ＞恋符「ノンディレクショナルレーザー」");
						card_use(204);
					end
				elseif my_act==322 and enemy_act>=50 and enemy_act<=89 and card_check(200) and my_spell_more(1500) then
					if my_allframe<=10 then
						card_1st(200);
					end
					if my_hitstop<=3 and my_hitstop>=1 then
						print("コンボ：ＡＡＡＡ＞恋符「マスタースパーク」");
						card_use(200);
					end
				elseif y==0 and my_act==322 and my_allframe>=42 and enemy_act>=50 and enemy_act<=89 then
					print("コンボ：ＡＡＡＡ＞ＤＡ");
					key_on(front);
					key_on(ACT_D);
					yield();
					key_event(ACT_A);
				

--遠A>6A※遠Ａヒットした場合、６Ａ
	elseif my_act==301 and enemy_act>=50 and enemy_act<=89 and ey>0 and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true then
		key_reset();
		print("遠Ａ＞６Ａ");
		key_event2(ACT_A,front);
--遠A>623コマンド
	elseif my_act==301 and enemy_act>=50 and enemy_act<=89 and ey>0 and my_hitstop<=6 and my_hitstop>=5 and is_dir_front==true and my_correction>=32 then
		key_reset();
		print("遠Ａ＞６２３コマンド");
		if get_skill_lv(0,9)>=0 and my_frontside<=300 then
			lvr623(ACT_B);
		else
			lvr623(ACT_C);
		end
--遠A>6A
	elseif my_act==301 and enemy_act>=150 and enemy_act<=166 and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true and math.random(16)==1 then
		key_resetEX();
		print("遠Ａ＞６Ａ");
		key_event2(ACT_A,front);
--遠A>3A
	elseif my_act==301 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true then
		key_resetEX();
		print("遠Ａ＞３Ａ");
		key_event2(ACT_A,d_front);
--2A>6A
	elseif my_act==303 and enemy_act>=150 and enemy_act<=166 and my_hitstop<=3 and my_hitstop>=1 and en_keymap2_down<=0 and is_dir_front==true and math.random(16)==1 then
		key_resetEX();
		print("２Ａ＞６Ａ");
		key_event2(ACT_A,front);
--2A>3A
	elseif my_act==303 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true then
		key_resetEX();
		print("２Ａ＞３Ａ");
		key_event2(ACT_A,d_front);
--3A>6C
	elseif (my_act==302 or my_act==304) and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true and math.random(3)==1 then
		print("３Ａ＞６Ｃ");
		key_event2(ACT_C,front);
--3A>C
	elseif (my_act==302 or my_act==304) and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true and my_frontside<=240 then
		print("３Ａ＞Ｃ");
		key_event(ACT_C);
--3A>B
	elseif (my_act==302 or my_act==304) and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true and dis<=80 then
		print("３Ａ＞B");
		key_event(ACT_B);
--3A>2B
	elseif (my_act==302 or my_act==304) and (enemy_act>=143 and enemy_act<=166) and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true then
		print("３Ａ＞２B");
		key_on(ACT_DOWN);
		key_on(ACT_B);
		wait(20);
		while ey==0 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) do
			yield();
		end
		key_reset();

--JA>JC
	elseif my_act==306 and enemy_act>=150 and enemy_act<=166 and my_hitstop<=3 and my_hitstop>=1 and ((my_airEX~=0) or (my_airEX==0 and y-(my_yspeed*2+my_yspeed/5*13)<=0)) and is_dir_front==true then
		key_resetEX();
		print("ＪＡ＞ＪＣ");
		key_event(ACT_C);
--JA>J6A
	elseif my_act==306 and enemy_act>=50 and enemy_act<=89 and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true then
		key_resetEX();
		print("ＪＡ＞Ｊ６Ａ");
		key_event2(ACT_A,front);
--J6A>6C or ラジアルストライク
	elseif my_act==307 and enemy_act>=50 and enemy_act<=89 and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true then
		key_resetEX();
		if get_skill_lv(0,4)>=1 then
			print("Ｊ６Ａ＞６Ｃ");
			lvr214(ACT_B);
		else
			print("Ｊ６Ａ＞６Ｃ");
			key_event2(ACT_C,front);
		end
--J2A>214コマンド
	elseif my_act==308 and enemy_act>=50 and enemy_act<=89 then
		key_resetEX();
		if my_allframe<=10 then
			if card_check(103) then
					card_1st(103);
			elseif card_check(107) then
				card_1st(107);
			elseif card_check(111) then
				card_1st(111);
			end
		end
		if my_hitstop<=3 and my_hitstop>=1 and is_dir_front then
			if card_check(103) then
				card_use(103);
			elseif card_check(107) then
				card_use(107);
			elseif card_check(111) then
				card_use(111);
			else
				print("Ｊ２Ａ＞２１４スキル");
				lvr214(ACT_C);
			end
			if my_hitstop>=1 then
				wait(my_hitstop);
			end
			if my_act>=500 and my_act<=514 then
				wait(2);
			end
		end
		while (my_act>=500 and my_act<=514 and my_allframe<=30 and is_dir_front) do
			if enemy_act>=50 and enemy_act<=89 and card_check(205) and my_frontside<=240 then
				if my_allframe<=10 then
					card_1st(205);
				end
				if ((my_hitstop<=3 and my_hitstop>=1) or (enemy_hitstop<=3 and enemy_hitstop>=1) or (enemy_act>=50 and enemy_act<=89 and enemy_frame+1<=3)) and my_frontside<=240 then
					print("コンボ：ＡＡＡＡ＞魔符「スターダストレヴァリエ」");
					card_use(205);
				end
					
			elseif enemy_act>=50 and enemy_act<=89 and card_check(211) then
				if my_allframe<=10 then
					card_1st(211);
				end
				if (my_hitstop<=3 and my_hitstop>=1) or (enemy_hitstop<=3 and enemy_hitstop>=1) or (enemy_act>=50 and enemy_act<=89 and enemy_frame+1<=2) then
					print("コンボ：ＡＡＡＡ＞光符「ルミネスストライク」");
					card_use(211);
				end
			end
			yield();
		end
--AAA>3AorC
	elseif my_act==321 and enemy_act>=143 and enemy_act<=166 and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true then
		print("AAA>〜(派生)");
		if math.random(2)==1 then
			wait(4);
			if enemy_act>=220 and enemy_act<=226 then
				key_event(ACT_A);
			else
				key_event2(ACT_A,d_front);
			end
		elseif math.random(2)==2 then
			key_event(ACT_C);
			wait(2);
		end
--J8A>6C
	elseif my_act==309 and my_allframe>=15 and enemy_act>=50 and enemy_act<=89 and my_hitstop<=3 and my_hitstop>=1 then
		key_on(front);
		key_on(ACT_C);
		while my_act==309 and ey>y and not(dis_y<=180 and enemy_yspeed<0) do
			yield();
		end
		key_reset();
		
--J6A or J2A or J8A > C or 6C
	elseif (my_act==307 or my_act==308 or (my_act==309 and math.random(3)<=2)) and enemy_act>=143 and enemy_act<=166 and my_hitstop<=3 and my_hitstop>=1 and is_dir_front==true and ((my_yspeed*1/5*20>=1 and my_yspeed*1/5*30<=0)or(my_air<=1 or (my_air<=2 and weather==10))) then
		if ey-y>=-80 and ey-y<=80 then
			print("〜>6C");
			key_event2(ACT_C,front);
		else
			print("〜>C");
			key_event(ACT_C);
		end
	
		
--固め
--ＤＡ＞スキル
	elseif my_act==305 then
		if my_act==305 and my_combo>=4 and enemy_act>=50 and enemy_act<=89 and card_check(205) and my_spell_more(1000) then
			if my_allframe<=10 then
				card_1st(205);
			end
			if my_hitstop<=3 and my_hitstop>=1 then
				print("コンボ：ＡＡＡＡ＞魔符「スターダストレヴァリエ」");
				card_use(205);
			end
		elseif my_act==305 and my_combo>=4 and enemy_act>=50 and enemy_act<=89 and my_frontside>=240 and card_check(211) and my_spell_more(1000) then
			if my_allframe<=10 then
				card_1st(211);
			end
			if my_hitstop<=3 and my_hitstop>=1 then
				print("コンボ：ＡＡＡＡ＞光符「ルミネスストライク」");
				card_use(211);
			end
			
		elseif my_act==305 and my_allframe<=10 and my_card~=104 and card_check(104) then
			card_1st(104);
		elseif my_act==305 and ((enemy_act>=50 and enemy_act<=89 and (my_correction<32 or (ey>0 and my_correction>=32))) ) and my_hitstop<=3 and my_hitstop>=1 and my_card==104 then
			print("ＤＡ＞スキカ：ラジアル");
			key_reset();
			key_event(ACT_BC);
		elseif my_act==305 and ((enemy_act>=50 and enemy_act<=89 and (my_correction<32 or (ey>0 and my_correction>=32))) ) and my_hitstop<=7 and my_hitstop>=5 and get_skill_lv(0,4)>=0 then
			print("ＤＡ＞コマンド：ラジアル");
			key_reset();
			lvr214(ACT_B);
			
		elseif my_act==305 and my_allframe<=10 and my_card~=103 and card_check(103) then
			card_1st(103);
		elseif my_act==305 and ((enemy_act>=50 and enemy_act<=89 and (my_correction<32 or (ey>0 and my_correction>=32))) ) and my_hitstop<=3 and my_hitstop>=1 and my_card==103 then
			print("ＤＡ＞スキカ：デブリ");
			key_reset();
			key_event(ACT_BC);
		elseif my_act==305 and ((enemy_act>=50 and enemy_act<=89 and (my_correction<32 or (ey>0 and my_correction>=32))) ) and my_hitstop<=7 and my_hitstop>=5 and get_skill_lv(0,3)>=0 then
			print("ＤＡ＞コマンド：デブリ");
			key_reset();
			key_on(ACT_D);yield();key_off(ACT_D);yield();
			lvr236(ACT_B);
			
		elseif my_act==305 and my_allframe<=10 and my_card~=101 and card_check(101) then
			card_1st(101);
		elseif my_act==305 and ((enemy_act>=50 and enemy_act<=89 and (my_correction<32 or (ey>0 and my_correction>=32))) ) and my_hitstop<=3 and my_hitstop>=1 and my_card==101 then
			print("ＤＡ＞スキカ：ミアズマ");
			key_reset();
			key_event(ACT_BC);
		elseif my_act==305 and ((enemy_act>=50 and enemy_act<=89 and (my_correction<32 or (ey>0 and my_correction>=32))) ) and my_hitstop<=7 and my_hitstop>=5 and get_skill_lv(0,1)>=0 then
			print("ＤＡ＞コマンド：ミアズマ");
			key_reset();
			lvr623(ACT_B);
			
		elseif my_act==305 and my_allframe<=10 and my_card~=100 and card_check(100) then
			card_1st(100);
		elseif my_act==305 and ((enemy_act>=50 and enemy_act<=89 and (my_correction<32 or (ey>0 and my_correction>=32))) ) and my_hitstop<=3 and my_hitstop>=1 and my_card==100 then
			print("ＤＡ＞スキカ：レイライン");
			key_reset();
			key_event(ACT_BC);
		elseif my_act==305 and ((enemy_act>=50 and enemy_act<=89 and (my_correction<32 or (ey>0 and my_correction>=32))) ) and my_hitstop<=7 and my_hitstop>=5 and get_skill_lv(0,0)>=0 then
			print("ＤＡ＞コマンド：レイライン");
			key_reset();
			lvr214(ACT_B);
----尻＞スキル
		elseif my_act==302 and my_allframe<=10 and my_card~=104 and card_check(104) then
			card_1st(104);
		elseif my_act==302 and my_allframe>=30 and 
		((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and 
		my_card==104 then
			print("尻＞スキカ：ラジアル");
			key_reset();
			key_event(ACT_BC);
		elseif my_act==302 and my_allframe>=25 and 
		--((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and 
		get_skill_lv(0,4)>=0 then
			print("尻＞コマンド：ラジアル");
			key_reset();
			lvr214(ACT_B);
			
		elseif my_act==302 and my_allframe<=10 and my_card~=103 and card_check(103) then
			card_1st(103);
		elseif my_act==302 and my_allframe>=30 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and my_card==103 then
			print("尻＞スキカ：デブリ");
			key_reset();
			key_event(ACT_BC);
		elseif my_act==302 and my_allframe>=25 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) and get_skill_lv(0,3)>=0 then
			print("尻＞コマンド：デブリ");
			key_reset();
			key_on(ACT_D);yield();key_off(ACT_D);yield();
			lvr236(ACT_B);
			
		elseif my_act==302 and my_allframe<=10 and my_card~=101 and card_check(101) then
			card_1st(101);
		elseif my_act==302 and my_allframe>=30 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=158)) and my_card==101 then
			print("尻＞スキカ：ミアズマ");
			key_reset();
			key_event(ACT_BC);
		elseif my_act==302 and my_allframe>=25 and 
		--((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=158)) and 
		get_skill_lv(0,1)>=0 then
			print("尻＞コマンド：ミアズマ");
			key_reset();
			lvr623(ACT_B);
			
		elseif my_act==302 and my_allframe<=10 and my_card~=100 and card_check(100) then
			card_1st(100);
		elseif my_act==302 and my_allframe>=30 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=158)) and my_card==100 then
			print("尻＞スキカ：レイライン");
			key_reset();
			key_event(ACT_BC);
		elseif my_act==302 and my_allframe>=25 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=158)) and get_skill_lv(0,0)>=0 then
			print("尻＞コマンド：レイライン");
			key_reset();
			lvr214(ACT_B);
		end
--スキル中に結界を行っていた場合、魔符「スターダストレヴァリエ」
	elseif my_act>=500 and my_act<=574 and my_allframe<=10 and card_check(205) and my_card~=205 then
		card_1st(205)
	elseif my_act>=500 and my_act<=574 and dis<=200 and y<=120 and ey==0 and enemy_act>=201 and enemy_act<=226 and enemy_allframe<=1 and my_card==205 and math.random(3)==1 then
		print("スキルキャンセル　⇒　魔符「スターダストレヴァリエ」");
		key_reset();
		key_event(ACT_BC);
	elseif my_act>=500 and my_act<=574 and my_allframe<=10 and card_check(205) and my_card==205 and (get_card_id(0,1)==205 or get_card_id(0,1)==206) then
		if battle_time%2==0 then
			key_on(ACT_AB);
		elseif battle_time%2==1 then
			key_off(ACT_AB);
		end
--スキル中に結界を行っていた場合、星符「エスケープベロシティ」
	elseif my_act>=500 and my_act<=574 and my_allframe<=10 and card_check(206) and my_spell_more(1500) and my_card~=206 then
		card_1st(206)
	elseif my_act>=500 and my_act<=574 and dis<=180 and y==0 and ey==0 and enemy_act>=201 and enemy_act<=226 and enemy_act~=201 and enemy_act~=224 and enemy_allframe<=1 and my_card==206 and math.random(3)==1 then
		print("スキルキャンセル　⇒　星符「エスケープベロシティ」");
		key_reset();
		key_event(ACT_BC);
	elseif my_act>=500 and my_act<=574 and my_allframe<=10 and card_check(206) and my_card==206 and (get_card_id(0,1)==206 or get_card_id(0,2)==206) then
		if battle_time%2==0 then
			key_on(ACT_AB);
		elseif battle_time%2==1 then
			key_off(ACT_AB);
		end

--]]
		
--▼ 攻撃 ▼

--▼ spell card ▼

	--▼ cost1

		--星符「メテオニックシャワー」 208,608,658,g,a
			--g,a
				elseif card_check(208)==true and
					my_spell_more(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(208);

	--▼cost2

		--魔符「スターダストレヴァリエ」 205,605,g,a
			--g,a
				elseif card_check(205)==true and
					my_spell_more(1000) 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(205);

		--光符「ルミネスストライク」 211,611,g,a
			--g,a
				elseif card_check(211)==true and
					my_spell_more(1000) 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(211);

		--儀符「オーレリーズサン」 215,615,g
			--G,set
				elseif card_check(215)==true and
					my_spell_more(1000) 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(215);

	--▼cost3

		--恋符「マスタースパーク」 200,600,g
			--Ground
				elseif card_check(200)==true and
					my_spell_more(1500) and
					dis_y<50 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,10)==false and 
					is_dir_front==true and 
					subs_count>=530 and nega_count ~= 1 and math.random(64)==1 then
						print("恋符「マスタースパーク」");
						card_use(200);

		--星符「エスケープベロシティ」 206,606,g
			--g
				elseif card_check(206)==true and
					my_spell_more(1500) and
					dis<150 and
					dis_y<200 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(206);

		--星符「グラビティビート」 209,609,g
			--g
				elseif card_check(209)==true and
					my_spell_more(1500) 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(209);

		--光符「アースライトレイ」 212,612,g
			--g
				elseif card_check(212)==true and
					my_spell_more(1500) and
					dis_y<=50 and
					y==0 and
					my_frontside>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(212);

	--▼cost4

		--恋符「ノンディレクショナルレーザー」 204,604,g
			--g
				elseif card_check(204)==true and
					my_spell_more(2000) and
					dis_y<=50 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(204);

		--魔廃「ディープエコロジカルボム」 214,614,g
			--g
				elseif card_check(214)==true and
					my_spell_more(2000) 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(214);

	--▼cost5

		--魔砲「ファイナルスパーク」 202,602,g
			--g
				elseif card_check(202)==true and
					my_spell_more(2500) and
					ey<dis/2+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,20)==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,g,a
			--g,a
				elseif card_check(203)==true and
					my_spell_more(2500) and
					dis<600 and
					ey<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(203);

		--彗星「ブレイジングスター」 207,607,g,a
			--g,a
				elseif card_check(207)==true and
				my_spell_more(2500) 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);

		--邪恋「実りやすいマスタースパーク」 219,619,g
			--Ground
				elseif card_check(219)==true and
					my_spell_more(2500) and
					y==0 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(219);
--]]
--
--▼ skill card ▼

	--▼ スキル 236

		--メテオニックデブリ,103,560,561,562,563,g,a
			--g,a
				elseif get_skill_lv(0,3)>=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,3)>=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(103)==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(103);
		
		--ナロースパーク,107,565,566,567,568,g,a
			--g,a
				elseif get_skill_lv(0,7)>=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,7)>=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(107)==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(107);
		
		--グリーンスプレッド,111,570,571,572,573,g,a
			--g,a
				elseif get_skill_lv(0,11)>=0 and 
					my_rei>=400 and 
					dis>350 and
					dis<500 and
					dis_y<100 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,11)>=0 and 
					my_rei>=400 and 
					dis>350 and
					dis<500 and
					dis_y<100 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(111)==true and 
					my_rei>=400 and 
					dis>350 and
					dis<500 and
					dis_y<100 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);
		
	--▼ スキル 623

		--ミアズマスウィープ,101,520,521,g
			--g
				elseif get_skill_lv(0,1)>=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,1)>=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(101)==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(101);
		
		--バスキースウィーパー,105,525,526,g
			--g
				elseif get_skill_lv(0,5)>=0 and 
					my_rei>=400 and 
					dis<200 and
					y==0 and
					ey-y<dis+50 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,5)>=0 and 
					my_rei>=400 and 
					dis<400 and
					y==0 and
					ey-y<dis+50 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(105)==true and 
					my_rei>=400 and 
					dis<200 and
					y==0 and
					ey-y<dis+50 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(105);

		--ステラミサイル,109,530,531,g
			--g
				elseif get_skill_lv(0,9)>=0 and 
					my_rei>=400 and 
					y==0 and
					(ex-x)*my_dir-(enemy_xspeedEX)*15		<=	180+120+30 	and
					(ex-x)*my_dir-(enemy_xspeedEX)*15		>=	180-120-30 	and
					(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	<=	360+120		and
					(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	>=	360-120+60-120	and
					enemy_hitstop==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("ステラミサイル");
						lvr623(ACT_B);
					
				elseif get_skill_lv(0,9)>=0 and 
					my_rei>=400 and 
					y==0 and
					(ex-x)*my_dir-(enemy_xspeedEX)*15		<=	400+120+30 	and
					(ex-x)*my_dir-(enemy_xspeedEX)*15		>=	400-120-30 	and
					(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	<=	360+120		and
					(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	>=	360-120+60-120	and
					enemy_hitstop==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("ステラミサイル");
						lvr623(ACT_C);
					
				elseif card_check(109)==true and 
					my_rei>=400 and 
					y==0 and
					(ex-x)*my_dir-(enemy_xspeedEX)*15		<=	180+120+30 	and
					(ex-x)*my_dir-(enemy_xspeedEX)*15		>=	180-120-30 	and
					(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	<=	360+120		and
					(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	>=	360-120+60-120	and
					enemy_hitstop==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);

	--▼ スキル 214
		--ウィッチレイライン,100,500,504,g,a
			--g,a
				elseif get_skill_lv(0,0)>=0 and 
					my_rei>=400 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,0)>=0 and
					my_rei>=400 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_C);
					
				elseif card_check(100)==true and
					my_rei>=400 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(100);	
		
		--ラジアルストライク,104,505,506,g,a
			--g,a
				elseif get_skill_lv(0,4)>=0 and
					my_rei>=400 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,4)>=0 and
					my_rei>=400 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(104)==true and
					my_rei>=400 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,511,512,513,g,a
			--g,a
				elseif get_skill_lv(0,8)>=0 and
					my_rei>=400 and 
					dis<200 and
					--y==0 and
					ey>=y and
					dis_y<100 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,8)>=0 and
					my_rei>=400 and 
					dis<300 and
					--y==0 and
					ey>=y and
					dis_y<150 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(108)==true and
					my_rei>=400 and 
					dis<200 and
					--y==0 and
					ey>=y and
					dis_y<100 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);

	--▼ スキル 22
		--グラウンドスターダスト,102,540,541,542,543,g,a
			--g,a
				elseif get_skill_lv(0,2)>=0 and
					my_rei>=400 and 
					dis<400 and
					ey<50 and 
					enemy_yspeed<=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("グラウンドスターダスト");
						lvr22(ACT_B);
					
				elseif get_skill_lv(0,2)>=0 and
					my_rei>=400 and 
					dis<400 and
					ey<50 and 
					enemy_yspeed<=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("グラウンドスターダスト");
						lvr22(ACT_C);
					
				elseif card_check(102)==true and
					my_rei>=400 and 
					dis<400 and
					ey<50 and 
					enemy_yspeed<=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(102);	
		
		--デビルダムトーチ,106,545,546,547,548,g,a
			--g
				elseif get_skill_lv(0,6)>=0 and 
					my_rei>=400 and 
					dis<400 and
					ey<50 and 
					enemy_yspeed<=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("デビルダムトーチ");
						lvr22(ACT_B);
					
				elseif get_skill_lv(0,6)>=0 and
					my_rei>=400 and 
					dis<400 and
					ey<50 and 
					enemy_yspeed<=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("デビルダムトーチ");
						lvr22(ACT_C);
					
				elseif card_check(106)==true and
					my_rei>=400 and 
					dis<400 and
					ey<50 and 
					enemy_yspeed<=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(106);
			--a
				elseif get_skill_lv(0,6)>=0 and
					my_rei>=400 and 
					dis<400 and
					ey<50 and 
					enemy_yspeed<=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("デビルダムトーチ");
						lvr22(ACT_B);
					
				elseif get_skill_lv(0,6)>=0 and
					my_rei>=400 and 
					dis<400 and
					ey<50 and 
					enemy_yspeed<=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("デビルダムトーチ");
						lvr22(ACT_C);
					
				elseif card_check(106)==true and
					my_rei>=400 and 
					dis<400 and
					ey<50 and 
					enemy_yspeed<=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(106);
		
		--マジカル産廃再利用ボム,110,550,551,552,553,g,a
			--g,a
				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 
					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("マジカル産廃再利用ボム");
						lvr22(ACT_B);
					
				elseif get_skill_lv(0,10)>=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("マジカル産廃再利用ボム");
						lvr22(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 
					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);
--]]
			
--▼攻撃▼
--通常攻撃
--ＪＡ
	elseif	y>0 and 
	(my_act<=10 or (my_act>=180 and my_act<300)) and 
	not(enemy_act>=98 and enemy_act<=98) and
	not(enemy_act>=197 and enemy_act<=199) and
	enemy_obj_range_in(150,60)==false and
	is_dir_front and subs_count>=530 and nega_count ~= 1 and math.random(4)>=3 and 
	(y+my_yspeed*11+(11*(10*m_gs))/2)>0 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*9		<=	110+30 	and
				--(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*9		>=	20-30 	and
				(ey+enemy_yspeed*9+(9*(8*e_gs))/2)	-	(y+my_yspeed*9+(9*(8*m_gs))/2)	<=	80 		and
				(ey+enemy_yspeed*9+(9*(8*e_gs))/2)	-	(y+my_yspeed*9+(9*(8*m_gs))/2)	>=	40-120 	then
					print("ＪＡ");
					key_resetEX();
					key_event(ACT_A);
--Ｊ６Ａ
	elseif	y>0 and 
	(my_act<=10 or (my_act>=180 and my_act<300)) and 
	not(enemy_act>=98 and enemy_act<=98) and
	not(enemy_act>=197 and enemy_act<=199) and
	enemy_obj_range_in(150,60)==false and
	is_dir_front and ((weather~=13) or (weather==13 and my_backside>=300)) and subs_count>=530 and nega_count ~= 1 and math.random(8)==1 and 
	(y+my_yspeed*15+(15*(14*m_gs))/2)>0 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*15		<=	160+30 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*15		>=	30-30 	and
				(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+my_yspeed*15+(15*(14*m_gs))/2)	<=	160 		and
				(ey+enemy_yspeed*15+(15*(14*e_gs))/2)	-	(y+my_yspeed*15+(15*(14*m_gs))/2)	>=	60-120 	then
					print("Ｊ６Ａ");
					key_resetEX();
					key_event2(ACT_A,front);
--Ｊ２Ａ
	elseif	y>0 and 
	(my_act<=10 or (my_act>=180 and my_act<300)) and 
	not(enemy_act>=98 and enemy_act<=98) and
	not(enemy_act>=197 and enemy_act<=199) and
	enemy_obj_range_in(150,60)==false and
	is_dir_front and weather~=13 and my_airEX>=1 and subs_count>=530 and nega_count ~= 1 and math.random(8)==1 and 
	(y+my_yspeed*18+(18*(17*m_gs))/2)>0 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*18		<=	100+30 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*18		>=	20-30 	and
				(ey+enemy_yspeed*18+(18*(17*e_gs))/2)	-	(y+my_yspeed*18+(18*(17*m_gs))/2)	<=	20 			and
				(ey+enemy_yspeed*18+(18*(17*e_gs))/2)	-	(y+my_yspeed*18+(18*(17*m_gs))/2)	>=	-60-120 	then
					print("Ｊ２Ａ");
					key_resetEX();
					key_event2(ACT_A,ACT_DOWN);
--Ｊ８Ａ
	elseif	y>0 and 
	(my_act<=10 or (my_act>=180 and my_act<300)) and 
	not(enemy_act>=98 and enemy_act<=98) and
	not(enemy_act>=197 and enemy_act<=199) and
	enemy_obj_range_in(150,60)==false and
	is_dir_front and my_airEX>=1 and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 and 
	(y+my_yspeed*12+(12*(11*m_gs))/2)>0 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*12		<=	80+30 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*12		>=	30-30 	and
				(ey+enemy_yspeed*12+(12*(11*e_gs))/2)	-	(y+my_yspeed*12+(12*(11*m_gs))/2)	<=	240 		and
				(ey+enemy_yspeed*12+(12*(11*e_gs))/2)	-	(y+my_yspeed*12+(12*(11*m_gs))/2)	>=	160-120 	then
					print("Ｊ８Ａ");
					key_resetEX();
					key_event2(ACT_A,ACT_UP);

--対空４Ａ:なにか妙な挙動をしている気がする:初期値9
	elseif y==0 and 
	ey>0 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)*9		<=	110+20 	and
				(ex-x)*my_dir-(my_xspeedEX+enemy_xspeedEX)*9		>=	20-20 	and
				(ey+enemy_yspeed*9+(9*(8*e_gs))/2)	-	(y+my_yspeed*9+(9*(8*m_gs))/2)	<=	130 		and
				(ey+enemy_yspeed*9+(9*(8*e_gs))/2)	-	(y+my_yspeed*9+(9*(8*m_gs))/2)	>=	60-110 	then
		print("対空4Ａ");
		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 
	dis<=120 and my_act==200 and my_allframe>=10 and ey==0 and 
	enemy_obj_range_in(150,60)==false 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) and en_keymap2_down>=1 and math.random(4)==1) or 
		(enemy_act>=50 and enemy_act<=166)
	) and 
	subs_count>=530 and nega_count ~= 1 then
		print("ダッシュＡ");
		wait(2)
		key_event(ACT_A);
		wait(5);
--ダッシュ＞２Ａ
	elseif dis<=220 and my_act==200 and my_allframe>=10 and ey==0 and 
	enemy_obj_range_in(150,60)==false 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) and en_keymap2_down<=0 and math.random(4)==1) or --被ダメージ時、被ガード時を除く状況では確率で
		(enemy_act>=50 and enemy_act<=166)
	) and 
	subs_count>=530 and nega_count ~= 1 then
		print("ダッシュ２Ａ");
		wait(2)
		key_event2(ACT_A,ACT_DOWN);
		wait(5);
--刻み4Ａ
	elseif (dis<=120 or (dis<=180 and my_xspeed>0)) and my_act==330 and ey==0 and my_hitstop<=3 and my_hitstop>=1 and enemy_obj_range_in(150,60)==false and 
	((enemy_act>=143 and enemy_act<=166) or (enemy_act>=50 and enemy_act<=89 and math.random(3)<=2)) and subs_count>=530 and nega_count ~= 1 then
		print("刻み４Ａ");
		key_event2(ACT_A,back);
		wait(3);
--Ａ
	elseif dis<=180-20 and y==0 and ey<100 and 
	enemy_obj_range_in(150,60)==false and 
	my_act<=10 and (enemy_act~=97 and enemy_act~=98 and enemy_act~=197 and enemy_act~=198 and enemy_act~=199 and enemy_act~=300 and enemy_act~=303 and enemy_act~=320 and enemy_act~=321 and enemy_act~=322 and enemy_act~=330) and 
	is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(4)==1 then
		print("Ａ");
		key_event(ACT_A);--]]
--ＤＡ
	elseif dis<=300 and dis>=200-50 and 
	y==0 and ey<100 and 
	enemy_obj_range_in(150,60)==false and 
	my_act<=10 and (enemy_act~=97 and enemy_act~=98 and enemy_act~=197 and enemy_act~=198 and enemy_act~=199 and enemy_act~=300 and enemy_act~=303 and enemy_act~=320 and enemy_act~=321 and enemy_act~=322 and enemy_act~=330) and 
	is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(24)==1 then
		print("ＤＡ");
		key_on(frontEX());
		key_event2(ACT_D,ACT_A);
		wait(5);
--[[２Ｂ
	elseif dis<=300 and dis>=150 and y==0 and ey==0 and enemy_obj_range_in(150,60)==false and my_act<=10 and enemy_act>=300 and (enemy_act~=97 and enemy_act~=98 and enemy_act~=197 and enemy_act~=198 and enemy_act~=199 and enemy_act~=300 and enemy_act~=303 and enemy_act~=320 and enemy_act~=321 and enemy_act~=322 and enemy_act~=330) and 
	my_rei>=600 and is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(24)==1 then
		print("２Ｂ");
		key_on(ACT_DOWN);
		key_on(ACT_B);
		wait(20);
		while ey==0 and ((enemy_act>=50 and enemy_act<=89) or (enemy_act>=143 and enemy_act<=166)) do
			yield();
		end
		key_reset();--]]
--５Ｂ
	elseif dis>300 and dis<=500 and y==0 and enemy_obj_range_in(150,60)==false and my_act<=10 and (enemy_act~=97 and enemy_act~=98 and enemy_act~=197 and enemy_act~=198 and enemy_act~=199 and enemy_act~=300 and enemy_act~=303 and enemy_act~=320 and enemy_act~=321 and enemy_act~=322 and enemy_act~=330) and 
	my_rei>=600 and is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(24)==1 then
		print("５Ｂ");
		key_event(ACT_B);
--６Ｃ
	elseif dis>600 and y==0 and enemy_obj_range_in(150,60)==false and my_act<=10 and (enemy_act~=97 and enemy_act~=98 and enemy_act~=197 and enemy_act~=198 and enemy_act~=199 and enemy_act~=300 and enemy_act~=303 and enemy_act~=320 and enemy_act~=321 and enemy_act~=322 and enemy_act~=330) and 
	my_rei>=600 and is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(24)==1 then
		print("６Ｃ");
		key_event2(ACT_C,front);
--J5C
	elseif dis>=200 and (ey-y)+80>-1*dis and (ey-y)+80<1.5*dis and
	y>0 and 
	my_airEX>=1 and 
	y-(my_yspeed*2+my_yspeed/5*13)>0 and
	enemy_obj_range_in(150,60)==false and
	my_act<300 and 
	(
		enemy_act~=97 and enemy_act~=98 and 
		enemy_act~=197 and enemy_act~=198 and enemy_act~=199 and 
		enemy_act~=300 and enemy_act~=303 and enemy_act~=320 and enemy_act~=321 and enemy_act~=322 and enemy_act~=330 and
		not(enemy_act>=50 and enemy_act<143)
	) and 
	my_rei>=600 and 
	is_dir_front==true and subs_count>=530 and nega_count ~= 1 and math.random(24)==1 then
		print("J5C");
		key_resetEX();
		key_event(ACT_C);
--]]
--中距離以上からの８ｈｊ
	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