#東方弾幕風[Single]
#ScriptVersion[3]
#Title["Example S"]
#System[".\Foxi's System.txt"]

#include".\system/Resources.txt"
#include".\OzzieEffects.txt"
#include".\RenderBossFunctions.txt"
#include".\ShotFunctions.txt"
#include".\MiscFunctions.txt"
#include".\Cutin.txt"
#include".\shot/shot_const.txt"

let objEnemy;
let objPlayer; 

@Event
{
	alternative(GetEventType())
	case(EV_REQUEST_LIFE)
	{
		
		SetScriptResult(100);
	}
	case(EV_REQUEST_TIMER)
	{
		SetScriptResult(60);
	}
	case(EV_REQUEST_SPELL_SCORE)
	{
		SetScriptResult(3);
	}
	
}

@Initialize
{
	PlaytestInvincibility();
	objPlayer = GetPlayerObjectID();

	objEnemy = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	ObjEnemy_Regist(objEnemy);
	ObjEnemy_SetDamageRate(objEnemy, 0, 0);
	TAnimate();
	TBoss();
	let cx = GetStgFrameWidth() / 2;
	let cy = 75;
	ObjMove_SetDestAtFrame(objEnemy, cx, cy, 60);
	TSpellCardScene;
	TMain();
}


@MainLoop{
	yield;
}

task TSpellCardScene
{
	
	wait(60);
	TAttack(1);
	SE_Play(spellcard, 120);
	ObjEnemyBossScene_StartSpell(GetEnemyBossSceneObjectID());
	let enmcut = GetCurrentScriptDirectory ~ "img/bossImg2.png";
	TCutin("Test sign \"Testing\"",enmcut,KANAKO,[255,0,0],0);
}

task TBoss(){
	while(!Obj_IsDeleted(objEnemy)){
		ObjEnemy_SetIntersectionCircleToShot(objEnemy, ObjMove_GetX(objEnemy), ObjMove_GetY(objEnemy), 10);
		ObjEnemy_SetIntersectionCircleToPlayer(objEnemy, ObjMove_GetX(objEnemy), ObjMove_GetY(objEnemy), 14);
		if(ObjEnemy_GetInfo(objEnemy, INFO_LIFE) <= 0){
			TEnd();
		}
		yield;
	}
}



task TMain
{
	wait(60*4);
	ConcentrationA3(objEnemy,"BULLET", 60 * 2,8,200,[255,0,0]);
	ConcentrationA3(objEnemy,"BULLET", 60 * 2,8,200,[255,0,200]);
	SE_Play(charge0, 70);
	ObjEnemy_SetDamageRate(objEnemy, 0, 0);
	wait(60*2 + 30);
	ObjEnemy_SetDamageRate(objEnemy, 100, 100);
}

task TEnd
{
	
	
	
	Set2DCameraRatioX(cos(0));
	Set2DCameraRatioY(cos(0));
	Obj_Delete(objEnemy);
	let r = 0;
	loop(60)
	{
		DeleteShotAll(TYPE_ALL,TYPE_IMMEDIATE);
		yield;
	}
	DeleteShotAll(TYPE_ALL,TYPE_IMMEDIATE);
	CloseScript(GetOwnScriptID());
}
