This commit is contained in:
aozhiwei 2022-10-09 14:55:54 +08:00
parent b92d5ccd8c
commit 1dd0b0e25e
3 changed files with 63 additions and 27 deletions

View File

@ -16,6 +16,7 @@
#include "entityfactory.h" #include "entityfactory.h"
#include "player.h" #include "player.h"
#include "incubator.h" #include "incubator.h"
#include "skillhelper.h"
RoomObstacle::RoomObstacle():Obstacle() RoomObstacle::RoomObstacle():Obstacle()
{ {
@ -856,7 +857,13 @@ void RoomObstacle::ActiveMedicalStation()
room->grid_service->GetAllCellsByXy(room, GetPos().x, GetPos().y, *grid_list_); room->grid_service->GetAllCellsByXy(room, GetPos().x, GetPos().y, *grid_list_);
} }
if (meta->i->width() > 0 && meta->int_param2 > 0) { if (!skill_meta || !skill_meta->number_meta) {
return;
}
if (skill_meta->GetMagicId() != MAGIC_YLZ) {
return;
}
room->xtimer.AddRepeatTimerAndAttach room->xtimer.AddRepeatTimerAndAttach
( (
meta->int_param1 / FRAME_RATE_MS, meta->int_param1 / FRAME_RATE_MS,
@ -865,6 +872,10 @@ void RoomObstacle::ActiveMedicalStation()
[] (const a8::XParams& param) [] (const a8::XParams& param)
{ {
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData(); RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
if (!obstacle->master.Get()) {
return;
}
Room* room = obstacle->room; Room* room = obstacle->room;
std::set<Creature*> target_list; std::set<Creature*> target_list;
room->grid_service->TraverseCreatures room->grid_service->TraverseCreatures
@ -873,20 +884,28 @@ void RoomObstacle::ActiveMedicalStation()
[obstacle, &target_list, room] (Creature* hum, bool& stop) [obstacle, &target_list, room] (Creature* hum, bool& stop)
{ {
if (obstacle->master.Get()->team_id == hum->team_id && if (obstacle->master.Get()->team_id == hum->team_id &&
!hum->dead && !hum->dead
obstacle->TestCollision(room, hum)) { ) {
if (IntersectCircleCircle(
obstacle->GetPos(),
SkillHelper::GetYlzRange(obstacle->skill_meta),
hum->GetPos(),
hum->GetRadius()
)) {
target_list.insert(hum); target_list.insert(hum);
} }
} }
}
); );
for (auto& c : target_list) { for (auto& c : target_list) {
c->AddHp(obstacle->meta->int_param2); c->AddHp(SkillHelper::GetYlzRecoverHp(obstacle->master.Get(),
c,
obstacle->skill_meta));
} }
}, },
&xtimer_attacher.timer_list_ &xtimer_attacher.timer_list_
); );
} }
}
void RoomObstacle::ActivePortal() void RoomObstacle::ActivePortal()
{ {

View File

@ -306,3 +306,17 @@ void SkillHelper::ProcSummonObstacle(const MetaData::Skill* skill_meta, RoomObst
} }
} }
int SkillHelper::GetYlzRange(const MetaData::Skill* skill_meta)
{
return skill_meta->number_meta->float_range2;
}
int SkillHelper::GetYlzRecoverHp(Creature* sender, Creature* target, const MetaData::Skill* skill_meta)
{
float hp =
(skill_meta->number_meta->float_ratio +
skill_meta->number_meta->float_ratio * sender->GetBattleContext()->GetHeroTotalAtk()) *
(1 + target->GetBattleContext()->GetExtRecoverHp());
return hp;
}

View File

@ -34,6 +34,9 @@ class SkillHelper
static int GetYmczBuffTime(const MetaData::Skill* skill_meta); static int GetYmczBuffTime(const MetaData::Skill* skill_meta);
static int GetYmczReserveDistance(const MetaData::Skill* skill_meta); static int GetYmczReserveDistance(const MetaData::Skill* skill_meta);
static float GetYmczDmg(Creature* sender, Creature* target, const MetaData::Skill* skill_meta); static float GetYmczDmg(Creature* sender, Creature* target, const MetaData::Skill* skill_meta);
//医疗站
static int GetYlzRange(const MetaData::Skill* skill_meta);
static int GetYlzRecoverHp(Creature* sender, Creature* target, const MetaData::Skill* skill_meta);
static void ProcBulletHitBuff(Bullet* bullet, Creature* c, int buff_uniid); static void ProcBulletHitBuff(Bullet* bullet, Creature* c, int buff_uniid);
static bool ProcBulletDmg(Bullet* bullet, Creature* target, float& finaly_dmg); static bool ProcBulletDmg(Bullet* bullet, Creature* target, float& finaly_dmg);