This commit is contained in:
aozhiwei 2024-09-05 15:45:05 +08:00
parent 60df47fa29
commit 1c6d10574c
6 changed files with 14 additions and 8 deletions

View File

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

View File

@ -2,6 +2,12 @@
#include "attrdefine.h"
#include "weakptr.h"
enum AbilitySourceType_e
{
kAstChip,
kAstOther
};
class Ability
{
public:
@ -29,7 +35,7 @@ class Ability
void GMDelAttr(int attr_id, int idx);
void GMClearAttr();
std::vector<std::string> GMShowAttrs();
void SetSource(AttrHandle handle, std::shared_ptr<std::function<std::string()>> cb);
void SetSource(AttrHandle handle, int source_type, std::shared_ptr<std::function<std::string()>> cb);
private:
void Clear();

View File

@ -33,7 +33,7 @@ void ModifyAttrBuff::Activate()
{
return source_name;
});
owner->GetAbility()->SetSource(attr_handle_, cb);
owner->GetAbility()->SetSource(attr_handle_, kAstOther, cb);
}
#endif
}

View File

@ -351,7 +351,7 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
{
return source_name;
});
target->GetAbility()->SetSource(handle, cb);
target->GetAbility()->SetSource(handle, kAstOther, cb);
}
}
}

View File

@ -3498,7 +3498,7 @@ float Creature::InternalGetSpeed()
ruduce = std::max(ruduce, GetAbility()->GetAttrRuduce(kHAT_vSpeedRateIn));
#endif
float rate = addition + ruduce;
finaly_speed *= 1.0f + rate;
finaly_speed *= 1.0f + std::min(mt::Param::s().speed_rate_max, rate / mt::Param::s().speed_rf);
#ifdef MYDEBUG
if (IsPlayer() && finaly_speed > 500) {
a8::XPrintf("player speed:%f\n", {finaly_speed});
@ -4267,7 +4267,7 @@ void Creature::GenLevelAttr()
{
return source_name;
});
GetAbility()->SetSource(handle, cb);
GetAbility()->SetSource(handle, kAstOther, cb);
}
#endif
}

View File

@ -305,7 +305,7 @@ private:
{
return source_name;
});
owner_.Get()->GetAbility()->SetSource(attr_handle, cb);
owner_.Get()->GetAbility()->SetSource(attr_handle, kAstOther, cb);
#endif
}
}
@ -337,7 +337,7 @@ private:
{
return source_name;
});
owner_.Get()->GetAbility()->SetSource(attr_handle, cb);
owner_.Get()->GetAbility()->SetSource(attr_handle, kAstChip, cb);
#endif
}
}