summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-place.cc
diff options
context:
space:
mode:
authorSteve Melenchuk <smelenchuk@gmail.com>2014-04-02 12:42:40 -0600
committerSteve Melenchuk <smelenchuk@gmail.com>2014-05-07 18:23:20 -0600
commitb9ac4c953e9d5fae3bc23dde3f999218d396f804 (patch)
tree8548ca2b3ea15399b239c2fa493c6cd1c9908019 /crawl-ref/source/mon-place.cc
parent35db536519c705528e4f8bf41851e58502ceb4f5 (diff)
downloadcrawl-ref-b9ac4c953e9d5fae3bc23dde3f999218d396f804.tar.gz
crawl-ref-b9ac4c953e9d5fae3bc23dde3f999218d396f804.zip
Gozag: prelimiary implementation of Bribe Branch.
Spend 3000 gold for a chance of temporarily turning some of the inhabitants of a branch good neutral, or possibly even friendly. Bribes are only effective against newly generated monsters (i.e. on level creation or monsters that spawn afterwards); the fund times out over time and more quickly with the number of enemies affected, upon which neutral enemies turn hostile again; friendly followers will continue to follow the player subject to occasional follow-up payments.
Diffstat (limited to 'crawl-ref/source/mon-place.cc')
-rw-r--r--crawl-ref/source/mon-place.cc46
1 files changed, 46 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-place.cc b/crawl-ref/source/mon-place.cc
index 72b9e28957..064694dd4a 100644
--- a/crawl-ref/source/mon-place.cc
+++ b/crawl-ref/source/mon-place.cc
@@ -24,6 +24,7 @@
#include "externs.h"
#include "options.h"
#include "ghost.h"
+#include "godabil.h"
#include "lev-pand.h"
#include "libutil.h"
#include "losglobal.h"
@@ -1797,6 +1798,51 @@ static monster* _place_monster_aux(const mgen_data &mg, const monster *leader,
if (mon->type == MONS_TWISTER && !dont_place)
_place_twister_clouds(mon);
+ if (!(mg.flags & MG_FORCE_BEH) && !crawl_state.game_is_arena())
+ {
+ // Try to bribe the monster.
+ const int bribability = gozag_type_bribable(mon->type);
+ if (bribability > 0 && x_chance_in_y(bribability, 16))
+ {
+ bool minion = mg.flags & MG_BAND_MINION;
+ const branch_type br = gozag_bribable_branch(mon->type);
+ int cost = max(1, exper_value(mon) / 20);
+
+ if (minion)
+ {
+ const monster* sum = mg.summoner->as_monster();
+ if (sum && sum->has_ench(ENCH_PERMA_BRIBED))
+ {
+ gozag_deduct_bribe(br, 2*cost);
+ mon->add_ench(ENCH_PERMA_BRIBED);
+ }
+ else if (sum && sum->has_ench(ENCH_BRIBED))
+ {
+ gozag_deduct_bribe(br, cost);
+ // Don't continue if we exhausted our funds.
+ if (branch_bribe[br] > 0)
+ mon->add_ench(ENCH_BRIBED);
+ }
+ }
+ else
+ {
+ // Sometimes get permanent followers at twice the cost.
+ if (branch_bribe[br] > 2*cost && one_chance_in(3))
+ {
+ gozag_deduct_bribe(br, 2*cost);
+ mon->add_ench(ENCH_PERMA_BRIBED);
+ }
+ else
+ {
+ gozag_deduct_bribe(br, cost);
+ // Don't continue if we exhausted our funds.
+ if (branch_bribe[br] > 0)
+ mon->add_ench(ENCH_BRIBED);
+ }
+ }
+ }
+ }
+
return mon;
}