86 lines
2.3 KiB
C++
86 lines
2.3 KiB
C++
#include "precompile.h"
|
|
|
|
#include "mt/PveGeminiMode.h"
|
|
#include "mt/PveGeminiContent.h"
|
|
#include "mt/SafeArea.h"
|
|
|
|
IMPL_TABLE(mt::PveGeminiMode)
|
|
|
|
namespace mt
|
|
{
|
|
|
|
void PveGeminiMode::Init1()
|
|
{
|
|
{
|
|
std::vector<std::string> strings;
|
|
a8::Split(mode_time(), strings, '|');
|
|
for (auto& str : strings) {
|
|
int time = a8::XValue(str);
|
|
if (time <= 0) {
|
|
abort();
|
|
}
|
|
if (time > 200) {
|
|
abort();
|
|
}
|
|
_mode_time.push_back(time);
|
|
}
|
|
}
|
|
{
|
|
std::vector<std::string> strings;
|
|
a8::Split(area(), strings, '|');
|
|
for (auto& str : strings) {
|
|
const mt::SafeArea* p = mt::SafeArea::GetById(a8::XValue(str));
|
|
if (!p) {
|
|
abort();
|
|
}
|
|
_area.push_back(p);
|
|
}
|
|
}
|
|
if (_area.empty()) {
|
|
abort();
|
|
}
|
|
_waves.resize(_mode_time.size());
|
|
for (auto& content : *mt::PveGeminiContent::GetContentsByMode(id())) {
|
|
if (content->round() <= 0 ||
|
|
content->round() > (int)_mode_time.size()) {
|
|
abort();
|
|
}
|
|
_waves[content->round() - 1].push_back(content);
|
|
if (content->round() >= (int)_waves.size()) {
|
|
if (content->_enemys.size() != 1) {
|
|
abort();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
std::vector<std::string> strings;
|
|
a8::Split(score_reward(), strings, '|');
|
|
int last_val = 0;
|
|
for (std::string& str : strings) {
|
|
if (a8::XValue(str).GetInt() <= last_val) {
|
|
abort();
|
|
}
|
|
_score_reward.push_back(a8::XValue(str).GetInt());
|
|
last_val = a8::XValue(str);
|
|
}
|
|
if (_score_reward.size() < 0) {
|
|
abort();
|
|
}
|
|
}
|
|
}
|
|
|
|
int PveGeminiMode::CalcStar(int score) const
|
|
{
|
|
int star = 0;
|
|
for (size_t i = 0; i < _score_reward.size(); ++i) {
|
|
if (score >= _score_reward[i]) {
|
|
star = i + 1;
|
|
} else {
|
|
break;
|
|
}
|
|
}
|
|
return star;
|
|
}
|
|
|
|
}
|