完成冲刺功能
This commit is contained in:
parent
2a866392ee
commit
74c780bde7
@ -266,5 +266,33 @@ void Buff::ProcSprint(Creature* caster)
|
||||
{
|
||||
if (caster->IsPlayer()) {
|
||||
Player* hum = (Player*)caster;
|
||||
std::set<int>* hited_objects = new std::set<int>;
|
||||
owner->room->xtimer.AddRepeatTimerAndAttach
|
||||
(
|
||||
1,
|
||||
a8::XParams()
|
||||
.SetSender(this)
|
||||
.SetParam1(hited_objects),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Buff* buff = (Buff*)param.sender.GetUserData();
|
||||
std::set<int>* hited_objects = (std::set<int>*)param.param1.GetUserData();
|
||||
std::set<Creature*> enemys;
|
||||
buff->owner->GetHitEnemys(enemys);
|
||||
for (auto& enemy : enemys) {
|
||||
if (hited_objects->find(enemy->GetEntityUniId()) != hited_objects->end()) {
|
||||
hited_objects->insert(enemy->GetEntityUniId());
|
||||
for (int buff_id : buff->meta->param1_int_list) {
|
||||
enemy->TryAddBuff(buff->owner, buff_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
&xtimer_attacher.timer_list_,
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
std::set<int>* hited_objects = (std::set<int>*)param.param1.GetUserData();
|
||||
delete hited_objects;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -236,6 +236,14 @@ void Creature::MustBeAddBuff(Creature* caster, int buff_id)
|
||||
AddBuff(caster, buff_meta, 1);
|
||||
}
|
||||
|
||||
void Creature::TryAddBuff(Creature* caster, int buff_id)
|
||||
{
|
||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id);
|
||||
if (buff_meta) {
|
||||
AddBuff(caster, buff_meta, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void Creature::RemoveBuffById(int buff_id)
|
||||
{
|
||||
std::vector<MetaData::Buff*> removed_buffs;
|
||||
@ -1716,3 +1724,20 @@ float Creature::GetMaxHP()
|
||||
{
|
||||
return ability.max_hp;
|
||||
}
|
||||
|
||||
void Creature::GetHitEnemys(std::set<Creature*>& enemys)
|
||||
{
|
||||
room->grid_service->TouchCreatures
|
||||
(room->GetRoomIdx(),
|
||||
GetGridList(),
|
||||
[this, &enemys] (Creature* c, bool& stop)
|
||||
{
|
||||
if (IsProperTarget(c)) {
|
||||
AabbCollider aabb_box;
|
||||
c->GetHitAabbBox(aabb_box);
|
||||
if (!c->dead && TestCollision(room, &aabb_box)) {
|
||||
enemys.insert(c);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ class Creature : public MoveableEntity
|
||||
MetaData::Skill* buff_skill_meta = nullptr);
|
||||
bool IsImmuneBuffEffect(int buff_effect);
|
||||
void MustBeAddBuff(Creature* caster, int buff_id);
|
||||
void TryAddBuff(Creature* caster, int buff_id);
|
||||
void RemoveBuffById(int buff_id);
|
||||
void RecalcBuffAttr();
|
||||
void RemoveBuffByEffectId(int buff_effect_id);
|
||||
@ -158,6 +159,7 @@ class Creature : public MoveableEntity
|
||||
void ClearAimingBuffs();
|
||||
float GetHP();
|
||||
float GetMaxHP();
|
||||
void GetHitEnemys(std::set<Creature*>& enemys);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -639,6 +639,13 @@ namespace MetaData
|
||||
immune_buffeffect.insert(a8::XValue(str));
|
||||
}
|
||||
}
|
||||
{
|
||||
std::vector<std::string> strings;
|
||||
a8::Split(i->buff_param1(), strings, '|');
|
||||
for (auto& str : strings) {
|
||||
param1_int_list.push_back(a8::XValue(str).GetInt());
|
||||
}
|
||||
}
|
||||
{
|
||||
std::vector<std::string> strings;
|
||||
a8::Split(i->buff_param2(), strings, ':');
|
||||
|
@ -180,6 +180,7 @@ namespace MetaData
|
||||
float param2 = 0.0f;
|
||||
float param3 = 0.0f;
|
||||
float param4 = 0.0f;
|
||||
std::vector<int> param1_int_list;
|
||||
std::vector<int> param2_int_list;
|
||||
std::vector<std::tuple<int, std::vector<std::tuple<int, int>>>> batch_add_list;
|
||||
std::vector<std::tuple<int, std::vector<int>>> post_remove_action;
|
||||
|
Loading…
x
Reference in New Issue
Block a user