Files
Text-Adventure/Engine/src/player.cpp
T

66 lines
1.1 KiB
C++
Raw Normal View History

2026-08-07 13:10:07 -05:00
#include "player.h"
#include <algorithm>
#include <string>
Player::Player()
{
Init();
}
Player::Player(Player &rhs)
{
id = rhs.id;
level = rhs.level;
stats = rhs.stats;
name = rhs.name;
description = rhs.description;
curRoomID = rhs.curRoomID;
prevRoomID = rhs.prevRoomID;
}
Player& Player::operator=(Player& rhs)
{
swap(*this, rhs);
return *this;
}
2026-08-07 13:10:07 -05:00
2026-08-20 08:10:07 -05:00
void Player::Init() {
// initialize stats, room location, inventory and item data
stats = Stats{100.0f, 50.00f, 150.00f, 50.00f};
name = "Player";
2026-08-07 13:10:07 -05:00
}
2026-08-20 08:10:07 -05:00
void Player::LevelUp() {}
2026-08-07 13:10:07 -05:00
2026-08-20 08:10:07 -05:00
void Player::Die() {
// Now. You must, die!
2026-08-07 13:10:07 -05:00
}
2026-08-20 08:10:07 -05:00
void Player::TakeDamage(int damageType, float damage) {
// Ouch
2026-08-07 13:10:07 -05:00
}
2026-08-20 08:10:07 -05:00
float Player::GetHealth() { return 0.0f; }
2026-08-07 13:10:07 -05:00
2026-08-20 08:10:07 -05:00
void Player::ChangeRoom(int roomID) {
if (prevRoomID == roomID) {
curRoomID = prevRoomID;
}
2026-08-07 13:10:07 -05:00
2026-08-20 08:10:07 -05:00
else if (curRoomID != roomID) {
prevRoomID = curRoomID;
curRoomID = roomID;
}
2026-08-07 13:10:07 -05:00
}
Player::~Player()
{
id = -1;
level = -1;
stats = {};
name.erase();
description.erase();
curRoomID = -1;
prevRoomID = -1;
}