let EVE_BOMB_SEAL = 0;
let EVE_BEER = 1;
let EVE_HARD_FOE = 2;
let EVE_SOFT_FOE = 3;
let EVE_INVINCIBLE_FOE = 4;
let EVE_LASER = 5;
let EVE_GRAVITY = 6;
let EVE_PACIFIST = 7;
let EVE_POWER_1 = 8;
let EVE_POWER_2 = 9;
let EVE_POWER_3 = 10;
let EVE_ITEM_UP = 11;
let EVE_BARRIER_BREAK = 12;
let EVE_BARRIER_DRAIN = 13;
let EVE_BLIND_1 = 14;
let EVE_BLIND_2 = 15;
let EVE_BLIND_3 = 16;
let EVE_DRUNK = 17;
let EVE_PIERCE = 18;
let EVE_POISON = 19;
let EVE_FLIP = 20;
let EVE_TIME_SLOW = 21;
let EVE_EXTEND = 100;

task EBombSeal
{
	SetPlayerSpellEnable(false);
	while(del < 2){yield;}
	SetPlayerSpellEnable(true);
}

task EBeer
{
	while(del < 2)
		{
		AddBeer(1);
		yield;
		}
}

task EHardEnemy(rate)
{
	SetEvent("EVE_HARD",rate);
	while(del < 2){yield;}
	SetEvent("EVE_HARD",1);
}

task ELaser
{
	let counter = 0;
	let count = floor(rand(0,4));
	while(del < 2)
		{
		counter+=1;
		if(counter%65 == 0)
			{
			let x = -32;
			let y = rand(0,GetStgFrameHeight);
			let angle = 0;
			alternative(count%4)
				case(2)
					{
					x = GetStgFrameWidth+32;
					angle = 180;
					}
				case(1)
					{
					x = rand(0,GetStgFrameWidth);
					y = -32;
					angle = 90;
					}
				case(3)
					{
					x = rand(0,GetStgFrameWidth);
					y = GetStgFrameHeight+32;
					angle = 270;
					}
			count+=1;
			let shot = CreateLaserA2(x,y,50,angle+rand(-1,1)*45,GetStgFrameHeight*2,12.5,30,ST_LASER,130,SHOT_WHITE);
			ObjStLaser_SetSource(shot,false);
			ObjShot_SetAutoDelete(shot,false);
			TSound(shot);
			}
		yield;
		}
	task TSound(shot)
		{	
		PlaySound("se_LaserDelay",130);
		loop(130){if(Obj_IsDeleted(shot)){return;}yield;}		
		PlaySound("se_Laser",100);
		}
}


task EGravity
{
	let counter = 0;
	let numb = 75;
	while(del < 2)
		{
		counter+=1;
		if(counter%numb == 0)
			{
			TWall;
			}
		ObjMove_SetY(GetPlayerObjectID,GetPlayerY+1);
		yield;
		}
	task TWall
		{
		let yM = -100;
		let obj = ObjPrim_Create(OBJ_SPRITE_2D);
		ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./../../system/img/WhiteSquare.png");
		ObjSprite2D_SetSourceRect(obj,0,0,1,1);
		Obj_SetRenderPriority(obj,0.30);
		loop(35)
			{
			yM+=(GetStgFrameHeight+100)/30;
			ObjSprite2D_SetDestRect(obj,-10,yM-100,GetStgFrameWidth+10,yM+100);
			ObjRender_SetAlpha(obj,rand(20,45));
			ObjRender_SetColorHSV(obj,300,255,rand(105,155));
			if(del >= 2){break;}
			yield;
			}
		Obj_Delete(obj);
		}
}

task EPacifist
{
	while(del < 2)
		{
		if(length(GetShotIdInCircleA2(GetStgFrameWidth/2,GetStgFrameHeight/2,GetStgFrameHeight,TARGET_PLAYER)) <= 0 && GetPlayerHealth%100 < 99)
			{
			SetPlayerLife(100.25);
			}
		yield;
		}
}

task EPower(pow)
{
	SetEvent("EVE_POWER",pow);
	while(del < 2){yield;}
	SetEvent("EVE_POWER",pow);
}

task EItem
{
	SetEvent("EVE_ITEM",1);
	while(del < 2){yield;}
	SetEvent("EVE_ITEM",0);
}

task EBreak
{	
	loop(60){yield;}
	PlaySound("se_Shatter",130);
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./../../system/img/WhiteSquare.png");
	ObjSprite2D_SetSourceRect(obj,0,0,1,1);
	ObjSprite2D_SetDestRect(obj,-64,-64,GetStgFrameWidth+64,GetStgFrameHeight+64);
	Obj_SetRenderPriority(obj,0.64);
	ascent(t in 1..101)
		{
		ObjRender_SetAlpha(obj,t*t*255/9500);
		if(del >= 2){break;}
		yield;
		}
	Obj_Delete(obj);
	SetPlayerBarrier(0);
	while(del < 2){yield;}
}

task EDrain
{
	while(del < 2)
		{
		if(GetPlayerInvincibilityFrame == 0 && GetPlayerBarrier%100 > 0)
			{
			SetPlayerBarrier(max(floor(GetPlayerBarrier/100)*100,GetPlayerBarrier-1/14));
			}
		yield;
		}
}

task EBlind(numb)
{
	loop(60){yield;}
	numb = (4-numb)*52-12;

	let vertexcount = 44;
	vertexcount*=3;
	let alpha = 255;
	let switch = false;

	let outterrad = GetStgFrameHeight*1.5;
	let innerrad = outterrad;
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory ~ "./../../system/img/WhiteSquare.png");
	ObjPrim_SetVertexCount(obj,vertexcount);
	while(alpha > 0)
		{	
		if(del >= 2)
			{
			switch = true;
			}
		if(switch == true)
			{
			alpha-=255/15;
			}	
		if(innerrad > numb)
			{
			innerrad += (numb-outterrad)/120;
			}
		ascent(i in 0..vertexcount*0.5)
			{
			let i1 = i*2;
			let angle = i*360/(vertexcount*0.5-1);
			let rad = ((i+1)%2)*rand(0,1)*1;
			let x1 = GetPlayerX+(innerrad+rad)*cos(angle);
			let y1 = GetPlayerY+(innerrad+rad)*sin(angle);
			let x2 = GetPlayerX+outterrad*cos(angle);
			let y2 = GetPlayerY+outterrad*sin(angle);
			ObjPrim_SetVertexPosition(obj,i1+0,x1,y1,0);
			ObjPrim_SetVertexPosition(obj,i1+1,x2,y2,0);
			ObjPrim_SetVertexUVT(obj,i1+0,0,1);
			ObjPrim_SetVertexUVT(obj,i1+1,0,1);
			ObjPrim_SetVertexColor(obj,i1+0,0,0,0);
			ObjPrim_SetVertexColor(obj,i1+1,0,0,0);
			ObjPrim_SetVertexAlpha(obj,i1+0,max(0,alpha));
			ObjPrim_SetVertexAlpha(obj,i1+1,max(0,alpha));
			}
		yield;
		}
	Obj_Delete(obj);
}

task EDrunk
{
	SetEvent("EVE_DRUNK",1);
	while(del < 2){yield;}
	SetEvent("EVE_DRUNK",0);
}

task EPierce
{
	SetEvent("EVE_PIERCE",1);
	while(del < 2){yield;}
	SetEvent("EVE_PIERCE",0);
}

task EPoison
{
	while(del < 2)
		{
		if(GetPlayerInvincibilityFrame == 0 && GetPlayerHealth%100 > 0)
			{
			SetPlayerHealth(max(floor(GetPlayerHealth/100)*100,GetPlayerHealth-1/14));
			}
		yield;
		}
}

task EReverse
{	
	Obj_SetValue(objPlayer,"EVE_FLIP",true);
	while(del < 2){yield;}
	Obj_SetValue(objPlayer,"EVE_FLIP",false);
}

task ESlow
{
	StartSlow(TARGET_ALL,30);
	while(del < 2){yield;}
	StopSlow(TARGET_ALL);
}


task ELife
{
	let switch = false;
	while(del < 2)
		{
		let life = GetPlayerHealth;
		let barrier = GetPlayerBarrier;
		let bomb = GetPlayerSpell;
		yield;
		if(GetPlayerSpell < bomb || GetPlayerHealth < life || GetPlayerBarrier < barrier)
			{
			switch = true;
			}
		}
	if(switch == false)
		{
		PlaySound("se_Extend",100);
		SetPlayerLife(200);
		}
}