//#TouhouDanmakufu[Single]
#ScriptVersion[3]
#Title["Rain"]
#include "./../ZUNShot/ZUNShot_Const.txt"
#include "./sharedfuncMario.dnh"


let objBoss;
let width = 384;
let height = 448;
let life = 4500;
let scene= GetEnemyBossSceneObjectID();


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


@Initialize{
    objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
    ObjEnemy_Regist(objBoss);
	Indicator(objBoss);
    
	animNon(objBoss);
	
	
	TFinalizeNon(objBoss);
    ObjMove_SetDestAtFrame(objBoss, width/2, 90, 60);
	Main;
}


@MainLoop{
    ObjEnemy_SetIntersectionCircleToShot(objBoss, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 32); 
    ObjEnemy_SetIntersectionCircleToPlayer(objBoss, ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 28);
    yield;
}


task Main{
    takeDamage(objBoss, scene, life);
    ObjEnemy_SetDamageRate(objBoss, 0, 0);
	wait(60);
	ObjEnemy_SetDamageRate(objBoss, 10, 0);
	ObjSound_Play(LoadEffect(GetCurrentScriptDirectory~ "../SFX/POWER UP.WAV", 100));
	wait(100);
	ObjEnemy_SetDamageRate(objBoss, 100, 60);
	let colour= [269, 273, 277, 280, 283];
	let ocolour = [123, 124, 127, 131, 132, 134];
    move(2*width/5, 7*width/10, height/5 + 15, 3*height/10+25, 230, objBoss);
	rain(371, 375, colour, 200, 90, 0.05, 60, rand(0.03, 0.05), objBoss);
	rain(1, 1, ocolour, 200, 90, 0.05, 30, rand(0.03, 0.07), objBoss);
}