#TouhouDanmakufu[Single]
#ScriptVersion[3]
#Title["Nonspell 1"]
#Text["Woop"]

let objBoss;
let BossX;
let BossY;

#include "./Functions/Index.txt"


@Initialize {
	objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	ObjEnemy_Regist(objBoss);
	renderorin(objBoss);
	BossShotSound(objBoss, 100, 600);
	BottomEnemyMarker(objBoss, objBoss);
	
	ObjMove_SetPosition(objBoss,0,0);
	ObjMove_SetDestAtWeight(objBoss,384/2,150,5,5);
	mainTask;
	end;
} 

@Event { 
	alternative(GetEventType())
	case(EV_REQUEST_LIFE){
		SetScriptResult(4500);
     	}
	case(EV_REQUEST_TIMER){
		SetScriptResult(50);
	}
	case(EV_REQUEST_SPELL_SCORE){
		SetScriptResult(1000000);
	}
} 

@MainLoop {
	BossX = ObjMove_GetX(objBoss);
	BossY = ObjMove_GetY(objBoss);
	
	ObjEnemy_SetIntersectionCircleToShot(objBoss,BossX,BossY,24);
	ObjEnemy_SetIntersectionCircleToPlayer(objBoss,BossX,BossY,24);
	yield;
} 

@Finalize {

} 

task mainTask { 
wait(120);
let reverse = 1;
loop{
	attack = true;
	SE_Play(GetCurrentScriptDirectory ~ "Functions/sfx/chargelong.wav", 80);
	wait(20);
	OrinSpread(2,25*reverse,4,12,200,ICE_BLUE,0,false,25,0,0.1,5);
		if(reverse==-1){reverse=1;}
		else{reverse=-1;}
	wait(60);
	attack = false;
	wait(60);
	ObjMove_SetDestAtWeight(objBoss,GetPlayerX+rand(-25,25),150+rand(-25,25),15,5);
	wait(60);
	}
}

task end{
    while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){yield;}
    Obj_Delete(objBoss);
	SetCommonData("deathsound",1);
    DeleteShotAll(TYPE_ALL, TYPE_ITEM);
    SetAutoDeleteObject(true);
    CloseScript(GetOwnScriptID());
} 
