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;
void Init1();
static std::vector<const mt::PveGeminiContent*>* GetContentsByMode(int mode);
};
}

View File

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

View File

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

View File

@ -12,9 +12,9 @@ namespace mt
std::vector<std::string> strings;
a8::Split(skin_id(), 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();
}
}

View File

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

View File

@ -1,25 +1,29 @@
#include "precompile.h"
#include "mt/Skill.h"
#include "mt/Buff.h"
#include "mt/SkillNumber.h"
#include "skillhelper.h"
IMPL_TABLE(mt::Skill)
namespace mt
{
void Skill::Init()
void Skill::Init1()
{
{
std::vector<std::string> strings;
a8::Split(pb->buff_list(), strings, '|');
a8::Split(buff_list(), 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::Reflection* reflection = pb->GetReflection();
const google::protobuf::Descriptor* descriptor = GetDescriptor();
const google::protobuf::Reflection* reflection = GetReflection();
for (int idx = 1; idx <= 100; ++idx) {
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()
{
int skill_id = pb->skill_id();
if (!(pb->skill_type() == kActiveSkill || pb->skill_type() == kPassiveSkill)) {
if (!(skill_type() == kActiveSkill || skill_type() == kPassiveSkill)) {
A8_ABORT();
}
#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();
}
#endif
{
for (int buff_id : buff_list) {
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id);
for (int buff_id : _buff_list) {
const mt::Buff* buff_meta = mt::Buff::GetById(buff_id);
if (!buff_meta) {
A8_ABORT();
}
if (pb->skill_type() == kPassiveSkill) {
if (buff_meta->pb->trigger_type() != kBTT_UseSkill) {
if (skill_type() == kPassiveSkill) {
if (buff_meta->trigger_type() != kBTT_UseSkill) {
A8_ABORT();
}
}
auto itr = trigger_type_buffs.find(buff_meta->pb->trigger_type());
if (itr != trigger_type_buffs.end()) {
auto itr = _trigger_type_buffs.find(buff_meta->trigger_type());
if (itr != _trigger_type_buffs.end()) {
itr->second.insert(buff_meta);
} 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);
if (base_skill_id) {
if (!base_skill_meta) {
_base_skill_meta = mt::Skill::GetById(_base_skill_id);
if (_base_skill_id) {
if (!_base_skill_meta) {
abort();
}
}
}
{
number_meta = MetaMgr::Instance()->GetSkillNumber(pb->skill_id());
if (!number_meta && GetMagicId() != 0) {
_number_meta = mt::SkillNumber::GetById(skill_id());
if (!_number_meta && GetMagicId() != 0) {
abort();
}
}
@ -131,12 +135,12 @@ namespace mt
int Skill::GetMagicId() const
{
return magic_id;
return _magic_id;
}
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")
public:
struct SkillNumber* number_meta = nullptr;
struct mt::SkillNumber* _number_meta = nullptr;
void Init();
void Init1();
void Init2();
Skill* base_skill_meta = nullptr;
float value_up = 0.0f;
std::set<int> buff_list;
std::map<int, std::set<const mt::Buff*>> trigger_type_buffs;
std::vector<mt::SkillPhase> phases;
std::vector<mt::SkillPhase> raw_phases;
const mt::Skill* _base_skill_meta = nullptr;
float _value_up = 0.0f;
std::set<int> _buff_list;
std::map<int, std::set<const mt::Buff*>> _trigger_type_buffs;
std::vector<mt::SkillPhase> _phases;
std::vector<mt::SkillPhase> _raw_phases;
bool IsTurnOverSkill() const;
int GetMagicId() const;
private:
int magic_id = 0;
int base_skill_id = 0;
int _magic_id = 0;
int _base_skill_id = 0;
};

View File

@ -1,85 +1,90 @@
#include "precompile.h"
#include "mt/SkillNumber.h"
#include "mt/Skill.h"
IMPL_TABLE(mt::SkillNumber)
namespace mt
{
void SkillNumber::Init()
void SkillNumber::Init1()
{
int_ratio = a8::XValue(pb->ratio());
float_ratio = a8::XValue(pb->ratio()).GetDouble();
if (pb->ratio().find('%') != std::string::npos) {
std::string tmp_str = pb->ratio();
_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;
_float_ratio = a8::XValue(tmp_str).GetDouble() / 100;
}
int_ratio2 = a8::XValue(pb->ratio2());
float_ratio2 = a8::XValue(pb->ratio2()).GetDouble();
if (pb->ratio2().find('%') != std::string::npos) {
std::string tmp_str = pb->ratio2();
_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;
_float_ratio2 = a8::XValue(tmp_str).GetDouble() / 100;
}
int_speed = a8::XValue(pb->speed());
float_speed = a8::XValue(pb->speed()).GetDouble();
if (pb->speed().find('%') != std::string::npos) {
std::string tmp_str = pb->speed();
_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;
_float_speed = a8::XValue(tmp_str).GetDouble() / 100;
}
int_range = a8::XValue(pb->range());
float_range = a8::XValue(pb->range()).GetDouble();
if (pb->range().find('%') != std::string::npos) {
std::string tmp_str = pb->range();
_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;
_float_range = a8::XValue(tmp_str).GetDouble() / 100;
}
int_range2 = a8::XValue(pb->range2());
float_range2 = a8::XValue(pb->range2()).GetDouble();
if (pb->range2().find('%') != std::string::npos) {
std::string tmp_str = pb->range2();
_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;
_float_range2 = a8::XValue(tmp_str).GetDouble() / 100;
}
int_probability = a8::XValue(pb->probability());
float_probability = a8::XValue(pb->probability()).GetDouble();
if (pb->probability().find('%') != std::string::npos) {
std::string tmp_str = pb->probability();
_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;
_float_probability = a8::XValue(tmp_str).GetDouble() / 100;
}
int_time = a8::XValue(pb->time());
float_time = a8::XValue(pb->time()).GetDouble();
if (pb->time().find('%') != std::string::npos) {
std::string tmp_str = pb->time();
_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;
_float_time = a8::XValue(tmp_str).GetDouble() / 100;
}
int_cd = a8::XValue(pb->cd());
float_cd = a8::XValue(pb->cd()).GetDouble();
if (pb->cd().find('%') != std::string::npos) {
std::string tmp_str = pb->cd();
_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;
_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) {
abort();
}
#if 0
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
}
}