Text-Adventure/State.h

39 lines
805 B
C
Raw Normal View History

2023-11-16 00:44:12 +08:00
#ifndef TEXTADV_STATE_H
#define TEXTADV_STATE_H
#include "Room.h"
#include "GameObject.h"
class State : public Serializable {
int currentRoomId;
// int: game object id
bool inventory_sorted;
std::list<int> inventory;
int HP;
public:
static int seed;
explicit State(int room_id);
void goTo(Room* target);
void announceLoc() const;
Room* getCurrentRoom() const;
int getHP() const;
void setHP(int HP);
std::list<int> getInventory();
void addToInventory(int object_id);
void removeFromInventory(int object_id);
bool IsInInventory(int object_id) const;
static int NextRandom();
string ToString() const override;
void FromString(const string &str) override;
};
#endif //TEXTADV_STATE_H