#TouhouDanmakufu
#ScriptVersion[3]
#Title["England Non-Spell 4"]

#include".\ZUNShot_Const.txt"
#include".\drawstuff.txt"
#include "script/default_system/Default_Effect.txt"

let ex;
let ey;
let fx1;
let fx2;
let fy1;
let fy2;
let AttackAnim = 0;
let End = 1;
let objEnemy;


	@Initialize{
		objEnemy = ObjEnemy_Create(OBJ_ENEMY_BOSS);
		ObjEnemy_Regist(objEnemy);
		ObjEnemy_SetDamageRate(objEnemy, 0, 0);
		DeleteShotAll(TYPE_ALL, TYPE_ITEM);
		Magiccircle(objEnemy);
		AuraMake;
		mainTask;	
		}

	@MainLoop
	{
		ex = ObjMove_GetX(objEnemy);
		ey = ObjMove_GetY(objEnemy);
		ObjEnemy_SetIntersectionCircleToShot(objEnemy, ex, ey, 32);//Sets the hitbox against player bullets
		ObjEnemy_SetIntersectionCircleToPlayer(objEnemy, ex, ey, 24);//Sets the hitbox against the player

		yield;
		if(ObjEnemy_GetInfo(objEnemy,INFO_LIFE)<=0){
			Obj_Delete(objEnemy);
			CloseScript(GetOwnScriptID());
		}
	}

	@Event
	{
		alternative(GetEventType())
		case(EV_REQUEST_LIFE)
		{
			SetScriptResult(2300);//Sets the life to 1500
		}
		case(EV_REQUEST_TIMER)
		{
			SetScriptResult(50);//Sets the time limit to 60
		}
		case(EV_REQUEST_SPELL_SCORE)
		{
			SetScriptResult(0);//Sets spellcard bonus to 30000 points
		}
	}

task mainTask{
	ObjMove_SetDestAtWeight(objEnemy,GetStgFrameWidth/2,GetStgFrameHeight/2-50,4,5);
	EnglandMove;
	loop(60){yield;}
	move;
	AimedShot;
	yield;
	}


task AimedShot(){
	loop(60){yield;}
	ObjEnemy_SetDamageRate(objEnemy, 100, 100);
	let x = 0;
	let ny = 0;
	let y = 0;
	let dir = 0;
loop{
		loop(5){
		DelaySE(SShot2,0,-5);
		y = rand(100,-100);
		ny = rand(100,-100);
		while(x<10){
			CreateShotA1(ex+ny,ey+y,3.8,GetAngle(ex+ny,ey+y,ObjMove_GetX(GetPlayerObjectID),ObjMove_GetY(GetPlayerObjectID))+dir,165,10);
			CreateShotA1(ex+ny,ey+y,3.6,GetAngle(ex+ny,ey+y,ObjMove_GetX(GetPlayerObjectID),ObjMove_GetY(GetPlayerObjectID))+dir,165,10);
			CreateShotA1(ex+ny,ey+y,3.4,GetAngle(ex+ny,ey+y,ObjMove_GetX(GetPlayerObjectID),ObjMove_GetY(GetPlayerObjectID))+dir,165,10);	
			CreateShotA1(ex+ny,ey+y,3.2,GetAngle(ex+ny,ey+y,ObjMove_GetX(GetPlayerObjectID),ObjMove_GetY(GetPlayerObjectID))+dir,165,10);
			CreateShotA1(ex+ny,ey+y,3.0,GetAngle(ex+ny,ey+y,ObjMove_GetX(GetPlayerObjectID),ObjMove_GetY(GetPlayerObjectID))+dir,165,10);
			CreateShotA1(ex+ny,ey+y,2.8,GetAngle(ex+ny,ey+y,ObjMove_GetX(GetPlayerObjectID),ObjMove_GetY(GetPlayerObjectID))+dir,165,10);				
			x+=1;
			dir+=360/10;
			}
		loop(3){yield;}
		x = 0;
		}
		loop(30){yield;}
	}
}
task move{
	loop{
	ObjMove_SetDestAtWeight(objEnemy,(GetStgFrameWidth/2)+rand(-100,100),rand(75,100),10,2);
	loop(120){yield;}
	}
}