#e[Player]	//@XNvgł邱Ƃ܂
#ScriptVersion[2]	//XNvgo[W2K{ł
#Menu[~AEXJ[bg]		//@Iʂŕ\郁j[ł
#Text[Ver.1.05EJX}uCN
CF݂肠E[
{FFuFv
@uCfBXN~lCgv
UЗ́F
Ú͈F`
xF
ᑬxF
\́F̓P
@@@@@xE얲
SV^̎@B
{gƎx𓾂B
]	//@Iʂŕ\eLXgł
#Image[.\img\image_Remi.png]
#ReplayName[RemiBR]	//vCIɕ\镶łB8ȓłB

script_player_main
{
	let current = GetCurrentScriptDirectory();//JgfBNg擾
	let imgRemi = current~"img\Remi.png";
	let CutRemiS = current~"img\cutin_RemiS.png";
	let CutRemiR = current~"img\cutin_RemiR.png";
	let shotCount = -1;//eAŔ˂邽߂̕ϐ
	let bNextShot = false;//񉟂łeA˂邽߂̕ϐ(Â炢)
	let SubShot = false;
	let angleA = 0;
	let angleB = 0;
	let angleC = 0;
	let angleD = 0;
	let Animation = 0;
	let AnimaX = 0;
	let AnimaY = 0;
	let Type = 0;

	@Initialize
	{	
		//@̏Ɉ񂾂Ăяo镔ł
		SetPlayerLifeImage(imgRemi,0,0,39,42);//c@̉摜
		LoadGraphic(imgRemi);
		LoadGraphic(CutRemiS);
		LoadGraphic(CutRemiR);
		SetSpeed(5,2);//ړxݒ
		SetRibirthFrame(7);
		SetInitialBombCount(3);
		LoadPlayerShotData(current~"RemiShotData.txt");
		SetItemCollectLine(125);//ACeCݒ
		Anima;
	}
	
	@MainLoop
	{
		if(Type==2){
			angleA=angleA+6;//bj
			if(angleA>360){angleA=0;}
			angleB=angleB+1;//j
			if(angleB>360){angleB=0;}
			} else if(Type==1){
			angleC=angleC+2;
			if(angleC>360){angleC=0;}
			angleD=angleD+5;
			if(angleD>360){angleD=0;}
			}
	if(!OnBomb){
		if((GetKeyState(VK_SHOT)==KEY_PUSH || GetKeyState(VK_SHOT)==KEY_HOLD || bNextShot==true) && shotCount==-1)
		{
			shotCount = 0;
			bNextShot = false;
		}
		if(GetKeyState(VK_SHOT)==KEY_HOLD && shotCount>0)
		{
			bNextShot = true;
		}

	if(!OnMissed&&!OnEvent){
		if(shotCount%6==0)
		{
			PlaySE("sePlayerShot01.wav");
			if(Type==0){
			MainShot(270,10,-7,-20,8,6);
			MainShot(270,10,7,-20,8,6);
			} else if(Type==1){
			MainShot(270,20,-7,-20,9,4);
			MainShot(270,20,7,-20,9,4);
			MainShot(rand(260,280),21,-20,5,8,1.5);
			MainShot(rand(260,280),21,-20,5,8,1.5);
			MainShot(rand(260,280),21,20,5,8,1.5);
			MainShot(rand(260,280),21,20,5,8,1.5);
			} else if(Type==2){
			MainShot(270,30,-7,-20,9,4);
			MainShot(270,30,7,-20,9,4);
			MainShot(250,31,-9,-30,8,1.2);
			MainShot(260,31,-9,-30,8,1.2);
			MainShot(265,31,-9,-30,8,1.2);
			MainShot(275,31,9,-30,8,1.2);
			MainShot(280,31,9,-30,8,1.2);
			MainShot(290,31,9,-30,8,1.2);
			}
		}
		if(GetKeyState(VK_USER)==KEY_PUSH){	//[U[L[
			Type=0;
		}
	}

		if(shotCount >= 0)
		{
			shotCount++;
		}
		if(shotCount == 30)
		{
			shotCount=-1;
		}
		} else {shotCount=-1;}

		SetIntersectionCircle(GetPlayerX,GetPlayerY,1.5);
		yield;
	}


task MainShot(Angle,SW,SX,SY,SP,SS){
	let dAngle = 0;
	let obj = Obj_Create(OBJ_SHOT);
	Obj_SetPosition(obj,GetPlayerX+SX,GetPlayerY+SY);
	Obj_SetSpeed(obj,SP);
	Obj_SetAngle(obj,Angle);
	ObjShot_SetDamage(obj,SS);
	ObjShot_SetPenetration(obj,2);
	ObjShot_SetGraphic(obj,SW);
	Obj_SetAlpha(obj,200);
}

	@Missed{
			Type=0;
		}

	@SpellCard
	{
	AnimaX = 20;
	AnimaY = 0;
		if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD)
		{	
		UseSpellCard("Sakuya",true);
		CutIn(KOUMA,"uCfBXN~lCgv",CutRemiS);
		Type=2;
		Anima2;
		}
		else
		{
		UseSpellCard("Reimu",true);
		CutIn(KOUMA,"FuFv",CutRemiR);
		Type=1;
		Anima2;
		}
	}
	
	@DrawLoop
	{
		if(Type==1){
		SetGraphicRect(40,288,69,331);
		SetTexture(imgRemi);
		SetGraphicScale(AnimaX*0.1,AnimaY*0.1);
		SetAlpha(255);
		SetColor(255,255,255);
		SetRenderState(ALPHA);
		SetGraphicAngle(0,0,0);
		DrawGraphic(GetPlayerX(), GetPlayerY()-50);

		SetGraphicRect(59,172,117,230);
		SetTexture(imgRemi);
		SetGraphicScale(1.5,1.5);
		SetAlpha(100);
		SetGraphicAngle(0,0,angleC);
		DrawGraphic(GetPlayerX(), GetPlayerY());
		SetGraphicRect(20,290,39,309);
		SetGraphicScale(1,1);
		SetAlpha(255);
		SetGraphicAngle(0,0,angleD);
		DrawGraphic(GetPlayerX()+22, GetPlayerY()+5);
		SetGraphicAngle(0,0,angleD*-1);
		DrawGraphic(GetPlayerX()-18, GetPlayerY()+5);
		} else if(Type==2){
		SetGraphicRect(71,288,100,331);
		SetTexture(imgRemi);
		SetGraphicScale(AnimaX*0.1,AnimaY*0.1);
		SetAlpha(255);
		SetColor(255,255,255);
		SetRenderState(ALPHA);
		SetGraphicAngle(0,0,0);
		DrawGraphic(GetPlayerX(), GetPlayerY()-50);

		SetGraphicRect(0,172,58,230);
		SetTexture(imgRemi);
		SetGraphicScale(1.5,1.5);
		SetAlpha(100);
		DrawGraphic(GetPlayerX(), GetPlayerY());
		SetGraphicRect(0,231,58,289);
		SetGraphicAngle(0,0,angleA);
		DrawGraphic(GetPlayerX(), GetPlayerY());
		SetGraphicRect(59,231,117,289);
		SetGraphicAngle(0,0,angleB);
		DrawGraphic(GetPlayerX(), GetPlayerY());
		SetGraphicRect(0,290,19,309);
		SetGraphicScale(1,1);
		SetAlpha(255);
		SetGraphicAngle(0,0,0);
		DrawGraphic(GetPlayerX()+9, GetPlayerY()-30);
		SetGraphicRect(0,290,19,309);
		SetGraphicAngle(0,0,0);
		DrawGraphic(GetPlayerX()-9, GetPlayerY()-30);
		}

		SetAlpha(255);
		SetRenderState(ALPHA);
		SetGraphicAngle(0,0,0);
		SetTexture(imgRemi);
		SetGraphicScale(1,1);
		if(GetKeyState(VK_LEFT)==KEY_PUSH || GetKeyState(VK_LEFT)==KEY_HOLD)
		{
			SetGraphicRect(40,0+43*Animation,79,42+43*Animation);
		}
		else if(GetKeyState(VK_RIGHT)==KEY_PUSH || GetKeyState(VK_RIGHT)==KEY_HOLD)
		{
			SetGraphicRect(80,0+43*Animation,119,42+43*Animation);
		}
		else 
		{
			SetGraphicRect(0,0+43*Animation,39,42+43*Animation);
		}
		DrawGraphic(GetPlayerX(), GetPlayerY());	
	}

task Anima{
		loop{
		Animation=0;
		loop(10){yield;}
		Animation=1;
		loop(10){yield;}
		Animation=2;
		loop(10){yield;}
		}
	}

task Anima2{
		loop(10){
		AnimaX=AnimaX-1;
		AnimaY=AnimaY+1;
		yield;}
		loop(120){yield;}
		loop(10){
		AnimaX=AnimaX-1;
		AnimaY=AnimaY+1;
		yield;}
	}

	@Finalize
	{
		DeleteGraphic(imgRemi);
	}
}

}

script_spell Sakuya
{
	let current = GetCurrentScriptDirectory();
	let bom2 = current~"se\BOM2.wav";
	let i = 0;
	@Initialize
	{
		SetPlayerInvincibility(175);//GԂݒ
		shoot;
	}
	@MainLoop
	{
		CollectItems;
		yield;
	}
	@Finalize
	{
	}


task shoot{
	loop(50){yield;}
	loop(100){
	PlaySE(bom2);
	Sshot11(30);
	Sshot11(30);
	Sshot11(30);
	Sshot11(31);
	Sshot11(31);
	Sshot11(31);
	yield;}
	loop(25){yield;}
	End;
}

task Sshot11(SW){
	let obj = Obj_Create(OBJ_SHOT);
	Obj_SetPosition(obj,GetPlayerX+rand(-20,20),GetPlayerY+rand(-70,-30));
	Obj_SetSpeed(obj,10);
	Obj_SetAngle(obj,rand_int(0,360));
	ObjShot_SetDamage(obj,1);
	ObjShot_SetPenetration(obj,10000);
	ObjShot_SetGraphic(obj,SW);
	Obj_SetAlpha(obj,200);
}

}

script_spell Reimu
{
	let current = GetCurrentScriptDirectory();
	let bom1 = current~"se\BOM1.wav";
	let i = 0;
	@Initialize
	{
		SetPlayerInvincibility(175);//GԂݒ
		shoot;
	}
	@MainLoop
	{
		CollectItems;
		yield;
	}
	@Finalize
	{
	}


task shoot{
	let x = 0;
	let y = 0;
	loop(50){yield;}
	x=GetPlayerX;
	y=GetPlayerY;
	loop(35){
	PlaySE(bom1);
	Sshot11(5+i,x,y,270,350);
	Sshot11(5+i,x,y,210,290);
	Sshot11(5+i,x,y,150,230);
	Sshot11(5+i,x,y,90,170);
	Sshot11(5+i,x,y,30,110);
	Sshot11(5+i,x,y,330,50);
	Sshot11(5+i,x,y,270,190);
	Sshot11(5+i,x,y,210,130);
	Sshot11(5+i,x,y,150,70);
	Sshot11(5+i,x,y,90,10);
	Sshot11(5+i,x,y,30,310);
	Sshot11(5+i,x,y,330,250);
	loop(2){yield;}
	i=i+20;
	yield;}
	loop(40){yield;}
	End;
}

task Sshot11(SW,SX,SY,angle,bngle){
	let i = 0;
	let obj = Obj_Create(OBJ_SHOT);
	Obj_SetPosition(obj,SX+cos(angle)*SW,SY-50+sin(angle)*SW);
	Obj_SetSpeed(obj,0);
	Obj_SetAngle(obj,bngle);
	ObjShot_SetDamage(obj,1);
	ObjShot_SetPenetration(obj,10000);
	ObjShot_SetGraphic(obj,20);
	Obj_SetAlpha(obj,200);
	ObjShot_SetDelay(obj,20);
	loop(100){
	Obj_SetSpeed(obj,0+i);
	i=i+0.05;
	yield;}
}

}