#ifndef ROBBER_H #define ROBBER_H // Programmer: Brett Weiland // Date: 4/30/23 // File: robber.h // Assignment: SP-B-finalProject // Purpose: contains robber class, an npc that steals money and runs away from cops. // has different characteristics based on greedy variable, wanted to use a single // object for both greedy and non-greedy robbers to ensure I was following the assignment. #include "npc.h" template class cop; template class robber : public npc { private: //even while our inherited inventory is of inherited constant INVENTORY_SIZE, //we can't pick up more then BAG_SIZE. INVENTORY_SIZE is used due to the fact we can't //change the length of the array during construction; see npc.h for more info. const unsigned int BAG_SIZE = 7; //maximum amount of consecutive moves a robber can make if something allows them to make more const unsigned int MAX_MOVES = 3; //Desc: called to handle what happens when we run into a certain type of object. //Pre: valid peer passed //Post: interaction is carried out dependent on what type of gameObject we're dealing with bool handleInteractable(gameObject &peer); //Desc: finds all gameObjects we are located on and calls handleInteractable //Pre: none //Post: handleInteractable called for each gameObject we are stacked on bool iterateInteractables(); //changes how the robber moves. If this is set to true, //robber will always move twords a random jewl if available, //and will bribe officer with one inventory item to release all robbers. //if robber is greedy and runs into another rober, half of inventory is dropped. //robber can move up to MAX_MOVES times in a round if they get an item with even value. bool greedy; static unsigned int total_loot_value; public: //Desc: called when robber is arrested. returns inventory pointer to caller, // cop uses this to record items in their own stash. //Pre: none //Post: npc is no longer active (can't move), more behavior is defined by cop arrest() function T **getArrested(); //overriden functions, see respective files void move() override; //npc.h char getIcon() const override; //gameObject.h unsigned int get_drawPriority() const override; //gameObject.h //getters and setters void setGreedy(const bool greedy_value); bool isGreedy() const; void free(); //sets us to active unsigned int get_totalRobberValue() const; //returns combined value of ALL robbers }; template unsigned int robber::total_loot_value = 0; #include "robber.hpp" #endif