game2006/server/gameserver/master_agent.cc
aozhiwei 3e2dac8e99 1
2023-10-16 11:10:08 +08:00

83 lines
1.2 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()->level;
}
void MasterAgent::SetOwner(Creature* owner)
{
owner_ = owner;
}
Room* MasterAgent::GetRoom()
{
return owner_->room;
}