game2006/server/gameserver/mt/SkillNumber.cc
aozhiwei e161c89e03 1
2023-03-04 12:09:37 +08:00

122 lines
3.9 KiB
C++

#include "precompile.h"
#include "mt/SkillNumber.h"
#include "mt/Skill.h"
IMPL_TABLE(mt::SkillNumber)
namespace mt
{
void SkillNumber::Init1()
{
#if 0
_int_ratio = a8::XValue(ratio());
_float_ratio = a8::XValue(ratio()).GetDouble();
if (ratio().find('%') != std::string::npos) {
std::string tmp_str = ratio();
a8::ReplaceString(tmp_str, "%", "");
_float_ratio = a8::XValue(tmp_str).GetDouble() / 100;
}
_int_ratio2 = a8::XValue(ratio2());
_float_ratio2 = a8::XValue(ratio2()).GetDouble();
if (ratio2().find('%') != std::string::npos) {
std::string tmp_str = ratio2();
a8::ReplaceString(tmp_str, "%", "");
_float_ratio2 = a8::XValue(tmp_str).GetDouble() / 100;
}
#endif
_int_speed = a8::XValue(speed());
_float_speed = a8::XValue(speed()).GetDouble();
if (speed().find('%') != std::string::npos) {
std::string tmp_str = speed();
a8::ReplaceString(tmp_str, "%", "");
_float_speed = a8::XValue(tmp_str).GetDouble() / 100;
}
_int_range = a8::XValue(range());
_float_range = a8::XValue(range()).GetDouble();
if (range().find('%') != std::string::npos) {
std::string tmp_str = range();
a8::ReplaceString(tmp_str, "%", "");
_float_range = a8::XValue(tmp_str).GetDouble() / 100;
}
_int_range2 = a8::XValue(range2());
_float_range2 = a8::XValue(range2()).GetDouble();
if (range2().find('%') != std::string::npos) {
std::string tmp_str = range2();
a8::ReplaceString(tmp_str, "%", "");
_float_range2 = a8::XValue(tmp_str).GetDouble() / 100;
}
_int_range3 = a8::XValue(range3());
_float_range3 = a8::XValue(range3()).GetDouble();
if (range3().find('%') != std::string::npos) {
std::string tmp_str = range3();
a8::ReplaceString(tmp_str, "%", "");
_float_range3 = a8::XValue(tmp_str).GetDouble() / 100;
}
_int_probability = a8::XValue(probability());
_float_probability = a8::XValue(probability()).GetDouble();
if (probability().find('%') != std::string::npos) {
std::string tmp_str = probability();
a8::ReplaceString(tmp_str, "%", "");
_float_probability = a8::XValue(tmp_str).GetDouble() / 100;
}
_int_time = a8::XValue(time());
_float_time = a8::XValue(time()).GetDouble();
if (time().find('%') != std::string::npos) {
std::string tmp_str = time();
a8::ReplaceString(tmp_str, "%", "");
_float_time = a8::XValue(tmp_str).GetDouble() / 100;
}
_int_cd = a8::XValue(cd());
_float_cd = a8::XValue(cd()).GetDouble();
if (cd().find('%') != std::string::npos) {
std::string tmp_str = cd();
a8::ReplaceString(tmp_str, "%", "");
_float_cd = a8::XValue(tmp_str).GetDouble() / 100;
}
{
const mt::Skill* skill_meta = mt::Skill::GetById(skill_id());
if (!skill_meta) {
abort();
}
#if 1
_float_cd = 6;
#endif
//metatable::Skill* skill_pb = (metatable::Skill*)(skill_meta->pb);
//skill_pb->set_skill_cd(float_cd);
//skill_cd_ = _float_cd;
}
{
std::vector<std::string> strings;
a8::Split(effect_list(), strings, '|');
for (auto& str : strings) {
_effect_list.push_back(a8::XValue(str));
}
}
}
float SkillNumber::GetAttrByIdx(int idx)
{
}
int SkillNumber::GetAttrIdxByName(const std::string& name)
{
if (name == "${skillNumber.speed}") {
return 0;
}
return -1;
}
}