aboutsummaryrefslogtreecommitdiffstats
path: root/src/weapon.hpp
blob: 5e8fde4867ef5d2d20262da9c3d7105d696e2748 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*********************************/
/*   THRESHOLD        (  //      */
/*   weaponh           ( )/      */
/*   by salade         )(/       */
/*  ________________  ( /)       */
/* ()__)____________)))))   :^}  */
/*********************************/

#ifndef WEAPON_H_
#define WEAPON_H_

#include "projectile.hpp"
#include "raylib.h"

#include <iostream>
#include <vector>

class Entity;

class AWeapon {
   protected:
    Sound shot;
    Sound reload;

    unsigned int max;

    double cooldown;
    double t;

    float const range;
    unsigned int const damage;
    const std::string name;

    Projectile projectile;

   public:
    AWeapon(float const rg,           // range
            unsigned int const& dmg,  // damage
            unsigned int const& mag,  // mag capacity
            double const& cooldown,   // duh
            const char* s,            // shot sound  path
            const char* r,            // reload sound path
            std::string const& nm,    // name
            bool const& hasProj);     // projectiles ? yea/nay
    ~AWeapon();

    virtual int bang(std::vector<Entity>* enemies, Entity* player) = 0;
    void refill();

    virtual Projectile const& getProjectile() const = 0;

    bool empty;
    unsigned int barrel;
    bool hasProjectiles;
};

#endif  // WEAPON_H_