This commit is contained in:
aozhiwei 2024-03-28 10:49:13 +08:00
parent bf2a4f01b8
commit 5684536a8e
3 changed files with 24 additions and 0 deletions

View File

@ -29,6 +29,7 @@
#include "mt/MapThing.h"
#include "mt/BattleBasicAttribute.h"
#include "mt/Map.h"
#include "mt/MobaRoom.h"
Hero::Hero():Creature()
{
@ -368,6 +369,27 @@ void Hero::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
}
AllocDeadExp(killer_id);
GetTrigger()->Die(killer_id, weapon_id);
if (room->IsMobaModeRoom() && !room->IsGameOver()) {
int revive_time = room->GetMapMeta()->GetMobaRoomMeta()->GetMonsterReviveTime(GetHeroMeta()->id());
if (revive_time >= 0) {
room->xtimer.SetTimeoutEx
(revive_time * SERVER_FRAME_RATE,
[room = room, hero_meta = GetHeroMeta(), pos = src_pos] (int event, const a8::Args* args)
{
glm::vec3 pos;
if (a8::TIMER_EXEC_EVENT == event) {
Hero* hero = room->CreateHero
(nullptr,
hero_meta,
pos,
GlmHelper::UP,
666,
0);
}
},
&room->xtimer_attacher_);
}
}
}
void Hero::OnAddToTargetPartObject(Entity* target)

View File

@ -15,6 +15,7 @@ public:
const mt::Hero* meta = nullptr;
bool is_pve_boss = false;
list_head entry;
glm::vec3 src_pos = glm::vec3(0.0f, 0.0f, 0.0f);
Hero();
virtual ~Hero() override;

View File

@ -868,6 +868,7 @@ Hero* Room::CreateHero(Creature* master,
hero->master.Attach(master);
}
hero->room = this;
hero->src_pos = pos;
hero->GetMutablePos().FromGlmVec3(pos);
hero->SetMoveDir(dir);
hero->SetAttackDir(dir);