1
This commit is contained in:
parent
cf3a8a8b39
commit
6e46e42ac3
@ -21,6 +21,7 @@
|
||||
#include "mapinstance.h"
|
||||
#include "collision.h"
|
||||
#include "gungrasp.h"
|
||||
#include "effect.h"
|
||||
|
||||
#include "mt/Param.h"
|
||||
#include "mt/Hero.h"
|
||||
@ -2718,25 +2719,37 @@ void Creature::ClearEnergyShield()
|
||||
|
||||
int Creature::AddEffect(int effect_id)
|
||||
{
|
||||
|
||||
auto effect = std::make_shared<Effect>();
|
||||
effect->effect_uniid = ++buff_uniid_;
|
||||
effect->owner = this;
|
||||
effect->effect_id = effect_id;
|
||||
effect_hash_[effect->effect_uniid] = effect;
|
||||
}
|
||||
|
||||
void Creature::RemoveEffect(int effect_uniid)
|
||||
{
|
||||
|
||||
effect_hash_.erase(effect_uniid);
|
||||
}
|
||||
|
||||
void Creature::RemoveEffects(std::vector<int> effect_uniids)
|
||||
{
|
||||
|
||||
for (int effect_uniid : effect_uniids) {
|
||||
RemoveEffect(effect_uniid);
|
||||
}
|
||||
}
|
||||
|
||||
void Creature::ClearEffect()
|
||||
{
|
||||
|
||||
effect_hash_.clear();
|
||||
}
|
||||
|
||||
void Creature::TraverseEffect(std::function<void (Effect*, bool&)> func)
|
||||
void Creature::TraverseEffect(std::function<void (Effect*, bool&)> cb)
|
||||
{
|
||||
|
||||
for (auto& pair : effect_hash_) {
|
||||
bool stop = false;
|
||||
cb(pair.second.get(), stop);
|
||||
if (stop) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ private:
|
||||
std::array<list_head, kBET_End> depend_effect_ = {};
|
||||
std::array<list_head, kCondBuffEnd> cond_buffs_ = {};
|
||||
std::list<std::shared_ptr<Buff>> buff_list_;
|
||||
std::list<std::shared_ptr<Effect>> effect_list_;
|
||||
std::map<int, std::shared_ptr<Effect>> effect_hash_;
|
||||
std::list<std::tuple<int, Hero*>> slave_heros_;
|
||||
std::list<std::tuple<int, RoomObstacle*>> slave_things_;
|
||||
a8::XTimerWp auto_switch_weapon_timer_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user