//------------------------------------------------------------------------------------------------------------\
//gcsd				<- Get Current Script Directory					|
//------------------------------------------------------------------------------------------------------------|
//SetLife(hp)			<- Place in @Event, sets object's life					|
//SetTimer(time)			<- Place in @Event, sets timer					|
//SetScore(score)			<- Place in @Event, sets spell card bonus				|
//												|
//GetLife(id)			<- Gets the current life of the specified object				|
//												|
//GetPlayer			<- Bind Player Object to a variable (let player = GetPlayer;)		|
//StartEnemy			<- Bind Enemy Object to a variable and register it			|
//StartBoss			<- Bind Enemy Boss Object to a variable and register it			|
//StartSpell			<- Registers the script as a spell in the current boss scene		|
//												|
//SetTexture(id, path)		<- Sets texture to the specified object, auto-loads image if needed	|
//DrawSprite2D(id, x1, y1, x2, y2)	<- Draw a 2D sprite for the specified object with its texture		|
//												|
//MoveSpeed(id, x, y, speed)	<- Move object to location with specified speed				|
//MoveFrame(id, x, y, frames)	<- Move object to location in specified time				|
//												|
//GetCenterX			<- Gets the center X of the playing field				|
//GetCenterY			<- Gets the center Y of the playing field				|
//GetX(id)			<- Gets the X of the specified object					|
//GetY(id)			<- Gets the Y of the specified object					|
//												|
//SetCollisionShot(id, x, y, radius)	<- SetCollisionA							|
//SetCollisionPlayer(id, x, y, radius)	<- SetCollisionB							|
//SetDamageRate(id, normal, spell)	<- Set damage rate for normal and spell attacks			|
//------------------------------------------------------------------------------------------------------------/


let gcsd = GetCurrentScriptDirectory;

function SetDamageRate(let id, let n, let s)
{
	ObjEnemy_SetDamageRate(id, n, s);
}

function StartSpell
{
	let objScene = GetEnemyBossSceneObjectID();
	ObjEnemyBossScene_StartSpell(objScene);
}

function SetLife(let hp)
{
	if(GetEventType == EV_REQUEST_LIFE){SetScriptResult(hp);}
}

function SetTimer(let t)
{
	if(GetEventType == EV_REQUEST_TIMER){SetScriptResult(t);}
}

function SetScore(let sc)
{
	if(GetEventType == EV_REQUEST_SPELL_SCORE){SetScriptResult(sc);}
}

function GetLife(let id)
{
	let hp = ObjEnemy_GetInfo(id, INFO_LIFE);
	return hp;
}

function GetPlayer
{
	let p = GetPlayerObjectID;
	return p;
}

function StartEnemy
{
	let id = ObjEnemy_Create(OBJ_ENEMY);
	ObjEnemy_Regist(id);
	return id;
}

function StartBoss
{
	let id = ObjEnemy_Create(OBJ_ENEMY_BOSS);
	ObjEnemy_Regist(id);
	return id;
}

function SetTexture(let id, let path)
{
	ObjPrim_SetTexture(id, path);
}

function DrawSprite2D(let id, let x1, let y1, let x2, let y2)
{
	ObjSprite2D_SetSourceRect(id, x1, y1, x2, y2);
	ObjSprite2D_SetDestCenter(id);
}

function MoveSpeed(let id, let x, let y, let v)
{
	ObjMove_SetDestAtSpeed(id, x, y, v);
}

function MoveFrame(let id, let x, let y, let f)
{
	ObjMove_SetDestAtFrame(id, x, y, f);
}

function GetCenterX
{
	let cx = GetStgFrameWidth/2;
	return cx;
}

function GetCenterY
{
	let cy = GetStgFrameHeight/2;
	return cy;
}

function GetX(let id)
{
	let x = ObjMove_GetX(id);
	return x;
}

function GetY(let id)
{
	let y = ObjMove_GetY(id);
	return y;
}

function GetAngleToPlayer2(let id)
{
	let atp = atan2(GetPlayerY - GetY(id), GetPlayerX - GetX(id));
	return atp;
}

function SetCollisionShot(let id, let x, let y, let r)
{
	ObjEnemy_SetIntersectionCircleToShot(id, x, y, r);
}

function SetCollisionPlayer(let id, let x, let y, let r)
{
	ObjEnemy_SetIntersectionCircleToPlayer(id, x, y, r);
}