
script_enemy_main
{
	#include_script".\..\..\EnemyBossSystem.txt";
	#include_script".\Daiyousei_AnimeLib.txt";
	
	tex_enemy=filedir~"DaiyouseiAnother_Main.png";
	tex_spellbg=filedir~"DaiyouseiAnother_SpellBG.png";
	
	bg_rect=[0,0,386,512];
	
	@Initialize
	{
		point=480;
		SetLife(900);
		SetTimer(52);
		EnemyBossInitialize;
		SetAnimetion(tex_enemy);
	}
	@MainLoop{EnemyBossMainLoopSystem(50,invincible);yield;}
	@DrawLoop{EnemyBossDrawLoop;}
	@Finalize{EnemyBossFinalize;}
	
	task MainThread_Standard{}

	
	task MainThread_Advanced
	{
		yield;
		SetMovePositionHermite(cenX,minY+120,0,0,0,0,100);
		SetAction(ACT_MOVE,100);
		SetSpellCard("水霊「リルフィノーラ」",65);
		wait(120);
		loop
		{
			SetAction(ACT_SHOT_B,90);
			local
			{
				let way=24;
				let p=GetAngleToPlayer;
				
				let speed=1;
				let angle=p;
				let gra=54;
				let delay=10;
				while(angle<p+360)
				{
					CreateShot02(GetX,GetY,speed*10,angle,-speed,speed+0.1,gra,delay);
					angle+=360/way;
				}
			}
			wait(30);
			local
			{
				let lp=0;
				let speed=3.5;
				let way=10;
				loop(6)
				{
					let p=rand(0,360);
					let wide=6;
					let limit=60;
					let leng=20;
					let sch=[0.3,-0.3];
					let ag=p;
					let gra=242;
					let delay=10;
					while(ag<p+360)
					{
						let angle=ag-wide/2;
						while(angle<=ag+wide/2+1)
						{
							let sx=GetX+leng*cos(angle);
							let sy=GetY+leng*sin(angle);
							ascent(a in 0..length(sch))
							{
								let spd=[speed,speed-(speed-(speed/1.4))/2];
								SetShot(sx,sy,spd[a],angle,sch[a],gra,delay);
							}
							angle+=2;
						}
						ag+=360/way;
					}
					way+=1;
					speed/=1.4;
				}
				
				task SetShot(let sx,let sy,let speed,let angle,let sch,let gra,let delay)
				{
					let flame=0;
					let leng=0;
					let o=Obj_Create(OBJ_SHOT);
					Obj_SetX(o,sx);
					Obj_SetY(o,sy);
					Obj_SetSpeed(o,0);
					Obj_SetAngle(o,angle);
					ObjShot_SetGraphic(o,gra);
					ObjShot_SetDelay(o,delay);
					Obj_SetAutoDelete(o,false);
					ObjShot_SetBombResist(o,true);
					
					while(!Obj_BeDeleted(o))
					{
						Obj_SetX(o,sx+leng*cos(angle));
						Obj_SetY(o,sy+leng*sin(angle));
						Obj_SetAngle(o,angle);
						
						if(flame>=delay)
						{
							angle+=sch;
							leng+=speed;
						}
						if(leng>=500||Obj_GetY(o)>=maxY+20){Obj_Delete(o);}
						flame++;
						yield;
					}
				}
			}
			wait(180);
			let wt=120;
			SetMovePositionHermite(cenX+rand(-70,70),minY+rand(110,140),0,0,0,0,wt);
			SetAction(ACT_MOVE,wt);
			wait(wt+60);
		}
	}
	
	
	
	
	task MainThread_Unlimited{}
	
}