1
This commit is contained in:
parent
b79c58cf30
commit
3e4456644a
@ -101,6 +101,7 @@ class Creature : public MoveableEntity
|
||||
int level = 1;
|
||||
int hero_level = 1;
|
||||
int revive_count = 0;
|
||||
CreatureWeakPtr master;
|
||||
|
||||
Weapon second_weapon;
|
||||
glm::vec3 skill_pos;
|
||||
|
@ -12,7 +12,6 @@ class HeroAgent;
|
||||
class Hero : public Creature
|
||||
{
|
||||
public:
|
||||
CreatureWeakPtr master;
|
||||
const mt::Hero* meta = nullptr;
|
||||
bool is_pve_boss = false;
|
||||
list_head entry;
|
||||
|
82
server/gameserver/master_agent.cc
Normal file
82
server/gameserver/master_agent.cc
Normal file
@ -0,0 +1,82 @@
|
||||
#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;
|
||||
}
|
30
server/gameserver/master_agent.h
Normal file
30
server/gameserver/master_agent.h
Normal file
@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include "new_base_agent.h"
|
||||
|
||||
#include "creature.h"
|
||||
|
||||
class MasterAgent : public BaseAgent
|
||||
{
|
||||
public:
|
||||
MasterAgent();
|
||||
|
||||
virtual ~MasterAgent();
|
||||
|
||||
BEHAVIAC_DECLARE_AGENTTYPE(MasterAgent, BaseAgent)
|
||||
|
||||
int GetUniId();
|
||||
bool IsValid();
|
||||
bool IsDead();
|
||||
const glm::vec3 GetPos();
|
||||
float GetHp();
|
||||
float GetMaxHp();
|
||||
int GetHeroId();
|
||||
int GetLevel();
|
||||
|
||||
void SetOwner(Creature* owner);
|
||||
virtual Room* GetRoom() override;
|
||||
|
||||
private:
|
||||
Creature* owner_ = nullptr;
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user