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,36 +857,54 @@ 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) {
room->xtimer.AddRepeatTimerAndAttach return;
( }
meta->int_param1 / FRAME_RATE_MS, if (skill_meta->GetMagicId() != MAGIC_YLZ) {
a8::XParams() return;
.SetSender(this), }
[] (const a8::XParams& param)
{ room->xtimer.AddRepeatTimerAndAttach
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData(); (
Room* room = obstacle->room; meta->int_param1 / FRAME_RATE_MS,
std::set<Creature*> target_list; a8::XParams()
room->grid_service->TraverseCreatures .SetSender(this),
(room->GetRoomIdx(), [] (const a8::XParams& param)
*obstacle->grid_list_, {
[obstacle, &target_list, room] (Creature* hum, bool& stop) RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
{ if (!obstacle->master.Get()) {
if (obstacle->master.Get()->team_id == hum->team_id && return;
!hum->dead && }
obstacle->TestCollision(room, hum)) {
Room* room = obstacle->room;
std::set<Creature*> target_list;
room->grid_service->TraverseCreatures
(room->GetRoomIdx(),
*obstacle->grid_list_,
[obstacle, &target_list, room] (Creature* hum, bool& stop)
{
if (obstacle->master.Get()->team_id == hum->team_id &&
!hum->dead
) {
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) { );
c->AddHp(obstacle->meta->int_param2); for (auto& c : target_list) {
} c->AddHp(SkillHelper::GetYlzRecoverHp(obstacle->master.Get(),
}, c,
&xtimer_attacher.timer_list_ obstacle->skill_meta));
); }
} },
&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);