e
#Title[ʏ3]
#Text[]
#BGM[.\..\bgm\bgm.wav]
#BackGround[User]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{
	
	@Initialize{
		imgBoss = imgBoss_LilyWhite;
		InitializeData();
		InitializeAction();
		
		SetLife(5000);
		Warp(CenterX,MinY + 130,40);
		SetDamageRate(155,100);
		SetCollisionEx(32,16,false,160);
		SetEnemyMarker(true);
		
		TMain();
	}
	
	@MainLoop{
		yield;
	}
	
	@DrawLoop{
		DrawBoss(imgBoss);
	}
	
	@Finalize{
		FinalizeData();
	}
	
	task TMain(){
		FWait(120);
		
		SetTimer(52);
		
		Atack();
	}
	
	task Atack(){
		let angle = 0;
		let turn = 1;
		
		SetAction(ACT_SHOT_B,21600);
		
		loop{
			angle = rand(0,360);
			ascent(i in 0..6){
				Cherry(angle + i * 360 / 6,turn);
			}
			turn *= -1;
			FWait(180);
		}
	}
	
	task Cherry(angle,turn){
		let x = GetX();
		let y = GetY();
		let vx = x;
		let vy = y;
		let rad = 0;
		let count = 0;
		
		loop(180){
			rad += 1.4;
			angle += 3.56 * turn;
			vx = GetGapX(x,rad,angle);
			vy = GetGapY(y,rad,angle);
			
			GrowEffect(vx,vy,7,20,19);
			if(count % 2 == 0){
				CherryShot(vx,vy,1.1 + count * 0.011,angle + 180 - 40 * turn,PURPLE23,0);
			}
			
			count += 1;
			
			yield;
		}
	}
	
	task CherryShot(x,y,speed,angle,graph,delay){
		let obj = CreateObjShot(x,y,speed,angle,graph,delay);
		Obj_SetAutoDelete(obj,false);
		FWait(60);
		if( !Obj_BeDeleted(obj) ){
			Obj_SetAutoDelete(obj,true);
		}
	}
	
	#include_function ".\initialize.txt"
	
	#include_function ".\..\lib\lib_obj.txt"
	#include_function ".\..\lib\lib_value.txt"
	#include_function ".\..\lib\lib_effect.txt"
}