This commit is contained in:
aozhiwei 2022-12-23 11:51:28 +08:00
parent ec3a94d9ef
commit 18ea98dff7
7 changed files with 49 additions and 47 deletions

View File

@ -1,6 +1,7 @@
#include "precompile.h"
#include "mt/Equip.h"
#include "mt/Buff.h"
IMPL_TABLE(mt::Equip)
@ -11,12 +12,12 @@ namespace mt
{
{
std::vector<std::string> strings;
a8::Split(pb->bullet_born_offset(), strings, '|');
a8::Split(bullet_born_offset(), strings, '|');
for (auto& str : strings) {
std::vector<std::string> strings2;
a8::Split(str, strings2, ':');
assert(strings2.size() >= 2);
bullet_born_offset.push_back
_bullet_born_offset.push_back
(std::make_tuple(
a8::XValue(strings2[0]).GetDouble(),
a8::XValue(strings2[1]).GetDouble(),
@ -26,7 +27,7 @@ namespace mt
strings2.size() > 5 ? a8::XValue(strings2[5]).GetInt() : 0
)
);
if (std::get<5>(bullet_born_offset[bullet_born_offset.size() - 1]) != 0) {
if (std::get<5>(_bullet_born_offset[_bullet_born_offset.size() - 1]) != 0) {
lock_time = std::max(lock_time, strings2.size()>3 ? a8::XValue(strings2[3]).GetInt() : 0);
}
#if 0
@ -38,7 +39,7 @@ namespace mt
}
{
std::vector<std::string> strings;
a8::Split(pb->volume(), strings, '|');
a8::Split(volume(), strings, '|');
for (auto& str : strings) {
std::vector<std::string> strings2;
a8::Split(str, strings2, ':');
@ -46,28 +47,28 @@ namespace mt
if (strings2.size() >= 2) {
size_t slot = a8::XValue(strings2[0]);
size_t num = a8::XValue(strings2[1]);
if (slot >= 0 && slot < volume.size()){
volume[slot] = num;
if (slot >= 0 && slot < _volume.size()){
_volume[slot] = num;
}
}
}
}
{
int_param1 = a8::XValue(pb->param1());
float_param1 = a8::XValue(pb->param1()).GetDouble();
_int_param1 = a8::XValue(param1());
_float_param1 = a8::XValue(param1()).GetDouble();
}
{
int_param2 = a8::XValue(pb->param2());
float_param2 = a8::XValue(pb->param2()).GetDouble();
_int_param2 = a8::XValue(param2());
_float_param2 = a8::XValue(param2()).GetDouble();
}
{
std::vector<std::string> strings;
a8::Split(pb->launch_dev(), strings, '|');
a8::Split(launch_dev(), strings, '|');
for (auto& str : strings) {
std::vector<std::string> strings2;
a8::Split(str, strings2, ':');
if (strings2.size() >= 2) {
shoot_offsets.push_back(std::make_tuple
_shoot_offsets.push_back(std::make_tuple
(1,
glm::vec3(
(float)a8::XValue(strings2[0]).GetDouble(),
@ -76,7 +77,7 @@ namespace mt
)
);
} else {
shoot_offsets.push_back(std::make_tuple
_shoot_offsets.push_back(std::make_tuple
(0,
glm::vec3(
0.0f,
@ -89,18 +90,18 @@ namespace mt
}
{
std::vector<std::string> time_strings;
a8::Split(pb->power_time(), time_strings, '|');
a8::Split(power_time(), time_strings, '|');
std::vector<std::string> gun_strings;
a8::Split(pb->power_gun(), gun_strings, '|');
a8::Split(power_gun(), gun_strings, '|');
std::vector<std::string> buff_strings;
a8::Split(pb->power_buff(), buff_strings, '|');
a8::Split(power_buff(), buff_strings, '|');
if (time_strings.size() == gun_strings.size() && gun_strings.size() == buff_strings.size()) {
int last_time = -1;
for (size_t i = 0; i < time_strings.size(); ++i) {
int time = a8::XValue(time_strings[i]);
int gun = a8::XValue(gun_strings[i]);
int buff = a8::XValue(buff_strings[i]);
power_charge.push_back(std::make_tuple(time, gun, buff));
_power_charge.push_back(std::make_tuple(time, gun, buff));
if (time <= last_time) {
A8_ABORT();
}
@ -111,16 +112,16 @@ namespace mt
}
}
{
if (pb->buffid() != 0) {
buff_meta = MetaMgr::Instance()->GetBuff(pb->buffid());
if (!buff_meta) {
if (buffid() != 0) {
_buff_meta = mt::Buff::GetById(buffid());
if (!_buff_meta) {
A8_ABORT();
}
}
}
if (pb->equip_type() == EQUIP_TYPE_CAR) {
if (equip_type() == EQUIP_TYPE_CAR) {
std::vector<std::string> strings;
a8::Split(pb->param1(), strings, '|');
a8::Split(param1(), strings, '|');
int j = 0;
for (auto& str : strings) {
std::vector<std::string> strings2;
@ -129,17 +130,17 @@ namespace mt
switch (j) {
case 0:
{
car_active_buff_id = a8::XValue(strings2[1]).GetInt();
_car_active_buff_id = a8::XValue(strings2[1]).GetInt();
}
break;
case 1:
{
car_deactive_buff_id = a8::XValue(strings2[1]).GetInt();
_car_deactive_buff_id = a8::XValue(strings2[1]).GetInt();
}
break;
default:
{
car_buff_list.push_back
_car_buff_list.push_back
(std::make_tuple
(
(float)a8::XValue(strings2[0]).GetDouble(),
@ -156,28 +157,28 @@ namespace mt
}
{
std::vector<std::string> strings;
a8::Split(pb->special_damage_type(), strings, '|');
a8::Split(special_damage_type(), strings, '|');
for (auto& str : strings) {
int n = a8::XValue(str);
if (n <= 0 || n > 63) {
A8_ABORT();
}
a8::SetBitFlag(special_damage_type, n);
a8::SetBitFlag(_special_damage_type, n);
}
}
{
std::vector<std::string> strings;
a8::Split(pb->hit_buff(), strings, '|');
a8::Split(hit_buff(), strings, '|');
for (auto& str : strings) {
hit_buff_list.push_back(a8::XValue(str));
_hit_buff_list.push_back(a8::XValue(str));
}
}
}
void Equip::Init2()
{
if (pb->equip_type() == EQUIP_TYPE_WEAPON) {
MetaData::Equip* bullet = MetaMgr::Instance()->GetEquip(pb->use_bullet());
if (equip_type() == EQUIP_TYPE_WEAPON) {
const mt::Equip* bullet = mt::Equip::GetById(use_bullet());
if (!bullet) {
#if 0
a8::XPrintf("no bullet %d\n", {i->id()});
@ -191,8 +192,8 @@ namespace mt
int Equip::GetWeaponIdx()
{
int weapon_idx = -1;
if (pb->equip_type() == EQUIP_TYPE_WEAPON) {
if (pb->equip_subtype() == 1) {
if (equip_type() == EQUIP_TYPE_WEAPON) {
if (equip_subtype() == 1) {
return 0;
} else {
return GUN_SLOT1;
@ -207,20 +208,20 @@ namespace mt
case kCondBuffUpdateWeaponId:
case kCondBuffShotWeaponId:
{
return val == pb->id();
return val == id();
}
break;
case kCondBuffUpdateWeaponSlot:
case kCondBuffShotWeaponSlot:
{
return val == pb->_inventory_slot();
return val == _inventory_slot();
}
break;
case kCondBuffUpdateWeaponType:
case kCondBuffShotWeaponType:
{
return val == pb->equip_subtype() &&
(val2 == 0 || val2 == pb->equip_type());
return val == equip_subtype() &&
(val2 == 0 || val2 == equip_type());
}
break;
default:

View File

@ -22,7 +22,7 @@ namespace mt
int _int_param2 = 0;
float _float_param2 = 0;
std::vector<std::tuple<int, int, int>> _power_charge;
MetaData::Buff* _buff_meta = nullptr;
const mt::Buff* _buff_meta = nullptr;
std::vector<std::tuple<float, int>> _car_buff_list;
std::vector<int> _hit_buff_list;
int _car_active_buff_id = 0;

View File

@ -7,8 +7,8 @@ namespace mt
{
DECLARE_AUTO_ID_TABLE(FormulaPvp, mtb::FormulaPvp,
"formulaPvp@formulaPvp.csv",
"")
"formulaPvp@formulaPvp.csv"
)
public:
};

View File

@ -1,5 +1,7 @@
#include "precompile.h"
#include <math.h>
#include "mt/GunQuality.h"
IMPL_TABLE(mt::GunQuality)
@ -10,7 +12,6 @@ namespace mt
long long GunQuality::GetPvpCegUpLimit()
{
double sys_param = 0;
double lucky = lucky();
long long up_limit = round
(
(
@ -20,9 +21,9 @@ namespace mt
1.3389
) +
(
0.0074*pow(lucky, 3) -
0.59396*pow(lucky, 2) +
16.7708*lucky -
0.0074*pow(lucky(), 3) -
0.59396*pow(lucky(), 2) +
16.7708*lucky() -
153.964
)
) + sys_param;

View File

@ -15,7 +15,7 @@ namespace mt
std::vector<std::string> tmp_strs2;
a8::Split(str, tmp_strs2, ':');
if (tmp_strs2.size() >= 2) {
addattr.push_back(
_addattr.push_back(
std::make_tuple(a8::XValue(tmp_strs2[0]), a8::XValue(tmp_strs2[1]))
);
}

View File

@ -11,7 +11,7 @@ namespace mt
"id")
public:
std::vector<std::tuple<int, int>> addattr;
std::vector<std::tuple<int, int>> _addattr;
void Init1();
};

View File

@ -22,7 +22,7 @@ DECLARE_COMMON_HEAD(classname, base, filename, key, 1) \
};
#define DECLARE_AUTO_ID_TABLE(classname, base, filename) \
DECLARE_COMMON_HEAD(classname, base, filename, key, 0) \
DECLARE_COMMON_HEAD(classname, base, filename, "", 0) \
public: \
static classname* GetById(long long id) \
{ \