task ShotA1{
	let r = 270; let n = 7;
	while(!Obj_IsDeleted(objPlayer)){
		let S = GetVirtualKeyState(VK_SHOT);
		if(S == KEY_PUSH || S == KEY_HOLD && GetPlayerState() == STATE_NORMAL && IsPermitPlayerShot() && !IsPlayerSpellActive){
			CreatePlayerShotA1(GetPlayerX - 9, GetPlayerY, 13, r, 1, 1, 1);
			CreatePlayerShotA1(GetPlayerX + 5, GetPlayerY, 13, r, 1, 1, 1);
		}
		holdup(2);
	}
}

task Unfuckous{
	let r = 270; let H = []; let v = 0.8;
	
	//PolygonPShot(x, y, speed, angle, nSide, bpSide, special, graphic, dmg, pen)
	while(!Obj_IsDeleted(objPlayer)){
		H = [];
	
		let S = GetVirtualKeyState(VK_SHOT); 
		if(S == KEY_PUSH || S == KEY_HOLD && GetPlayerState() == STATE_NORMAL && !isFocus && IsPermitPlayerShot() && !IsPlayerSpellActive){
			H = PolygonPShot(GetPlayerX, GetPlayerY, 7, r, 4, 8, 1, 2, 1.5, 5);
			ascent(i in 0..length(H)){
				if(!Obj_IsDeleted(H[i])){
					ObjMove_SetAngularVelocity(H[i], v);
				}
			}
			
			v *= -1;
		}
		
		r = rand(0,360);
		holdup(10);
	}
}

task Needles(o){
	while(!Obj_IsDeleted(objPlayer)){
		let S = GetVirtualKeyState(VK_SHOT);
		if(S == KEY_PUSH || S == KEY_HOLD && GetPlayerState() == STATE_NORMAL && IsPermitPlayerShot() && isFocus && !IsPlayerSpellActive){
			let x = ObjRender_GetX(o);
			let y = ObjRender_GetY(o);
			
			CreatePlayerShotA1(x, y+8, 18, 270, 1.5, 1/2, 3);
		}
		holdup(2);
	}
}

//---------------------------------------------------------------------------------------------------------------------------
task squared(n){
	SetCommonData("bomb_end", false);

	SetForbidPlayerSpell(true);
	SetPlayerInvincibilityFrame(210); SpellBlink();
	SetPlayerSpeed(1, 1);
	
	let r = 0; let angvel = 1;
	while(GetPlayerInvincibilityFrame() > 0){
		
		let A = [];
		ascent(i in 0..30){
			A = A ~ [PolygonPShot(GetPlayerX, GetPlayerY, 2.5 + i/15, r, 4, 5, 1, 4, 1, 8)];

			ascent(j in 0..length(A[i])){
				let b = A[i];
				if(!Obj_IsDeleted(b[j])){
					let vs = Obj_GetValue(b[j], "sv"); let va = Obj_GetValue(b[j], "av");
					ObjMove_AddPatternA2(b[j], 15, NO_CHANGE, NO_CHANGE, -1/10*vs, 0, 0);
					ObjMove_AddPatternA2(b[j], 45, 0, NO_CHANGE, 1/5*vs, angvel, 30*vs); setdmg(b[j], 1.5, 45);
				}
			}

			r += 1/20;
		}

		
		
		angvel *= -1;
		holdup(45);
	}

	holdup(45);
	SetCommonData("bomb_end", true);

	task setdmg(ps, dmg, time){
		ObjShot_SetDamage(ps, 0);
		holdup(time);
		ObjShot_SetDamage(ps, dmg);
	}
}

task SpellBlink{
	while(GetPlayerInvincibilityFrame() > 0){
		DeleteShotInCircle(TYPE_ALL, TYPE_ITEM, GetPlayerX, GetPlayerY, 160);
		
		ObjRender_SetColor(objPlayer, 236, 179, 255);
		holdup(3);
		ObjRender_SetColor(objPlayer, 204, 51, 255);
		holdup(3);
	}

	while(GetCommonData("bomb_end", false) == false){
		ObjRender_SetColor(objPlayer, 236, 179, 255);
		holdup(3);
		ObjRender_SetColor(objPlayer, 204, 51, 255);
		holdup(3);
	}

	ObjRender_SetColor(objPlayer, 255, 255, 255);
	//Clearing Spell
	
	SetForbidPlayerShot(false); SetForbidPlayerSpell(false); 
	SetPlayerSpeed(4, 1.75); Obj_Delete(GetSpellManageObject());
	
	SetPlayerInvincibilityFrame(45);
}