1
This commit is contained in:
parent
c90e0d95c3
commit
5d89cb529f
@ -1495,7 +1495,7 @@ void Creature::SummonObstacle(Buff* buff, int id, const Position& target_pos)
|
|||||||
obstacle->SetRotate(*p_rotate);
|
obstacle->SetRotate(*p_rotate);
|
||||||
}
|
}
|
||||||
obstacle->context_ability = context_ability;
|
obstacle->context_ability = context_ability;
|
||||||
slave_things_.push_back(std::make_tuple(buff->meta->buff_id(), obstacle));
|
slave_things_.push_back(std::make_tuple(buff->meta->buff_id(), obstacle->GetWeakPtrRef()));
|
||||||
if (buff->skill_meta) {
|
if (buff->skill_meta) {
|
||||||
SkillHelper::ProcSummonObstacle(buff->skill_meta, obstacle);
|
SkillHelper::ProcSummonObstacle(buff->skill_meta, obstacle);
|
||||||
}
|
}
|
||||||
@ -1717,7 +1717,8 @@ void Creature::SlaveOnRemove(Entity* slave)
|
|||||||
case ET_Obstacle:
|
case ET_Obstacle:
|
||||||
{
|
{
|
||||||
for (auto itr = slave_things_.begin(); itr != slave_things_.end(); ++itr) {
|
for (auto itr = slave_things_.begin(); itr != slave_things_.end(); ++itr) {
|
||||||
if ((Entity*)std::get<1>(*itr) == slave) {
|
if (std::get<1>(*itr).Get() &&
|
||||||
|
std::get<1>(*itr).Get() == slave) {
|
||||||
slave_things_.erase(itr);
|
slave_things_.erase(itr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1752,15 +1753,16 @@ void Creature::RemoveSurplusHero(int buff_id, int id, int num)
|
|||||||
void Creature::RemoveSurplusObstacle(int buff_id, int id, int num)
|
void Creature::RemoveSurplusObstacle(int buff_id, int id, int num)
|
||||||
{
|
{
|
||||||
if (slave_things_.size() >= num && num > 0) {
|
if (slave_things_.size() >= num && num > 0) {
|
||||||
std::vector<RoomObstacle*> matched_things;
|
std::vector<RoomObstacleWeakPtr> matched_things;
|
||||||
for (auto& itr : slave_things_) {
|
for (auto& itr : slave_things_) {
|
||||||
if (std::get<0>(itr) == buff_id &&
|
if (std::get<0>(itr) == buff_id &&
|
||||||
std::get<1>(itr)->meta->thing_id() == id) {
|
std::get<1>(itr).Get() &&
|
||||||
|
std::get<1>(itr).Get()->meta->thing_id() == id) {
|
||||||
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]->Destory();
|
matched_things[0].Get()->Destory();
|
||||||
matched_things.erase(matched_things.begin());
|
matched_things.erase(matched_things.begin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2795,3 +2797,17 @@ void Creature::TraverseEffect(std::function<void (Effect*, bool&)> cb)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Creature::RemoveSkillObstacle(const mt::Skill* skill_meta)
|
||||||
|
{
|
||||||
|
std::vector<RoomObstacleWeakPtr> del_obs;
|
||||||
|
for (auto itr = slave_things_.begin(); itr != slave_things_.end(); ++itr) {
|
||||||
|
RoomObstacleWeakPtr ob = std::get<1>(*itr);
|
||||||
|
if (ob.Get() && ob.Get()->skill_meta == skill_meta) {
|
||||||
|
del_obs.push_back(ob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (auto ob : del_obs) {
|
||||||
|
ob.Get()->Destory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -318,6 +318,7 @@ class Creature : public MoveableEntity
|
|||||||
void PullTarget(const glm::vec3& target_pos);
|
void PullTarget(const glm::vec3& target_pos);
|
||||||
void MarkSyncActivePlayer(const char* file, int line, const char* func);
|
void MarkSyncActivePlayer(const char* file, int line, const char* func);
|
||||||
void CheckBulletHitHoldShield(IBullet* bullet, bool& eat);
|
void CheckBulletHitHoldShield(IBullet* bullet, bool& eat);
|
||||||
|
void RemoveSkillObstacle(const mt::Skill* skill_meta);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void OnBuffRemove(Buff& buff);
|
virtual void OnBuffRemove(Buff& buff);
|
||||||
@ -381,7 +382,7 @@ private:
|
|||||||
std::list<std::shared_ptr<Buff>> buff_list_;
|
std::list<std::shared_ptr<Buff>> buff_list_;
|
||||||
std::map<int, std::shared_ptr<Effect>> effect_hash_;
|
std::map<int, std::shared_ptr<Effect>> effect_hash_;
|
||||||
std::list<std::tuple<int, Hero*>> slave_heros_;
|
std::list<std::tuple<int, Hero*>> slave_heros_;
|
||||||
std::list<std::tuple<int, RoomObstacle*>> slave_things_;
|
std::list<std::tuple<int, RoomObstacleWeakPtr>> slave_things_;
|
||||||
a8::XTimerWp auto_switch_weapon_timer_;
|
a8::XTimerWp auto_switch_weapon_timer_;
|
||||||
a8::XTimerWp reload_delay_timer_;
|
a8::XTimerWp reload_delay_timer_;
|
||||||
int follow_times_ = 0;
|
int follow_times_ = 0;
|
||||||
|
@ -796,7 +796,7 @@ void RoomObstacle::ActiveMedicalStation()
|
|||||||
|
|
||||||
room->xtimer.SetIntervalEx
|
room->xtimer.SetIntervalEx
|
||||||
(
|
(
|
||||||
meta->_int_param1 / FRAME_RATE_MS,
|
SERVER_FRAME_RATE,
|
||||||
[this] (int event, const a8::Args* args)
|
[this] (int event, const a8::Args* args)
|
||||||
{
|
{
|
||||||
if (a8::TIMER_EXEC_EVENT != event) {
|
if (a8::TIMER_EXEC_EVENT != event) {
|
||||||
@ -825,6 +825,7 @@ void RoomObstacle::ActiveMedicalStation()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
bool hit = false;
|
||||||
for (auto& c : target_list) {
|
for (auto& c : target_list) {
|
||||||
if (c->team_id == master.Get()->team_id) {
|
if (c->team_id == master.Get()->team_id) {
|
||||||
float add_hp = SkillHelper::GetYlzRecoverHp(master.Get(),
|
float add_hp = SkillHelper::GetYlzRecoverHp(master.Get(),
|
||||||
@ -833,12 +834,13 @@ void RoomObstacle::ActiveMedicalStation()
|
|||||||
float old_hp = c->GetHP();
|
float old_hp = c->GetHP();
|
||||||
c->AddHp(add_hp);
|
c->AddHp(add_hp);
|
||||||
if (std::abs(c->GetHP() - old_hp) > 0.0001f && master.Get()) {
|
if (std::abs(c->GetHP() - old_hp) > 0.0001f && master.Get()) {
|
||||||
for (int buff_id : meta->_buff_list) {
|
if (meta->_int_param2) {
|
||||||
c->TryAddBuff(master.Get(),
|
c->TryAddBuff(master.Get(),
|
||||||
buff_id
|
meta->_int_param2
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
hit = true;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{
|
{
|
||||||
std::string dbg_msg = a8::Format
|
std::string dbg_msg = a8::Format
|
||||||
@ -868,13 +870,19 @@ void RoomObstacle::ActiveMedicalStation()
|
|||||||
master.Get()->GetName(),
|
master.Get()->GetName(),
|
||||||
dmg_out);
|
dmg_out);
|
||||||
|
|
||||||
for (int buff_id : meta->_buff_list) {
|
if (meta->_int_param1) {
|
||||||
c->TryAddBuff(master.Get(),
|
c->TryAddBuff(master.Get(),
|
||||||
buff_id
|
meta->_int_param1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
hit = true;
|
||||||
}
|
}
|
||||||
|
if (hit) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}//end if
|
||||||
|
if (hit) {
|
||||||
|
RemoveSameSkillObstacle();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
&xtimer_attacher);
|
&xtimer_attacher);
|
||||||
@ -887,3 +895,10 @@ void RoomObstacle::ForceGridList()
|
|||||||
room->grid_service->GetAllCellsByXy(room, GetPos().GetX(), GetPos().GetZ(), *grid_list_);
|
room->grid_service->GetAllCellsByXy(room, GetPos().GetX(), GetPos().GetZ(), *grid_list_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RoomObstacle::RemoveSameSkillObstacle()
|
||||||
|
{
|
||||||
|
if (master.Get() && skill_meta) {
|
||||||
|
master.Get()->RemoveSkillObstacle(skill_meta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -59,6 +59,7 @@ private:
|
|||||||
|
|
||||||
void CalcTempPassObjects();
|
void CalcTempPassObjects();
|
||||||
void ForceGridList();
|
void ForceGridList();
|
||||||
|
void RemoveSameSkillObstacle();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RoomObstacleWeakPtr weak_ptr_;
|
RoomObstacleWeakPtr weak_ptr_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user