#e[Player]
#ScriptVersion[2]
#Menu[얲A]
#Text[pXEFCWj[h 

	uwv
	uޖv]
#ReplayName[얲A]

script_player_main
{
	let count=0;
	let Power=2000;		//PowerǗϐ
	let drawangle=0;	//IvV̉]px
	let opX=[0,1,2,3,4,5];	//IvVXW
	let opY=[0,1,2,3,4,5];	//IvVYW
	let csd = GetCurrentScriptDirectory();
	let img = csd~"..\img\player_reimu.png";
	let imgSpell = csd~"..\img\HoshiShot.png";
	let imgKekkai = csd~"..\img\circle.png";
	let imgBorder = csd~"..\img\border.png";
	let imgShot = csd~"..\img\shot_all.png";
	let shotCount = -1;
	let KekkaiOn=0;	//Eǂ̕ϐ
	let Kekkaicount=0;//E悤ɂȂ܂ł̎
	let bonus=1;	//Ekpϐ
	let BonusOn=-1;
	let bonuspoint=0;
	let BombBonus=0;
	let MissPowerRecover;
	SetCommonData("STARTPOWER",0);
	let SE=["seSuperNaturalBorder1.wav","seSuperNaturalBorder2.wav","sePlayerShot01.wav"];
	@Initialize
	{
	//	SetAutoEffect(false);
		SetPlayerLifeImage(img, 0, 0, 48, 48);
		LoadGraphic(img);
		LoadGraphic(imgSpell);
		LoadGraphic(imgKekkai);
		LoadGraphic(imgBorder);
		LoadGraphic(csd~"..\img\shot_reimu.png");
		LoadGraphic(imgShot);
		SetSpeed(4.5, 2.0);//@̈ړx
		LoadPlayerShotData(csd~"..\txt\ShotData.txt");
		SetItemCollectLine(160);//ACeyW
		SetGrazeCircle(40);//@̂蔻
		SetRebirthFrame(8);//H炢{̗Lt[
		Config;
		Tmain;
	}

	task Tmain
	{
		yield;
		Cdraw;
		Pdraw;
		optionmove;
		Powor;
		GetPowerItem;
		GetBonusItem;
		Shot;
		SubShot;
		if(BonusOn==1)
		{
		Graze;
		Bdraw;
		}

	}

	@MainLoop
	{
		SetIntersectionCircle(GetPlayerX, GetPlayerY, 0);//@̓蔻
		MissPowerRecover=true;
		yield;
	}

	@Missed{
MainLoop;
if(OnBorderOfLife && KekkaiOn==1)//oA̓I[g{
{
	KekkaiOn=0;
	bonus=0;
	if(GetPlayerBomb>=1)
	{
	CallSpellCard;
	Power-=500;
	if(Power<0)
	{
	Power=0;
	}
	MissPowerRecover=false;
	}

}
       SetPlayerInvincibility(250);
	if(MissPowerRecover==true && Power<3000)
	{
	Power=3000;
	}
}

	@SpellCard//oA̗Lɂă{ω
	{
			if(KekkaiOn==0)
			{
			UseSpellCard("Huumajin", 0);
			}
			else
			{
			UseSpellCard("TaimahuRanbu", 0);
			}
		bonus=0;
		KekkaiOn=0;

	}

	@DrawLoop
	{

		SetColor(255, 255, 255);
		SetGraphicAngle(0,0,0);
		SetRenderState(ALPHA);

		SetTexture(img);
		if(GetKeyState(VK_LEFT)==KEY_PUSH || GetKeyState(VK_LEFT)==KEY_HOLD)
		{
			if(GetCommonDataDefault("MoveReverse",false)==true && OnEnemySpell)
			{
				SetGraphicRect(10, 101, 38, 142);
			}
			else
			{
				SetGraphicRect(10, 53, 38, 94);
			}

		}
		else if(GetKeyState(VK_RIGHT)==KEY_PUSH || GetKeyState(VK_RIGHT)==KEY_HOLD)
		{
			if(GetCommonDataDefault("MoveReverse",false)==true && OnEnemySpell)
			{
				SetGraphicRect(10, 53, 38, 94);
			}
			else
			{
				SetGraphicRect(10, 101, 38, 142);
			}
		}
		else
		{

			SetGraphicRect(10, 6, 38, 48);


		}
		DrawGraphic(GetPlayerX(), GetPlayerY());//@̕`


		if(Power>=5000)
		{
		SetGraphicRect(21,162,35,176);
		SetGraphicAngle(0,0,drawangle+180);
		SetAlpha(150);
		SetGraphicScale(1.4,1.4);
        	DrawGraphic(opX[0], opY[0]);
        	DrawGraphic(opX[1], opY[1]);
        	DrawGraphic(opX[2], opY[2]);
        	DrawGraphic(opX[3], opY[3]);
		}


		if(Power>=1000)
		{
		SetGraphicRect(21,162,35,176);
		SetGraphicAngle(0,0,drawangle);
		SetAlpha(255);
		SetGraphicScale(1.0,1.0);
        	DrawGraphic(opX[0], opY[0]);
		}

		if(Power>=2000)
		{
		SetGraphicRect(21,162,35,176);
		SetGraphicAngle(0,0,drawangle);
		SetAlpha(255);
		SetGraphicScale(1.0,1.0);
        	DrawGraphic(opX[1], opY[1]);
		}

		if(Power>=3000)
		{
		SetGraphicRect(21,162,35,176);
		SetGraphicAngle(0,0,drawangle);
		SetAlpha(255);
		SetGraphicScale(1.0,1.0);
        	DrawGraphic(opX[2], opY[2]);
		}

		if(Power>=4000)
		{
		SetGraphicRect(21,162,35,176);
		SetGraphicAngle(0,0,drawangle);
		SetAlpha(255);
		SetGraphicScale(1.0,1.0);
        	DrawGraphic(opX[3], opY[3]);
		}
		drawangle+=6;//IvV̕`


		if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD)
		{
		SetTexture(imgBorder);
		SetGraphicRect(27,27,37,37);
		SetGraphicAngle(0,0,drawangle/4);
		SetAlpha(255);
		SetGraphicScale(1.0,1.0);
        	DrawGraphic(GetPlayerX(), GetPlayerY());
		}

	}

	@Finalize
	{
		DeleteGraphic(img);
		DeleteGraphic(imgSpell);
		DeleteGraphic(imgKekkai);
		DeleteGraphic(imgBorder);
	}




#include_script".\..\txt\Pdraw.txt"
#include_script".\..\txt\Bdraw.txt"
#include_script".\..\txt\Cdraw.txt"
#include_script".\..\txt\Power.txt"
#include_script".\..\txt\Graze.txt"
#include_script".\ReimuMainShot.txt"
#include_script".\ReimuSubShot.txt"
#include_script".\ReimuOptionMove.txt"

task Config
{
#include_script".\..\txt\config.txt"
}

#include_script".\..\txt\data.txt"
}

#include_script".\..\txt\Spell001.txt"
