83 lines
1.3 KiB
C++
83 lines
1.3 KiB
C++
#include "precompile.h"
|
|
|
|
#include "master_agent.h"
|
|
|
|
#include "mt/Hero.h"
|
|
|
|
MasterAgent::MasterAgent():BaseAgent()
|
|
{
|
|
|
|
}
|
|
|
|
MasterAgent::~MasterAgent()
|
|
{
|
|
}
|
|
|
|
int MasterAgent::GetUniId()
|
|
{
|
|
if (owner_->master.Get()) {
|
|
return owner_->master.Get()->GetUniId();
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
bool MasterAgent::IsValid()
|
|
{
|
|
return owner_->master.Get() && !owner_->master.Get()->dead;
|
|
}
|
|
|
|
bool MasterAgent::IsDead()
|
|
{
|
|
if (owner_->master.Get()) {
|
|
return owner_->master.Get()->dead;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
const glm::vec3 MasterAgent::GetPos()
|
|
{
|
|
return owner_->master.Get()->GetPos().ToGlmVec3();
|
|
}
|
|
|
|
float MasterAgent::GetHP()
|
|
{
|
|
if (!owner_->master.Get()) {
|
|
abort();
|
|
}
|
|
return owner_->master.Get()->GetHP();
|
|
}
|
|
|
|
float MasterAgent::GetMaxHP()
|
|
{
|
|
if (!owner_->master.Get()) {
|
|
abort();
|
|
}
|
|
return owner_->master.Get()->GetMaxHP();
|
|
}
|
|
|
|
int MasterAgent::GetHeroId()
|
|
{
|
|
if (!owner_->master.Get()) {
|
|
abort();
|
|
}
|
|
return owner_->master.Get()->GetHeroMeta()->id();
|
|
}
|
|
|
|
int MasterAgent::GetLevel()
|
|
{
|
|
if (!owner_->master.Get()) {
|
|
abort();
|
|
}
|
|
return owner_->master.Get()->GetHeroLevel();
|
|
}
|
|
|
|
void MasterAgent::SetOwner(Creature* owner)
|
|
{
|
|
owner_ = owner;
|
|
}
|
|
|
|
Room* MasterAgent::GetRoom()
|
|
{
|
|
return owner_->room;
|
|
}
|