#include "tripleGun.hpp"
#include "../entity/bullet.hpp"
#include "../world.hpp"
#include <window.h>

namespace game::equipment {

TripleGun::TripleGun() noexcept: Weapon(0.2, 8, 20)
{

};

void TripleGun::Shoot(const vec2f &position, bool direction, World *world, bool forced) noexcept
{
    if (this->reloadTime > 0) {
        return;
    }

    this->reloadTime = this->cooldown;

    float angles[3] = {-25 + rand() % 4, 0, 25 + rand() % 4};

    float speed = this->bulletSpeed;
    if (direction) {
        speed *= -1;
    }

    float damage = this->damage;

    if (forced) {
        damage *= 2;
    }

    for (float angle: angles) {
        new entity::Bullet(world, position, speed, angle, damage);
    }
}


}
