This commit is contained in:
aozhiwei 2024-01-10 13:17:07 +08:00
parent eef66af46d
commit 273aca649e
3 changed files with 25 additions and 3 deletions

View File

@ -540,5 +540,6 @@ bool Ability::HasDecAttr(int attr_id)
void Ability::SetSource(AttrHandle handle, std::shared_ptr<std::function<std::string()>> cb)
{
auto p = handle.lock();
p->get_source = cb;
}

View File

@ -9,6 +9,7 @@
#include "car.h"
#include "mt/Buff.h"
#include "mt/Skill.h"
void ModifyAttrBuff::Activate()
{
@ -16,6 +17,25 @@ void ModifyAttrBuff::Activate()
float value = meta->GetBuffParam2(this);
if (f8::App::Instance()->GetInstanceId() != 3) {
attr_handle_ = owner->GetAbility()->AddAttr(attr_id, value);
#ifdef MYDEBUG
if (!attr_handle_.expired()) {
std::string source_name = a8::Format
("<-buff.%d.%d.%s",
{
meta->buff_id(),
skill_meta ? skill_meta->skill_id() : 0,
GetCaster().Get() ? (GetCaster().Get() == owner ? "self" : GetCaster().Get()->GetName() )
: "none"
});
auto cb = std::make_shared<std::function<std::string()>>
(
[source_name] () -> std::string
{
return source_name;
});
owner->GetAbility()->SetSource(attr_handle_, cb);
}
#endif
}
}

View File

@ -239,11 +239,12 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
SendDebugMsg("数值: " + str);
}
if (!handle.expired()) {
std::string source_name = "<-gm.self";
auto cb = std::make_shared<std::function<std::string()>>
(
[] () -> std::string
[source_name] () -> std::string
{
return "";
return source_name;
});
target->GetAbility()->SetSource(handle, cb);
}