1
This commit is contained in:
parent
2369f75190
commit
fe0f6bfc85
@ -124,7 +124,9 @@ void Explosion::ProcDamage()
|
|||||||
if (target->IsCreature(room_) && ((Creature*)target)->HasBuffEffect(kBET_BulletThrough)) {
|
if (target->IsCreature(room_) && ((Creature*)target)->HasBuffEffect(kBET_BulletThrough)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!IsThrough()) {
|
||||||
target->OnExplosionHit(this);
|
target->OnExplosionHit(this);
|
||||||
|
}
|
||||||
if (hit_cb_) {
|
if (hit_cb_) {
|
||||||
hit_cb_({target});
|
hit_cb_({target});
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,9 @@ class Explosion : public std::enable_shared_from_this<Explosion>
|
|||||||
bool IsPreBattleExplosion();
|
bool IsPreBattleExplosion();
|
||||||
int GetExplosionEffect() { return explosion_effect_; };
|
int GetExplosionEffect() { return explosion_effect_; };
|
||||||
void SetDamageDelay(int delay) { explosion_damage_delay_ = delay; };
|
void SetDamageDelay(int delay) { explosion_damage_delay_ = delay; };
|
||||||
void SetHitCb(CommonCbProc cb) { hit_cb_ = cb;};
|
void SetHitCb(CommonCbProc cb) { hit_cb_ = cb; };
|
||||||
|
void SetThrough(bool through) { through_ = through; };
|
||||||
|
bool IsThrough() { return through_; };
|
||||||
|
|
||||||
void IndifferenceAttack(Room* room,
|
void IndifferenceAttack(Room* room,
|
||||||
const a8::Vec2& center,
|
const a8::Vec2& center,
|
||||||
@ -51,6 +53,7 @@ protected:
|
|||||||
long long special_damage_type_ = 0;
|
long long special_damage_type_ = 0;
|
||||||
long long create_frameno_ = 0;
|
long long create_frameno_ = 0;
|
||||||
CommonCbProc hit_cb_;
|
CommonCbProc hit_cb_;
|
||||||
|
bool through_ = false;
|
||||||
|
|
||||||
friend class EntityFactory;
|
friend class EntityFactory;
|
||||||
};
|
};
|
||||||
|
@ -401,7 +401,48 @@ void Skill::ProcCMXD()
|
|||||||
{
|
{
|
||||||
Buff* hold_shield_buff = owner->GetBuffByEffectId(kBET_HoldShield);
|
Buff* hold_shield_buff = owner->GetBuffByEffectId(kBET_HoldShield);
|
||||||
if (hold_shield_buff) {
|
if (hold_shield_buff) {
|
||||||
|
MetaData::Skill* skill_meta = hold_shield_buff->skill_meta;
|
||||||
|
CreatureWeakPtr sender = owner->GetWeakPtrRef();
|
||||||
|
|
||||||
|
std::shared_ptr<Explosion> e = EntityFactory::Instance()->MakeExplosion();
|
||||||
|
e->SetThrough(true);
|
||||||
|
e->SetHitCb
|
||||||
|
(
|
||||||
|
[sender, skill_meta] (const std::vector<std::any>& params) mutable
|
||||||
|
{
|
||||||
|
if (sender.Get()) {
|
||||||
|
Entity* e = std::any_cast<Entity*>(params.at(0));
|
||||||
|
if (e->IsCreature(sender.Get()->room)) {
|
||||||
|
Creature* c = (Creature*)e;
|
||||||
|
if (c->IsInvincible()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (c->dead) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
float dmg = SkillHelper::GetCmxdDmg(sender.Get(), skill_meta);
|
||||||
|
c->DecHP(dmg,
|
||||||
|
VP_Explosion,
|
||||||
|
"",
|
||||||
|
SkillHelper::GetCmxdExplosion(skill_meta));
|
||||||
|
a8::Vec2 dir = sender.Get()->GetAttackDir();
|
||||||
|
if (!dir.IsZero()) {
|
||||||
|
a8::Vec2 target_pos = c->GetPos() +
|
||||||
|
dir * SkillHelper::GetCmxdDistance(skill_meta);
|
||||||
|
c->PullTarget(target_pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
e->EnemyAndObstacleAttack
|
||||||
|
(
|
||||||
|
owner->GetWeakPtrRef(),
|
||||||
|
owner->GetPos(),
|
||||||
|
SkillHelper::GetCmxdRange(meta),
|
||||||
|
SkillHelper::GetCmxdExplosion(meta),
|
||||||
|
0
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -158,12 +158,25 @@ void SkillHelper::GetMagicIdAndBaseSkillId(int skill_id, int& magic_id, int& bas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int SkillHelper::GetCmxdDmg(const MetaData::Skill* skill_meta)
|
int SkillHelper::GetCmxdDmg(Creature* c, const MetaData::Skill* skill_meta)
|
||||||
{
|
{
|
||||||
return 0;
|
float dmg =
|
||||||
|
(skill_meta->number_meta->float_ratio +
|
||||||
|
skill_meta->number_meta->float_ratio2 * c->GetBattleContext()->GetHeroTotalAtk());
|
||||||
|
return dmg;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SkillHelper::GetCmxdRange(const MetaData::Skill* skill_meta)
|
||||||
|
{
|
||||||
|
return skill_meta->number_meta->int_range;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SkillHelper::GetCmxdDistance(const MetaData::Skill* skill_meta)
|
int SkillHelper::GetCmxdDistance(const MetaData::Skill* skill_meta)
|
||||||
|
{
|
||||||
|
return skill_meta->number_meta->int_range2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SkillHelper::GetCmxdExplosion(const MetaData::Skill* skill_meta)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,10 @@ class SkillHelper
|
|||||||
static float GetSjydhxForthDistance(const MetaData::Skill* skill_meta);
|
static float GetSjydhxForthDistance(const MetaData::Skill* skill_meta);
|
||||||
static float GetSjydhxBackTime(const MetaData::Skill* skill_meta);
|
static float GetSjydhxBackTime(const MetaData::Skill* skill_meta);
|
||||||
//此面向敌
|
//此面向敌
|
||||||
static int GetCmxdDmg(const MetaData::Skill* skill_meta);
|
static int GetCmxdDmg(Creature* c, const MetaData::Skill* skill_meta);
|
||||||
|
static int GetCmxdRange(const MetaData::Skill* skill_meta);
|
||||||
static int GetCmxdDistance(const MetaData::Skill* skill_meta);
|
static int GetCmxdDistance(const MetaData::Skill* skill_meta);
|
||||||
|
static int GetCmxdExplosion(const MetaData::Skill* skill_meta);
|
||||||
//击杀回血
|
//击杀回血
|
||||||
static int GetJshxHp(Creature* c, const MetaData::Skill* skill_meta);
|
static int GetJshxHp(Creature* c, const MetaData::Skill* skill_meta);
|
||||||
//死亡自爆
|
//死亡自爆
|
||||||
|
Loading…
x
Reference in New Issue
Block a user