#東方弾幕風[Single]
#ScriptVersion[3]
#Title["And something else."]
#Text["No, I won't leave[r]my memes to Zaro."]
#System["./default_system/Meem_Default.txt"]
#Background["./default_System/Default_Background.txt"]
#include"./default_system/Default_Index.txt"

let objBoss;
	
let BossX;
let BossY;

@Initialize {
	SetPlayerClip(126, 12, 510, 468);
	objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	ObjEnemy_Regist(objBoss);
	
	ObjMove_SetPosition(objBoss, GetStgFrameWidth/2, -10);
	ObjMove_SetDestAtWeight(objBoss, GetStgFrameWidth/2, GetStgFrameHeight/2-100, 5, 0.30);

	Initialization;
	
	Main;
	end;
} 

task Initialization{
	RenderKaisen(objBoss);
	HitSound(objBoss,60,500);
	TimerCountdown;
	SetArmor(objBoss, [90, 80], 180);
	EnemyMarker(objBoss);
	ColorChange;
}

@Event { 
	alternative(GetEventType())
	case(EV_REQUEST_LIFE){SetScriptResult(10000);}
	case(EV_REQUEST_TIMER){SetScriptResult(60);}
	//case(EV_REQUEST_SPELL_SCORE){SetScriptResult(10000);}
	//case(EV_REQUEST_IS_DURABLE_SPELL){SetScriptResult(true);}
	//case(EV_REQUEST_IS_LAST_SPELL){SetScriptResult(true);}
} 

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

@Finalize {
} 

task ColorChange{
SetCommonData("StgFrameColor", [255, 255, 255]);
ascent(i in 0..32){
SetCommonData("StgFrameColor", [255-i*4, 255-i*8, 255-i*8]);
yield;
}
loop{
ascent(i in 0..32){
SetCommonData("StgFrameColor", [126, 0+i*4, 0]);
yield;
}
ascent(i in 0..32){
SetCommonData("StgFrameColor", [126-i*4, 126, 0]);
yield;
}
ascent(i in 0..32){
SetCommonData("StgFrameColor", [0, 126, 0+i*4]);
yield;
}
ascent(i in 0..32){
SetCommonData("StgFrameColor", [0, 126-i*4, 126]);
yield;
}
ascent(i in 0..32){
SetCommonData("StgFrameColor", [0+i*4, 0, 126]);
yield;
}
ascent(i in 0..32){
SetCommonData("StgFrameColor", [126, 0, 126-i*4]);
yield;
}
}
}

task Main { 
wait(60*9);
	ascent(j in 0..32){
		ascent(k in 0..6){
		FireShotA1(BossX, BossY, 1+1*k, j*360/32, L_BUBBLE_GREY, 25);
		}
	}
wait(60*4);
	ascent(h in 0..60*6){
		ascent(k in 0..3){
		FireShotA1(BossX+(75*sin(h))*cos(k*360/3+h*11), BossY+(75*sin(h+180))*sin(k*360/3+h*11), 3, k*360/3+h*6, KNIFE_GREY, 10);
		}
	PlaySound("lensmbullet", 75, 10);
	wait(2);
	}
wait(60);

	loop{
		ascent(i in 0..92){
			CreateShotB2(GetPlayerX-86, GetStageDown, rand(-1, 1), rand(-10, -15), 0, 0.15, 10, 3, KNIFE_YELLOW, 10);
			CreateShotB2(GetPlayerX+86, GetStageDown, rand(-1, 1), rand(-10, -15), 0, 0.15, 10, 3, KNIFE_YELLOW, 10);
			yield;
		}
		
		wait(60);
		
		ascent(i in 0..92){
			CreateShotB2(GetPlayerX-35, GetStageDown, rand(-1, 1), rand(-10, -15), 0, 0.15, 10, 3, KNIFE_YELLOW, 10);
			CreateShotB2(GetPlayerX+35, GetStageDown, rand(-1, 1), rand(-10, -15), 0, 0.15, 10, 3, KNIFE_YELLOW, 10);
			yield;
		}
		wait(60);
	}
}

task end{
    while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){yield;}
	NotifyEvent(GetStageID, EV_USER_STAGE, [true, true, true, false, false, false]); //smexplosion, smparticles, items, bigexplosion, bigparticles, shake+slow
    Obj_Delete(objBoss);
    DeleteShotAll(TYPE_ALL, TYPE_ITEM);
    SetAutoDeleteObject(true);
    CloseScript(GetOwnScriptID());
} 