This commit is contained in:
aozhiwei 2022-12-23 13:21:49 +08:00
parent 91186f44a2
commit 2ace1a04dc
9 changed files with 127 additions and 110 deletions

View File

@ -16,4 +16,9 @@ namespace mt
} }
} }
std::vector<const mt::PveGeminiContent*>* PveGeminiContent::GetContentsByMode(int mode)
{
return nullptr;
}
} }

View File

@ -15,6 +15,7 @@ namespace mt
std::vector<int> enemys; std::vector<int> enemys;
void Init1(); void Init1();
static std::vector<const mt::PveGeminiContent*>* GetContentsByMode(int mode);
}; };
} }

View File

@ -1,6 +1,8 @@
#include "precompile.h" #include "precompile.h"
#include "mt/PveGeminiMode.h" #include "mt/PveGeminiMode.h"
#include "mt/PveGeminiContent.h"
#include "mt/SafeArea.h"
IMPL_TABLE(mt::PveGeminiMode) IMPL_TABLE(mt::PveGeminiMode)
@ -20,32 +22,32 @@ namespace mt
if (time > 200) { if (time > 200) {
abort(); abort();
} }
mode_time.push_back(time); _mode_time.push_back(time);
} }
} }
{ {
std::vector<std::string> strings; std::vector<std::string> strings;
a8::Split(area(), strings, '|'); a8::Split(area(), strings, '|');
for (auto& str : strings) { for (auto& str : strings) {
MetaData::SafeArea* p = MetaMgr::Instance()->GetSafeArea(a8::XValue(str)); mt::SafeArea* p = mt::SafeArea::GetById(a8::XValue(str));
if (!p) { if (!p) {
abort(); abort();
} }
area.push_back(p); _area.push_back(p);
} }
} }
if (area.empty()) { if (_area.empty()) {
abort(); abort();
} }
waves.resize(mode_time.size()); _waves.resize(_mode_time.size());
for (auto& content : *MetaMgr::Instance()->GetPveGeminiContents(id())) { for (auto& content : *mt::PveGeminiContent::GetContentsByMode(id())) {
if (content.round() <= 0 || if (content->round() <= 0 ||
content.round() > mode_time.size()) { content->round() > _mode_time.size()) {
abort(); abort();
} }
waves[content.round() - 1].push_back(&content); _waves[content->round() - 1].push_back(content);
if (content.round() >= waves.size()) { if (content->round() >= _waves.size()) {
if (content.enemys.size() != 1) { if (content->enemys.size() != 1) {
abort(); abort();
} }
} }
@ -58,10 +60,10 @@ namespace mt
if (a8::XValue(str).GetInt() <= last_val) { if (a8::XValue(str).GetInt() <= last_val) {
abort(); abort();
} }
score_reward.push_back(a8::XValue(str).GetInt()); _score_reward.push_back(a8::XValue(str).GetInt());
last_val = a8::XValue(str); last_val = a8::XValue(str);
} }
if (score_reward.size() < 0) { if (_score_reward.size() < 0) {
abort(); abort();
} }
} }
@ -69,9 +71,9 @@ namespace mt
std::vector<std::string> strings; std::vector<std::string> strings;
a8::Split(round_score(), strings, '|'); a8::Split(round_score(), strings, '|');
for (std::string& str : strings) { for (std::string& str : strings) {
round_score.push_back(a8::XValue(str).GetInt()); _round_score.push_back(a8::XValue(str).GetInt());
} }
if (round_score.size() != waves.size()) { if (_round_score.size() != _waves.size()) {
abort(); abort();
} }
} }
@ -89,9 +91,9 @@ namespace mt
v.x = a8::XValue(strings2[0]).GetDouble(); v.x = a8::XValue(strings2[0]).GetDouble();
v.y = 0.0f; v.y = 0.0f;
v.y = a8::XValue(strings2[1]).GetDouble(); v.y = a8::XValue(strings2[1]).GetDouble();
next_door.push_back(v); _next_door.push_back(v);
} }
if (next_door.size() + 1 != waves.size()) { if (_next_door.size() + 1 != _waves.size()) {
abort(); abort();
} }
} }
@ -101,8 +103,8 @@ namespace mt
int PveGeminiMode::CalcStar(int score) int PveGeminiMode::CalcStar(int score)
{ {
int star = 0; int star = 0;
for (int i = 0; i < score_reward.size(); ++i) { for (int i = 0; i < _score_reward.size(); ++i) {
if (score >= score_reward[i]) { if (score >= _score_reward[i]) {
star = i + 1; star = i + 1;
} else { } else {
break; break;

View File

@ -12,8 +12,8 @@ namespace mt
public: public:
std::vector<int> _mode_time; std::vector<int> _mode_time;
std::vector<mt::SafeArea*> _area; std::vector<const mt::SafeArea*> _area;
std::vector<std::vector<PveGeminiContent*>> _waves; std::vector<std::vector<const mt::PveGeminiContent*>> _waves;
std::vector<int> _score_reward; std::vector<int> _score_reward;
std::vector<int> _round_score; std::vector<int> _round_score;
std::vector<glm::vec3> _next_door; std::vector<glm::vec3> _next_door;

View File

@ -12,9 +12,9 @@ namespace mt
std::vector<std::string> strings; std::vector<std::string> strings;
a8::Split(skin_id(), strings, '|'); a8::Split(skin_id(), strings, '|');
for (auto& str : strings) { for (auto& str : strings) {
skin_id.push_back(a8::XValue(str)); _skin_id.push_back(a8::XValue(str));
} }
if (skin_id.size() != 3) { if (_skin_id.size() != 3) {
A8_ABORT(); A8_ABORT();
} }
} }

View File

@ -11,22 +11,22 @@ namespace mt
{ {
std::vector<a8::Vec2> tmp_list; std::vector<a8::Vec2> tmp_list;
{ {
tmp_list.push_back(a8::Vec2(pb->x1(), pb->y1())); tmp_list.push_back(a8::Vec2(x1(), y1()));
tmp_list.push_back(a8::Vec2(pb->x2(), pb->y2())); tmp_list.push_back(a8::Vec2(x2(), y2()));
tmp_list.push_back(a8::Vec2(pb->x3(), pb->y3())); tmp_list.push_back(a8::Vec2(x3(), y3()));
tmp_list.push_back(a8::Vec2(pb->x4(), pb->y4())); tmp_list.push_back(a8::Vec2(x4(), y4()));
tmp_list.push_back(a8::Vec2(pb->x5(), pb->y5())); tmp_list.push_back(a8::Vec2(x5(), y5()));
tmp_list.push_back(a8::Vec2(pb->x6(), pb->y6())); tmp_list.push_back(a8::Vec2(x6(), y6()));
tmp_list.push_back(a8::Vec2(pb->x7(), pb->y7())); tmp_list.push_back(a8::Vec2(x7(), y7()));
tmp_list.push_back(a8::Vec2(pb->x8(), pb->y8())); tmp_list.push_back(a8::Vec2(x8(), y8()));
tmp_list.push_back(a8::Vec2(pb->x9(), pb->y9())); tmp_list.push_back(a8::Vec2(x9(), y9()));
tmp_list.push_back(a8::Vec2(pb->x10(), pb->y10())); tmp_list.push_back(a8::Vec2(x10(), y10()));
} }
for (auto& pos : tmp_list) { for (auto& pos : tmp_list) {
if (pos.x < 1.0f || pos.y < 1.0f) { if (pos.x < 1.0f || pos.y < 1.0f) {
break; break;
} }
poses.push_back(pos); _poses.push_back(pos);
} }
} }

View File

@ -1,25 +1,29 @@
#include "precompile.h" #include "precompile.h"
#include "mt/Skill.h" #include "mt/Skill.h"
#include "mt/Buff.h"
#include "mt/SkillNumber.h"
#include "skillhelper.h"
IMPL_TABLE(mt::Skill) IMPL_TABLE(mt::Skill)
namespace mt namespace mt
{ {
void Skill::Init() void Skill::Init1()
{ {
{ {
std::vector<std::string> strings; std::vector<std::string> strings;
a8::Split(pb->buff_list(), strings, '|'); a8::Split(buff_list(), strings, '|');
for (auto& str : strings) { for (auto& str : strings) {
buff_list.insert(a8::XValue(str)); _buff_list.insert(a8::XValue(str));
} }
} }
#if 0
{ {
const google::protobuf::Descriptor* descriptor = pb->GetDescriptor(); const google::protobuf::Descriptor* descriptor = GetDescriptor();
const google::protobuf::Reflection* reflection = pb->GetReflection(); const google::protobuf::Reflection* reflection = GetReflection();
for (int idx = 1; idx <= 100; ++idx) { for (int idx = 1; idx <= 100; ++idx) {
MetaData::SkillPhase phase; MetaData::SkillPhase phase;
{ {
@ -78,52 +82,52 @@ namespace mt
} }
} }
} }
#endif
{ {
SkillHelper::GetMagicIdAndBaseSkillId(pb->skill_id(), magic_id, base_skill_id); SkillHelper::GetMagicIdAndBaseSkillId(skill_id(), _magic_id, _base_skill_id);
} }
} }
void Skill::Init2() void Skill::Init2()
{ {
int skill_id = pb->skill_id(); if (!(skill_type() == kActiveSkill || skill_type() == kPassiveSkill)) {
if (!(pb->skill_type() == kActiveSkill || pb->skill_type() == kPassiveSkill)) {
A8_ABORT(); A8_ABORT();
} }
#if 0 #if 0
if (!(pb->use_method() == 1 || pb->use_method() == 2 || pb->use_method() == 3)) { if (!(use_method() == 1 || use_method() == 2 || use_method() == 3)) {
A8_ABORT(); A8_ABORT();
} }
#endif #endif
{ {
for (int buff_id : buff_list) { for (int buff_id : _buff_list) {
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id); const mt::Buff* buff_meta = mt::Buff::GetById(buff_id);
if (!buff_meta) { if (!buff_meta) {
A8_ABORT(); A8_ABORT();
} }
if (pb->skill_type() == kPassiveSkill) { if (skill_type() == kPassiveSkill) {
if (buff_meta->pb->trigger_type() != kBTT_UseSkill) { if (buff_meta->trigger_type() != kBTT_UseSkill) {
A8_ABORT(); A8_ABORT();
} }
} }
auto itr = trigger_type_buffs.find(buff_meta->pb->trigger_type()); auto itr = _trigger_type_buffs.find(buff_meta->trigger_type());
if (itr != trigger_type_buffs.end()) { if (itr != _trigger_type_buffs.end()) {
itr->second.insert(buff_meta); itr->second.insert(buff_meta);
} else { } else {
trigger_type_buffs[buff_meta->pb->trigger_type()] = std::set<MetaData::Buff*>({buff_meta}); _trigger_type_buffs[buff_meta->trigger_type()] = std::set<const mt::Buff*>({buff_meta});
} }
} }
} }
{ {
base_skill_meta = MetaMgr::Instance()->GetSkill(base_skill_id); _base_skill_meta = mt::Skill::GetById(_base_skill_id);
if (base_skill_id) { if (_base_skill_id) {
if (!base_skill_meta) { if (!_base_skill_meta) {
abort(); abort();
} }
} }
} }
{ {
number_meta = MetaMgr::Instance()->GetSkillNumber(pb->skill_id()); _number_meta = mt::SkillNumber::GetById(skill_id());
if (!number_meta && GetMagicId() != 0) { if (!_number_meta && GetMagicId() != 0) {
abort(); abort();
} }
} }
@ -131,12 +135,12 @@ namespace mt
int Skill::GetMagicId() const int Skill::GetMagicId() const
{ {
return magic_id; return _magic_id;
} }
bool Skill::IsTurnOverSkill() const bool Skill::IsTurnOverSkill() const
{ {
return !phases.empty() && phases[0].func_id == kSkill_TurnOver; return !_phases.empty() && _phases[0].func_id == kSkill_TurnOver;
} }

View File

@ -29,22 +29,22 @@ namespace mt
"skill_id") "skill_id")
public: public:
struct SkillNumber* number_meta = nullptr; struct mt::SkillNumber* _number_meta = nullptr;
void Init(); void Init1();
void Init2(); void Init2();
Skill* base_skill_meta = nullptr; const mt::Skill* _base_skill_meta = nullptr;
float value_up = 0.0f; float _value_up = 0.0f;
std::set<int> buff_list; std::set<int> _buff_list;
std::map<int, std::set<const mt::Buff*>> trigger_type_buffs; std::map<int, std::set<const mt::Buff*>> _trigger_type_buffs;
std::vector<mt::SkillPhase> phases; std::vector<mt::SkillPhase> _phases;
std::vector<mt::SkillPhase> raw_phases; std::vector<mt::SkillPhase> _raw_phases;
bool IsTurnOverSkill() const; bool IsTurnOverSkill() const;
int GetMagicId() const; int GetMagicId() const;
private: private:
int magic_id = 0; int _magic_id = 0;
int base_skill_id = 0; int _base_skill_id = 0;
}; };

View File

@ -1,85 +1,90 @@
#include "precompile.h" #include "precompile.h"
#include "mt/SkillNumber.h" #include "mt/SkillNumber.h"
#include "mt/Skill.h"
IMPL_TABLE(mt::SkillNumber) IMPL_TABLE(mt::SkillNumber)
namespace mt namespace mt
{ {
void SkillNumber::Init() void SkillNumber::Init1()
{ {
int_ratio = a8::XValue(pb->ratio()); _int_ratio = a8::XValue(ratio());
float_ratio = a8::XValue(pb->ratio()).GetDouble(); _float_ratio = a8::XValue(ratio()).GetDouble();
if (pb->ratio().find('%') != std::string::npos) { if (ratio().find('%') != std::string::npos) {
std::string tmp_str = pb->ratio(); std::string tmp_str = ratio();
a8::ReplaceString(tmp_str, "%", ""); a8::ReplaceString(tmp_str, "%", "");
float_ratio = a8::XValue(tmp_str).GetDouble() / 100; _float_ratio = a8::XValue(tmp_str).GetDouble() / 100;
} }
int_ratio2 = a8::XValue(pb->ratio2()); _int_ratio2 = a8::XValue(ratio2());
float_ratio2 = a8::XValue(pb->ratio2()).GetDouble(); _float_ratio2 = a8::XValue(ratio2()).GetDouble();
if (pb->ratio2().find('%') != std::string::npos) { if (ratio2().find('%') != std::string::npos) {
std::string tmp_str = pb->ratio2(); std::string tmp_str = ratio2();
a8::ReplaceString(tmp_str, "%", ""); a8::ReplaceString(tmp_str, "%", "");
float_ratio2 = a8::XValue(tmp_str).GetDouble() / 100; _float_ratio2 = a8::XValue(tmp_str).GetDouble() / 100;
} }
int_speed = a8::XValue(pb->speed()); _int_speed = a8::XValue(speed());
float_speed = a8::XValue(pb->speed()).GetDouble(); _float_speed = a8::XValue(speed()).GetDouble();
if (pb->speed().find('%') != std::string::npos) { if (speed().find('%') != std::string::npos) {
std::string tmp_str = pb->speed(); std::string tmp_str = speed();
a8::ReplaceString(tmp_str, "%", ""); a8::ReplaceString(tmp_str, "%", "");
float_speed = a8::XValue(tmp_str).GetDouble() / 100; _float_speed = a8::XValue(tmp_str).GetDouble() / 100;
} }
int_range = a8::XValue(pb->range()); _int_range = a8::XValue(range());
float_range = a8::XValue(pb->range()).GetDouble(); _float_range = a8::XValue(range()).GetDouble();
if (pb->range().find('%') != std::string::npos) { if (range().find('%') != std::string::npos) {
std::string tmp_str = pb->range(); std::string tmp_str = range();
a8::ReplaceString(tmp_str, "%", ""); a8::ReplaceString(tmp_str, "%", "");
float_range = a8::XValue(tmp_str).GetDouble() / 100; _float_range = a8::XValue(tmp_str).GetDouble() / 100;
} }
int_range2 = a8::XValue(pb->range2()); _int_range2 = a8::XValue(range2());
float_range2 = a8::XValue(pb->range2()).GetDouble(); _float_range2 = a8::XValue(range2()).GetDouble();
if (pb->range2().find('%') != std::string::npos) { if (range2().find('%') != std::string::npos) {
std::string tmp_str = pb->range2(); std::string tmp_str = range2();
a8::ReplaceString(tmp_str, "%", ""); a8::ReplaceString(tmp_str, "%", "");
float_range2 = a8::XValue(tmp_str).GetDouble() / 100; _float_range2 = a8::XValue(tmp_str).GetDouble() / 100;
} }
int_probability = a8::XValue(pb->probability()); _int_probability = a8::XValue(probability());
float_probability = a8::XValue(pb->probability()).GetDouble(); _float_probability = a8::XValue(probability()).GetDouble();
if (pb->probability().find('%') != std::string::npos) { if (probability().find('%') != std::string::npos) {
std::string tmp_str = pb->probability(); std::string tmp_str = probability();
a8::ReplaceString(tmp_str, "%", ""); a8::ReplaceString(tmp_str, "%", "");
float_probability = a8::XValue(tmp_str).GetDouble() / 100; _float_probability = a8::XValue(tmp_str).GetDouble() / 100;
} }
int_time = a8::XValue(pb->time()); _int_time = a8::XValue(time());
float_time = a8::XValue(pb->time()).GetDouble(); _float_time = a8::XValue(time()).GetDouble();
if (pb->time().find('%') != std::string::npos) { if (time().find('%') != std::string::npos) {
std::string tmp_str = pb->time(); std::string tmp_str = time();
a8::ReplaceString(tmp_str, "%", ""); a8::ReplaceString(tmp_str, "%", "");
float_time = a8::XValue(tmp_str).GetDouble() / 100; _float_time = a8::XValue(tmp_str).GetDouble() / 100;
} }
int_cd = a8::XValue(pb->cd()); _int_cd = a8::XValue(cd());
float_cd = a8::XValue(pb->cd()).GetDouble(); _float_cd = a8::XValue(cd()).GetDouble();
if (pb->cd().find('%') != std::string::npos) { if (cd().find('%') != std::string::npos) {
std::string tmp_str = pb->cd(); std::string tmp_str = cd();
a8::ReplaceString(tmp_str, "%", ""); a8::ReplaceString(tmp_str, "%", "");
float_cd = a8::XValue(tmp_str).GetDouble() / 100; _float_cd = a8::XValue(tmp_str).GetDouble() / 100;
} }
{ {
MetaData::Skill* skill_meta = MetaMgr::Instance()->GetSkill(pb->skill_id()); const mt::Skill* skill_meta = mt::Skill::GetById(skill_id());
if (!skill_meta) { if (!skill_meta) {
abort(); abort();
} }
#if 0
metatable::Skill* skill_pb = (metatable::Skill*)(skill_meta->pb); metatable::Skill* skill_pb = (metatable::Skill*)(skill_meta->pb);
skill_pb->set_skill_cd(float_cd); - skill_pb->set_skill_cd(float_cd);
+
skill_cd_ = _float_cd;
#endif
} }
} }