ProjectTextRPG/TextRPG/Source/Game/Characters/Player/Archer/Archer.cpp

53 lines
1.2 KiB
C++

#include "Archer.h"
#include "GameInstance.h"
#include "Core/Subsystems/GameInputSystem.h"
#include "Game/Characters/Monster/Monster.h"
Archer::Archer(PlayerStatData&& Rvalue) :
Player(std::move(Rvalue))
{
HitCount = 3;
}
Archer::~Archer()
{
}
void Archer::Initalize()
{
Player::Initalize();
PlayerData.Job = "궁수";
int MaxAttack = Game::InitCharacterJob::AddMaxAttack;
GInput << "궁수로 전직하였습니다." << "(Attack +" << MaxAttack << ")" << "\n";
GInput << "크리티컬 샷 추가!\n";
PlayerData.Attack += MaxAttack;
}
void Archer::Release()
{
Player::Release();
}
void Archer::Attack(class Monster* Target)
{
std::string TargetName = Target->GetName();
int TargetDefence = Target->GetDefence();
int Damage = 0;
Damage = (PlayerData.Attack - TargetDefence) < 0 ? 1 : (PlayerData.Attack - TargetDefence) / HitCount;
GInput << "크리티컬 샷! -> " << TargetName << "에게 " << Damage << " 데미지! (x" << HitCount << ")" << "\n";
GInput << Target->GetName() << " HP: " << Target->GetHP() << " -> ";
for (int i = 0; i < HitCount; ++i)
Target->TakeDamage(Damage);
GInput << Target->GetHP() << "\n";
system("pause");
}
void Archer::TakeDamage(int Amount)
{
Player::TakeDamage(Amount);
}