1
This commit is contained in:
parent
0c3a1baa4c
commit
e2661014fe
@ -574,6 +574,14 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
|||||||
SendGameOver();
|
SendGameOver();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (room->GetAliveTeamNum() == 1) {
|
||||||
|
std::set<Human*>* members = room->GetAliveTeam();
|
||||||
|
if (members) {
|
||||||
|
for (Human* member : *members) {
|
||||||
|
member->SendGameOver();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -699,14 +699,12 @@ void Player::LootInteraction(Loot* entity)
|
|||||||
if (item_meta->i->_inventory_slot() == 5 ||
|
if (item_meta->i->_inventory_slot() == 5 ||
|
||||||
item_meta->i->_inventory_slot() == 6) {
|
item_meta->i->_inventory_slot() == 6) {
|
||||||
Weapon* weapon = &weapons[3 + (item_meta->i->_inventory_slot() - 5)];
|
Weapon* weapon = &weapons[3 + (item_meta->i->_inventory_slot() - 5)];
|
||||||
if (weapon->weapon_id == 0) {
|
|
||||||
weapon->weapon_id = entity->item_id;
|
weapon->weapon_id = entity->item_id;
|
||||||
weapon->weapon_lv = 1;
|
weapon->weapon_lv = 1;
|
||||||
weapon->ammo += entity->count;
|
weapon->ammo += entity->count;
|
||||||
weapon->meta = item_meta;
|
weapon->meta = item_meta;
|
||||||
DecInventory(item_meta->i->_inventory_slot(), add_num);
|
DecInventory(item_meta->i->_inventory_slot(), add_num);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (item_meta->i->_inventory_slot() > 12) {
|
if (item_meta->i->_inventory_slot() > 12) {
|
||||||
if (item_meta->i->_inventory_slot() - 12 > curr_scope_idx) {
|
if (item_meta->i->_inventory_slot() - 12 > curr_scope_idx) {
|
||||||
curr_scope_idx = item_meta->i->_inventory_slot() - 12;
|
curr_scope_idx = item_meta->i->_inventory_slot() - 12;
|
||||||
|
@ -624,6 +624,32 @@ bool Room::BattleStarted()
|
|||||||
return battle_start_frameno_ != 0;
|
return battle_start_frameno_ != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Room::GetAliveTeamNum()
|
||||||
|
{
|
||||||
|
int num = 0;
|
||||||
|
for (auto& pair : team_hash_) {
|
||||||
|
for (Human* hum : pair.second) {
|
||||||
|
if (!hum->dead) {
|
||||||
|
++num;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::set<Human*>* Room::GetAliveTeam()
|
||||||
|
{
|
||||||
|
for (auto& pair : team_hash_) {
|
||||||
|
for (Human* hum : pair.second) {
|
||||||
|
if (!hum->dead) {
|
||||||
|
return &pair.second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
int Room::NewTeam()
|
int Room::NewTeam()
|
||||||
{
|
{
|
||||||
++current_teamid;
|
++current_teamid;
|
||||||
|
@ -85,6 +85,8 @@ public:
|
|||||||
bool OverBorder(const Vector2D pos, float radius);
|
bool OverBorder(const Vector2D pos, float radius);
|
||||||
Human* GetWatchWarTarget(Human* hum);
|
Human* GetWatchWarTarget(Human* hum);
|
||||||
bool BattleStarted();
|
bool BattleStarted();
|
||||||
|
int GetAliveTeamNum();
|
||||||
|
std::set<Human*>* GetAliveTeam();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned short AllocUniid();
|
unsigned short AllocUniid();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user