This commit is contained in:
aozhiwei 2022-10-09 13:54:39 +08:00
parent 6f05e7b3ee
commit 95268cba51
8 changed files with 37 additions and 6 deletions

View File

@ -2452,6 +2452,9 @@ void Creature::SummonObstacle(Buff* buff, int id, const a8::Vec2& target_pos)
} }
obstacle->context_ability = context_ability; obstacle->context_ability = context_ability;
slave_things_.push_back(std::make_tuple(buff->meta->i->buff_id(), obstacle)); slave_things_.push_back(std::make_tuple(buff->meta->i->buff_id(), obstacle));
if (buff->skill_meta) {
SkillHelper::ProcSummonObstacle(buff->skill_meta, obstacle);
}
#ifdef DEBUG #ifdef DEBUG
SendDebugMsg(a8::Format("召唤物件 buff_id:%d thing_id:%d pos:%f,%f target_pos:%f,%f", SendDebugMsg(a8::Format("召唤物件 buff_id:%d thing_id:%d pos:%f,%f target_pos:%f,%f",
{buff->meta->i->buff_id(), {buff->meta->i->buff_id(),

View File

@ -1053,12 +1053,12 @@ namespace MetaData
} }
} }
int Skill::GetMagicId() int Skill::GetMagicId() const
{ {
return magic_id; return magic_id;
} }
bool Skill::IsTurnOverSkill() bool Skill::IsTurnOverSkill() const
{ {
return !phases.empty() && phases[0].func_id == kSkill_TurnOver; return !phases.empty() && phases[0].func_id == kSkill_TurnOver;
} }

View File

@ -318,8 +318,8 @@ namespace MetaData
std::set<int> buff_list; std::set<int> buff_list;
std::map<int, std::set<MetaData::Buff*>> trigger_type_buffs; std::map<int, std::set<MetaData::Buff*>> trigger_type_buffs;
std::vector<MetaData::SkillPhase> phases; std::vector<MetaData::SkillPhase> phases;
bool IsTurnOverSkill(); bool IsTurnOverSkill() const;
int GetMagicId(); int GetMagicId() const;
private: private:
int magic_id = 0; int magic_id = 0;
int base_skill_id = 0; int base_skill_id = 0;

View File

@ -362,7 +362,7 @@ void RoomObstacle::Active()
break; break;
} }
if (meta->i->life_time() > 0) { if (meta->i->life_time() > 0) {
room->xtimer.AddDeadLineTimerAndAttach xtimer_list* timer = room->xtimer.AddDeadLineTimerAndAttach
( (
meta->i->life_time() / FRAME_RATE_MS, meta->i->life_time() / FRAME_RATE_MS,
a8::XParams() a8::XParams()
@ -374,6 +374,7 @@ void RoomObstacle::Active()
}, },
&xtimer_attacher.timer_list_ &xtimer_attacher.timer_list_
); );
life_time_timer = room->xtimer.GetTimerPtr(timer);
} }
} }

View File

@ -25,6 +25,7 @@ class RoomObstacle : public Obstacle
MetaData::Buff* buff_meta = nullptr; MetaData::Buff* buff_meta = nullptr;
MetaData::Skill* skill_meta = nullptr; MetaData::Skill* skill_meta = nullptr;
long long born_frameno = 0; long long born_frameno = 0;
std::weak_ptr<a8::XTimerPtr> life_time_timer;
virtual ~RoomObstacle() override; virtual ~RoomObstacle() override;
virtual void Initialize() override; virtual void Initialize() override;

View File

@ -7,6 +7,7 @@
#include "skill.h" #include "skill.h"
#include "metadata.h" #include "metadata.h"
#include "room.h" #include "room.h"
#include "roomobstacle.h"
std::map<int, int> SkillHelper::magic_skill_hash_; std::map<int, int> SkillHelper::magic_skill_hash_;
std::map<int, int> SkillHelper::skill_magic_hash_; std::map<int, int> SkillHelper::skill_magic_hash_;
@ -282,3 +283,26 @@ bool SkillHelper::ProcBulletDmg(Bullet* bullet, Creature* target, float& finaly_
} }
return false; return false;
} }
void SkillHelper::ProcSummonObstacle(const MetaData::Skill* skill_meta, RoomObstacle* ob)
{
if (!skill_meta || skill_meta->number_meta) {
return;
}
switch (skill_meta->GetMagicId()) {
case MAGIC_WLFB:
case MAGIC_YLZ:
{
if (!ob->life_time_timer.expired()) {
ob->room->xtimer.ModifyTimer(ob->life_time_timer,
skill_meta->number_meta->float_time * 1000 / FRAME_RATE_MS);
}
}
break;
default:
{
}
break;
}
}

View File

@ -7,6 +7,7 @@ namespace MetaData
class Bullet; class Bullet;
class Creature; class Creature;
class RoomObstacle;
class SkillHelper class SkillHelper
{ {
public: public:
@ -36,6 +37,7 @@ class SkillHelper
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);
static void ProcSummonObstacle(const MetaData::Skill* skill_meta, RoomObstacle* ob);
private: private:

@ -1 +1 @@
Subproject commit cf4607dd902bcca2ec8e849b51a1968ffb2dc0ca Subproject commit 9d9efccd69f5a81ac2905617d2fe4d197394f27c