#TouhouDanmakufu
#Title[Lotus Grimoire "Undefined Star"]
#Text[That visit to Makai was so peaceful. Ah, such concentrations of magic~]
#BackGround[User(.\img\BG.png,0,0)]
#PlayLevel[Normal]
#Player[FREE]
#BGM[.\bgm.mp3]
#ScriptVersion[2]
script_enemy_main	
{
#include_function ".\function_cutin.txt"
#include_function ".\lib.txt"
let bgalpha = 0;	
let bgangle = 0;	
let bossflip = 0;
let ani = 0;
let Lotus1 = csd~"img/stage06e03.png";
let Lotus2 = csd~"img\stage06e02.png";
let s = 0;
let s2 = 0;
let Lotus2Rect = [192, 0, 194,256];
let pos=0;
@Initialize{
	LoadStuff;
	LoadGraphic(Lotus1);
	LoadGraphic(Lotus2);
	SetLife(3500);
	SetInvincibility(450);
	SetTimer(90);
	SetScore(1000000);
	cutin("NAZRIN","Lotus Grimoire "\""Undefined Star"\",Maricutin,0,0,256,512);
	SetEffectForZeroLife(60,0,0);
	SetMovePosition02(GetCenterX,GetCenterY-60,60);
	LoadUserShotData(GetCurrentScriptDirectory~"Shot.txt");
	MainTask;
	Timer;
	MoveAnimation;
	}
task MainTask{
	Wait(60);
	SetColor(231,199,69);
	Concentration01(120);
	SetColor(255,255,255);
	PlaySE(Charge);
	Wait(120);
	PlaySE(Boon);
	LotusGrow1;
	Wait(30);
	LotusGrow2;
	Wait(60);
	StarBeams;
	SummonFamiliars;
	}
task LotusGrow1{
	while(s <= 0.97){
		s += 0.03;
		yield;
		}
	}
task LotusGrow2{
	while(Lotus2Rect[0] != 0){
		Lotus2Rect[0]=Lotus2Rect[0]-3.2;
		Lotus2Rect[2]=Lotus2Rect[2]+3.2;
		pos+=3.2;
		ShotTrail(pos);
		yield;
		}
	}
task ShotTrail(rectL){
	ascent(i in -11..12){
		CreateShotA(i,GetCenterX-rectL, GetCenterY-60+(256/22)*i, 10);
		SetShotDataA(i, 0, 0, 0, 0, 0, 0, 69+i);
		SetShotKillTime(i, 0);
		FireShot(i);
		CreateShotA(i,GetCenterX+rectL, GetCenterY-60+(256/22)*i, 10);
		SetShotDataA(i, 0, 0, 0, 0, 0, 0, 69+i);
		SetShotKillTime(i, 0);
		FireShot(i);
		}
	}
task SummonFamiliars{
	CreateEnemyFromFile(csd~"BF.txt", GetX+60, GetY-80, 0, 0, -1);
	CreateEnemyFromFile(csd~"BF.txt", GetX-60, GetY-80, 0, 0, 1);
	CreateEnemyFromFile(csd~"BF.txt", GetX+115, GetY+55, 0, 0, -1);
	CreateEnemyFromFile(csd~"BF.txt", GetX-115, GetY+55, 0, 0, 1);
	}
task StarBeams{
	loop{
		ascent(i in 0..19){
			CreateLaserA(i, GetX, GetY, 700, 10, 1, 60);
			SetLaserDataA(i, 0, GetAngleToPlayer+ 20*i, 0, 0, 0, 0);
			SetShotKillTime(i, 120);
			FireShot(i);
			PlaySE(Laser);
			}
		Wait(120);
		}
	}
@MainLoop{
	SetCollisionA(GetX,GetY,48);
	SetCollisionB(GetX,GetY,32);
	yield;
	}
@DrawLoop{
	if (bossflip==0){SetGraphicScale(1,1);}
	if (bossflip==1){SetGraphicScale(-1,1);}
	DrawName("Marisa Kirisame");
	SetTexture(Lotus1);
	SetGraphicRect(0,0,256,256);
	SetAlpha(255);
	SetRenderState(ALPHA);
	SetGraphicScale(s,s);
	SetGraphicAngle(0,0,360*s);
	DrawGraphic(GetX,GetY);
	
	SetTexture(Lotus2);
	SetGraphicRect(Lotus2Rect[0],Lotus2Rect[1],Lotus2Rect[2],Lotus2Rect[3]);
	SetAlpha(255);
	SetRenderState(ALPHA);
	SetGraphicAngle(0,0,0);
	DrawGraphic(GetX,GetY);
	
	SetTexture(Marisprite);
	SetGraphicRect(BR[0],BR[1],BR[2],BR[3]);
	SetAlpha(255);
	SetRenderState(ALPHA);
	SetGraphicAngle(0,0,0);
	SetGraphicScale(1,1);
	DrawGraphic(GetX,GetY);
	}

@BackGround{
	SpellBG;
	}
@Finalize{
	DeleteStuff;
	CaptureBonus;
	}
}