This needs flavour messages, and looks odd for large power because the undiggable stone of the level also gets turned into glass possibly resulting in huge areas of glass tiles.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3464 c06c8d41-db1a-0410-9941-cceddc491573
22YVHM74WBJNJE4PA5CBEUTDWM6FAGGGILI26A4LXAURX55TNRKAC
IOMAHHDYJ6P65ZZK4Q44YX2PEBZWBPB7ZOA3OKXPUBI5BRLRQ5JAC
B3HWU2BEQQ4E6WKVTW3JQQJFMWTVW3XWKY6BHFNBRHSZPRCF2OTQC
TO3JMTZO6ETZWBXPA75JLCFD7ML546WXBRLWHPKL44ZIQ2H5HW6QC
TS7AQYZVJ5KEACP4MZPD6CTASY27O75U6KL3BYXYDEQZXFGQIJSQC
VUP5G3CB6L5I5TPVWMM4KAMF6N4X6UPO4HQZKTSO2ETXZEFBMOMAC
HIRKGUMNJPWKSVTR6TVBPD3MWNA63CEHCLCIPWEMGDFHVB3NPLDQC
45CWQUPQHKUFUJ4MVL5K3KCVCCKLY2Z7RZWZ53UT723RV5STPSRAC
KFULGQQOHWUTXOM3BXCCYPGGVGGY4Z6265XUFRCBPNLTZAEHJZSQC
PHQHFM4FPVCJFW4BJRFC23IXIZOVN35O36YBDYW7ZF37IYWOMSDQC
5BJPWUPLJFS34FUTFJVKA4A52YMIGV6EWDXLNSDCWBJWBGVSQFGQC
IQGGFC563RBS7GDOACKCLXK752EE5RC3T6G5L6H446SXTMSA7T2AC
GQL5SIGBHLU3FMCE54XVGLRY5AZHRM6DUEB722REA2DPLGJSN6EQC
QS3ZRS3E6KL3YJHPKYEWCWJYRBJSXD5OOYF6Y25HZVECGPJRDB5QC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
5V47S4NNTHWTSAHV3YLO2VGH7JTUIYJ3GBPDN5ZM4UQALT2ZEXDQC
OONYLF4DAPLIYLBNNRW74IVT5BBTWI4XHQBXSNSPVRX3FTKJBTRAC
3KAINFIXO7WNWGUGZB43EUNFRS2ZPBLQZDTY456QACMRHYIJ7WDAC
bolt beam;
// Okay, now for the nicer stuff (note: these things are not
// necessarily nice):
god_acting gdact(GOD_XOM);
// This series of random calls produces a poisson-looking distribution:
// initial hump, plus a long-ish tail.
temp_rand = random2(4);
god_speaks(GOD_XOM,
(temp_rand == 0) ? "\"Go forth and destroy!\"" :
(temp_rand == 1) ? "\"Go forth and cause havoc, mortal!\"" :
(temp_rand == 2) ? "Xom grants you a minor favour."
: "Xom smiles on you.");
switch (random2(7))
{
case 0:
potion_effect(POT_HEALING, 150);
break;
case 1:
potion_effect(POT_HEAL_WOUNDS, 150);
break;
case 2:
potion_effect(POT_SPEED, 150);
break;
case 3:
potion_effect(POT_MIGHT, 150);
break;
case 4:
potion_effect(POT_INVISIBILITY, 150);
break;
case 5:
if (one_chance_in(6))
potion_effect(POT_EXPERIENCE, 150);
else
{
you.berserk_penalty = NO_BERSERK_PENALTY;
potion_effect(POT_BERSERK_RAGE, 150);
}
break;
case 6:
god_speaks(GOD_XOM, random_choose_string(
"\"Go forth and destroy!\"",
"\"Go forth and cause havoc, mortal!\"",
"Xom grants you a minor favour.",
"Xom smiles on you.", NULL));
potion_type type = (potion_type)random_choose(
POT_HEALING, POT_HEAL_WOUNDS, POT_SPEED, POT_MIGHT,
POT_INVISIBILITY, POT_BERSERK_RAGE, POT_EXPERIENCE, -1);
// downplay this one a bit
if (type == POT_EXPERIENCE && !one_chance_in(6))
type = POT_BERSERK_RAGE;
if (type == POT_BERSERK_RAGE)
temp_rand = random2(3);
god_speaks(GOD_XOM,
(temp_rand == 0) ? "\"Serve the mortal, my children!\"" :
(temp_rand == 1) ? "Xom grants you some temporary aid."
: "Xom momentarily opens a gate.");
god_speaks(GOD_XOM, random_choose_string(
"\"Serve the mortal, my children!\"",
"Xom grants you some temporary aid.",
"Xom momentarily opens a gate.", NULL));
temp_rand = random2(3);
god_speaks(GOD_XOM,
(temp_rand == 0) ? "\"Serve the mortal, my child!\"" :
(temp_rand == 1) ? "\"Serve the toy, my child!\"" :
"Xom opens a gate.");
god_speaks(GOD_XOM, random_choose_string(
"\"Serve the mortal, my child!\"",
"\"Serve the toy, my child!\"",
"Xom opens a gate.", NULL));
temp_rand = random2(4);
god_speaks(GOD_XOM,
(temp_rand == 0) ? "\"This might be better!\"" :
(temp_rand == 1) ? "\"Hum-dee-hum-dee-hum...\"" :
(temp_rand == 2) ?
"Xom's power touches on a nearby monster."
: "You hear Xom's avuncular chuckle.");
god_speaks(GOD_XOM, random_choose_string(
"\"This might be better!\"",
"\"Hum-dee-hum-dee-hum...\"",
"Xom's power touches on a nearby monster.",
"You hear Xom's avuncular chuckle.", NULL));
temp_rand = random2(4);
god_speaks(GOD_XOM,
(temp_rand == 0) ? "\"You need some minor adjustments, mortal!\"" :
(temp_rand == 1) ? "\"Let me alter your pitiful body.\"" :
(temp_rand == 2) ? "Xom's power touches on you for a moment."
: "You hear Xom's maniacal cackling.");
if (you.is_undead)
goto try_again;
god_speaks(GOD_XOM, random_choose_string(
"\"You need some minor adjustments, mortal!\"",
"\"Let me alter your pitiful body.\"",
"Xom's power touches on you for a moment.",
"You hear Xom's maniacal cackling.", NULL));
temp_rand = random2(3);
god_speaks(GOD_XOM,
(temp_rand == 0) ? "Xom grants you a demonic assistant."
: (temp_rand == 1) ? "Xom grants you a demonic servitor."
: "Xom opens a gate.");
god_speaks(GOD_XOM, random_choose_string(
"Xom grants you a demonic assistant.",
"Xom grants you a demonic servitor.",
"Xom opens a gate.", NULL));
temp_rand = random2(4);
god_speaks(GOD_XOM,
(temp_rand == 0) ? "Xom almost notices you." :
(temp_rand == 1) ? "Xom's attention almost turns to you for a moment.":
(temp_rand == 2) ? "Xom's power almost touches on you for a moment."
: "You almost hear Xom's maniacal laughter.");
god_speaks(GOD_XOM, random_choose_string(
"Xom almost notices you.",
"Xom's attention almost turns to you for a moment.",
"Xom's power almost touches on you for a moment.",
"You almost hear Xom's maniacal laughter.", NULL));
temp_rand = random2(4);
god_speaks(GOD_XOM,
(temp_rand == 0) ? "Xom notices you." :
(temp_rand == 1) ? "Xom's attention turns to you for a moment.":
(temp_rand == 2) ? "Xom's power touches on you for a moment."
: "You hear Xom's maniacal laughter.");
god_speaks(GOD_XOM, random_choose_string(
"Xom notices you.",
"Xom's attention turns to you for a moment.",
"Xom's power touches on you for a moment.",
"You hear Xom's maniacal laughter.", NULL));
temp_rand = random2(4);
god_speaks(GOD_XOM,
(temp_rand == 0) ? "\"Suffer!\"" :
(temp_rand == 1) ? "Xom's malign attention turns to you for a moment." :
(temp_rand == 2) ? "Xom's power touches on you for a moment."
: "You hear Xom's maniacal laughter.");
god_speaks(GOD_XOM, random_choose_string(
"\"Suffer!\"",
"Xom's malign attention turns to you for a moment.",
"Xom's power touches on you for a moment.",
"You hear Xom's maniacal laughter.", NULL));
temp_rand = random2(4);
god_speaks(GOD_XOM,
(temp_rand == 0) ? "Xom notices you." :
(temp_rand == 1) ? "Xom's attention turns to you for a moment.":
(temp_rand == 2) ? "Xom's power touches on you for a moment."
: "You hear Xom's maniacal laughter.");
god_speaks(GOD_XOM, random_choose_string(
"Xom notices you.",
"Xom's attention turns to you for a moment.",
"Xom's power touches on you for a moment.",
"You hear Xom's maniacal laughter.", NULL));
temp_rand = random2(4);
god_speaks(GOD_XOM,
(temp_rand == 0) ? "\"You need some minor improvements, mortal!\"" :
(temp_rand == 1) ? "\"Let me alter your body.\"" :
(temp_rand == 2) ? "Xom's power brushes against you for a moment."
: "You hear Xom's avuncular chuckle.");
if (you.is_undead)
goto try_again;
god_speaks(GOD_XOM, random_choose_string(
"\"You need some minor improvements, mortal!\"",
"\"Let me alter your body.\"",
"Xom's power brushes against you for a moment.",
"You hear Xom's avuncular chuckle.", NULL));
temp_rand = random2(4);
god_speaks(GOD_XOM,
(temp_rand == 0) ? "\"This might be better!\"" :
(temp_rand == 1) ? "\"Hum-dee-hum-dee-hum...\"" :
(temp_rand == 2) ? "Xom's power touches on a nearby monster."
: "You hear Xom's avuncular chuckle.");
god_speaks(GOD_XOM, random_choose_string(
"\"This might be better!\"",
"\"Hum-dee-hum-dee-hum...\"",
"Xom's power touches on a nearby monster.",
"You hear Xom's avuncular chuckle.", NULL));
temp_rand = random2(4);
god_speaks(GOD_XOM,
(temp_rand == 0) ? "\"You have displeased me, mortal.\"" :
(temp_rand == 1) ? "\"You have grown too confident for your meagre worth.\"" :
(temp_rand == 2) ? "Xom's power touches on you for a moment."
: "You hear Xom's maniacal laughter.");
if (you.is_undead)
goto try_again;
god_speaks(GOD_XOM, random_choose_string(
"\"You have displeased me, mortal.\"",
"\"You have grown too confident for your meagre worth.\"",
"Xom's power touches on you for a moment.",
"You hear Xom's maniacal laughter.", NULL));
temp_rand = random2(4);
god_speaks(GOD_XOM,
(temp_rand == 0) ? "\"Time to have some fun!\"" :
(temp_rand == 1) ? "\"Fight to survive, mortal.\"" :
(temp_rand == 2) ? "\"Let's see if it's strong enough to survive yet.\""
: "You hear Xom's maniacal laughter.");
god_speaks(GOD_XOM, random_choose_string(
"\"Time to have some fun!\"",
"\"Fight to survive, mortal.\"",
"\"Let's see if it's strong enough to survive yet.\"",
"You hear Xom's maniacal laughter.", NULL));
temp_rand = random2(4);
god_speaks(GOD_XOM,
(temp_rand == 0) ? "\"Try this!\"" :
(temp_rand == 1) ? "Xom's attention turns to you.":
(temp_rand == 2) ? "Xom's power touches on you."
: "Xom giggles.");
god_speaks(GOD_XOM, random_choose_string(
"\"Try this!\"",
"Xom's attention turns to you.",
"Xom's power touches on you.",
"Xom giggles.", NULL));
temp_rand = random2(3);
god_speaks(GOD_XOM,
(temp_rand == 0) ? "\"You have grown too comfortable in your little world, mortal!\"" :
(temp_rand == 1) ? "Xom casts you into the Abyss!"
: "The world seems to spin as Xom's maniacal laughter rings in your ears.");
god_speaks(GOD_XOM, random_choose_string(
"\"You have grown too comfortable in your little world, mortal!\"",
"Xom casts you into the Abyss!",
"The world seems to spin as Xom's maniacal laughter rings in your ears.", NULL));
// Chooses one of the strings passed in at random. The list of strings
// must be terminated with NULL.
const char* random_choose_string(const char* first, ...)
{
va_list args;
va_start(args, first);
const char* chosen = first;
int count = 1, nargs = 100;
while (nargs-- > 0)
{
char* pick = va_arg(args, char*);
if (pick == NULL)
break;
if (one_chance_in(++count))
chosen = pick;
}
ASSERT(nargs > 0);
va_end(args);
return (chosen);
}
}
void vitrify_area(int radius)
{
const int radius2 = radius * radius;
for ( int x = X_BOUND_1; x <= X_BOUND_2; ++x )
{
for ( int y = Y_BOUND_1; y <= Y_BOUND_2; ++y )
{
if ( distance(x,y,you.x_pos,you.y_pos) < radius2 )
{
if ( grd[x][y] == DNGN_ROCK_WALL )
grd[x][y] = DNGN_CLEAR_ROCK_WALL;
else if ( grd[x][y] == DNGN_STONE_WALL )
grd[x][y] = DNGN_CLEAR_STONE_WALL;
else if ( grd[x][y] == DNGN_PERMAROCK_WALL )
grd[x][y] = DNGN_CLEAR_PERMAROCK_WALL;
}
}
}
int radius2;
if ( power_level == 2 )
radius2 = 1000000;
else
{
radius2 = random2(power/40) + 2;
radius2 *= radius2;
}
for ( int x = X_BOUND_1; x <= X_BOUND_2; ++x )
{
for ( int y = Y_BOUND_1; y <= Y_BOUND_2; ++y )
{
if ( distance(x,y,you.x_pos,you.y_pos) < radius2 )
{
if ( grd[x][y] == DNGN_ROCK_WALL )
grd[x][y] = DNGN_CLEAR_ROCK_WALL;
else if ( grd[x][y] == DNGN_STONE_WALL )
grd[x][y] = DNGN_CLEAR_STONE_WALL;
else if ( grd[x][y] == DNGN_PERMAROCK_WALL )
grd[x][y] = DNGN_CLEAR_PERMAROCK_WALL;
}
}
}
const int radius = ( power_level == 2 ) ? 1000 : random2(power/40) + 2;
vitrify_area(radius);