This commit is contained in:
aozhiwei 2022-10-08 20:10:12 +08:00
parent 39b88f1bbd
commit b339893d9f
4 changed files with 50 additions and 6 deletions

View File

@ -18,6 +18,7 @@
#include "roomobstacle.h" #include "roomobstacle.h"
#include "car.h" #include "car.h"
#include "creature.h" #include "creature.h"
#include "skillhelper.h"
Bullet::Bullet():MoveableEntity() Bullet::Bullet():MoveableEntity()
{ {
@ -845,11 +846,14 @@ void Bullet::TriggerHitBuff(Entity* e)
for (int buff_id : gun_meta->hit_buff_list) { for (int buff_id : gun_meta->hit_buff_list) {
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id); MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id);
if (buff_meta) { if (buff_meta) {
c->AddBuff( int buff_uniid = c->AddBuff(
sender.Get(), sender.Get(),
buff_meta, buff_meta,
skill_meta skill_meta
); );
if (skill_meta && buff_uniid) {
SkillHelper::ProcBulletHitBuff(this, c, buff_uniid);
}
} }
} }
} }

View File

@ -2093,7 +2093,7 @@ void Creature::Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance, int
InternalShot(this, InternalShot(this,
GetCurrWeapon()->meta, GetCurrWeapon()->meta,
GetCurrWeapon()->bullet_meta, GetCurrWeapon()->bullet_meta,
nullptr, GetCurrWeapon()->skill_meta,
fly_distance, fly_distance,
GetCurrWeapon()->weapon_uniid, GetCurrWeapon()->weapon_uniid,
trace_target_uniid); trace_target_uniid);

View File

@ -1,6 +1,12 @@
#include "precompile.h" #include "precompile.h"
#include "skillhelper.h" #include "skillhelper.h"
#include "creature.h"
#include "buff.h"
#include "bullet.h"
#include "skill.h"
#include "metadata.h"
#include "room.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_;
@ -190,3 +196,33 @@ int SkillHelper::GetSwzbPullDistance(const MetaData::Skill* skill_meta)
{ {
return 0; return 0;
} }
void SkillHelper::ProcBulletHitBuff(Bullet* bullet, Creature* c, int buff_uniid)
{
Buff* buff = c->GetBuffByUniId(buff_uniid);
if (!buff) {
return;
}
auto skill_meta = bullet->skill_meta;
if (!skill_meta) {
return;
}
switch (skill_meta->GetMagicId()) {
case MAGIC_AXXF:
{
if (buff->meta->i->buff_id() == 201011 &&
buff->meta->i->buff_effect() == kBET_Vertigo) {
c->room->xtimer.ModifyTimer
(buff->remover_timer,
skill_meta->number_meta->int_time / FRAME_RATE_MS);
} else {
}
}
break;
default:
{
}
break;
}
}

View File

@ -5,6 +5,8 @@ namespace MetaData
struct Skill; struct Skill;
}; };
class Bullet;
class Creature;
class SkillHelper class SkillHelper
{ {
public: public:
@ -26,6 +28,8 @@ class SkillHelper
static int GetSwzbEffect(const MetaData::Skill* skill_meta); static int GetSwzbEffect(const MetaData::Skill* skill_meta);
static int GetSwzbPullDistance(const MetaData::Skill* skill_meta); static int GetSwzbPullDistance(const MetaData::Skill* skill_meta);
static void ProcBulletHitBuff(Bullet* bullet, Creature* c, int buff_uniid);
private: private:
static std::map<int, int> magic_skill_hash_; static std::map<int, int> magic_skill_hash_;