Give the six play settings of the tactics board an effect; draw the board in chalk
- Match engine (Modern turn driver only, MatchEngine::tactic_effects): wing play, through balls, goal kicks, flat or high balls, offside trap and pressing of a human side shift how often it and its opponent come to a chance (play_shift, at most two steps of the chance roll). Each setting pays in one situation and costs in another; pressing also raises the foul roll. No random numbers are drawn; computer sides and the Classic core are unchanged. Documented in docs/DIFFERENCES.md. - The tactics read names the settings; desk and live dialog show every value in words with one sentence on its effect. The live dialog offers all eight settings again. - The tactics board is a slate with a wooden frame, drawn in wobbling chalk strokes. - modern_season_sim: SIM_TACTICS keeps a tactic set for measuring; new modern_play_shift_tests pin the direction of every setting. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
9708b720b2
commit
919342a5ae
16 files changed
+344
-80
No files matched your search
+129
-50
@@ -1,6 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#include "modern/ui/demo_sports.hpp"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <iomanip>
|
||||
#include <locale>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <array>
|
||||
#include <numeric>
|
||||
@@ -182,53 +186,113 @@ std::string edit_demo_tactics(Json &state, const Json &action) {
|
||||
}
|
||||
std::string tactics_diagram(const Json &state, const std::string &theme,
|
||||
const Json &lineup_points, int depth_max, int lane_max) {
|
||||
// A slate with a wooden frame, drawn on by hand: every line wobbles a little, is gone
|
||||
// over twice and skips where the chalk did not grip. The wobble follows from the
|
||||
// coordinates alone, so the same board always looks the same.
|
||||
const auto values = state.at("values").get<std::array<int, 8>>();
|
||||
const std::string line = theme == "silver" ? "#536f66" : "#dfe8bf";
|
||||
const auto field_line = theme == "silver" ? "#536f66" : "#d7edbf",
|
||||
man_line = theme == "silver" ? "#536f66" : "#c9e6ae",
|
||||
curve_line = theme == "silver" ? "#536f66" : "#d4e7ba";
|
||||
const std::string defence = theme == "silver" ? "#85600c" : "#ffdd6b";
|
||||
const std::string chalk = "#f1efe2", own = "#f3d977", opponent = "#ee8d77";
|
||||
const std::string slate = theme == "silver" ? "#35584a" : theme == "matchday" ? "#2f3b36" : "#274a3e";
|
||||
std::ostringstream out;
|
||||
out.imbue(std::locale::classic());
|
||||
out << "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 295 "
|
||||
"206'><defs><marker id='arrow' markerWidth='5' markerHeight='5' "
|
||||
"refX='4' refY='2.5' orient='auto'><path d='M0 0L5 2.5L0 5Z' fill='"
|
||||
<< line << "'/></marker></defs>";
|
||||
out << std::fixed << std::setprecision(2);
|
||||
uint32_t seed = 0x9e3779b9u;
|
||||
const auto wobble = [&](double amount) {
|
||||
seed = seed * 1664525u + 1013904223u;
|
||||
return (double((seed >> 8) & 0xffff) / 65535.0 - 0.5) * 2 * amount;
|
||||
};
|
||||
// one stroke through the points: the chalk line itself and a wider, fainter trace of dust
|
||||
const auto stroke = [&](const std::vector<std::pair<double, double>> &points, const std::string &colour, double width,
|
||||
bool dashed = false) {
|
||||
for (int pass = 0; pass < 2; ++pass) {
|
||||
out << "<path d='";
|
||||
for (size_t i = 0; i < points.size(); ++i)
|
||||
out << (i ? 'L' : 'M') << points[i].first + wobble(pass ? .28 : .12) << ' ' << points[i].second + wobble(pass ? .28 : .12);
|
||||
out << "' fill='none' stroke='" << colour << "' stroke-linecap='round' stroke-linejoin='round' stroke-width='"
|
||||
<< (pass ? width * 1.9 : width) << "' stroke-opacity='" << (pass ? .16 : .9) << "'";
|
||||
if (dashed) out << " stroke-dasharray='2.2 1.6'";
|
||||
else if (!pass) out << " stroke-dasharray='" << 9 + wobble(3) << " .35 " << 5 + wobble(2) << " .25 " << 13 + wobble(4) << " .4'";
|
||||
out << "/>";
|
||||
}
|
||||
};
|
||||
const auto line = [&](double x1, double y1, double x2, double y2, const std::string &colour, double width, bool dashed = false) {
|
||||
const double length = std::hypot(x2 - x1, y2 - y1);
|
||||
const int parts = std::max(2, int(length / 7));
|
||||
const double nx = length > 0 ? -(y2 - y1) / length : 0, ny = length > 0 ? (x2 - x1) / length : 0;
|
||||
std::vector<std::pair<double, double>> points;
|
||||
// a hand overshoots the ends a little and bows between them
|
||||
const double bow = wobble(std::min(1.1, length / 60));
|
||||
for (int i = 0; i <= parts; ++i) {
|
||||
const double t = double(i) / parts, lean = std::sin(t * 3.14159265) * bow + wobble(.22);
|
||||
points.emplace_back(x1 + (x2 - x1) * t + nx * lean, y1 + (y2 - y1) * t + ny * lean);
|
||||
}
|
||||
stroke(points, colour, width, dashed);
|
||||
};
|
||||
const auto ring = [&](double cx, double cy, double r, const std::string &colour, double width) {
|
||||
std::vector<std::pair<double, double>> points;
|
||||
const double start = wobble(3.14159265), squash = 1 + wobble(.07);
|
||||
const int parts = std::max(10, int(r * 2.2));
|
||||
// drawn in one go: it closes a little past where it began, slightly off
|
||||
for (int i = 0; i <= parts + 1; ++i) {
|
||||
const double a = start + double(i) / parts * 6.2831853, drift = 1 + double(i) / parts * .05 + wobble(.03);
|
||||
points.emplace_back(cx + std::cos(a) * r * drift, cy + std::sin(a) * r * drift * squash);
|
||||
}
|
||||
stroke(points, colour, width);
|
||||
};
|
||||
const auto arrow = [&](double x, double y, double dx, double dy, bool dashed = false) {
|
||||
line(x, y, x + dx, y + dy, chalk, .95, dashed);
|
||||
const double length = std::hypot(dx, dy);
|
||||
if (length < 1) return;
|
||||
const double ux = dx / length, uy = dy / length;
|
||||
for (int side : {-1, 1})
|
||||
line(x + dx, y + dy, x + dx - ux * 3.6 - uy * 2.1 * side, y + dy - uy * 3.6 + ux * 2.1 * side, chalk, .95);
|
||||
};
|
||||
// a player: a filled chalk mark, scribbled rather than printed
|
||||
const auto dot = [&](double x, double y, bool other = false) {
|
||||
const std::string &colour = other ? opponent : own;
|
||||
out << "<path d='";
|
||||
for (int i = 0; i <= 9; ++i) {
|
||||
const double a = double(i) / 9 * 6.2831853, r = 2.35 + wobble(.3);
|
||||
out << (i ? 'L' : 'M') << x + std::cos(a) * r << ' ' << y + std::sin(a) * r;
|
||||
}
|
||||
out << "Z' fill='" << colour << "' fill-opacity='.82'/>";
|
||||
for (int i = 0; i < 3; ++i)
|
||||
line(x - 1.5 + wobble(.4), y - 1.1 + i * 1.1, x + 1.5 + wobble(.4), y - .5 + i * 1.1 + wobble(.3), colour, .55);
|
||||
ring(x, y, 2.5, colour, .4);
|
||||
};
|
||||
const auto field = [&](double x, double y, double w, double h) {
|
||||
out << "<g fill='none' stroke='" << field_line
|
||||
<< "' stroke-width='.65'><path d='M" << x << ' ' << y << 'h' << w << 'v'
|
||||
<< h << 'h' << -w << "Z M" << x + w / 2 << ' ' << y << 'v' << h << " M"
|
||||
<< x << ' ' << y + h * .25 << 'h' << w * .15 << 'v' << h * .5 << 'h'
|
||||
<< -w * .15 << " M" << x + w << ' ' << y + h * .25 << 'h' << -w * .15
|
||||
<< 'v' << h * .5 << 'h' << w * .15 << "'/><circle cx='" << x + w / 2
|
||||
<< "' cy='" << y + h / 2 << "' r='" << h * .14 << "'/></g>";
|
||||
};
|
||||
const auto dot = [&](double x, double y, bool opponent = false) {
|
||||
out << "<circle cx='" << x << "' cy='" << y << "' r='2.4' fill='"
|
||||
<< (opponent ? "#e46145" : defence)
|
||||
<< "' stroke='#809344' stroke-width='.4'/>";
|
||||
};
|
||||
const auto arrow = [&](double x, double y, double dx, double dy,
|
||||
bool dashed = false) {
|
||||
out << "<path d='M" << x << ' ' << y << 'l' << dx << ' ' << dy
|
||||
<< "' fill='none' stroke='" << line << "' stroke-width='.85' "
|
||||
<< (dashed ? "stroke-dasharray='2 1.3'" : "")
|
||||
<< " marker-end='url(#arrow)'/>";
|
||||
line(x, y, x + w, y, chalk, .8); line(x + w, y, x + w, y + h, chalk, .8);
|
||||
line(x + w, y + h, x, y + h, chalk, .8); line(x, y + h, x, y, chalk, .8);
|
||||
line(x + w / 2, y, x + w / 2, y + h, chalk, .7);
|
||||
for (int side = 0; side < 2; ++side) {
|
||||
const double edge = side ? x + w : x, box = side ? -w * .15 : w * .15;
|
||||
line(edge, y + h * .25, edge + box, y + h * .25, chalk, .7);
|
||||
line(edge + box, y + h * .25, edge + box, y + h * .75, chalk, .7);
|
||||
line(edge + box, y + h * .75, edge, y + h * .75, chalk, .7);
|
||||
}
|
||||
ring(x + w / 2, y + h / 2, h * .14, chalk, .7);
|
||||
};
|
||||
|
||||
out << "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 295 206'>";
|
||||
// frame and slate; the wiped patches of an often used board
|
||||
out << "<rect x='4' y='1' width='272' height='159' rx='3' fill='#6b4a2e'/>"
|
||||
"<rect x='4.8' y='1.8' width='270.4' height='157.4' rx='2.5' fill='none' stroke='#8a6540' stroke-width='.6'/>"
|
||||
"<rect x='7.5' y='4.5' width='265' height='152' rx='1.2' fill='"
|
||||
<< slate << "'/><rect x='7.5' y='4.5' width='265' height='152' rx='1.2' fill='none' stroke='#16261f' stroke-opacity='.55' stroke-width='1'/>";
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
const double cx = 40 + i * 27 + wobble(12), cy = 30 + (i % 3) * 45 + wobble(14);
|
||||
out << "<ellipse cx='" << cx << "' cy='" << cy << "' rx='" << 26 + wobble(9) << "' ry='" << 9 + wobble(4)
|
||||
<< "' fill='#ffffff' fill-opacity='" << .022 + (i % 2) * .012 << "' transform='rotate(" << -14 + wobble(10) << ' ' << cx << ' ' << cy << ")'/>";
|
||||
}
|
||||
// chalk tray with two pieces of chalk
|
||||
out << "<rect x='96' y='160' width='88' height='3.2' rx='.8' fill='#58391f'/>"
|
||||
"<rect x='112' y='158.3' width='9' height='1.7' rx='.5' fill='#f1efe2'/>"
|
||||
"<rect x='127' y='158.5' width='6' height='1.6' rx='.5' fill='#f3d977' transform='rotate(-6 130 159)'/>";
|
||||
|
||||
field(19, 9, 104, 62);
|
||||
field(19, 82, 104, 62);
|
||||
field(137, 10, 58, 37);
|
||||
field(205, 10, 58, 37);
|
||||
std::array<std::pair<int, int>, 10> formation = {{{5, 1},
|
||||
{5, 3},
|
||||
{5, 5},
|
||||
{5, 7},
|
||||
{10, 1},
|
||||
{10, 3},
|
||||
{10, 5},
|
||||
{10, 7},
|
||||
{16, 3},
|
||||
{16, 5}}};
|
||||
std::array<std::pair<int, int>, 10> formation = {{{5, 1}, {5, 3}, {5, 5}, {5, 7}, {10, 1}, {10, 3}, {10, 5}, {10, 7}, {16, 3}, {16, 5}}};
|
||||
if (!lineup_points.is_null()) {
|
||||
if (!lineup_points.is_array() || lineup_points.size() != 11)
|
||||
throw editor::Error("invalid_lineup_points");
|
||||
@@ -254,9 +318,10 @@ std::string tactics_diagram(const Json &state, const std::string &theme,
|
||||
dot(x + 25, 20);
|
||||
dot(x + 25, 37);
|
||||
dot(x + 43, 28, true);
|
||||
if (values[size_t(5 + k)] == 0)
|
||||
out << "<path d='M" << x + 3 << " 12l52 32 M" << x + 55
|
||||
<< " 12l-52 32' stroke='" << line << "' stroke-width='1.6'/>";
|
||||
if (values[size_t(5 + k)] == 0) {
|
||||
line(x + 3, 12, x + 55, 44, chalk, 1.7);
|
||||
line(x + 55, 12, x + 3, 44, chalk, 1.7);
|
||||
}
|
||||
}
|
||||
dot(29, 111);
|
||||
dot(76, 94);
|
||||
@@ -266,15 +331,29 @@ std::string tactics_diagram(const Json &state, const std::string &theme,
|
||||
arrow(29, 111, 10 + values[3] * 10, -values[3] * 5, true);
|
||||
arrow(76, 94, 10 + values[2] * 8, 12 - values[2] * 5);
|
||||
arrow(76, 119, 10 + values[1] * 8, -8 + values[1] * 4, true);
|
||||
for (int x : {181, 222})
|
||||
out << "<g fill='none' stroke='" << man_line
|
||||
<< "' stroke-width='.8'><circle cx='" << x
|
||||
<< "' cy='65' r='2'/><path d='M" << x
|
||||
<< " 67l-2 7 5 4 m-5-4 -4 4 m5-8 -5 2 m5-2 5 2'/></g>";
|
||||
out << "<path d='M188 72Q201 " << (values[4] ? 45 : 72)
|
||||
<< " 215 72' fill='none' stroke='" << curve_line
|
||||
<< "' stroke-width='.9' stroke-dasharray='1 1.5' "
|
||||
"marker-end='url(#arrow)'/></svg>";
|
||||
for (int x : {181, 222}) {
|
||||
ring(x, 65, 2, chalk, .8);
|
||||
line(x, 67, x - 2, 74, chalk, .8);
|
||||
line(x - 2, 74, x + 3, 78, chalk, .8);
|
||||
line(x - 2, 74, x - 6, 78, chalk, .8);
|
||||
line(x - 1, 70, x - 6, 72, chalk, .8);
|
||||
line(x - 1, 70, x + 4, 72, chalk, .8);
|
||||
}
|
||||
{
|
||||
// the ball's way from one to the other: along the ground or lobbed
|
||||
std::vector<std::pair<double, double>> path;
|
||||
const double peak = values[4] ? 45 : 72;
|
||||
for (int i = 0; i <= 10; ++i) {
|
||||
const double t = i / 10.0;
|
||||
path.emplace_back((1 - t) * (1 - t) * 188 + 2 * (1 - t) * t * 201 + t * t * 215 + wobble(.2),
|
||||
(1 - t) * (1 - t) * 72 + 2 * (1 - t) * t * peak + t * t * 72 + wobble(.25));
|
||||
}
|
||||
stroke(path, chalk, .9, true);
|
||||
const double dy = values[4] ? 2.6 : 0;
|
||||
line(215, 72, 211.4, 72 - 2.1 - dy, chalk, .9);
|
||||
line(215, 72, 212.2 + dy, 72 + 2.3 - dy * 1.6, chalk, .9);
|
||||
}
|
||||
out << "</svg>";
|
||||
return out.str();
|
||||
}
|
||||
} // namespace bmh::modern_ui
|
||||
@@ -102,6 +102,6 @@ bool App::engine_sports_event(Rml::Event &event) {
|
||||
if (!change) return false;
|
||||
engine_tactics_draft_["values"][7] = value; last_tactic_ = 7;
|
||||
element("tactic-effort-value")->SetInnerRML(std::string(size_t(value), '!'));
|
||||
element("tactic-hint")->SetInnerRML(esc(engine_tactics_draft_.at("labels")[7].get<std::string>() + ": " + std::to_string(value) + " / " + std::to_string(engine_tactics_draft_.at("limits")[7].get<int>())));
|
||||
element("tactic-hint")->SetInnerRML("<strong>" + esc(engine_tactics_draft_.at("labels")[7].get<std::string>() + ": " + tactic_value_text(7, value, engine_tactics_draft_.at("limits")[7].get<int>())) + "</strong><span>" + esc(tactic_effect_text(7)) + "</span>");
|
||||
engine_sports_update(); dirty_ = true; return true;
|
||||
}
|
||||
@@ -388,6 +388,7 @@ bool App::live_action(const std::string &action, Rml::Element *target) {
|
||||
try {
|
||||
const int index = std::stoi(id);
|
||||
if (index < 0 || index > 7) return true;
|
||||
last_tactic_ = index;
|
||||
if (engine_live_running_) {
|
||||
// the next value of the engine's own range, wrapping to its lowest
|
||||
const auto &control = engine_live_tactics_.at(size_t(index));
|
||||
|
||||
@@ -8,14 +8,7 @@ std::string live_score_text(const Json &score) {
|
||||
}
|
||||
// A value of the engine's tactics board in words: the attitude (item 0, lowest = most
|
||||
// defensive), the commitment (item 7) and the numbered variants of the play patterns.
|
||||
std::string live_tactic_value(size_t index, int value, int maximum) {
|
||||
if (index == 0 && maximum == 3) {
|
||||
static const std::array<const char *, 4> attitude{"Sehr defensiv", "Defensiv", "Offensiv", "Sehr offensiv"};
|
||||
if (value >= 0 && value <= 3) return attitude[size_t(value)];
|
||||
}
|
||||
if (index == 7) return std::to_string(value) + " von " + std::to_string(maximum);
|
||||
return "Variante " + std::to_string(value + 1) + " von " + std::to_string(maximum + 1);
|
||||
}
|
||||
std::string live_tactic_value(size_t index, int value, int maximum) { return tactic_value_text(index, value, maximum); }
|
||||
const Json &live_match_by_id(const Json &rows, const Json &id) {
|
||||
|
||||
for (const auto &row : rows) if (row.at("id") == id) return row;
|
||||
@@ -112,13 +105,9 @@ std::string App::live_detail(const Json &owner, const Json &frame) {
|
||||
}
|
||||
if (live_tab_ == "tactics" && live_.running() && engine_live_tactics_.size() == 8) {
|
||||
std::string out = "<div class=\"live-context\"><h3>" + live_text("Taktik in diesem Spiel") + "</h3>";
|
||||
// the match engine reads the attitude (item 0) and the commitment (item 7); the play
|
||||
// patterns between them have no effect on a match and are not offered here
|
||||
for (size_t i = 0; i < engine_live_tactics_.size(); ++i)
|
||||
if (i == 0 || i == 7)
|
||||
out += "<div class=\"live-tactic-row\">" + live_text(engine_live_tactics_[i].at("label").get<std::string>()) +
|
||||
live_text(i == 0 && engine_live_assistant_ ? std::string("Assistent passt an") : live_tactic_value(i, engine_live_tactics_[i].at("value").get<int>(), engine_live_tactics_[i].at("max").get<int>())) + "</div>";
|
||||
out += "<p class=\"live-note\">" + live_text("Offensiver heißt mehr eigene Chancen und mehr Chancen für den Gegner. Mehr Einsatz bringt Druck nach vorn, aber auch mehr Karten und Verletzungen.") + "</p>";
|
||||
return out + btn("live-intervene-tactics", "Taktik ändern", "", "id=\"live-tactics-edit\"") + "</div>";
|
||||
}
|
||||
if (live_tab_ == "tactics" && recorded)
|
||||
@@ -181,9 +170,10 @@ std::string App::live_dialog_markup(const Json &owner) {
|
||||
const bool engine_board = live_.running() && engine_live_tactics_.size() == 8;
|
||||
const auto &values = engine_board ? live_dialog_draft_.at("values") : live_dialog_draft_.at("tactics").at("values");
|
||||
for (size_t i = 0; i < names.size(); ++i)
|
||||
if (!engine_board || i == 0 || i == 7)
|
||||
body += "<div class=\"live-tactic-row\">" + live_text(engine_board ? engine_live_tactics_[i].at("label").get<std::string>() : std::string(names[i])) + btn("live-tactic-cycle", engine_board ? live_tactic_value(i, values[i].get<int>(), engine_live_tactics_[i].at("max").get<int>()) : "Wert " + std::to_string(values[i].get<int>()), "", "id=\"live-tactic-" + std::to_string(i) + "\" data-id=\"" + std::to_string(i) + "\"") + "</div>";
|
||||
}
|
||||
if (live_dialog_ == "tactics" && live_.running() && engine_live_tactics_.size() == 8)
|
||||
body += "<p id=\"live-tactic-effect\">" + live_text(tactic_effect_text(size_t(std::clamp(last_tactic_, 0, 7)))) + "</p>";
|
||||
body += "<div class=\"live-dialog-actions\">" + btn("live-dialog-cancel", "Abbrechen", "", "id=\"live-dialog-cancel\"") +
|
||||
btn("live-dialog-apply", live_.running() ? (live_dialog_ == "lineup" ? "Wechsel ausführen" : "Taktik übernehmen") : "Demovorschau anzeigen", "", "id=\"live-dialog-apply\" " + std::string(live_dialog_ == "lineup" && (live_out_.empty() || live_in_.empty()) ? "disabled" : "")) + "</div>";
|
||||
return "<div class=\"live-dialog-layer\"><div id=\"live-dialog\" class=\"live-dialog\" role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"live-dialog-heading\">" + body + "</div></div>";
|
||||
|
||||
@@ -180,8 +180,10 @@ std::string App::render_tactics() {
|
||||
"data-input=\"tactic-effort\" min=\"" + std::to_string(engine_mode_ ? t.at("minima")[7].get<int>() : 0) + "\" max=\"" + std::to_string(limits[7]) + "\" step=\"1\" value=\"" +
|
||||
std::to_string(effort) +
|
||||
"\"/></div><p id=\"tactic-hint\" class=\"tactic-hint\">" +
|
||||
esc(names[size_t(last_tactic_)]) + ": " +
|
||||
(engine_mode_
|
||||
? "<strong>" + esc(names[size_t(last_tactic_)] + ": " + tactic_value_text(size_t(last_tactic_), t["values"][size_t(last_tactic_)].get<int>(), limits[size_t(last_tactic_)])) + "</strong><span>" + esc(tactic_effect_text(size_t(last_tactic_))) + "</span>"
|
||||
: esc(names[size_t(last_tactic_)]) + ": " +
|
||||
std::to_string(t["values"][size_t(last_tactic_)].get<int>()) + " / " +
|
||||
std::to_string(limits[size_t(last_tactic_)]) + "</p></div>";
|
||||
std::to_string(limits[size_t(last_tactic_)])) + "</p></div>";
|
||||
return body + (engine_mode_ ? engine_sports_footer() : "");
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#pragma once
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
namespace bmh::modern_ui {
|
||||
// A value of the engine's tactics board in words: the attitude (item 0, lowest = most
|
||||
// defensive), the six play settings (items 1-6) and the commitment (item 7).
|
||||
inline std::string tactic_value_text(size_t index, int value, int maximum) {
|
||||
static const std::array<std::array<const char *, 4>, 4> steps{{
|
||||
{"Sehr defensiv", "Defensiv", "Offensiv", "Sehr offensiv"},
|
||||
{"Durch die Mitte", "Eher durch die Mitte", "Eher über die Flügel", "Über die Flügel"},
|
||||
{"Kurzpassspiel", "Selten steil", "Oft steil", "Immer steil"},
|
||||
{"Kurz herausspielen", "Halblang", "Lang", "Weit nach vorn"}}};
|
||||
if (index < 4 && maximum == 3 && value >= 0 && value <= 3) return steps[index][size_t(value)];
|
||||
if (index == 4 && maximum == 1) return value ? "Hoch" : "Flach";
|
||||
if ((index == 5 || index == 6) && maximum == 1) return value ? "An" : "Aus";
|
||||
return std::to_string(value) + " von " + std::to_string(maximum);
|
||||
}
|
||||
// What a setting does in a match, in one sentence (the rule: play_shift in the match engine).
|
||||
inline std::string tactic_effect_text(size_t index) {
|
||||
static const std::array<const char *, 8> text{
|
||||
"Offensiver heißt mehr eigene Chancen und mehr Chancen für den Gegner.",
|
||||
"Flügelspiel lohnt sich als stärkere Mannschaft. Gegen stärkere Gegner geht der Ball außen verloren.",
|
||||
"Steilpässe wirken gegen offensive Gegner. Gegen tief stehende verpuffen sie.",
|
||||
"Lange Abschläge passen zu defensiver Ausrichtung, kurzes Herausspielen zu offensiver.",
|
||||
"Hoch bei nassem Platz und für konditionsstarke Mannschaften, flach für technisch starke auf trockenem Platz.",
|
||||
"Die Abseitsfalle hilft, wenn die Mannschaft offensiv steht. Bei defensiver Ausrichtung und gegen klar stärkere Gegner schadet sie.",
|
||||
"Pressing bringt eine Stunde lang mehr eigene Chancen und mehr Fouls. Danach ist die Mannschaft müde und der Gegner kommt häufiger durch.",
|
||||
"Mehr Einsatz bringt Druck nach vorn, aber auch mehr Karten und Verletzungen."};
|
||||
return index < text.size() ? text[index] : std::string();
|
||||
}
|
||||
} // namespace bmh::modern_ui
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "modern/ui/career_files.hpp"
|
||||
#include "modern/ui/live_match_info.hpp"
|
||||
#include "modern/ui/date_text.hpp"
|
||||
#include "modern/ui/tactic_text.hpp"
|
||||
#include "modern/ui/script_locator.hpp"
|
||||
#include "modern/ui/select_menu.hpp"
|
||||
#include "modern/ui/demo_calendar.hpp"
|
||||
@@ -876,7 +877,7 @@ class App final : public Rml::EventListener {
|
||||
if (auto *label = doc_->QuerySelector(".tactic-effort-label")) {
|
||||
const auto offset = std::to_string(int(std::round(2 * scale_)));
|
||||
label->SetProperty("font-effect",
|
||||
"shadow(" + offset + "px " + offset + "px #386824)");
|
||||
"shadow(" + offset + "px " + offset + "px #1b3329)");
|
||||
}
|
||||
}
|
||||
// Called after the stage was rebuilt: zoom in when it now shows a menu window.
|
||||
|
||||
Reference in new issue
Block a user