#include "Player.h" #include "GameInstance.h" #include "Core/Subsystems/GameInputSystem.h" #include "Game/Characters/Monster/Monster.h" #include "Game/Inventory/InventorySystem.h" Player::Player(PlayerStatData&& Rvalue) : PlayerData(std::move(Rvalue)), Inventory(nullptr), HitCount(1) { OriginalData = PlayerData; PrepareInitInventory(); } Player::~Player() { Release(); } void Player::PrepareInitInventory() { Inventory = new InventorySystem(); } void Player::Initalize() { PlayerData.Level = 1; } void Player::Release() { SafeDelete(Inventory); } void Player::PrintPlayerStatus() const { GInput << "------------------------------------" << "\n"; GInput << "닉네임: " << PlayerData.Name << " | " << "직업: " << PlayerData.Job << " | " << "Lv." << PlayerData.Level << "\n"; GInput << "HP: " << PlayerData.HP << " | " << "MP: " << PlayerData.MP << " | " <<"공격력: " << PlayerData.Attack << " | " << "방어력: " << PlayerData.Defence << "\n"; GInput << "------------------------------------" << "\n"; } InventorySystem* Player::GetInventory() const { return Inventory; } std::string Player::GetName() const { return PlayerData.Name; } std::string Player::GetJob() const { return PlayerData.Job; } int Player::GetLevel() const { return PlayerData.Level; } int Player::GetHP() const { return PlayerData.HP; } int Player::GetMP() const { return PlayerData.MP; } int Player::GetAttack() const { return PlayerData.Attack; } int Player::GetDefence() const { return PlayerData.Defence; } void Player::TakeDamage(int Amount) { int Damage = (Amount - PlayerData.Defence) < 0 ? 1 : (Amount - PlayerData.Defence); PlayerData.HP -= Damage; } bool Player::IsDead() { return PlayerData.HP < 0; } void Player::Reset() { PlayerData = OriginalData; }