#BackGround[Default]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main{
        #include_function ".\lib\lib_anime_Lunachild.txt"
	let imgBoss=GetCurrentScriptDirectory~"img\Boss\dot_lunachild.png";

        #include_function ".\lib\lib_Bosscommon.txt"
        #include_function ".\lib\lib_SpellBouns.txt"

    	@Initialize
        {
	  SetLife(2000);
	  SetDamageRate(0,0);
	  SetCountDown;
	  CreateEnemyFromScript("Sunny",GetX,GetY,0,0,0);//OL`
          Tmain;
	}
	
	@MainLoop
	{  
		if(OnEvent()==true){break;}
                yield;
                SetCollisionA(GetX(),GetY(),32);
		SetCollisionB(GetX(),GetY(),16);
		if(GetHitCount<=0){return;}
		if(Hitframe%4==0){
			PlaySE(Hit);
		}
		Hitframe++;
        } 
	
	@Finalize
	{       

	}

	@DrawLoop
	{//`
                SetColor(255,255,255);
		SetRenderState(ALPHA);
		DrawBoss( imgBoss );
	}

        task Tmain
        {
	 	SetMovePosition02(cx+250,cy-140,0);
		yield;
		//ÕXyǂ--------------------------------------------------------------
		if(GetCommonData("GetSpell")==true){GetSpellEffect( GetCommonData("GetSpellBounus_B") );}

		loop(120){yield;}
		let IceScore = GetCommonData("GetIce");						//_
		let Points=200000+GetGraze*10+IceScore+truncate(GetScore/100)-10000*GetBombCount;
		//J[h
	 	SetDamageRate(120,50);
		SetTimer(31);
		yield;

		SetMovePosition03(cx,cy-120,10,6);//ʓړ---------------------------------------------
	 	SetAction(ACT_MOVE,60);
		loop(120){yield;}
		//e-------------------------------------------------------------------------------------
		alternative(Level)
		case(1){//hard
			let ways = 12;
			Shot01(ways);
		}
		case(0){//easy
			let ways = 6;
			Shot01(ways);
		}
	}

	task Shot01(ways){//Sʌ}[N
		loop{
			let angle=90;
			loop(8){
				PlaySE(arrow01);
				loop(ways){
					Shot01b(angle);
					angle+=360/ways;
				}
				angle+=360/ways/3;
				loop(24){yield};
			}
			TMove();
		}

		task Shot01b(angle){//Sʌ}[N
				let Set_angle = angle - 90;
				loop(12){
					CreateShot01(GetX+35*cos(Set_angle),GetY+20*sin(Set_angle),4,angle,67,5);
					Set_angle += 180 / 11;
				}
				Set_angle = angle - 90;
				loop(12){
					CreateShot01(GetX+35*cos(Set_angle),GetY+35*sin(Set_angle),4,angle,67,5);
					Set_angle += 180 / 11;
				}

		}
	}

	task TMove(){
 		if(GetX>=GetPlayerX){SetMovePositionRandom01(60,30,2,GetX-60,cy-160,GetX-61,cy-80);}
 		if(GetX<=GetPlayerX){SetMovePositionRandom01(60,30,2,GetX+60,cy-160,GetX+61,cy-80);}
		if(GetX>=cx+100){SetMovePositionRandom01(60,30,2,GetX-60,cy-160,GetX-61,cy-80);}
		if(GetX<=cx-100){SetMovePositionRandom01(60,30,2,GetX+60,cy-160,GetX+61,cy-80);}
		SetAction( ACT_MOVE, 60 );
	}

        task effectshot(X,Y,delay,col){
                  CreateShotA(1,X,Y,delay);
                  SetShotDataA(1,0,0,0,0,0,0,7);
                  SetShotKillTime(1,0);
                  FireShot(1);
        }
}

script_enemy Sunny{
	#include_function ".\lib\lib_anime_Sunnymilk.txt"
	let imgBoss=GetCurrentScriptDirectory~"img\Boss\dot_sunnymilk.png";
	let Item  	=GetCurrentScriptDirectory~"\img\effect_tiny.png";
	#include_function ".\lib\lib_EnemyMarker.txt"
	EnemyMarker;
        let cx=GetCenterX;
        let cy=GetCenterY;
    	@Initialize
        {
          InitializeAction();
          LoadGraphic(imgBoss);
          SetInvincibility(90);
          SetLife(4000);
          Tmain;

	}

	@MainLoop
	{  
                yield;
        } 
	@Finalize
	{       

	}
	@DrawLoop
	{//`
                SetColor(255,255,255);
		SetRenderState(ALPHA);
		DrawBoss( imgBoss );
	}
        
        task Tmain
        {
                SetAction( ACT_MOVE, 60 );
		SetMovePosition03(cx+300,cy-150,10,6);//ʊOړ
		loop(60){yield;}
		VanishEnemy;//폜

        }
        task Tmove(){
                 if(GetX>=cx+100){SetMovePositionRandom01(70,20,2,GetX-70,cy-120,GetX-71,cy-60);}
                 else if(GetX<=cx-100){SetMovePositionRandom01(70,20,2,GetX+70,cy-120,GetX+71,cy-60);}
                 else if(GetX>=GetPlayerX){SetMovePositionRandom01(70,20,2,GetX-70,cy-120,GetX-71,cy-60);}
                 else if(GetX<=GetPlayerX){SetMovePositionRandom01(70,20,2,GetX+70,cy-120,GetX+71,cy-60);}
                 SetAction( ACT_MOVE, 60 );
        }
}
