#pragma once

#include <common/mutators/base.qh>

#include "buffs.qh"

void buffs_Initialize();

AUTOCVAR(g_buffs, int, -1, "enable buffs; \\\"-1\\\" = enabled but no auto location or replacing powerups, \\\"1\\\" = enabled and can replace them");

REGISTER_MUTATOR(buffs, autocvar_g_buffs)
{
	MUTATOR_ONADD
	{
		buffs_Initialize();
	}
}

bool  autocvar_g_buffs_effects;
float autocvar_g_buffs_waypoint_distance;
bool autocvar_g_buffs_pickup_anyway = false;
float autocvar_g_buffs_pickup_delay = 0.7;
bool autocvar_g_buffs_randomize;
bool autocvar_g_buffs_randomize_teamplay = true;
float autocvar_g_buffs_random_lifetime;
bool autocvar_g_buffs_random_location;
int autocvar_g_buffs_random_location_attempts;
int autocvar_g_buffs_spawn_count;
bool autocvar_g_buffs_replace_powerups;
bool autocvar_g_buffs_replace_available = true;
bool autocvar_g_buffs_drop = false;
float autocvar_g_buffs_cooldown_activate;
float autocvar_g_buffs_cooldown_respawn;
float autocvar_g_buffs_resistance_blockpercent;
float autocvar_g_buffs_medic_survive_chance;
float autocvar_g_buffs_medic_survive_health;
float autocvar_g_buffs_medic_rot;
float autocvar_g_buffs_medic_max;
float autocvar_g_buffs_medic_regen;
float autocvar_g_buffs_vengeance_damage_multiplier;
float autocvar_g_buffs_bash_force;
float autocvar_g_buffs_bash_force_self;
float autocvar_g_buffs_disability_slowtime;
float autocvar_g_buffs_disability_speed;
float autocvar_g_buffs_disability_rate;
float autocvar_g_buffs_disability_weaponspeed;
float autocvar_g_buffs_vampire_damage_steal;
float autocvar_g_buffs_jump_height;
float autocvar_g_buffs_inferno_burntime_factor;
float autocvar_g_buffs_inferno_burntime_min_time;
float autocvar_g_buffs_inferno_burntime_target_damage;
float autocvar_g_buffs_inferno_burntime_target_time;
float autocvar_g_buffs_inferno_damagemultiplier;
float autocvar_g_buffs_swapper_range;
float autocvar_g_buffs_magnet_range_item;
float autocvar_g_buffs_magnet_range_buff = 200;
float autocvar_g_buffs_luck_chance = 0.15;
float autocvar_g_buffs_luck_damagemultiplier = 3;

// ammo
.int buff_ammo_prev_infitems;
.int buff_ammo_prev_clipload;
// flight
.float buff_flight_oldgravity;
.bool buff_flight_crouchheld;
// common buff variables
.float buff_effect_delay;

// buff definitions
.bool buff_active;
.float buff_activetime;
.bool buff_activetime_updated;
.entity buff_waypoint;
.entity oldbuffs; // for updating effects
.float buff_shield; // delay for players to keep them from spamming buff pickups
.entity buff_model; // controls effects (TODO: make csqc)

float buff_Available(entity buff);

void buff_RemoveAll(entity actor, int removal_type);

entity buff_FirstFromFlags(entity actor);