summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/godwrath.cc
diff options
context:
space:
mode:
authorSteve Melenchuk <smelenchuk@gmail.com>2014-04-02 21:25:48 -0600
committerSteve Melenchuk <smelenchuk@gmail.com>2014-05-07 18:23:20 -0600
commit3d55e912dc5df60344645ce6a092257dd1948264 (patch)
tree26a2858be1bcbaaaf756a6a2ab87a83f6d1f14d8 /crawl-ref/source/godwrath.cc
parentba5a6485e52823b2a6082f18ee3487e280ad51a2 (diff)
downloadcrawl-ref-3d55e912dc5df60344645ce6a092257dd1948264.tar.gz
crawl-ref-3d55e912dc5df60344645ce6a092257dd1948264.zip
Gozag wrath: counter-bribe.
When you spot monsters, Gozag can incite them against you, granting them one of a handful of beneficial effects.
Diffstat (limited to 'crawl-ref/source/godwrath.cc')
-rw-r--r--crawl-ref/source/godwrath.cc49
1 files changed, 49 insertions, 0 deletions
diff --git a/crawl-ref/source/godwrath.cc b/crawl-ref/source/godwrath.cc
index 4296db2dde..1ca5705748 100644
--- a/crawl-ref/source/godwrath.cc
+++ b/crawl-ref/source/godwrath.cc
@@ -24,6 +24,7 @@
#include "libutil.h"
#include "message.h"
#include "misc.h"
+#include "mon-behv.h"
#include "mon-cast.h"
#include "mon-util.h"
#include "mon-pick.h"
@@ -47,6 +48,7 @@
#include "state.h"
#include "transform.h"
#include "shout.h"
+#include "view.h"
#include "xom.h"
#include <sstream>
@@ -1749,3 +1751,50 @@ void ash_reduce_penance(int amount)
if (new_pen < you.penance[GOD_ASHENZARI])
dec_penance(GOD_ASHENZARI, you.penance[GOD_ASHENZARI] - new_pen);
}
+
+void gozag_incite(monster *mon)
+{
+ ASSERT(!mon->wont_attack());
+
+ behaviour_event(mon, ME_ALERT, &you);
+
+ bool success = false;
+
+ if (coinflip() && mon->needs_berserk(false))
+ {
+ mon->go_berserk(false);
+ success = true;
+ }
+ else
+ {
+ int tries = 3;
+ do
+ {
+ switch(random2(3))
+ {
+ case 0:
+ if (mon->has_ench(ENCH_MIGHT))
+ break;
+ enchant_monster_with_flavour(mon, mon, BEAM_MIGHT);
+ success = true;
+ break;
+ case 1:
+ if (mon->has_ench(ENCH_HASTE))
+ break;
+ enchant_monster_with_flavour(mon, mon, BEAM_HASTE);
+ success = true;
+ break;
+ case 2:
+ if (mon->invisible() || you.can_see_invisible())
+ break;
+ enchant_monster_with_flavour(mon, mon, BEAM_INVISIBILITY);
+ success = true;
+ break;
+ }
+ }
+ while (!success && --tries > 0);
+ }
+
+ if (success)
+ view_update_at(mon->pos());
+}