#TouhouDanmakufu[Single]
#ScriptVersion[3]
#Title["Dross Muerto :)"]
#Text["..."]
#System[".\system\Default_System.txt"]


#include"./lib/AllStarShot_Const.dnh"
#include"./lib/TheFunctions.txt"
#include"./BGTask.txt"
#include"./Animation_lib_satori.txt"

let Enemy = ID_INVALID;
let EnemyX = 0;
let EnemyY = 0;

@Event{
	alternative(GetEventType)
	case(EV_REQUEST_LIFE){SetScriptResult(1);}
	case(EV_REQUEST_TIMER){SetScriptResult(50);}
//case(EV_REQUEST_SPELL_SCORE){SetScriptResult(90000);}
}

@Initialize{
	Enemy = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	ObjEnemy_Regist(Enemy);
SetDamageRateAtFrame(Enemy,0,0,120);
SetAutoDeleteObject(true);
InitializeAction(Enemy,DrossDot);
DrawBoss_Task(Enemy);
name("Dross Rotzank",0,10);
//LifeCircleBar_A(Enemy,0.8,0.2,true);
//LifeCircleBar_B(Enemy,0.2,0.0,true);
//LifeCircleBar_Marker(Enemy,0.8);
//LifeStock(2,1);
//TWaveCircle_Shadertask(Enemy,5);
LoadSounds;
//TAura(Enemy,5);
//ObjRender_SetPosition(Enemy,GetStgFrameWidth/2, 200,0);
	//ObjMove_SetDestAtWeight(Enemy, GetStgFrameWidth/2+rand(150,-150), 100+rand(80,100), 10,5);
	BossActions;
}

@MainLoop{

	yield;
}

task BossActions{
	ShootBullets;
//Texto;
	while(ObjEnemy_GetInfo(Enemy, INFO_LIFE) > 0){
		EnemyX = ObjMove_GetX(Enemy);
		EnemyY = ObjMove_GetY(Enemy);
		ObjEnemy_SetIntersectionCircleToShot(Enemy, EnemyX, EnemyY, 40);
		ObjEnemy_SetIntersectionCircleToPlayer(Enemy, EnemyX, EnemyY, 30);
                                          
		yield;
	}
DeleteShotAll(TYPE_ALL, TYPE_ITEM);
	Obj_Delete(Enemy);
	loop(120){yield;}
	CloseScript(GetOwnScriptID);
}
function wait(t){loop(t){yield;}}

task ShootBullets{

wait(40);
BFX_ReleaseA1(EnemyX,EnemyY,300,ChargeEffNeito2,beam,120);
//PlaySFX(boom00);	
wait(120);
BFX_ExplosionA2(EnemyX,EnemyY,600,ChargeEffNeito2,wave,60);
PlaySFX(boom00);	
wait(60);
ObjEnemy_SetLife(Enemy,0);
}


