#TouhouDanmakufu
#Title[nonspell4L]
#Text[nonspell4L]
#Image[.\img\spellcard0103.jpg]
#PlayLevel[Normal]
#ScriptVersion[2]

script_enemy_main
{
#include_function ".\draweverything.txt";
#include_function ".\system\Effects.txt";
#include_function ".\cutin.txt";
#include_function ".\MediEffect.txt";
let ImgBoss = GetCurrentScriptDirectory~"img\boss_medicine.png";
let CSD = GetCurrentScriptDirectory;
let angle = 0;
let switch = 1;
let count = 0;
let ypos = 0;
let xpos = 0;
let Cut = GetCurrentScriptDirectory~"img\cut5.png";
SetCommonData("back",0);

@Initialize
{
SetLife(2500);
SetDamageRate(100,50);
SetTimer(60);
mainTask;
MediStart;
SetMovePosition03(GetCenterX, 120, 10, 4);
}

//---------------------------------------------------------------

@MainLoop 
{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
yield;
}

//---------------------------------------------------------------

@DrawLoop
{
drawall;
}

//---------------------------------------------------------------

@Finalize
{
DeleteGraphic(ImgBoss);
}

// main task
task mainTask{
	wait(60);
	fire;
	wait(240);
	fire2;
}

task fire{
	Concentration01(60);
	wait(60);
	loop{
	xpos = 0;
	PlaySE(CSD~"sound\eff1.wav");
	ascent(n in 0..260){
	if(n%10==0){switch = -1;}
	else{switch = 1;}
	xpos += 1.75;
	ypos = GetCenterY+20*sin(n*4);
	CreateShotA(0,xpos,ypos+100,25);
	SetShotDataA(0,0,rand(1,2+switch*1.5),180-90*switch,0,0,0,63+n%3);
	FireShot(0);
	CreateShotA(0,xpos,ypos-100,25);
	SetShotDataA(0,0,rand(1,2+switch*1.5),180+90*switch,0,0,0,63+n%3);
	FireShot(0);
	wait(1);
	}
	/////////////////////////////
	xpos = 416;
	PlaySE(CSD~"sound\eff1.wav");
	ascent(n in 0..260){
	if(n%10==0){switch = -1;}
	else{switch = 1;}
	xpos -= 1.75;
	ypos = GetCenterY+20*sin(n*4);
	CreateShotA(0,xpos,ypos+100,25);
	SetShotDataA(0,0,rand(1,2+switch*1.5),180-90*switch,0,0,0,58);
	FireShot(0);
	CreateShotA(0,xpos,ypos-100,25);
	SetShotDataA(0,0,rand(1,2+switch*1.5),180+90*switch,0,0,0,58);
	FireShot(0);
	wait(1);
	}
	yield;
	}
	}

task fire2{
	loop{
	PlaySE(CSD~"sound\bright.wav");
	ascent(i in 0..12){
	ascent(j in 0..4){
	CreateShot01(GetX,GetY,1.5-i/18,GetAngleToPlayer+i*2+j*90,13,10);
	CreateShot01(GetX,GetY,1.5-i/18,GetAngleToPlayer-i*2+j*90,13,10);
	}
	}
	ascent(i in 0..6){
	ascent(j in 0..4){
	CreateShot01(GetX,GetY,0.75,24+i*8+j*90+GetAngleToPlayer,13,10); 
	}
	}
	wait(75);
	SetMovePositionRandom01(rand(10,20),0,2,GetClipMinX+100,rand(150,160),GetClipMaxX-100,rand(100,150));
	checkmove;
	wait(75);
	}
	}

	function wait(w){
		loop(w){yield;}
			}
}