diff options
author | Steve Melenchuk <smelenchuk@gmail.com> | 2014-03-31 18:45:47 -0600 |
---|---|---|
committer | Steve Melenchuk <smelenchuk@gmail.com> | 2014-05-07 18:23:18 -0600 |
commit | ffe63d874a0e8ecfab8e25ddce347c9d42ef8c2f (patch) | |
tree | 3430ea8e6ef063f6ecca01f30e2a8799c8c67f46 /crawl-ref/source/main.cc | |
parent | 985d96caa06b0afcde7e323a159828a871d83d11 (diff) | |
download | crawl-ref-ffe63d874a0e8ecfab8e25ddce347c9d42ef8c2f.tar.gz crawl-ref-ffe63d874a0e8ecfab8e25ddce347c9d42ef8c2f.zip |
Gozag: charge a service fee for joining.
The base portion of the fee is 100 gold, down from 300 in the proposal;
this is based on initial feedback that the fee was too high.
Diffstat (limited to 'crawl-ref/source/main.cc')
-rw-r--r-- | crawl-ref/source/main.cc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc index d0fa0e0efa..5117af5cf4 100644 --- a/crawl-ref/source/main.cc +++ b/crawl-ref/source/main.cc @@ -229,6 +229,7 @@ static void _god_greeting_message(bool game_start); static void _take_starting_note(); static void _startup_hints_mode(); static void _set_removed_types_as_identified(); +static void _count_all_gold(); static void _compile_time_asserts(); @@ -418,6 +419,7 @@ NORETURN static void _launch_game() init_hints_options(); _set_removed_types_as_identified(); + _count_all_gold(); if (!game_start && you.prev_save_version != Version::Long) { @@ -669,6 +671,46 @@ static void _set_removed_types_as_identified() you.type_ids[OBJ_POTIONS][POT_SLOWING] = ID_KNOWN_TYPE; } +// Count gold generated on all levels. +// Needed for calculating Gozag's service fee. +static void _count_all_gold() +{ + if (crawl_state.game_is_arena() || you.attribute[ATTR_GOLD_GENERATED] > 0) + return; + + vector<PlaceInfo> list = you.get_all_place_info(true, false); + for (unsigned int i = 0; i < list.size(); i++) + { + for (int j = 1; j <= brdepth[list[i].branch]; j++) + { + level_id lid(list[i].branch, j); + if (is_existing_level(lid)) + { + level_excursion le; + le.go_to(lid); + for (rectangle_iterator ri(0); ri; ++ri) + { + for (stack_iterator k(*ri); k; ++k) + { + if (k->base_type != OBJ_GOLD) + continue; + + you.attribute[ATTR_GOLD_GENERATED] += k->quantity; + } + if (monster* mons = monster_at(*ri)) + { + if (mons->inv[MSLOT_GOLD] != NON_ITEM) + { + you.attribute[ATTR_GOLD_GENERATED] + += mitm[mons->inv[MSLOT_GOLD]].quantity; + } + } + } + } + } + } +} + #ifdef WIZARD static void _do_wizard_command(int wiz_command, bool silent_fail) { |