perf: 优化肉鸽一些地块的权重,新支持一些地块

fix #900
This commit is contained in:
MistEO
2022-06-18 04:07:59 +08:00
parent b9e2302608
commit a9fce8ffb8
3 changed files with 35 additions and 27 deletions

View File

@@ -117,27 +117,27 @@ bool asst::RoguelikeBattleTaskPlugin::get_stage_info()
}
if (calced) {
#ifdef ASST_DEBUG
auto normal_tiles = tile.calc(m_stage_name, true);
cv::Mat draw = cv::imread("j.png");
for (const auto& [point, info] : normal_tiles) {
using TileKey = TilePack::TileKey;
static const std::unordered_map<TileKey, std::string> TileKeyMapping = {
{ TileKey::Invalid, "invalid" },
{ TileKey::Forbidden, "forbidden" },
{ TileKey::Wall, "wall" },
{ TileKey::Road, "road" },
{ TileKey::Home, "end" },
{ TileKey::EnemyHome, "start" },
{ TileKey::Floor, "floor" },
{ TileKey::Hole, "hole" },
{ TileKey::Telin, "telin" },
{ TileKey::Telout, "telout" }
};
cv::putText(draw, TileKeyMapping.at(info.key), cv::Point(info.pos.x, info.pos.y), 1, 1, cv::Scalar(0, 0, 255));
}
#endif
//#ifdef ASST_DEBUG
// auto normal_tiles = tile.calc(m_stage_name, true);
// cv::Mat draw = cv::imread("j.png");
// for (const auto& [point, info] : normal_tiles) {
// using TileKey = TilePack::TileKey;
// static const std::unordered_map<TileKey, std::string> TileKeyMapping = {
// { TileKey::Invalid, "invalid" },
// { TileKey::Forbidden, "forbidden" },
// { TileKey::Wall, "wall" },
// { TileKey::Road, "road" },
// { TileKey::Home, "end" },
// { TileKey::EnemyHome, "start" },
// { TileKey::Floor, "floor" },
// { TileKey::Hole, "hole" },
// { TileKey::Telin, "telin" },
// { TileKey::Telout, "telout" }
// };
//
// cv::putText(draw, TileKeyMapping.at(info.key), cv::Point(info.pos.x, info.pos.y), 1, 1, cv::Scalar(0, 0, 255));
// }
//#endif
auto cb_info = basic_info_with_what("StageInfo");
auto& details = cb_info["details"];
@@ -679,8 +679,10 @@ asst::Point asst::RoguelikeBattleTaskPlugin::calc_direction(Point loc, BattleRol
{ TileKey::EnemyHome, 800 },
{ TileKey::Floor, 1000 },
{ TileKey::Hole, 0 },
{ TileKey::Telin, 0 },
{ TileKey::Telout, 0 }
{ TileKey::Telin, 700 },
{ TileKey::Telout, 700 },
{ TileKey::Volcano, 1000 },
{ TileKey::Healing, 1000 },
};
// 治疗干员朝向的权重
static const std::unordered_map<TileKey, int> TileKeyMedicWeights = {
@@ -693,7 +695,9 @@ asst::Point asst::RoguelikeBattleTaskPlugin::calc_direction(Point loc, BattleRol
{ TileKey::Floor, 0 },
{ TileKey::Hole, 0 },
{ TileKey::Telin, 0 },
{ TileKey::Telout, 0 }
{ TileKey::Telout, 0 },
{ TileKey::Volcano, 1000 },
{ TileKey::Healing, 1000 },
};
switch (role) {

View File

@@ -54,7 +54,9 @@ std::unordered_map<asst::Point, asst::TilePack::TileInfo> asst::TilePack::calc(
{ "tile_floor", TileKey::Floor },
{ "tile_hole", TileKey::Hole },
{ "tile_telin", TileKey::Telin },
{ "tile_telout", TileKey::Telout }
{ "tile_telout", TileKey::Telout },
{ "tile_volcano", TileKey::Volcano },
{ "tile_healing", TileKey::Healing },
};
for (size_t y = 0; y < pos.size(); ++y) {

View File

@@ -39,8 +39,10 @@ namespace asst
EnemyHome, // 红门(可能还有其他的情况)
Floor, // 不能放干员,但敌人可以走
Hole, // 空降兵掉下去的地方(
Telin, // 不知道是啥
Telout // 不知道是啥
Telin, // 传送门入口
Telout, // 传送门出口
Volcano, // 岩浆地块,可以放干员,敌人也可以走,但是会持续掉血
Healing // 治疗地块,可以放干员,敌人也可以走,会给干员回血
};
struct TileInfo