git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5267 c06c8d41-db1a-0410-9941-cceddc491573
VIFZ6DO6GWJGYMXJZKFZ2JYNPHNE74H3OFAOCPISQG7M7A4LCOHAC
XKKLLU7B6AMFPCH5CZRWEC43IQJCER5BZISYGD2DTQS4T6MFWWAAC
EFWEYIB2R3DPD3JWIPU6LS6SFLPMYN7J7X4GBZR7DJWKHJ3UELSAC
SVY2PTCLXR3KNPQAWXVXTTGCC5DR334HOAKHYO3VDDRWM2BWMALAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
5KJCHLIUFKRPMIVWUAYT6EOF7SW4PTQF6Y5OPEFWXGLE7DUGYLZAC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
5BJPWUPLJFS34FUTFJVKA4A52YMIGV6EWDXLNSDCWBJWBGVSQFGQC
5HJJGIOOIIQNCRIL33ZQAY6S57MPTSTG27UETJW3HE3BUUPUKPQAC
}
item_def *find_floor_item(object_class_type cls, int sub_type)
{
int item = NON_ITEM;
for (int y = 0; y < GYM; ++y)
for (int x = 0; x < GXM; ++x)
{
item = igrd[x][y];
while (item != NON_ITEM)
{
item_def &i(mitm[item]);
if (is_valid_item(i) && i.base_type == cls
&& i.sub_type == sub_type)
return (&i);
item = i.link;
}
}
return (NULL);
// Returns the roll to use to check if we want to create an abyssal rune.
static int _abyssal_rune_roll()
{
if (you.attribute[ATTR_ABYSSAL_RUNES])
return (-1);
// The longer the player's hung around in the Abyss, the more
// likely the rune. Never generate a new rune if the player
// already found one, but make the Abyssal rune eligible for
// generation again if the player loses it.
// If the player leaves the Abyss turns_on_level resets to 0. So
// hang in there if you want your Abyssal rune fix quick. :P
// Worshippers of Lugonu with decent piety will attract the rune
// to themselves.
const bool lugonu_favoured =
(you.religion == GOD_LUGONU && !player_under_penance()
&& you.piety > 120);
const int cutoff = lugonu_favoured ? 50 : 500;
const int scale = lugonu_favoured ? 10 : 40;
const int odds =
std::max(200 - std::max((env.turns_on_level - cutoff) / scale, 0), 6);
#ifdef DEBUG_ABYSS
mprf(MSGCH_DIAGNOSTICS, "Abyssal rune odds: 1 in %d", odds);
#endif
return (odds);
}