#TouhouDanmakufu[Single]
#ScriptVersion[3]
#Title["Nonspell6"]
#Text["Woop"]


let objBoss;

let BossX;
let BossY;


#include "./Functions/Index.txt"
#include "./Functions/Dialogue.txt"


@Initialize {
	objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	ObjEnemy_Regist(objBoss);
	renderkanako(objBoss);
	BossShotSound(objBoss, 100, 600);
	KanakoAura(objBoss, false);
	Sticks(objBoss, false);
	BottomEnemyMarker(objBoss, objBoss);
	DrawName("Kanako Yasaka", [20, 20, 200], 11);
	ObjMove_SetDestAtWeight(objBoss, GetStgFrameWidth/2, GetStgFrameHeight/3, 10, 5);
	Maintask;
	end;
} 

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

@MainLoop {
	BossX = ObjMove_GetX(objBoss);
	BossY = ObjMove_GetY(objBoss);
	
	if(invisible==false){
	ObjEnemy_SetIntersectionCircleToShot(objBoss,BossX,BossY,21);
	ObjEnemy_SetIntersectionCircleToPlayer(objBoss,BossX,BossY,16);
	}
	
	if(GetPlayerInvincibilityFrame<=0){invisible=false;}
	else{invisible=true;}
	
	yield;
} 

@Finalize {

} 


task Maintask{
wait(80);
Pattern;
attack = true;
}


task Pattern{
let angle = 0;
	loop{
		ascent(i in 0..5){
			ascent(j in 0..4){
				let obj = CreateShotA1(BossX, BossY, 2.6+(i/20), i*1.3+(j*360/4)+angle, ICE_RED, 5);
				
			}
		}
		angle+=8.2;
		wait(3);
		ascent(i in 0..5){
			ascent(j in 0..4){
				let obj2 = CreateShotA1(BossX, BossY, 2.6-(i/20), i*1.3-(j*360/4)-angle, ICE_BLUE, 5);
				
			}
		}
		angle+=8.4;
		wait(2);
	}
}



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