summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/unit_scientist.cpp24
-rw-r--r--src/game/unit_soldier.cpp16
2 files changed, 32 insertions, 8 deletions
diff --git a/src/game/unit_scientist.cpp b/src/game/unit_scientist.cpp
index 8319aaa..537539e 100644
--- a/src/game/unit_scientist.cpp
+++ b/src/game/unit_scientist.cpp
@@ -27,7 +27,7 @@ static std::string scientist_name(procgen::prng_t *prng)
"Дмитрий", "Иосиф", "Иван", "Пётр", "Юрий"
};
- ss << "проф. ";
+ ss << "Проф. ";
ss << names[prng->next() % (sizeof(names) / sizeof(names[0]))];
return ss.str();
@@ -51,6 +51,23 @@ unit_scientist_t::unit_scientist_t(game::state_t *game) : unit_t(game, UNIT_SCIE
health = max_health = 15;
}
+static std::string russian_plural(size_t count, const char *nom_sg, const char *gen_sg,
+ const char *gen_pl)
+{
+ const char *word;
+
+ if (count >= 10 && count < 20)
+ word = gen_sg;
+ else if (count % 10 == 1)
+ word = nom_sg;
+ else if (count % 10 >= 2 && count % 10 < 5)
+ word = gen_sg;
+ else
+ word = gen_pl;
+
+ return std::to_string(count) + " " + word;
+}
+
void unit_scientist_t::gather_crystals(void)
{
rectf_t rect;
@@ -77,10 +94,9 @@ void unit_scientist_t::gather_crystals(void)
goto out;
}
- crystals = 75;
+ crystals = game->prng.next() % 60 + 25;
game->crystals += crystals;
- game->interface.print(name + " collected " + std::to_string(crystals) + " " +
- (crystals == 1 ? "crystal" : "crystals"));
+ say("Я собрал " + russian_plural(crystals, "кристалл", "кристалла", "кристаллов") + ".");
deco->type = DECO_CRYSTAL_BROKEN;
assets::scientist.gather.play_3d(x);
diff --git a/src/game/unit_soldier.cpp b/src/game/unit_soldier.cpp
index 969075a..0e58d0c 100644
--- a/src/game/unit_soldier.cpp
+++ b/src/game/unit_soldier.cpp
@@ -62,6 +62,11 @@ unit_soldier_t::unit_soldier_t(game::state_t *game) : unit_t(game, UNIT_SOLDIER)
storage.max_grenades = 3;
}
+std::string german_plural(size_t count, const char *sg, const char *pl)
+{
+ return std::to_string(count) + " " + (count == 1 ? sg : pl);
+}
+
static v2f_t spread_aim(v2f_t x, v2f_t aim, float cof, procgen::prng_t *prng)
{
float r, r_, dth;
@@ -116,7 +121,7 @@ void unit_soldier_t::fire_shotgun(v2f_t aim)
if (!storage.shells) {
next_attack = game->time + SEC(1);
- say("Keine Munition mehr!");
+ say("Keine Schrotpatronen mehr!");
return;
}
@@ -306,15 +311,18 @@ void unit_soldier_t::command_restock(bool grenades)
if (grenades)
say("Ich konnte keine Granaten finden.");
else
- say("Ich konnte keine Munition finden.");
+ say("Ich konnte keine Schrotpatronen finden.");
return;
}
- if (grenades)
+ if (grenades) {
storage.grenades += taken;
- else
+ say("Ich habe " + german_plural(taken, "Granate", "Granaten") + " abgenommen." );
+ } else {
storage.shells += taken;
+ say("Ich habe " + german_plural(taken, "Schrotpatrone", "Schrotpatronen") + " abgenommen." );
+ }
}
void unit_soldier_t::render_to(render::state_t *render)