
public skill_volcanic_flame(id)
{
	new vec[3],aim_vec[3],velocity_vec[3];
	static length,speed0;
	
	get_user_origin(id,vec);
	get_user_origin(id,aim_vec,2);
	
	new dist = get_distance(vec,aim_vec);

	new speed1 = 160;
	new speed2 = 350;
	new radius = 105;

	if(dist < 50)
	{
		radius = 0;
		speed0 = 5;
	}
	else if(dist < 150)
	{
		speed1 = speed2 = 1;
		speed0 = 5;
		radius = 50;
	}
	else if(dist < 200)
	{
		speed1 = speed2 = 1;
		speed0 = 5;
		radius = 90;
	}
	else if(dist < 250)
	{
		speed1 = speed2 = 90;
		speed0 = 6;
		radius = 90;
	}
	else if(dist < 300)
	{
		speed1 = speed2 = 140;
		speed0 = 7;
	}
	else if(dist < 350)
	{
		speed1 = speed2 = 190;
		speed0 = 7;
	}
	else if(dist < 400)
	{
		speed1 = 150;
		speed2 = 240;
		speed0 = 8;
	}
	else if(dist < 450)
	{
		speed1 = 150;
		speed2 = 290;
		speed0 = 8;
	}
	else if(dist < 500)
	{
		speed1 = 180;
		speed2 = 340;
		speed0 = 9;
	}
	
	velocity_vec[0]=aim_vec[0]-vec[0];
	velocity_vec[1]=aim_vec[1]-vec[1];
	velocity_vec[2]=aim_vec[2]-vec[2];
	
	length=sqrt(velocity_vec[0]*velocity_vec[0]+velocity_vec[1]*velocity_vec[1]+velocity_vec[2]*velocity_vec[2]);
	
	velocity_vec[0]=velocity_vec[0]*speed0/length;
	velocity_vec[1]=velocity_vec[1]*speed0/length;
	velocity_vec[2]=velocity_vec[2]*speed0/length;

	static parm_flame[6];
	
	parm_flame[0] = vec[0];
	parm_flame[1] = vec[1];
	parm_flame[2] = vec[2];
	
	parm_flame[3] = velocity_vec[0];
	parm_flame[4] = velocity_vec[1];
	parm_flame[5] = velocity_vec[2];
	
	set_task(0.1,"skill_vf_fire",0,parm_flame,6,"a",3);
	
	skill_vf_burnzone(id,vec,aim_vec,speed1,speed2,radius);
	
	return PLUGIN_HANDLED;
}

public skill_vf_fire(parm_flame[6])
{
	static vec[3],velocity_vec[3];
	
	vec[0]=parm_flame[0];
	vec[1]=parm_flame[1];
	vec[2]=parm_flame[2];
	
	velocity_vec[0]=parm_flame[3];
	velocity_vec[1]=parm_flame[4];
	velocity_vec[2]=parm_flame[5];
	
	create_te_spray(vec,velocity_vec,g_sprite_explosion,8,70,100,5);
}

public skill_vf_burnzone(id,vec[3],aim_vec[3],speed1,speed2,radius)
{
	new players[MAXPLAYERS],origin[3],burn_vec1[3],burn_vec2[3];
	static num,length,target,body_part;
	
	burn_vec1[0]=aim_vec[0]-vec[0];
	burn_vec1[1]=aim_vec[1]-vec[1];
	burn_vec1[2]=aim_vec[2]-vec[2];

	length=sqrt(burn_vec1[0]*burn_vec1[0]+burn_vec1[1]*burn_vec1[1]+burn_vec1[2]*burn_vec1[2]);
	
	burn_vec2[0]=burn_vec1[0]*speed2/length;
	burn_vec2[1]=burn_vec1[1]*speed2/length;
	burn_vec2[2]=burn_vec1[2]*speed2/length;
	
	burn_vec1[0]=burn_vec1[0]*speed1/length;
	burn_vec1[1]=burn_vec1[1]*speed1/length;
	burn_vec1[2]=burn_vec1[2]*speed1/length;
	
	burn_vec1[0] += vec[0];
	burn_vec1[1] += vec[1];
	burn_vec1[2] += vec[2];
	
	burn_vec2[0] += vec[0];
	burn_vec2[1] += vec[1];
	burn_vec2[2] += vec[2];
	
	get_user_aiming(id,target,body_part,500);
	if(pev_valid(target) && is_user_alive(target))
	{
		if(get_user_team(id) != get_user_team(target))
		{
			g_player_burning[target]=true;
			
			set_bleach_damage(id,target,1.0+g_skill[id][P_SKILL_6]/3.0);
			skill_vf_burn(id,target);
		}
	}
	
	get_players(players,num,"ah");
	for(new i = 0; i < num; i++)
	{
		if(get_user_team(id)==get_user_team(players[i]) || g_player_burning[players[i]])
		{
			continue;
		}
		
		g_player_burning[players[i]]=true;
		get_user_origin(players[i],origin);
	
		if(get_distance(origin,burn_vec1) <= radius)
		{
			skill_vf_burn(id,players[i]);
		}
		else if(get_distance(origin,burn_vec2) <= radius)
		{
			skill_vf_burn(id,players[i]);
		}
	}
	
	return PLUGIN_CONTINUE;
}

public skill_vf_burn(id,victim)
{
	static task,parm_flame[2],burn_time;
	
	task = BLEACH_TASK_VBURNING + victim;
	remove_task(task,0);
	
	parm_flame[0] = id;
	parm_flame[1] = victim;
	
	if(!g_player_burning[victim])
	{
		burn_time=random_num(4,8);
		set_task(0.8,"skill_vf_burning",task,parm_flame,2,"a",burn_time);
	}
	
	return PLUGIN_CONTINUE;
}

public skill_vf_burning(parm_flame[2])
{
	new origin[3];
	static id,victim;
	
	id = parm_flame[0];
	victim = parm_flame[1];
	
	if(!is_user_alive(victim))
	{
		remove_task(BLEACH_TASK_VBURNING+victim,0);
		return PLUGIN_HANDLED;
	}
	
	if(g_player_frozen[victim] || g_player_frosted[victim] > 0)
	{
		g_player_frozen[victim]=false;
		g_player_frosted[victim]=0;
		return PLUGIN_HANDLED;
	}
	
	get_user_origin(victim,origin);
		
	origin[0]+=random_num(-30,30);
	origin[1]+=random_num(-30,30);
	origin[2]+=random_num(-30,30)+10;
	
	create_te_sprite(origin,g_sprite_burning,30,200);
		
	origin[0]+=random_num(-30,30)*2;
	origin[1]+=random_num(-30,30)*2;
	origin[2]+=random_num(-30,30)*2+100;
		
	create_te_smoke(origin,g_sprite_smoke,60,15);
		
	create_screen_fade(victim,(1<<10),(1<<10),(1<<12),255,0,0,150);
		
	set_bleach_damage(id,victim,1.0+g_skill[id][P_SKILL_6]/2.0);
	
	return PLUGIN_CONTINUE;
}
