1
This commit is contained in:
parent
bc6ffe3eec
commit
b366492f0e
@ -16,10 +16,13 @@
|
|||||||
#include "jsondatamgr.h"
|
#include "jsondatamgr.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "mapinstance.h"
|
#include "mapinstance.h"
|
||||||
|
#include "human.h"
|
||||||
|
#include "stats.h"
|
||||||
|
|
||||||
#include "mt/MapMode.h"
|
#include "mt/MapMode.h"
|
||||||
#include "mt/Hero.h"
|
#include "mt/Hero.h"
|
||||||
#include "mt/MapThing.h"
|
#include "mt/MapThing.h"
|
||||||
|
#include "mt/Param.h"
|
||||||
|
|
||||||
const int BOX_ID = 150001;
|
const int BOX_ID = 150001;
|
||||||
|
|
||||||
@ -53,6 +56,29 @@ void BoxDrop::OnObstacleDeadDrop(Obstacle* ob)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BoxDrop::OnHumanDeadDrop(Human* hum)
|
||||||
|
{
|
||||||
|
if (hum->box_num <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (room_->IsGameOver()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (room_->GetVictoryTeam()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int rnd = a8::RandEx(0, 100);
|
||||||
|
if (hum->stats->abandon_battle) {
|
||||||
|
if (rnd <= mt::Param::s().battle_event_end_loss_rate_quit * 100) {
|
||||||
|
Drop(hum->box_num, hum->GetPos().ToGlmVec3());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (rnd <= mt::Param::s().battle_event_end_loss_rate_dead * 100) {
|
||||||
|
Drop(hum->box_num, hum->GetPos().ToGlmVec3());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BoxDrop::Drop(int num, const glm::vec3& center)
|
void BoxDrop::Drop(int num, const glm::vec3& center)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < num; ++i) {
|
for (int i = 0; i < num; ++i) {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
class Room;
|
class Room;
|
||||||
class Hero;
|
class Hero;
|
||||||
class Obstacle;
|
class Obstacle;
|
||||||
|
class Human;
|
||||||
|
|
||||||
class BoxDrop : public std::enable_shared_from_this<BoxDrop>
|
class BoxDrop : public std::enable_shared_from_this<BoxDrop>
|
||||||
{
|
{
|
||||||
@ -14,6 +15,7 @@ class BoxDrop : public std::enable_shared_from_this<BoxDrop>
|
|||||||
void OnBattleStart();
|
void OnBattleStart();
|
||||||
void OnHeroDeadDrop(Hero* hero);
|
void OnHeroDeadDrop(Hero* hero);
|
||||||
void OnObstacleDeadDrop(Obstacle* ob);
|
void OnObstacleDeadDrop(Obstacle* ob);
|
||||||
|
void OnHumanDeadDrop(Human* hum);
|
||||||
void RequestReturnBoxNum();
|
void RequestReturnBoxNum();
|
||||||
bool GetNextBoxPos(glm::vec3& pos);
|
bool GetNextBoxPos(glm::vec3& pos);
|
||||||
void DropByUuid(int obj_uniid, const glm::vec3& center);
|
void DropByUuid(int obj_uniid, const glm::vec3& center);
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
#include "hero.h"
|
#include "hero.h"
|
||||||
#include "bornpoint.h"
|
#include "bornpoint.h"
|
||||||
#include "ingamevoice.h"
|
#include "ingamevoice.h"
|
||||||
|
#include "boxdrop.h"
|
||||||
|
|
||||||
#include "buff/sprint.h"
|
#include "buff/sprint.h"
|
||||||
|
|
||||||
@ -3252,6 +3253,7 @@ void Human::InternalBeKill(int killer_id, const std::string& killer_name, int we
|
|||||||
}
|
}
|
||||||
room->GetInGameVoice()->OnHumanBeKill(real_killer_id, this);
|
room->GetInGameVoice()->OnHumanBeKill(real_killer_id, this);
|
||||||
}
|
}
|
||||||
|
room->GetBoxDrop()->OnHumanDeadDrop(this);
|
||||||
SendViewerUiMemberUpdate({GetUniId(), killer_id, real_killer_id});
|
SendViewerUiMemberUpdate({GetUniId(), killer_id, real_killer_id});
|
||||||
room->NotifyUiUpdate();
|
room->NotifyUiUpdate();
|
||||||
}
|
}
|
||||||
|
@ -520,6 +520,9 @@ void Trigger::RemoveEventHandlers(std::vector<std::weak_ptr<EventHandler>> handl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
!!!
|
||||||
|
*/
|
||||||
void Trigger::DispatchEvent(int event_id, const std::vector<std::any>& param)
|
void Trigger::DispatchEvent(int event_id, const std::vector<std::any>& param)
|
||||||
{
|
{
|
||||||
auto itr = listeners_hash_.find(event_id);
|
auto itr = listeners_hash_.find(event_id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user