summaryrefslogtreecommitdiff
path: root/src/game/unit_scientist.cpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2018-04-22 18:02:00 +0200
committerPaweł Redman <pawel.redman@gmail.com>2018-04-22 18:02:00 +0200
commitfb1988b1cd747c5f77583db827ac240dff2ed4be (patch)
tree4fa9850781fc87c1d264758119432770be564980 /src/game/unit_scientist.cpp
parent87422cff1507f8b5a8633eee5dadbadfef872dab (diff)
Add crystals as a currency.
Diffstat (limited to 'src/game/unit_scientist.cpp')
-rw-r--r--src/game/unit_scientist.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/game/unit_scientist.cpp b/src/game/unit_scientist.cpp
index bac2a23..129d7fa 100644
--- a/src/game/unit_scientist.cpp
+++ b/src/game/unit_scientist.cpp
@@ -57,6 +57,7 @@ void unit_scientist_t::gather_crystals(void)
world::trace_t trace;
bool found = true;
deco_t *deco;
+ size_t crystals;
if (!move.moving)
start_moving(gathering_at);
@@ -76,6 +77,11 @@ void unit_scientist_t::gather_crystals(void)
goto out;
}
+ crystals = game->prng.next() % 100 + 1;
+ game->crystals += crystals;
+ game->interface.print(name + " collected " + std::to_string(crystals) + " " +
+ (crystals == 1 ? "crystal" : "crystals"));
+
deco->type = DECO_CRYSTAL_BROKEN;
assets::scientist.gather.play_3d(x);