1
This commit is contained in:
parent
892da19824
commit
e17c25b65f
@ -393,3 +393,13 @@ void Buff::SetV(int key, int val)
|
||||
}
|
||||
(*dyn_data_)[key] = val;
|
||||
}
|
||||
|
||||
void Buff::PreExec(const a8::Args* args)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Buff::PostExec(const a8::Args* args)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -62,6 +62,8 @@ class Buff
|
||||
|
||||
virtual void Activate();
|
||||
virtual void Deactivate();
|
||||
virtual void PreExec(const a8::Args* args);
|
||||
virtual void PostExec(const a8::Args* args);
|
||||
|
||||
protected:
|
||||
void ClearEventHandlers();
|
||||
|
@ -1603,15 +1603,17 @@ void CallFuncBuff::OnBreakSkill()
|
||||
|
||||
void CallFuncBuff::BreakSkill()
|
||||
{
|
||||
Buff* on_break_buff = nullptr;
|
||||
Buff* selected_buff = nullptr;
|
||||
for (auto buff_id : meta->_buff_param2_int_list) {
|
||||
on_break_buff = owner->GetBuffById(buff_id);
|
||||
if (on_break_buff) {
|
||||
selected_buff = owner->GetBuffById(buff_id);
|
||||
if (selected_buff) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (on_break_buff) {
|
||||
int buff_uniid = on_break_buff->buff_uniid;
|
||||
if (selected_buff) {
|
||||
a8::Args args({this});
|
||||
selected_buff->PreExec(&args);
|
||||
int buff_uniid = selected_buff->buff_uniid;
|
||||
for (auto buff_id : meta->_buff_param3_int_list) {
|
||||
if (buff_id > 0) {
|
||||
owner->TryAddBuff(
|
||||
@ -1625,7 +1627,10 @@ void CallFuncBuff::BreakSkill()
|
||||
owner->RemoveBuffById(-buff_id);
|
||||
}
|
||||
}
|
||||
if (selected_buff) {
|
||||
selected_buff->PostExec(&args);
|
||||
owner->RemoveBuffByUniId(buff_uniid);
|
||||
}
|
||||
} else {
|
||||
for (auto buff_id : meta->_buff_param4_int_list) {
|
||||
if (buff_id > 0) {
|
||||
@ -1645,5 +1650,105 @@ void CallFuncBuff::BreakSkill()
|
||||
|
||||
void CallFuncBuff::BuffEffectCondAdd()
|
||||
{
|
||||
|
||||
Buff* selected_buff = nullptr;
|
||||
for (auto buff_effect : meta->_buff_param2_int_list) {
|
||||
selected_buff = owner->GetBuffByEffectId(buff_effect);
|
||||
if (selected_buff) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selected_buff) {
|
||||
for (auto buff_id : meta->_buff_param3_int_list) {
|
||||
if (buff_id > 0) {
|
||||
owner->TryAddBuff(
|
||||
GetCaster().Get(),
|
||||
buff_id,
|
||||
skill_meta,
|
||||
init_args,
|
||||
buff_vars
|
||||
);
|
||||
} else {
|
||||
owner->RemoveBuffById(-buff_id);
|
||||
}
|
||||
}
|
||||
selected_buff = owner->GetBuffByUniId(buff_uniid);
|
||||
} else {
|
||||
for (auto buff_id : meta->_buff_param4_int_list) {
|
||||
if (buff_id > 0) {
|
||||
owner->TryAddBuff(
|
||||
GetCaster().Get(),
|
||||
buff_id,
|
||||
skill_meta,
|
||||
init_args,
|
||||
buff_vars
|
||||
);
|
||||
} else {
|
||||
owner->RemoveBuffById(-buff_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CallFuncBuff::PreExec(const a8::Args* args)
|
||||
{
|
||||
switch ((BuffCallFunc_e)meta->_int_buff_param1) {
|
||||
case BuffCallFunc_e::kOnBreakSkill:
|
||||
{
|
||||
OnBreakSkillPreExec();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CallFuncBuff::PostExec(const a8::Args* args)
|
||||
{
|
||||
switch ((BuffCallFunc_e)meta->_int_buff_param1) {
|
||||
case BuffCallFunc_e::kOnBreakSkill:
|
||||
{
|
||||
OnBreakSkillPostExec();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CallFuncBuff::OnBreakSkillPreExec()
|
||||
{
|
||||
for (auto buff_id : meta->_buff_param2_int_list) {
|
||||
if (buff_id > 0) {
|
||||
owner->TryAddBuff(
|
||||
GetCaster().Get(),
|
||||
buff_id,
|
||||
skill_meta,
|
||||
init_args,
|
||||
buff_vars
|
||||
);
|
||||
} else {
|
||||
owner->RemoveBuffById(-buff_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CallFuncBuff::OnBreakSkillPostExec()
|
||||
{
|
||||
for (auto buff_id : meta->_buff_param3_int_list) {
|
||||
if (buff_id > 0) {
|
||||
owner->TryAddBuff(
|
||||
GetCaster().Get(),
|
||||
buff_id,
|
||||
skill_meta,
|
||||
init_args,
|
||||
buff_vars
|
||||
);
|
||||
} else {
|
||||
owner->RemoveBuffById(-buff_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,8 @@ class CallFuncBuff : public Buff
|
||||
|
||||
virtual void Activate() override;
|
||||
virtual void Deactivate() override;
|
||||
virtual void PreExec(const a8::Args* args) override;
|
||||
virtual void PostExec(const a8::Args* args) override;
|
||||
|
||||
private:
|
||||
void ProcIntervalRangeAddBuffFunc();
|
||||
@ -87,6 +89,9 @@ class CallFuncBuff : public Buff
|
||||
|
||||
void InternalRangeHoldBuff(std::function<bool(glm::vec3&)> get_center_func);
|
||||
|
||||
void OnBreakSkillPreExec();
|
||||
void OnBreakSkillPostExec();
|
||||
|
||||
float hold_param2_ = 0.0;
|
||||
Weapon* hold_weapon_ = nullptr;
|
||||
std::function<void()> deactivate_cb_ = nullptr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user