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

let objBoss;
let objBossFake;

let BossX; 
let BossY;

@Initialize {
	objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	ObjEnemy_Regist(objBoss);
	HitSound(objBoss, 80, 450);
	EnemyMarker(objBoss);
	DrawName("Aunn Komano", [40,140,90], 12.7);
	MagicRing(objBoss,true);
	FlameAura(objBoss,[199, 5, 5],3);
	RenderCharacter(objBoss);
	
	objBossFake = ObjEnemy_Create(OBJ_ENEMY);
	ObjEnemy_Regist(objBossFake);
	MagicRing(objBossFake,true);
	FlameAura(objBossFake,[199, 5, 5],3);
	RenderCharacter(objBossFake);
	ObjMove_SetPosition(objBossFake, -100, -100);
	
	ObjMove_SetDestAtWeight(objBoss, GetStgFrameWidth/2, GetStgFrameHeight/3, 10, 4);
	
	mainTask;
} 

@Event { 
	alternative(GetEventType())
	case(EV_REQUEST_LIFE){
		SetScriptResult(1);
     	}
	case(EV_REQUEST_TIMER){
		SetScriptResult(40);
	}
	case(EV_REQUEST_SPELL_SCORE){
		SetScriptResult(1000000);
	}
} 

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

@Finalize {
} 

task mainTask { 
wait(120);
SetCommonData("musicswap",1);
PlaySound(GetCurrentScriptDirectory ~ "Default_System/se/barrage.wav", 255);
ObjMove_SetPosition(objBossFake, BossX, BossY);
ObjMove_SetAngle(objBoss, 0);
ObjMove_SetAngle(objBossFake, 180);
ObjMove_SetSpeed(objBoss, 2);
ObjMove_SetSpeed(objBossFake, 2);
wait(60);
ObjMove_SetSpeed(objBoss, 0);
ObjMove_SetSpeed(objBossFake, 0);
wait(30);
ObjMove_SetDestAtWeight(objBoss, -100, -100, 10, 8);
ObjMove_SetDestAtWeight(objBossFake, GetStgFrameWidth+100, -100, 10, 10);
wait(120);
Obj_Delete(objBoss);
DeleteShotAll(TYPE_ALL, TYPE_ITEM);
SetAutoDeleteObject(true);
CloseStgScene;
}