summaryrefslogtreecommitdiff
path: root/cop.h
blob: 2b46fb920c4eb62b89e87566d1f6509daa1b629c (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
#ifndef COP_H
#define COP_H

// Programmer: Brett Weiland
// Date: 4/30/23
// File: cop.h
// Assignment: SP-B-finalProject
// Purpose: defines cop npc which arrests robbers and takes money on contact.
//          cops will also release robbers if bribed (see robbers.h).

template <class T>
class robber;

template <class T>
class cop : public npc<T> {
  private:
    unsigned int robbers_caught = 0; 
  public:
    //overrides; see relevant files for descriptions
    void move() override;                             //npc.h
    char getIcon() const override;                    //gameObject.h
    unsigned int get_drawPriority() const override;   //gameObject.h
    
    //getters and setters
    unsigned int get_robbersCaught() const;

    //Desc: notifies all previously arrested robbers are now active, set robbers_caught to 0.
    //Pre:  none
    //Post: none
    void robbersReleased();

    //Desc: arrests robber, calls robbers getArrested() function.
    //      takes all robbers inventory for self.
    //Pre:  active robber is passed
    //Post: robber is arrested
    void arrest(robber<T> &offender);

    //Desc: robber calls this when they want to give us a bribe.
    //      Take an inventory item for ourselves, release all robbers.
    //Pre:  Item is passed as bribe
    //Post: bribe is put into inventory, all robbers released. Robber not arrested as a result.
    void takeBribe(T *bribe);

};

#include "cop.hpp"

#endif