添加死亡掉落

This commit is contained in:
aozhiwei 2019-05-21 14:23:56 +08:00
parent ce9408f6f9
commit db3dcb8dfa
2 changed files with 25 additions and 0 deletions

View File

@ -605,6 +605,7 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
}
}
}
DeadDrop();
}
}
@ -1852,3 +1853,26 @@ void Human::InternalSendGameOver()
delete params;
sending_gameover_ = true;
}
void Human::DeadDrop()
{
for (auto& weapon : weapons) {
if (weapon.weapon_id != 0 && weapon.weapon_id != default_weapon.weapon_id) {
Vector2D drop_pos = pos;
room->DropItem(drop_pos, weapon.weapon_id, 1);
}
}
for (size_t slot = 0; slot < inventory_.size(); ++slot) {
if (inventory_[slot] > 0) {
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquipBySlotId(slot);
if (equip_meta) {
if (equip_meta->i->equip_type() == 2 &&
MetaMgr::Instance()->fighting_mode) {
return;
}
Vector2D drop_pos = pos;
room->DropItem(drop_pos, equip_meta->i->id(), inventory_[slot]);
}
}
}
}

View File

@ -179,6 +179,7 @@ private:
void ClearFrameData();
void GenBattleReportData(a8::MutableXObject* params);
void InternalSendGameOver();
void DeadDrop();
protected:
long long last_shot_frameno_ = 0;