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


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


@Event{
    alternative(GetEventType())
    case(EV_REQUEST_LIFE){
        SetScriptResult(life);
    }
    case(EV_REQUEST_TIMER){
        SetScriptResult(40);
    }
    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);
	Maint;
}


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


task Maint{
    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);
	spittle(4, 3,7, objBoss);
	wait(60);
	move(2*width/5, 3*width/5, height/5 +20, height/5+20, 120, objBoss);
}
	