1
This commit is contained in:
parent
7673c49071
commit
87dfb4fbdd
@ -7,6 +7,9 @@
|
|||||||
#include "human.h"
|
#include "human.h"
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
#include "skillhelper.h"
|
#include "skillhelper.h"
|
||||||
|
#include "trigger.h"
|
||||||
|
#include "entityfactory.h"
|
||||||
|
#include "explosion.h"
|
||||||
|
|
||||||
#include "mt/Skill.h"
|
#include "mt/Skill.h"
|
||||||
#include "mt/Buff.h"
|
#include "mt/Buff.h"
|
||||||
@ -65,8 +68,114 @@ void HoldShieldBuff::Activate()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
owner->GetTrigger()->AddListener
|
||||||
|
(
|
||||||
|
kShieldDestoryEvent,
|
||||||
|
[this] (const a8::Args& params)
|
||||||
|
{
|
||||||
|
OnShieldDestory(params);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoldShieldBuff::Deactivate()
|
void HoldShieldBuff::Deactivate()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HoldShieldBuff::OnShieldDestory(const a8::Args& params)
|
||||||
|
{
|
||||||
|
if (!skill_meta || skill_meta->GetMagicId() != MAGIC_21001_NIU) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CreatureWeakPtr sender = owner->GetWeakPtrRef();
|
||||||
|
|
||||||
|
std::shared_ptr<Explosion> e = EntityFactory::Instance()->MakeExplosion();
|
||||||
|
e->SetThrough(true);
|
||||||
|
e->SetCustomCheckCb
|
||||||
|
(
|
||||||
|
[sender]
|
||||||
|
(const a8::Args& args) mutable
|
||||||
|
{
|
||||||
|
bool* is_hit = args.Get<bool*>(0);
|
||||||
|
Entity* e = args.Get<Entity*>(1);
|
||||||
|
if (sender.Get() && e->IsCreature(sender.Get()->room)) {
|
||||||
|
Creature* c = (Creature*)e;
|
||||||
|
glm::vec3 target_pos = sender.Get()->GetPos().ToGlmVec3();
|
||||||
|
target_pos = target_pos + (sender.Get()->GetAttackDir() * (float)SkillHelper::GetCmxdRange(this_skill_meta) / 2.0f);
|
||||||
|
bool ret = Collision::Check2dRotationRectangle
|
||||||
|
(c->GetPos().GetX(),
|
||||||
|
c->GetPos().GetY(),
|
||||||
|
20,
|
||||||
|
target_pos.x,
|
||||||
|
target_pos.y,
|
||||||
|
shield_buff_meta->_buff_param4,
|
||||||
|
SkillHelper::GetCmxdRange(this_skill_meta),
|
||||||
|
sender.Get()->GetAttackDirRotate() * 180.0f
|
||||||
|
);
|
||||||
|
if (ret) {
|
||||||
|
*is_hit = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
e->SetHitCb
|
||||||
|
(
|
||||||
|
[sender, skill_meta] (const a8::Args& args) mutable
|
||||||
|
{
|
||||||
|
if (sender.Get()) {
|
||||||
|
Entity* e = args.Get<Entity*>(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);
|
||||||
|
float dmg_out = 0.0f;
|
||||||
|
c->DecHP(dmg,
|
||||||
|
VP_Explosion,
|
||||||
|
"",
|
||||||
|
SkillHelper::GetCmxdExplosion(skill_meta),
|
||||||
|
sender.Get()->GetUniId(),
|
||||||
|
sender.Get()->GetName(),
|
||||||
|
dmg_out);
|
||||||
|
glm::vec3 dir = sender.Get()->GetAttackDir();
|
||||||
|
if (!GlmHelper::IsZero(dir)) {
|
||||||
|
glm::vec3 target_pos = c->GetPos().ToGlmVec3() +
|
||||||
|
dir * (float)SkillHelper::GetCmxdDistance(skill_meta);
|
||||||
|
c->PullTarget(target_pos);
|
||||||
|
}
|
||||||
|
c->TryAddBuffAndSetTime(sender.Get(),
|
||||||
|
kVertigoEffectBuffId,
|
||||||
|
SkillHelper::GetCmxdVertigoTime(skill_meta) * 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
e->EnemyAndObstacleAttack
|
||||||
|
(
|
||||||
|
owner->GetWeakPtrRef(),
|
||||||
|
owner->GetPos(),
|
||||||
|
SkillHelper::GetCmxdRange(meta),
|
||||||
|
SkillHelper::GetCmxdExplosion(meta),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
#ifdef DEBUG
|
||||||
|
{
|
||||||
|
std::string dbg_msg = a8::Format
|
||||||
|
(
|
||||||
|
"skill_id:%d 此面向 range:%f range2:%f ratio:%f time:%f",
|
||||||
|
{
|
||||||
|
meta->skill_id(),
|
||||||
|
meta->_number_meta->_float_range,
|
||||||
|
meta->_number_meta->_float_range2,
|
||||||
|
meta->_number_meta->_float_ratio,
|
||||||
|
meta->_number_meta->_float_time
|
||||||
|
});
|
||||||
|
owner->SendDebugMsg(dbg_msg);
|
||||||
|
a8::XPrintf("%s\n", {dbg_msg});
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@ -9,4 +9,7 @@ class HoldShieldBuff : public Buff
|
|||||||
virtual void Activate() override;
|
virtual void Activate() override;
|
||||||
virtual void Deactivate() override;
|
virtual void Deactivate() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void OnShieldDestory(const a8::Args& params);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1041,114 +1041,7 @@ void Skill::Proc30901XIONG()
|
|||||||
|
|
||||||
void Skill::Proc31001NIU()
|
void Skill::Proc31001NIU()
|
||||||
{
|
{
|
||||||
#if 1
|
|
||||||
owner->GetAbility()->AddDmgRuduce(meta->_number_meta->damage_change());
|
owner->GetAbility()->AddDmgRuduce(meta->_number_meta->damage_change());
|
||||||
#else
|
|
||||||
owner->GetTrigger()->AddListener
|
|
||||||
(
|
|
||||||
kShieldDestoryEvent,
|
|
||||||
[this] (const a8::Args& params)
|
|
||||||
{
|
|
||||||
Buff* hold_shield_buff = owner->GetBuffByEffectId(kBET_HoldShield);
|
|
||||||
if (hold_shield_buff) {
|
|
||||||
const mt::Skill* skill_meta = hold_shield_buff->skill_meta;
|
|
||||||
const mt::Skill* this_skill_meta = meta;
|
|
||||||
const mt::Buff* shield_buff_meta = hold_shield_buff->meta;
|
|
||||||
CreatureWeakPtr sender = owner->GetWeakPtrRef();
|
|
||||||
|
|
||||||
std::shared_ptr<Explosion> e = EntityFactory::Instance()->MakeExplosion();
|
|
||||||
e->SetThrough(true);
|
|
||||||
e->SetCustomCheckCb
|
|
||||||
(
|
|
||||||
[sender, skill_meta, this_skill_meta, shield_buff_meta]
|
|
||||||
(const a8::Args& args) mutable
|
|
||||||
{
|
|
||||||
bool* is_hit = args.Get<bool*>(0);
|
|
||||||
Entity* e = args.Get<Entity*>(1);
|
|
||||||
if (sender.Get() && e->IsCreature(sender.Get()->room)) {
|
|
||||||
Creature* c = (Creature*)e;
|
|
||||||
glm::vec3 target_pos = sender.Get()->GetPos().ToGlmVec3();
|
|
||||||
target_pos = target_pos + (sender.Get()->GetAttackDir() * (float)SkillHelper::GetCmxdRange(this_skill_meta) / 2.0f);
|
|
||||||
bool ret = Collision::Check2dRotationRectangle
|
|
||||||
(c->GetPos().GetX(),
|
|
||||||
c->GetPos().GetY(),
|
|
||||||
20,
|
|
||||||
target_pos.x,
|
|
||||||
target_pos.y,
|
|
||||||
shield_buff_meta->_buff_param4,
|
|
||||||
SkillHelper::GetCmxdRange(this_skill_meta),
|
|
||||||
sender.Get()->GetAttackDirRotate() * 180.0f
|
|
||||||
);
|
|
||||||
if (ret) {
|
|
||||||
*is_hit = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
e->SetHitCb
|
|
||||||
(
|
|
||||||
[sender, skill_meta] (const a8::Args& args) mutable
|
|
||||||
{
|
|
||||||
if (sender.Get()) {
|
|
||||||
Entity* e = args.Get<Entity*>(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);
|
|
||||||
float dmg_out = 0.0f;
|
|
||||||
c->DecHP(dmg,
|
|
||||||
VP_Explosion,
|
|
||||||
"",
|
|
||||||
SkillHelper::GetCmxdExplosion(skill_meta),
|
|
||||||
sender.Get()->GetUniId(),
|
|
||||||
sender.Get()->GetName(),
|
|
||||||
dmg_out);
|
|
||||||
glm::vec3 dir = sender.Get()->GetAttackDir();
|
|
||||||
if (!GlmHelper::IsZero(dir)) {
|
|
||||||
glm::vec3 target_pos = c->GetPos().ToGlmVec3() +
|
|
||||||
dir * (float)SkillHelper::GetCmxdDistance(skill_meta);
|
|
||||||
c->PullTarget(target_pos);
|
|
||||||
}
|
|
||||||
c->TryAddBuffAndSetTime(sender.Get(),
|
|
||||||
kVertigoEffectBuffId,
|
|
||||||
SkillHelper::GetCmxdVertigoTime(skill_meta) * 1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
e->EnemyAndObstacleAttack
|
|
||||||
(
|
|
||||||
owner->GetWeakPtrRef(),
|
|
||||||
owner->GetPos(),
|
|
||||||
SkillHelper::GetCmxdRange(meta),
|
|
||||||
SkillHelper::GetCmxdExplosion(meta),
|
|
||||||
0
|
|
||||||
);
|
|
||||||
#ifdef DEBUG
|
|
||||||
{
|
|
||||||
std::string dbg_msg = a8::Format
|
|
||||||
(
|
|
||||||
"skill_id:%d 此面向 range:%f range2:%f ratio:%f time:%f",
|
|
||||||
{
|
|
||||||
meta->skill_id(),
|
|
||||||
meta->_number_meta->_float_range,
|
|
||||||
meta->_number_meta->_float_range2,
|
|
||||||
meta->_number_meta->_float_ratio,
|
|
||||||
meta->_number_meta->_float_time
|
|
||||||
});
|
|
||||||
owner->SendDebugMsg(dbg_msg);
|
|
||||||
a8::XPrintf("%s\n", {dbg_msg});
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Skill::ProcSkillPhase(const mt::SkillPhase* phase)
|
void Skill::ProcSkillPhase(const mt::SkillPhase* phase)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user