#TouhouDanmakufu[Single]
#ScriptVersion[3]
#Title["Spell3(Uninteresting)"]
#Text["Tengu Sign \"Year of The Wolf -New Year's Dawn-\""]

let cirno;
let bossX = 0;
let bossY = 0;
let imgBoss = GetCurrentScriptDirectory ~ "./img/Th125Momizi01.png";
let MagicCircle = GetCurrentScriptDirectory ~ "./img/magic.png";
let objcircle;
let isbehindscreen = 0;
let charge = GetCurrentScriptDirectory ~ "./sounds/power_logo.wav";
let charge2 = GetCurrentScriptDirectory ~ "./sounds/Charge3.wav";
let shotsound1 = GetCurrentScriptDirectory ~ "./sounds/shot1.wav";
let shotsound2 = GetCurrentScriptDirectory ~ "./sounds/shot2.wav";
let shotsound3 = GetCurrentScriptDirectory ~ "./sounds/shot3.wav";
let spellcardwarn = GetCurrentScriptDirectory ~ "./sounds/spellcard.wav";
let wave = GetCurrentScriptDirectory ~ "./sounds/BulletWave.wav";
let slashsound = GetCurrentScriptDirectory ~ "./sounds/Slash.wav";
let pow = GetCurrentScriptDirectory ~ "./sounds/Eff2.wav";
let familiarsound = GetCurrentScriptDirectory ~ "./sounds/fam.wav";
let boon = GetCurrentScriptDirectory ~ "./sounds/Boon1.wav";
let defeat = GetCurrentScriptDirectory ~ "./sounds/enemoff.wav";
let familiarimg = GetCurrentScriptDirectory ~ "./img/FamiliarOrb.png";
let familiar1 = ObjEnemy_Create(OBJ_ENEMY);
let familiar2 = ObjEnemy_Create(OBJ_ENEMY);
let familiar3 = ObjEnemy_Create(OBJ_ENEMY);
let familiar4 = ObjEnemy_Create(OBJ_ENEMY);
let mirror1 = ObjEnemy_Create(OBJ_ENEMY);
let mirror2 = ObjEnemy_Create(OBJ_ENEMY);
let mirror3 = ObjEnemy_Create(OBJ_ENEMY);
let mirror4 = ObjEnemy_Create(OBJ_ENEMY);
let mirrors = [mirror1,mirror2,mirror3,mirror4];
let familiars = [familiar1,familiar2,familiar3,familiar4];
let m1=0;
let m2=0;
let m3=0;
let fmovementbools = [m1,m2,m3];
let r1=0;
let r2=0;
let r3=0;
let r4=0;
let renderbools = [r1,r2,r3,r4];
let imgmirror = GetCurrentScriptDirectory ~ "./img/Mirror.png";

#include "script\default_system\Default_Effect.txt"
#include "./Shot/AllStarShot_Const.dnh"
#include "./momijiCutin.txt"

@Initialize {
	
	cirno = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	ObjEnemy_Regist(cirno);
	ObjMove_SetPosition(cirno,GetCommonData("X",0),GetCommonData("Y",0));
	ObjMove_SetDestAtWeight(cirno,192,120,6,4);
	renderBoss;
	yourmagiccircle;
	DeleteShotAll(TYPE_ALL,TYPE_ITEM);
	
	LoadSounds;

	mainTask;

}

@Event {

	alternative(GetEventType())
	case(EV_REQUEST_LIFE) {
		SetScriptResult(5600);
	}
	case(EV_REQUEST_TIMER) {
		SetScriptResult(-1);
	}

}

@MainLoop {
	bossX = ObjMove_GetX(cirno);
	bossY = ObjMove_GetY(cirno);
	
	if(isbehindscreen == 0){
	ObjEnemy_SetIntersectionCircleToShot(cirno,bossX,bossY,24);
	ObjEnemy_SetIntersectionCircleToPlayer(cirno,bossX,bossY,18);
	}
	
	yield;
}

@Finalize {

}

function wait(w) { loop(w) { yield; } }

task LoadSounds {
LoadSound(charge);
LoadSound(charge2);
LoadSound(shotsound1);
LoadSound(shotsound2);
LoadSound(shotsound3);
LoadSound(spellcardwarn);
LoadSound(wave);
LoadSound(slashsound);
LoadSound(pow);
LoadSound(familiarsound);
LoadSound(boon);
LoadSound(defeat);
}

task mainTask {
	
	TEnd;
	LowDamageStart;
	wait(10);
	PlaySE(charge2);
	wait(60);
	ascent(i in 1..40){ScreenShake(i,1); yield;}
	cutinimage("Tengu Sign \"Year of The Wolf -New Year's Dawn-\"",300);
	PlaySE(spellcardwarn);
	descent(i in 1..40){ScreenShake(i,1); yield;}
	wait(60);
	fire;
	
}

task LowDamageStart{ObjEnemy_SetDamageRate(cirno,3,10); wait(60*8); ObjEnemy_SetDamageRate(cirno,100,100);}


task yourmagiccircle {
	let circleframe = 0;
	let circlesize = 0.8;
	
	objcircle = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(objcircle, MagicCircle);
	ObjSprite2D_SetSourceRect(objcircle,0,0,256,256);
	ObjSprite2D_SetDestCenter(objcircle);
	ObjRender_SetScaleXYZ(objcircle,circlesize,circlesize,0);
	ObjRender_SetBlendType(objcircle,BLEND_ALPHA);
	Obj_SetRenderPriorityI(objcircle, 25);

	while(!Obj_IsDeleted(cirno)) {

	ObjRender_SetPosition(objcircle, bossX, bossY, 0);
	ObjRender_SetAngleZ(objcircle, circleframe);
	circleframe+=2;

	if(ObjEnemy_GetInfo(cirno,INFO_LIFE) <= 0) {
		Obj_Delete(objcircle);
	}

	if(isbehindscreen == 0){
		ObjRender_SetAlpha(objcircle,255);
	}
	else if(isbehindscreen == 1){
		ObjRender_SetAlpha(objcircle,255/2);
	}

	yield;

	}

	
}


task renderBoss {
	let dir;
	let speed;
	
	ObjPrim_SetTexture(cirno,imgBoss);
	ObjSprite2D_SetSourceRect(cirno,0,0,39,54);
	ObjSprite2D_SetDestCenter(cirno);
	ObjRender_SetBlendType(cirno,BLEND_ALPHA);
	
	while(!Obj_IsDeleted(cirno)) {
 		dir = ObjMove_GetAngle(cirno);
  		speed = ObjMove_GetSpeed(cirno);
 
  		if(speed == 0) {ObjSprite2D_SetSourceRect(cirno,0,0,39,54); ObjRender_SetAngleXYZ(cirno,0,180,0); ObjRender_SetScaleXYZ(cirno,1,1,0);}
  		else if(cos(dir) < 0) {ObjSprite2D_SetSourceRect(cirno,0,0,39,54); ObjRender_SetAngleXYZ(cirno,0,180,0); ObjRender_SetScaleXYZ(cirno,1,1,0);}
  		else if(cos(dir) > 0) {ObjSprite2D_SetSourceRect(cirno,0,0,39,54); ObjRender_SetAngleXYZ(cirno,0,0,0); ObjRender_SetScaleXYZ(cirno,1,1,0);}
		
		if(isbehindscreen == 0){ObjRender_SetAlpha(cirno,255);}
		else if(isbehindscreen == 1){ObjRender_SetAlpha(cirno,255/2);}
 
  		yield;
	}


}

task renderfamiliars{

	ascent(i in 0..4){
		ObjEnemy_Regist(familiars[i]);
		
		ObjPrim_SetTexture(familiars[i],familiarimg);
		ObjSprite2D_SetSourceRect(familiars[i],0,0,28,28);
		ObjSprite2D_SetDestCenter(familiars[i]);
		ObjRender_SetBlendType(familiars[i],BLEND_ADD_ARGB);
		familiarspin(familiars[i]);
		CheckForZeroHP(familiars[i]);
		CheckForFamTrans(i);
	}
	
}

task CheckForFamTrans(number){
	
	while(renderbools[number] == 0) {yield;}
	ObjEnemy_Regist(mirrors[number]);
	renderMirror(mirrors[number]);
	ObjMove_SetPosition(mirrors[number],ObjMove_GetX(familiars[number]),ObjMove_GetY(familiars[number]));
	ascent(i in 0..255/5){
		ObjRender_SetAlpha(familiars[number],255-i*5);
		ObjRender_SetAlpha(mirrors[number],i*5);
		yield;
	}
	Obj_Delete(familiars[number]);
	
}

task familiarspin(f){
	let spin=0;
	while(!Obj_IsDeleted(f)){
		ObjRender_SetAngleZ(f,spin);
		spin=spin-11;
		yield;
	}
}

task fmovement1{

	let fpos1=0;
	let fpos2=90;
	let fpos3=180;
	let fpos4=270;
	let fpos = [fpos1,fpos2,fpos3,fpos4];
	let distanceX = 100;
	let distanceY = 100;
	let switchX = 1;
	let switchY = -1;
	while(fmovementbools[0] == 0){
		
		ascent(i in 0..4){ObjMove_SetPosition(familiars[i],bossX+distanceX*cos(fpos[i]),bossY+distanceY*sin(fpos[i])); fpos[i]=fpos[i]+2;}
		distanceX=distanceX+switchX;
		distanceY=distanceY+switchY;
		if(distanceX == 130){switchX=-1;}
		else if(distanceX == -130){switchX=1;}
		if(distanceY == 130){switchY=-1;}
		else if(distanceY == -130){switchY=1;}
		yield;
	}
	
}

task fmovement2{
	
	let fpos1=0;
	let fpos2=360/3;
	let fpos3=fpos2*2;
	let fpos = [fpos1,fpos2,fpos3];
	let distanceX = 100;
	let distanceY = 100;
	let switchX = 1;
	let switchY = -1;
	
	while(fmovementbools[1] == 0){
		
		ascent(i in 0..3){ObjMove_SetPosition(familiars[i],bossX+distanceX*cos(fpos[i]),bossY+distanceY*sin(fpos[i])); fpos[i]=fpos[i]+2;}
		distanceX=distanceX+switchX;
		distanceY=distanceY+switchY;
		if(distanceX == 130){switchX=-1;}
		else if(distanceX == -130){switchX=1;}
		if(distanceY == 130){switchY=-1;}
		else if(distanceY == -130){switchY=1;}
		yield;
	}
}

task fmovement3{
	
	let fpos1=0;
	let fpos2=180;
	let fpos=[fpos1,fpos2];
	let distanceX = 100;
	let distanceY = 100;
	let switchX = 1;
	let switchY = -1;
	
	while(fmovementbools[2] == 0){
		
		ascent(i in 0..2){ObjMove_SetPosition(familiars[i],bossX+distanceX*cos(fpos[i]),bossY+distanceY*sin(fpos[i])); fpos[i]=fpos[i]+2;}
		distanceX=distanceX+switchX;
		distanceY=distanceY+switchY;
		if(distanceX == 130){switchX=-1;}
		else if(distanceX == -130){switchX=1;}
		if(distanceY == 130){switchY=-1;}
		else if(distanceY == -130){switchY=1;}
		yield;
	}
	
}

task renderMirror(mirror){
	let dir;
	let speed;
	
	ObjPrim_SetTexture(mirror,imgmirror);
	ObjSprite2D_SetSourceRect(mirror,0,0,39,54);
	ObjSprite2D_SetDestCenter(mirror);
	ObjRender_SetBlendType(mirror,BLEND_ADD_ARGB);
	ObjRender_SetColorHSV(mirror,359,0,255);
	CheckForZeroHP(mirror);
	
	while(!Obj_IsDeleted(mirror)) {
 		dir = ObjMove_GetAngle(mirror);
  		speed = ObjMove_GetSpeed(mirror);
 
  		if(speed == 0) {ObjSprite2D_SetSourceRect(mirror,0,0,39,54); ObjRender_SetAngleXYZ(mirror,0,180,0); ObjRender_SetScaleXYZ(mirror,1,1,0);}
  		else if(cos(dir) < 0) {ObjSprite2D_SetSourceRect(mirror,0,0,39,54); ObjRender_SetAngleXYZ(mirror,0,180,0); ObjRender_SetScaleXYZ(mirror,1,1,0);}
  		else if(cos(dir) > 0) {ObjSprite2D_SetSourceRect(mirror,0,0,39,54); ObjRender_SetAngleXYZ(mirror,0,0,0); ObjRender_SetScaleXYZ(mirror,1,1,0);}
 
  		yield;
	}


}

task CheckForZeroHP(obj){
	
	while(ObjEnemy_GetInfo(cirno,INFO_LIFE) > 0) {
		yield;
	}
	if(!Obj_IsDeleted(obj)){loop(5){TossFlowerPetal(ObjMove_GetX(obj),ObjMove_GetY(obj),rand(0,360),2);}}
	Obj_Delete(obj);
	
}

task TossFlowerPetal(x,y,angle,speed){
	let mx = speed*cos(angle);
	let my = speed*sin(angle);
	let f = 0;
	let s = 0;
	let e = 0;
	let ins = 0;
	let a = 255;
	let cl= ObjPrim_Create(OBJ_SPRITE_2D);
	ObjRender_SetBlendType(cl,BLEND_ALPHA);
	ObjRender_SetAlpha(cl,a);
	Obj_SetRenderPriority(cl,0.80);
	ObjPrim_SetTexture(cl,GetCurrentScriptDirectory ~ "./img/FlowerPetal.png");
	ObjSprite2D_SetSourceRect(cl,0,0,23,24);
	ObjSprite2D_SetDestCenter(cl);
	//ObjRender_SetColor(cl,255,0,0);
	ObjRender_SetX(cl,x);
	ObjRender_SetY(cl,y);
	while(!Obj_IsDeleted(cl)){
	f++;
	ObjRender_SetPosition(cl,ObjRender_GetX(cl)+mx,ObjRender_GetY(cl)+my,0);
		ObjRender_SetScaleXYZ(cl,1+sin(e)*0.2,1+sin(e)*0.2,1);
		e+=1.90;
	ObjRender_SetAlpha(cl,a);
	if(a > 0){a=a-1;}
	yield;
	}
	e+=2.10;
	ins+=0.01;
	s+=0.01;
	if(f==620){Obj_Delete(cl);}
	if(Obj_IsDeleted(cirno)){Obj_Delete(cl);}
	yield;
}

function angleToPlayer {
	let dir = atan2(GetPlayerY-bossY,GetPlayerX-bossX);
	return dir;
}

task fire {
	
	wait(80);
	renderfamiliars;
	PlaySE(familiarsound);
	ascent(i in 0..4){ObjMove_SetPosition(familiars[i],bossX,bossY);}
	ObjMove_SetDestAtWeight(familiars[0],bossX+100,bossY,8,20);
	ObjMove_SetDestAtWeight(familiars[1],bossX,bossY-100,8,20);
	ObjMove_SetDestAtWeight(familiars[2],bossX-100,bossY,8,20);
	ObjMove_SetDestAtWeight(familiars[3],bossX,bossY+100,8,20);
	wait(70);
	fmovement1;
	
	loop(3){
		if(ObjEnemy_GetInfo(cirno,INFO_LIFE) > 0){
			tracklaser(cirno,GetPlayerObjectID,1);
			wait(140);
		}
		else{return;}
	}
	ObjMove_SetDestAtWeight(cirno,192,120,8,10);
	wait(80);
	fmovementbools[0]=1;
	ObjMove_SetDestAtWeight(familiars[0],bossX+100,bossY,6,6);
	ObjMove_SetDestAtWeight(familiars[1],bossX,bossY+100,6,6);
	ObjMove_SetDestAtWeight(familiars[2],bossX-100,bossY,6,6);
	ObjMove_SetDestAtWeight(familiars[3],bossX,bossY-100,6,6);
	if(ObjEnemy_GetInfo(cirno,INFO_LIFE) > 0){
		bigsword(cirno);
		PlaySE(charge);
	}
	else{return;}
	wait(60*4);
	if(ObjEnemy_GetInfo(cirno,INFO_LIFE) > 0){
		PlaySE(boon);
		ObjMove_SetDestAtWeight(familiars[3],bossX,bossY+200,8,20);
		ObjMove_SetDestAtWeight(familiars[1],bossX,bossY-92,8,20);
		ObjMove_SetDestAtWeight(familiars[0],bossX+75,bossY+60,8,20);
		ObjMove_SetDestAtWeight(familiars[2],bossX-75,bossY+60,8,20);
	}
	else{return;}
	wait(60);
	fmovement2;
	renderbools[3]=1;
	wait(255/5);
	loop(3){
		if(ObjEnemy_GetInfo(cirno,INFO_LIFE) > 0){
			tracklaser(mirrors[3],GetPlayerObjectID,0);
			wait(140/5);
			tracklaser(cirno,GetPlayerObjectID,1);
			wait(140/5*4);
		}
		else{return;}
	}
	wait(60);
	if(ObjEnemy_GetInfo(cirno,INFO_LIFE) > 0){
		ObjMove_SetDestAtWeight(mirrors[3],102,120,8,20);
		ObjMove_SetDestAtWeight(cirno,282,120,8,20);
	}
	else{return;}
	wait(80);
	fmovementbools[1]=1;
	ObjMove_SetDestAtWeight(familiars[1],bossX,bossY-92,6,6);
	ObjMove_SetDestAtWeight(familiars[0],bossX+75,bossY+60,6,6);
	ObjMove_SetDestAtWeight(familiars[2],bossX-75,bossY+60,6,6);
	if(ObjEnemy_GetInfo(cirno,INFO_LIFE) > 0){
		bigsword(cirno);
		bigsword(mirrors[3]);
		PlaySE(charge);
	}
	else{return;}
	wait(60*4);
	if(ObjEnemy_GetInfo(cirno,INFO_LIFE) > 0){
		PlaySE(boon);
		ObjMove_SetDestAtWeight(familiars[2],192,280,8,20);
		ObjMove_SetDestAtWeight(familiars[0],bossX+100,bossY,8,20);
		ObjMove_SetDestAtWeight(familiars[1],bossX-100,bossY,8,20);
	}
	else{return;}
	wait(60);
	fmovement3;
	renderbools[2]=1;
	wait(60);
	loop(3){
		if(ObjEnemy_GetInfo(cirno,INFO_LIFE) > 0){
			tracklaser(mirrors[2],GetPlayerObjectID,0);
			wait(140/5);
			tracklaser(mirrors[3],GetPlayerObjectID,0);
			wait(140/5);
			tracklaser(cirno,GetPlayerObjectID,1);
			wait(140/5*3);
		}
		else{return;}
	}
	wait(70);
	if(ObjEnemy_GetInfo(cirno,INFO_LIFE) > 0){
		ObjMove_SetDestAtWeight(cirno,192,102,8,20);
		ObjMove_SetDestAtWeight(mirrors[2],40,120,8,20);
		ObjMove_SetDestAtWeight(mirrors[3],334,120,8,20);
	}
	else{return;}
	wait(80);
	fmovementbools[2]=1;
	ObjMove_SetDestAtWeight(familiars[0],bossX+100,bossY,6,6);
	ObjMove_SetDestAtWeight(familiars[1],bossX-100,bossY,6,6);
	if(ObjEnemy_GetInfo(cirno,INFO_LIFE) > 0){
		bigsword(cirno);
		bigsword(mirrors[3]);
		bigsword(mirrors[2]);
		PlaySE(charge);
	}
	else{return;}
	wait(60*4);
	ObjMove_SetDestAtWeight(familiars[0],bossX+90,200,8,20);
	ObjMove_SetDestAtWeight(familiars[1],bossX-90,200,8,20);
	PlaySE(boon);
	wait(60);
	renderbools[0]=1;
	renderbools[1]=1;
	wait(60);
	loop{
		loop(3){
			if(ObjEnemy_GetInfo(cirno,INFO_LIFE) > 0){
				tracklaser(mirrors[0],GetPlayerObjectID,0);
				wait(140/5);
				tracklaser(mirrors[1],GetPlayerObjectID,0);
				wait(140/5);
				tracklaser(mirrors[2],GetPlayerObjectID,0);
				wait(140/5);
				tracklaser(mirrors[3],GetPlayerObjectID,0);
				wait(140/5);
				tracklaser(cirno,GetPlayerObjectID,1);
				wait(140/5);
			}
			else{return;}
		}
		wait(80);
		if(ObjEnemy_GetInfo(cirno,INFO_LIFE) > 0){
			ObjMove_SetDestAtWeight(cirno,192,102,8,20);
			ObjMove_SetDestAtWeight(mirrors[0],40,102,8,20);
			ObjMove_SetDestAtWeight(mirrors[1],100,70,8,20);
			ObjMove_SetDestAtWeight(mirrors[2],192+92,134,8,20);
			ObjMove_SetDestAtWeight(mirrors[3],192+152,102,8,20);
		}
		else{return;}
		wait(60);
		if(ObjEnemy_GetInfo(cirno,INFO_LIFE) > 0){
			PlaySE(charge);
			bigsword(cirno);
			ascent(i in 0..4){bigsword(mirrors[i]);}
		}
		else{return;}
		wait(60*4);
	}
	
}

task tracklaser(obj,obj2,decision){
	
	let sword = CreateStraightLaserA1(ObjMove_GetX(obj),ObjMove_GetY(obj),0,100,15,15,1001,120);
	ObjLaser_SetLength(sword,GetObjectDistance(obj2,obj));
	loop(60){
		ObjStLaser_SetAngle(sword,GetAngleToPlayer(sword));
		ObjLaser_SetLength(sword,GetObjectDistance(obj2,obj)+50);
		yield;
	}
	let dir = atan2(ObjMove_GetY(obj2)-ObjMove_GetY(obj),ObjMove_GetX(obj2)-ObjMove_GetX(obj));
	let familiar = ObjEnemy_Create(OBJ_ENEMY);
	ObjEnemy_Regist(familiar);
	ObjMove_SetPosition(familiar,ObjMove_GetX(obj),ObjMove_GetY(obj));
	ObjMove_SetAngle(familiar,dir);
	let X = GetPlayerX;
	let Y = GetPlayerY;
	wait(20);
	ObjMove_SetSpeed(familiar,15);
	if(ObjEnemy_GetInfo(cirno,INFO_LIFE) > 0){ObjMove_SetDestAtWeight(obj,X,Y,5,25);}
	else{return;}
	let fireangle = 0;
	let fireangle2 = 0;
	if(ObjEnemy_GetInfo(cirno,INFO_LIFE) > 0){
		if(decision == 0){
			loop(20){
				CreateShotA2(ObjMove_GetX(familiar),ObjMove_GetY(familiar),0,dir+50,0.005,2,67,20);
				CreateShotA2(ObjMove_GetX(familiar),ObjMove_GetY(familiar),0,dir-50,0.005,2,67,20);
				PlaySE(shotsound1);
				wait(2);
			}
		}
		else if(decision == 1){
			loop(20){
				CreateShotA1(ObjMove_GetX(familiar),ObjMove_GetY(familiar),0,fireangle2,71,20);
				CreateShotA1(ObjMove_GetX(familiar),ObjMove_GetY(familiar),0,fireangle2+90,71,20);
				CreateShotA1(ObjMove_GetX(familiar),ObjMove_GetY(familiar),0,fireangle2+180,71,20);
				CreateShotA1(ObjMove_GetX(familiar),ObjMove_GetY(familiar),0,fireangle2+270,71,20);
				PlaySE(shotsound1);
				fireangle2=fireangle2+rand(5,12);
				wait(2);
			}
		}
	}
	else{return};
}

task bigsword(obj){
	
	CreateStraightLaserA1(ObjMove_GetX(obj),-20,90,800,80,15,1001,90);
	wait(90);
	let bulletarray = GetShotIdInCircleA2(192,224,1000,TARGET_ENEMY);
	ascent(i in 0..length(bulletarray)){
		if(ObjShot_GetImageID(bulletarray[i]) == 71){ObjMove_SetAcceleration(bulletarray[i],0.01); ObjMove_SetMaxSpeed(bulletarray[i],3);}
	}
	PlaySE(slashsound);
	descent(i in 1..10){ScreenShake(i*3,1); yield;}
	wait(30);
	PlaySE(wave);
	
}

task ScreenShake(distance,time){

	loop(time)
	{
		Set2DCameraFocusX(rand(-distance+GetStgFrameWidth/2,distance+GetStgFrameWidth/2));
		Set2DCameraFocusY(rand(-distance+GetStgFrameHeight/2,distance+GetStgFrameHeight/2));
		yield;
	}

	Reset2DCamera();

}

task TEnd {
	while(ObjEnemy_GetInfo(cirno,INFO_LIFE) > 0) {
		yield;
	}
	PlaySE(defeat);
	ObjMove_SetDestAtWeight(cirno,bossX+rand(-50,50),bossY+rand(-50,50),30,1);
	TExplosionA(bossX,bossY,10,0.5);
	loop(100){TossFlowerPetal(ObjMove_GetX(cirno),ObjMove_GetY(cirno),rand(0,360),3); DeleteShotAll(TYPE_ALL,TYPE_ITEM); yield;}
	loop(20){TossFlowerPetal(ObjMove_GetX(cirno),ObjMove_GetY(cirno),rand(0,360),3);}
	Obj_Delete(cirno);
	PlaySE(defeat);
	loop(240){DeleteShotAll(TYPE_ALL,TYPE_ITEM); yield;}
	CloseScript(GetOwnScriptID);
}