#TouhouDanmakufu[Single]
#ScriptVersion[3]
#Title["SP2"]
#Text["Baaaaaaaaaap"]
#System["./default_system/Default_System.txt"]
#include "./default_system/MS_Index.txt"

let objBoss;

let BossX; 
let BossY;

@Initialize {
	objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	ObjEnemy_Regist(objBoss);
	HitSound(objBoss, 80, 450);
	EnemyMarker(objBoss);
	DamageReduction(objBoss, 1);
	DrawName("Aunn Komano", [40,140,90], 12.7);
	MagicRing(objBoss,true);
	RenderCharacter(objBoss);
	ObjMove_SetDestAtWeight(objBoss, GetStgFrameWidth/2, GetStgFrameHeight/3, 10, 4);
	mainTask;
	end;
} 

@Event { 
	alternative(GetEventType())
	case(EV_REQUEST_LIFE){
		SetScriptResult(4000);
     	}
	case(EV_REQUEST_TIMER){
		SetScriptResult(105);
	}
	case(EV_REQUEST_SPELL_SCORE){
		SetScriptResult(1000000);
	}
} 

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

@Finalize {
} 

task mainTask { 
SpellCard("Hound Sign &quot;Shisa's Legendary Roar&quot;", [40,140,90], GetCurrentScriptDirectory ~ "./default_system/img/Ingame/AunnCutin.png", 25);
PlaySound(GetCurrentScriptDirectory ~ "Default_System/se/charge.wav", 255);
	loop(8){
	Concentrate(BossX, BossY, 0, 4, 4, 1, "Cherry", 200, -2, [125, 15, 125]);
	Concentrate(BossX, BossY, 0, 4, 4, 1, "Cherry", 200, 2, [255, 255, 255]);
	wait(5);
	}
Pattern;
}

task Pattern{
loop{
ascent(j in 0..32){
	ascent(i in 0..3){
		ascent(k in -1..1){
		let obj = CreateShotA2(BossX+50*cos(i*360/3+k*1.5+j*32), BossY+50*sin(i*360/3+k*1.5+j*32), 4+k/10, i*360/3+k*1.5+j*32, -0.01-j/255, 0, RICE_S_RED, 10);
		let obj2 = CreateShotA2(BossX+50*cos(i*360/3-k*1.5+j*32), BossY+50*sin(i*360/3-k*1.5+j*32), 4+k/10, i*360/3-k*1.5+j*32, -0.01-j/255, 0, RICE_S_RED, 10);
		Red(obj);
		Red(obj2);
		}
	}
PlaySound(GetCurrentScriptDirectory ~ "Default_System/se/smbullet.wav", 80);
wait(10-j/7);
}
wait(120);
descent(j in 0..32){
	ascent(i in 0..3){
		ascent(k in -1..1){
		let obj = CreateShotA2(BossX, BossY, 4+k/10, i*360/3+k*1.5+j*32, -0.01-j/755, 0, RICE_S_YELLOW, 10);
		let obj2 = CreateShotA2(BossX, BossY, 4+k/10, i*360/3-k*1.5+j*32, -0.01-j/755, 0, RICE_S_YELLOW, 10);
		Red(obj);
		Red(obj2);
		}
	}
PlaySound(GetCurrentScriptDirectory ~ "Default_System/se/smbullet.wav", 80);
wait(10-j/7);
}
wait(120);
}
	task Red(obj){
	while(ObjMove_GetSpeed(obj)>0.1){yield;}
	PlaySound(GetCurrentScriptDirectory ~ "Default_System/se/spirit.wav", 60);
	ObjMove_AddPatternA2(obj, 0, 0.2, GetAngleToPlayer(obj), 0.005, 0, 10);
	}
}

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());
} 