summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/zotdef.cc
diff options
context:
space:
mode:
authorChris Campbell <chriscampbell89@gmail.com>2014-05-01 11:25:46 +0100
committerChris Campbell <chriscampbell89@gmail.com>2014-05-09 05:30:22 +0100
commit82f6ad17de140911205a720b336cfa36603c8532 (patch)
treeeb6e2b8bb35965eba5d38a68452f94ad20130dae /crawl-ref/source/zotdef.cc
parent9e88b4757e9ef1b02dfbbdb8e026245897608b33 (diff)
downloadcrawl-ref-82f6ad17de140911205a720b336cfa36603c8532.tar.gz
crawl-ref-82f6ad17de140911205a720b336cfa36603c8532.zip
Remove decks of dungeons and a number of now-unused cards
Decks of dungeons were no longer gifted and only generated very rarely. Most of the cards in it (as well as some cards just removed from wonders) were either uninteresting or problematic for various reasons. The removed cards are Experience, Sage, Water, Glass, Trowel, Minefield.
Diffstat (limited to 'crawl-ref/source/zotdef.cc')
-rw-r--r--crawl-ref/source/zotdef.cc58
1 files changed, 58 insertions, 0 deletions
diff --git a/crawl-ref/source/zotdef.cc b/crawl-ref/source/zotdef.cc
index 139a8b7b5b..f8aceb37d6 100644
--- a/crawl-ref/source/zotdef.cc
+++ b/crawl-ref/source/zotdef.cc
@@ -7,6 +7,7 @@
#include "bitary.h"
#include "branch.h"
+#include "coordit.h"
#include "describe.h"
#include "directn.h"
#include "dungeon.h" // for Zotdef unique placement
@@ -1005,6 +1006,63 @@ bool create_zotdef_ally(monster_type mtyp, const char *successmsg)
return true;
}
+void zotdef_sage(int power)
+{
+ // how much to weight your skills
+ const int c = random2(10) + 1;
+
+ // FIXME: yet another reproduction of random_choose_weighted
+ // Ah for Python:
+ // skill = random_choice([x*(40-x)*c/10 for x in skill_levels])
+ int totalweight = 0;
+ skill_type result = SK_NONE;
+ for (int i = SK_FIRST_SKILL; i < NUM_SKILLS; ++i)
+ {
+ skill_type s = static_cast<skill_type>(i);
+ if (skill_name(s) == NULL || is_useless_skill(s))
+ continue;
+
+ if (you.skills[s] < MAX_SKILL_LEVEL)
+ {
+ // Choosing a skill is likelier if you are somewhat skilled in it.
+ const int curweight = 1 + you.skills[s] * (40 - you.skills[s]) * c;
+ totalweight += curweight;
+ if (x_chance_in_y(curweight, totalweight))
+ result = s;
+ }
+ }
+
+ if (result == SK_NONE)
+ mpr("You feel omnipotent."); // All skills maxed.
+ else
+ {
+ int xp = exp_needed(min<int>(you.max_level, 27) + 1)
+ - exp_needed(min<int>(you.max_level, 27));
+ xp = xp / 10 + random2(xp / 4);
+
+ // There may be concurrent sages for the same skill, with different
+ // bonus multipliers.
+ you.sage_skills.push_back(result);
+ you.sage_xp.push_back(xp);
+ you.sage_bonus.push_back(power / 25);
+ mprf(MSGCH_PLAIN, "You feel studious about %s.", skill_name(result));
+ dprf("Will redirect %d xp, bonus = %d%%\n", xp, (power / 25) * 2);
+ }
+}
+
+void zotdef_create_pond(const coord_def& center, int radius)
+{
+ for (radius_iterator ri(center, radius, C_ROUND, LOS_DEFAULT); ri; ++ri)
+ {
+ const coord_def p = *ri;
+ if (p != you.pos() && coinflip())
+ {
+ if (grd(p) == DNGN_FLOOR)
+ dungeon_terrain_changed(p, DNGN_SHALLOW_WATER);
+ }
+ }
+}
+
void zotdef_bosses_check()
{
if ((you.num_turns + 1) % ZOTDEF_CYCLE_LENGTH == 0)