1
This commit is contained in:
parent
a838ac6408
commit
7ed5aa8fa7
@ -332,13 +332,14 @@ void Hero::DecHP(float dec_hp, int killer_id, const std::string killer_name, int
|
||||
|
||||
void Hero::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
||||
{
|
||||
std::vector<int> items;
|
||||
dead = true;
|
||||
if (meta->HasDrop() && !room->IsPveRoom()) {
|
||||
room->ScatterDrop(GetPos().ToGlmVec3(), meta->RandDrop());
|
||||
room->ScatterDrop(GetPos().ToGlmVec3(), meta->RandDrop(), false, &items);
|
||||
}
|
||||
if (!room->IsPveRoom()) {
|
||||
for (int id : meta->_drop_list) {
|
||||
room->ScatterDrop(GetPos().ToGlmVec3(), id);
|
||||
room->ScatterDrop(GetPos().ToGlmVec3(), id, false, &items);
|
||||
}
|
||||
}
|
||||
room->frame_event.AddDead(GetWeakPtrRef(), 0);
|
||||
@ -370,23 +371,38 @@ 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)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
Hero* hero = room->CreateHero
|
||||
(nullptr,
|
||||
hero_meta,
|
||||
pos,
|
||||
GlmHelper::UP,
|
||||
666,
|
||||
0);
|
||||
}
|
||||
},
|
||||
&room->xtimer_attacher_);
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
Hero* hero = room->CreateHero
|
||||
(nullptr,
|
||||
hero_meta,
|
||||
pos,
|
||||
GlmHelper::UP,
|
||||
666,
|
||||
0);
|
||||
}
|
||||
},
|
||||
&room->xtimer_attacher_);
|
||||
}
|
||||
}
|
||||
{
|
||||
int life_time = room->GetMapMeta()->GetMobaRoomMeta()->GetMonsterLootLifeTime(GetHeroMeta()->id());
|
||||
if (life_time >= 0) {
|
||||
room->xtimer.SetTimeoutEx
|
||||
(life_time * SERVER_FRAME_RATE,
|
||||
[room = room, items] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
}
|
||||
},
|
||||
&room->xtimer_attacher_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user