----肪oTXyJĂāAJ[hQ[W͑Ă邩肷֐
--FɎw肵ڈȓɃoTXyJ邩肷
--@@@ȗ1Ƃ݂Ȃ
--߂lFڈȓɃoTXyJAJ[hQ[WĂꍇ1ԂAȂꍇ0
--F	if spellCheckRvs(2)==1 then
--		key_event(ACT_DOWN)
--	end
--L̗ł͑̎D2ڈȓɃoTꍇL
--
--ӁFłĂ܂߁AKvȏꍇ̓XNvgŐ䂨肢܂B

require("XyJp`t@C.txt");
function spellCheckRvs(i)
	if i==nil then
		i = 1
	end
	if i>=1 and i<=5 then
		for n=1,i do
			if get_card_id(1,n-1)~=nil and get_card_id(1,n-1)~=-1 and SCard[enemy_char][get_card_id(1,n-1)].reversal~=nil then
				if SCard[enemy_char][get_card_id(1,n-1)].reversal==true then
					if get_card_id(1,get_card_cost2(1,n-1)-1)>-1 then
						return 1
					end
				end
			end
		end
	else
		print("spellCheckRvs:Error")
	end
	
	return 0
end

----ifł̃[Vl̏yɂ֐
function act_flag(flag)
	flag = string.lower(flag)
	if flag=="normal" then
		if my_act==0 or my_act==2 or (my_act>=4 and my_act<=9) then return 1 else return 0 end
	elseif flag=="attack" then
		if my_act>=300 and my_act<=420 then return 1 else return 0 end
	elseif flag=="dageki" then
		if my_act>=300 and my_act<=322 then return 1 else return 0 end
	elseif flag=="shageki" then
		if my_act>=400 and my_act<=420 then return 1 else return 0 end
	elseif flag=="move" then
		if (my_act>=4 and my_act<=10) or (my_act>=200 and my_act<=226) then return 1 else return 0 end
	elseif flag=="guard" then
		if my_act>=150 and my_act<=158 then return 1 else return 0 end
	elseif flag=="guard2" then
		if my_act>=150 and my_act<=165 then return 1 else return 0 end
	elseif flag=="damage" then
		if my_act>=50 and my_act<=89 then return 1 else return 0 end
	elseif flag=="damage2" then
		if my_act>=50 and my_act<=97 then return 1 else return 0 end
	elseif flag=="spell" then
		if my_act>=600 and my_act<=680 then return 1 else return 0 end
	elseif flag=="card" then
		if my_act>=600 and my_act<=700 then return 1 else return 0 end
	else
		print("act_flag:Error",flag)
	end
end

function e_act_flag(flag)
	flag = string.lower(flag)
	if flag=="normal" then
		if enemy_act==0 or enemy_act==2 or (enemy_act>=4 and enemy_act<=9) then return 1 else return 0 end
	elseif flag=="attack" then
		if enemy_act>=300 and enemy_act<=420 then return 1 else return 0 end
	elseif flag=="dageki" then
		if enemy_act>=300 and enemy_act<=322 then return 1 else return 0 end
	elseif flag=="shageki" then
		if enemy_act>=400 and enemy_act<=420 then return 1 else return 0 end
	elseif flag=="move" then
		if (enemy_act>=4 and enemy_act<=10) or (enemy_act>=200 and enemy_act<=226) then return 1 else return 0 end
	elseif flag=="guard" then
		if enemy_act>=150 and enemy_act<=158 then return 1 else return 0 end
	elseif flag=="guard2" then
		if enemy_act>=150 and enemy_act<=165 then return 1 else return 0 end
	elseif flag=="damage" then
		if enemy_act>=50 and enemy_act<=89 then return 1 else return 0 end
	elseif flag=="damage2" then
		if enemy_act>=50 and enemy_act<=97 then return 1 else return 0 end
	elseif flag=="spell" then
		if enemy_act>=600 and enemy_act<=680 then return 1 else return 0 end
	elseif flag=="card" then
		if enemy_act>=600 and enemy_act<=700 then return 1 else return 0 end
	else
		print("e_act_flag:Error",flag)
	end
end

----KEZR}hsŏ邩Ȃ֐
--Ăяo
--Flvr236(ACT_C)
--@ gR}h{C
--
--
function lvr236(button)
	key_on(ACT_DOWN);yield()
	key_on(front);yield()
	key_off(ACT_DOWN);yield()
	key_off(front)
	if button>=0 and button<=9 then
		key_event(button)
	end
end

function lvr623(button)
	key_on(front);yield();key_off(front)
	key_on(ACT_DOWN);yield()
	key_on(front);yield()
	key_off(ACT_DOWN);key_off(front)
	if button>=0 and button<=9 then
		key_event(button)
	end
end

function lvr214(button)
	key_on(ACT_DOWN);yield()
	key_on(back);yield()
	key_off(ACT_DOWN);yield()
	key_off(back)
	if button>=0 and button<=9 then
		key_event(button)
	end
end

function lvr421(button)
	key_on(back);yield();key_off(back)
	key_on(ACT_DOWN);yield()
	key_on(back);yield()
	key_off(ACT_DOWN);key_off(back)
	if button>=0 and button<=9 then
		key_event(button)
	end
end

function lvr22(button)
	key_on(ACT_DOWN);yield();key_off(ACT_DOWN);yield()
	key_on(ACT_DOWN);yield();key_off(ACT_DOWN)
	if button>=0 and button<=9 then
		key_event(button)
	end
end