-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathResource.h
42 lines (27 loc) · 1004 Bytes
/
Resource.h
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
//
// Created by Ivo Georgiev on 11/22/15.
//
#ifndef PA5GAME_RESOURCE_H
#define PA5GAME_RESOURCE_H
#include "Game.h"
#include "Piece.h"
namespace Gaming {
class Resource : public Piece {
protected:
double __capacity;
public:
static const double RESOURCE_SPOIL_FACTOR;
Resource(const Game &g, const Position &p, double capacity);
~Resource();
virtual double getCapacity() const { return __capacity; }
virtual double consume();
void age() override final;
bool isViable() const override final { return !isFinished() && __capacity > 0.0; }
ActionType takeTurn(const Surroundings &s) const override;
// note: these won't be called while resources don't move
Piece &operator*(Piece &other) override final;
Piece &interact(Agent *) override final;
Piece &interact(Resource *) override final; // note: no interaction between resources
};
}
#endif //PA5GAME_RESOURCE_H