This commit is contained in:
aozhiwei 2023-03-29 13:30:45 +08:00
parent 57c7346cd7
commit 11c3f8139f
2 changed files with 34 additions and 26 deletions

View File

@ -5,6 +5,8 @@
#include "mt/Buff.h"
#include "mt/Hero.h"
#include "buff/callfunc.h"
IMPL_TABLE(mt::Buff)
namespace mt
@ -12,29 +14,6 @@ namespace mt
void Buff::Init1()
{
{
std::string data = "";
std::vector<std::string> strings;
a8::Split(data, strings, '|');
for (auto& str : strings) {
std::vector<std::string> strings2;
a8::Split(str, strings2, ':');
if (strings2.size() < 2) {
abort();
}
_bullet_born_offset.push_back
(std::make_tuple(
a8::XValue(strings2[0]).GetDouble(),
a8::XValue(strings2[1]).GetDouble(),
strings2.size() > 2 ? a8::XValue(strings2[2]).GetDouble() : 0,
strings2.size() > 3 ? a8::XValue(strings2[3]).GetInt() : 0,
strings2.size() > 4 ? a8::XValue(strings2[4]).GetInt() : 0,
strings2.size() > 5 ? a8::XValue(strings2[5]).GetInt() : 0
)
);
}
}
_buff_param1 = a8::XValue(buff_param1()).GetDouble();
_buff_param2 = a8::XValue(buff_param2()).GetDouble();
_buff_param3 = a8::XValue(buff_param3()).GetDouble();
@ -296,6 +275,31 @@ namespace mt
A8_ABORT();
}
}
{
if (buff_effect() == kBET_CallFunc &&
(int)BuffCallFunc_e::kSetBulletBornOffset == _int_buff_param1) {
std::string data = buff_param2();
std::vector<std::string> strings;
a8::Split(data, strings, '|');
for (auto& str : strings) {
std::vector<std::string> strings2;
a8::Split(str, strings2, ':');
if (strings2.size() < 2) {
abort();
}
_bullet_born_offset.push_back
(std::make_tuple(
a8::XValue(strings2[0]).GetDouble(),
a8::XValue(strings2[1]).GetDouble(),
strings2.size() > 2 ? a8::XValue(strings2[2]).GetDouble() : 0,
strings2.size() > 3 ? a8::XValue(strings2[3]).GetInt() : 0,
strings2.size() > 4 ? a8::XValue(strings2[4]).GetInt() : 0,
strings2.size() > 5 ? a8::XValue(strings2[5]).GetInt() : 0
)
);
}
}
}
}
void Buff::Init2()

View File

@ -362,7 +362,11 @@ void InternalShot(Creature* c,
ProcMissile(c, weapon_meta, bullet_meta, skill_meta, fly_distance, weapon_uniid, trace_target_uniid);
return;
}
for (auto& tuple : weapon_meta->_bullet_born_offset) {
auto bullet_born_offset_ptr = &weapon_meta->_bullet_born_offset;
if (c->GetCurrWeapon()->meta == weapon_meta) {
bullet_born_offset_ptr = c->GetCurrWeapon()->bullet_born_offset_ptr;
}
for (auto& tuple : *bullet_born_offset_ptr) {
glm::vec3 bullet_born_offset = glm::vec3(std::get<0>(tuple), 0.0f, std::get<1>(tuple));
float bullet_born_angle = GlmHelper::CalcAngle(c->GetAttackDir(), GlmHelper::UP);
if (c->GetAttackDir().x > 0.00001f) {
@ -417,8 +421,8 @@ void InternalShot(Creature* c,
}
}
int bulletIdx = 0;
int bulletNum = weapon_meta->_bullet_born_offset.size();
for (auto& tuple : weapon_meta->_bullet_born_offset) {
int bulletNum = bullet_born_offset_ptr->size();
for (auto& tuple : *bullet_born_offset_ptr) {
++bulletIdx;
glm::vec3 bullet_born_offset = glm::vec3(std::get<0>(tuple), 0.0f, std::get<1>(tuple));
glm::vec3 bullet_born_pos = c->GetPos().ToGlmVec3() + c->shoot_offset + bullet_born_offset;