1
This commit is contained in:
parent
e16548430d
commit
30a816d507
@ -2191,8 +2191,8 @@ void Creature::RemoveSurplusHero(int buff_id, int id, int num)
|
|||||||
matched_heros.push_back(std::get<1>(itr));
|
matched_heros.push_back(std::get<1>(itr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (matched_heros.size() >= num) {
|
while (matched_heros.size() > num) {
|
||||||
matched_heros[0]->DetachFromMaster();
|
matched_heros[0]->Destory();
|
||||||
matched_heros.erase(matched_heros.begin());
|
matched_heros.erase(matched_heros.begin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2208,8 +2208,8 @@ void Creature::RemoveSurplusObstacle(int buff_id, int id, int num)
|
|||||||
matched_things.push_back(std::get<1>(itr));
|
matched_things.push_back(std::get<1>(itr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (matched_things.size() >= num) {
|
while (matched_things.size() > num) {
|
||||||
matched_things[0]->DetachFromMaster();
|
matched_things[0]->Destory();
|
||||||
matched_things.erase(matched_things.begin());
|
matched_things.erase(matched_things.begin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -344,6 +344,40 @@ void Hero::InitAI()
|
|||||||
void Hero::OnBattleStart(Room* room)
|
void Hero::OnBattleStart(Room* room)
|
||||||
{
|
{
|
||||||
if (master.Get()) {
|
if (master.Get()) {
|
||||||
|
Destory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Hero::Destory()
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
room->BroadcastDebugMsg(a8::Format("hero destory uniid:%d pos:%d,%d",
|
||||||
|
{
|
||||||
|
GetUniId(),
|
||||||
|
GetPos().x,
|
||||||
|
GetPos().y
|
||||||
|
}));
|
||||||
|
#endif
|
||||||
|
room->xtimer.AddDeadLineTimerAndAttach
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
a8::XParams()
|
||||||
|
.SetSender(this),
|
||||||
|
[] (const a8::XParams& param)
|
||||||
|
{
|
||||||
|
Hero* hero = (Hero*)param.sender.GetUserData();
|
||||||
|
if (hero->delete_frameno == 0) {
|
||||||
|
hero->BroadcastDeleteState(hero->room);
|
||||||
|
hero->RemoveFromAroundPlayers(hero->room);
|
||||||
|
hero->room->grid_service->RemoveCreature(hero);
|
||||||
|
hero->room->RemoveObjectLater(hero);
|
||||||
|
hero->delete_frameno = hero->room->GetFrameNo();
|
||||||
|
std::vector<Human*> watch_list;
|
||||||
|
hero->room->GetPartObjectWatchList(hero, watch_list);
|
||||||
|
if (!watch_list.empty()) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
&xtimer_attacher.timer_list_);
|
||||||
|
}
|
||||||
|
@ -39,7 +39,7 @@ public:
|
|||||||
virtual void OnAddToTargetPartObject(Entity* target) override;
|
virtual void OnAddToTargetPartObject(Entity* target) override;
|
||||||
virtual void OnRemoveFromTargetPartObject(Entity* target) override;
|
virtual void OnRemoveFromTargetPartObject(Entity* target) override;
|
||||||
virtual void OnBattleStart(Room* room) override;
|
virtual void OnBattleStart(Room* room) override;
|
||||||
void DetachFromMaster();
|
void Destory();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void _UpdateMove(int speed) override;
|
virtual void _UpdateMove(int speed) override;
|
||||||
@ -47,6 +47,7 @@ protected:
|
|||||||
virtual void RecalcSelfCollider() override;
|
virtual void RecalcSelfCollider() override;
|
||||||
void BeKill(int killer_id, const std::string& killer_name, int weapon_id);
|
void BeKill(int killer_id, const std::string& killer_name, int weapon_id);
|
||||||
void InitAI();
|
void InitAI();
|
||||||
|
void DetachFromMaster();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool later_removed_ = false;
|
bool later_removed_ = false;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "playermgr.h"
|
#include "playermgr.h"
|
||||||
#include "perfmonitor.h"
|
#include "perfmonitor.h"
|
||||||
#include "jsondatamgr.h"
|
#include "jsondatamgr.h"
|
||||||
|
#include "skill.h"
|
||||||
|
|
||||||
const int kREVIVE_BUFF_ID = 1005;
|
const int kREVIVE_BUFF_ID = 1005;
|
||||||
|
|
||||||
@ -1244,6 +1245,12 @@ void Player::_CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg)
|
|||||||
SendDebugMsg(a8::Format("attr_id:%d abs_val:%f rate_val:%f", {attr_id, abs_val, rate_val}));
|
SendDebugMsg(a8::Format("attr_id:%d abs_val:%f rate_val:%f", {attr_id, abs_val, rate_val}));
|
||||||
} else if (cmd == "bufflist") {
|
} else if (cmd == "bufflist") {
|
||||||
SendDebugMsg(DebugOutBuffList());
|
SendDebugMsg(DebugOutBuffList());
|
||||||
|
} else if (cmd == "reset_skill" && cmds.size() >= 2) {
|
||||||
|
int skill_id = a8::XValue(cmds[1]);
|
||||||
|
Skill* skill = GetSkill(skill_id);
|
||||||
|
if (skill) {
|
||||||
|
skill->Accelerate(-10000000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2422,7 +2422,7 @@ ObstacleData* Room::GetPermanentObstacleData(int obstacle_uniid)
|
|||||||
long long Room::GetGasInactiveTime()
|
long long Room::GetGasInactiveTime()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
return f8::IsOnlineEnv() ? 10 : 10;
|
return f8::IsOnlineEnv() ? 10 : 50;
|
||||||
#endif
|
#endif
|
||||||
if (room_mode_ == kZombieMode) {
|
if (room_mode_ == kZombieMode) {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
@ -508,7 +508,7 @@ void RoomObstacle::ActiveKeepRangeBuff()
|
|||||||
[] (const a8::XParams& param)
|
[] (const a8::XParams& param)
|
||||||
{
|
{
|
||||||
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
|
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
|
||||||
obstacle->DetachFromMaster();
|
obstacle->Destory();
|
||||||
},
|
},
|
||||||
&xtimer_attacher.timer_list_
|
&xtimer_attacher.timer_list_
|
||||||
);
|
);
|
||||||
@ -578,6 +578,11 @@ RoomObstacleWeakPtr& RoomObstacle::GetWeakPtrRef()
|
|||||||
void RoomObstacle::OnBattleStart(Room* room)
|
void RoomObstacle::OnBattleStart(Room* room)
|
||||||
{
|
{
|
||||||
if (master.Get()) {
|
if (master.Get()) {
|
||||||
|
Destory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RoomObstacle::Destory()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -27,13 +27,13 @@ class RoomObstacle : public Obstacle
|
|||||||
void ActiveTimerFunc();
|
void ActiveTimerFunc();
|
||||||
void UpdateTimerFunc();
|
void UpdateTimerFunc();
|
||||||
void Active();
|
void Active();
|
||||||
void DetachFromMaster();
|
|
||||||
virtual void Die(Room* room) override;
|
virtual void Die(Room* room) override;
|
||||||
Entity* GetRealObject(Room* room);
|
Entity* GetRealObject(Room* room);
|
||||||
|
|
||||||
RoomObstacleWeakPtrChunk* GetWeakPtrChunk() { return &weak_ptr_chunk_; };
|
RoomObstacleWeakPtrChunk* GetWeakPtrChunk() { return &weak_ptr_chunk_; };
|
||||||
RoomObstacleWeakPtr AllocWeakPtr();
|
RoomObstacleWeakPtr AllocWeakPtr();
|
||||||
RoomObstacleWeakPtr& GetWeakPtrRef();
|
RoomObstacleWeakPtr& GetWeakPtrRef();
|
||||||
|
void Destory();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SpecExplosion();
|
void SpecExplosion();
|
||||||
@ -49,6 +49,7 @@ private:
|
|||||||
|
|
||||||
void SummonAirDropBox(int box_id);
|
void SummonAirDropBox(int box_id);
|
||||||
void ProcKeepRangeBuff();
|
void ProcKeepRangeBuff();
|
||||||
|
void DetachFromMaster();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RoomObstacleWeakPtr weak_ptr_;
|
RoomObstacleWeakPtr weak_ptr_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user