summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-ench.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-ench.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-ench.cc')
-rw-r--r--crawl-ref/source/mon-ench.cc71
1 files changed, 68 insertions, 3 deletions
diff --git a/crawl-ref/source/mon-ench.cc b/crawl-ref/source/mon-ench.cc
index 7356c192d5..0941d69675 100644
--- a/crawl-ref/source/mon-ench.cc
+++ b/crawl-ref/source/mon-ench.cc
@@ -151,8 +151,12 @@ bool monster::add_ench(const mon_enchant &ench)
if (new_enchantment)
add_enchantment_effect(ench);
- if (ench.ench == ENCH_CHARM)
+ if (ench.ench == ENCH_CHARM
+ || ench.ench == ENCH_BRIBED
+ || ench.ench == ENCH_PERMA_BRIBED)
+ {
this->align_avatars(true);
+ }
return true;
}
@@ -258,6 +262,8 @@ void monster::add_enchantment_effect(const mon_enchant &ench, bool quiet)
break;
case ENCH_CHARM:
+ case ENCH_BRIBED:
+ case ENCH_PERMA_BRIBED:
behaviour = BEH_SEEK;
target = you.pos();
foe = MHITYOU;
@@ -617,6 +623,59 @@ void monster::remove_enchantment_effect(const mon_enchant &me, bool quiet)
behaviour_event(this, ME_EVAL);
break;
+ case ENCH_PERMA_BRIBED:
+ // Only demand further payment if you can see the player.
+ if (you_worship(GOD_GOZAG))
+ {
+ if (!you.can_see(this))
+ {
+ add_ench(mon_enchant(ENCH_PERMA_BRIBED, 1, NULL,
+ 20 * BASELINE_DELAY));
+ break;
+ }
+ else
+ {
+ string monname = name(DESC_THE);
+ const int cost = fuzz_value(exper_value(this), 15, 15) / 10;
+ mprf("%s demands further payment of %d gold.", monname.c_str(),
+ cost);
+ if (you.gold >= cost)
+ {
+ string prompt = make_stringf("Pay %s demand of %d gold?",
+ apostrophise(monname).c_str(),
+ cost);
+ if (yesno(prompt.c_str(), false, 0))
+ {
+ mprf("%s seems mollified.", monname.c_str());
+ you.gold -= cost;
+ add_ench(ENCH_PERMA_BRIBED);
+ break;
+ }
+ }
+ else
+ mpr("You cannot afford to meet that demand!");
+ }
+ }
+ // deliberate fall-through
+ case ENCH_BRIBED:
+ if (!quiet)
+ simple_monster_message(this, " is no longer bribed.");
+
+ if (you.can_see(this))
+ {
+ // and fire activity interrupts
+ interrupt_activity(AI_SEE_MONSTER,
+ activity_interrupt_data(this, SC_UNCHARM));
+ }
+
+ if (is_patrolling())
+ patrol_point.reset();
+ mons_att_changed(this);
+
+ // Reevaluate behaviour.
+ behaviour_event(this, ME_EVAL);
+ break;
+
case ENCH_CORONA:
case ENCH_SILVER_CORONA:
if (!quiet)
@@ -1070,7 +1129,8 @@ void monster::timeout_enchantments(int levels)
case ENCH_BLIND: case ENCH_WORD_OF_RECALL: case ENCH_INJURY_BOND:
case ENCH_FLAYED: case ENCH_BARBS:
case ENCH_AGILE: case ENCH_FROZEN: case ENCH_EPHEMERAL_INFUSION:
- case ENCH_BLACK_MARK: case ENCH_SAP_MAGIC:
+ case ENCH_BLACK_MARK: case ENCH_SAP_MAGIC: case ENCH_BRIBED:
+ case ENCH_PERMA_BRIBED:
lose_ench_levels(i->second, levels);
break;
@@ -1286,6 +1346,7 @@ void monster::apply_enchantment(const mon_enchant &me)
case ENCH_FROZEN:
case ENCH_EPHEMERAL_INFUSION:
case ENCH_SAP_MAGIC:
+ case ENCH_PERMA_BRIBED:
// case ENCH_ROLLING:
decay_enchantment(en);
break;
@@ -2169,7 +2230,8 @@ static const char *enchant_names[] =
#endif
"poison_vuln", "icemail", "agile",
"frozen", "ephemeral_infusion", "black_mark", "grand_avatar",
- "sap magic", "shroud", "phantom_mirror", "buggy",
+ "sap magic", "shroud", "phantom_mirror", "bribed", "permabribed",
+ "buggy",
};
static const char *_mons_enchantment_name(enchant_type ench)
@@ -2440,6 +2502,9 @@ int mon_enchant::calc_duration(const monster* mons,
case ENCH_FROZEN:
cturn = 3 * BASELINE_DELAY;
break;
+ case ENCH_PERMA_BRIBED:
+ cturn = 10000 / _mod_speed(25, mons->speed);
+ break;
default:
break;
}