This commit is contained in:
aozhiwei 2022-10-06 16:23:21 +08:00
parent a4037375fe
commit ff6f1cd69f
5 changed files with 58 additions and 4 deletions

View File

@ -125,6 +125,9 @@ void Explosion::ProcDamage()
continue;
}
target->OnExplosionHit(this);
if (hit_cb_) {
hit_cb_({target});
}
}
}

View File

@ -17,6 +17,7 @@ class Explosion : public std::enable_shared_from_this<Explosion>
bool IsPreBattleExplosion();
int GetExplosionEffect() { return explosion_effect_; };
void SetDamageDelay(int delay) { explosion_damage_delay_ = delay; };
void SetHitCb(CommonCbProc cb) { hit_cb_ = cb;};
void IndifferenceAttack(Room* room,
const a8::Vec2& center,
@ -49,6 +50,7 @@ protected:
a8::Vec2 center_;
long long special_damage_type_ = 0;
long long create_frameno_ = 0;
CommonCbProc hit_cb_;
friend class EntityFactory;
};

View File

@ -5,6 +5,9 @@
#include "room.h"
#include "metamgr.h"
#include "trigger.h"
#include "skillhelper.h"
#include "entityfactory.h"
#include "explosion.h"
void Skill::Initialzie()
{
@ -305,9 +308,11 @@ void Skill::ProcSSJS()
owner->GetTrigger()->AddListener
(
kReceiveDmgEvent,
[] (const std::vector<std::any>& params)
[this] (const std::vector<std::any>& params)
{
if (GetLeftTime() <= 0) {
}
}
);
}
@ -317,9 +322,12 @@ void Skill::ProcJSHX()
owner->GetTrigger()->AddListener
(
kKillEvent,
[] (const std::vector<std::any>& params)
[this] (const std::vector<std::any>& params)
{
if (!owner->dead) {
float add_hp = SkillHelper::GetJshxHp(meta);
owner->AddHp(add_hp);
}
}
);
}
@ -329,9 +337,24 @@ void Skill::ProcSWZB()
owner->GetTrigger()->AddListener
(
kDieEvent,
[] (const std::vector<std::any>& params)
[this] (const std::vector<std::any>& params)
{
std::shared_ptr<Explosion> e = EntityFactory::Instance()->MakeExplosion();
e->SetHitCb
(
[] (const std::vector<std::any>& params)
{
}
);
e->EnemyAndObstacleAttack
(
owner->GetWeakPtrRef(),
owner->GetPos(),
0,
0,
0
);
}
);
}

View File

@ -113,3 +113,23 @@ int SkillHelper::GetCmxdDistance(const MetaData::Skill* skill_meta)
{
return 0;
}
int SkillHelper::GetJshxHp(const MetaData::Skill* skill_meta)
{
return 0;
}
int SkillHelper::GetSwzbRadius(const MetaData::Skill* skill_meta)
{
return 0;
}
int SkillHelper::GetSwzbDmg(const MetaData::Skill* skill_meta)
{
return 0;
}
int SkillHelper::GetSwzbPullDistance(const MetaData::Skill* skill_meta)
{
return 0;
}

View File

@ -18,6 +18,12 @@ class SkillHelper
//此面向敌
static int GetCmxdDmg(const MetaData::Skill* skill_meta);
static int GetCmxdDistance(const MetaData::Skill* skill_meta);
//击杀回血
static int GetJshxHp(const MetaData::Skill* skill_meta);
//死亡自爆
static int GetSwzbRadius(const MetaData::Skill* skill_meta);
static int GetSwzbDmg(const MetaData::Skill* skill_meta);
static int GetSwzbPullDistance(const MetaData::Skill* skill_meta);
private: