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AWU7FUJE5VZDZV66365DLBLLK64T557E7NDEMKXQC
RGGANRTOXB5K2HRQGK2F4XFZJVZSWOLVWFXZVVFEQQPO64Z4SQ7QC
DP6XLMKLDC42SWISM7WKLJFTJTRZ3BKTRS7DWUQWLLP3DR4UUGZAC
PHBACPMH3F34GODHVDKNCMXWU373RJQGVTDLBFCCDLLWDXVYOLTAC
22YVHM74WBJNJE4PA5CBEUTDWM6FAGGGILI26A4LXAURX55TNRKAC
KO7PZNWIRLSAPOXUHK7U446ZXT562QCPIT3AYFYKPG7OWRLNBU4QC
KPSCSVGHKEQ4ENM3QQU2U3GYMV52NDFO5L6ML7YDPUKV3365OA3QC
5MGUZD2UACJCSG74TEZHI3Z4YL5KL6ZVUCQ3XVZKDOLKM7EMGWJAC
3BYUIM6LIJXLXBFPOHP7GMXZTICP522CRFSVEKUCBOHLRW7XC3KAC
6YMXFO4BZAMBWHSVWS2FTO2D7EGABBK4NPCSCAN4ELFHEYTWGXVAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
KYVZGUJXV23ELA4CKPVQZO3NTJCODXMCWYAZJYWVWJVLPETNHLGQC
AVFOHOY7UBYKRKWU5MYDZ4JNB3E3Z23GPHJI23ICIQCJ4I3OV4IAC
UVJBHQ5KGUIEFRHKTYQPKSXYDUDKTRAXINUXGJJJ6QGNCR6JO7ZAC
NUYGFMQOZK32XUFTDPGTZ25L7JGOU532S2D4MELYJB5GQL7KNGOAC
W2KRIXSCRJPS6WDIYTHVF5IRMF3V5DWECRAWUPVTB7VZ6A2BLD4QC
HQ6VH4IA7QMX6LG44K5EJGDWAQJLSSJBX7URJG5URZCSNFJLOM4AC
return (you.piety > 160) ? "A beloved toy of Xom." :
(you.piety > 145) ? "A favourite toy of Xom." :
(you.piety > 130) ? "A very special toy of Xom." :
(you.piety > 115) ? "A special toy of Xom." :
if (you.gift_timeout < 1)
return "A BORING thing.";
else
return (you.piety > 180) ? "A beloved toy of Xom." :
(you.piety > 160) ? "A favourite toy of Xom." :
(you.piety > 140) ? "A very special toy of Xom." :
(you.piety > 120) ? "A special toy of Xom." :
(you.piety > 85) ? "A plaything of Xom." :
(you.piety > 70) ? "A special plaything of Xom." :
(you.piety > 55) ? "A very special plaything of Xom." :
(you.piety > 40) ? "A favourite plaything of Xom."
(you.piety > 80) ? "A plaything of Xom." :
(you.piety > 60) ? "A special plaything of Xom." :
(you.piety > 40) ? "A very special plaything of Xom." :
(you.piety > 20) ? "A favourite plaything of Xom."
void xom_tick()
{
// Xom semi-randomly drifts your piety.
int delta;
const char *origfavour = describe_xom_favour();
const bool good = you.piety > (MAX_PIETY / 2);
int size = abs(you.piety - 100);
delta = (x_chance_in_y(511, 1000) ? 1 : -1);
size += delta;
you.piety = (MAX_PIETY / 2) + (good ? size : -size);
const char *newfavour = describe_xom_favour();
if (strcmp(origfavour, newfavour))
{
// Dampen oscillation across announcement boundaries.
size += delta * 8;
you.piety = (MAX_PIETY / 2) + (good ? size : -size);
}
// ...but he gets bored...
if (one_chance_in(2))
you.gift_timeout--;
newfavour = describe_xom_favour();
if (strcmp(origfavour, newfavour)) {
char buf[8192];
strcpy(buf, "Your title is now: ");
strcat(buf, newfavour);
god_speaks( you.religion, buf );
}
if (you.gift_timeout == 1)
simple_god_message(" is getting BORED.");
if (one_chance_in(20))
xom_acts(abs(you.piety - 100));
}
// Returns a demon suitable for use in Xom's punishments, filtering out
// the really nasty ones early on.
static monster_type _xom_random_punishment_demon(int sever)
{
monster_type demon = MONS_PROGRAM_BUG;
do
demon = _xom_random_demon(sever);
while ((demon == MONS_HELLION
&& you.experience_level < 12
&& !one_chance_in(3 + (12 - you.experience_level) / 2)));
return (demon);
}
monsters *monster;
for (unsigned i = 0; i < MAX_MONSTERS; i++)
{
monster = &menv[i];
if (monster->type == -1 || !mons_near(monster) || mons_wont_attack(monster) || one_chance_in(20))
continue;
if (monster->add_ench(mon_enchant(ENCH_CONFUSION, 0, KC_FRIENDLY, random2(sever))))
{
if (!done)
god_speaks(GOD_XOM, _get_xom_speech("confusion").c_str());
done = true;
if (player_monster_visible( monster ))
simple_monster_message(monster, " looks rather confused.");
}
}
}
else if (x_chance_in_y(5, sever))
{
// player_angers_monster() will turn the monster against you
// only if the monster hates your religion. No monsters hate
// Xom-religion, so this will only have an effect if you are not
// currently a worshipper of Xom, e.g. if you just abandoned him
// or if you drew a Card of Xom or something.
else if (x_chance_in_y(9, sever))
else if (x_chance_in_y(10, sever) && (you.level_type != LEVEL_ABYSS))
{
// rearrange the pieces -- blink every monster on this level and the player
// Every now and then, Xom also confuses them all.
bool confusem = one_chance_in(10);
// Not just every monster in sight -- oh no. Every monster on this level!
monsters *monster;
for (unsigned i = 0; i < MAX_MONSTERS; i++)
{
monster = &menv[i];
if (monster->type == -1)
continue;
if (monster_blink(monster))
{
if (!done)
god_speaks(GOD_XOM, _get_xom_speech("rearrange the pieces").c_str());
done = true;
if (confusem)
if (monster->add_ench(mon_enchant(ENCH_CONFUSION, 0, KC_FRIENDLY, random2(sever))))
if (player_monster_visible( monster ))
simple_monster_message(monster, " looks rather confused.");
}
// If he blinked at least one monster, blink the player too and this act is considered "done".
if (done)
random_blink(false);
}
}
else if (x_chance_in_y(11, sever) && (you.level_type != LEVEL_ABYSS))
{
// The Xom teleportation train takes you on instant teleportation to
// a few random areas, stopping randomly but mostly likely in an area
// that is not dangerous to you.
god_speaks(GOD_XOM, _get_xom_speech("teleportation journey").c_str());
do {
you_teleport_now(false);
more();
if (one_chance_in(10))
break;
} while (x_chance_in_y(3, 4) || player_in_a_dangerous_place());
done = true;
}
else if (x_chance_in_y(12, sever))
// The Xom teleportation train takes you on instant teleportation to
// a few random areas, stopping if an area is dangerous to you or
// randomly stopping.
god_speaks(GOD_XOM, _get_xom_speech("teleportation journey").c_str());
do {
you_teleport_now(false);
more();
} while (x_chance_in_y(3, 4) && !player_in_a_dangerous_place());
done = true;
}
else if (x_chance_in_y(8, sever))
{
else if (x_chance_in_y(10, sever))
else if (x_chance_in_y(11, sever))
{
std::string speech = _get_xom_speech("confusion");
if (confuse_player(random2(sever)+1, false)) {
done = true;
// Well, sometimes Xom gets carried away and starts confusing other
// creatures too.
if (coinflip()) {
monsters* monster;
for (unsigned i = 0; i < MAX_MONSTERS; i++) {
monster = &menv[i];
if (monster->type == -1 || !mons_near(monster) || one_chance_in(20))
continue;
if (monster->add_ench(mon_enchant(ENCH_CONFUSION, 0, KC_FRIENDLY, random2(sever)))) {
if (player_monster_visible( monster ))
simple_monster_message(monster, " looks rather confused.");
}
}
}
}
}
else if (x_chance_in_y(12, sever))
{
// Xom semi-randomly drifts your piety.
int delta;
const char *origfavour = describe_xom_favour();
const bool good = you.piety > (MAX_PIETY / 2);
int size = abs(you.piety - 100);
delta = (x_chance_in_y(511, 1000) ? 1 : -1);
size += delta;
you.piety = (MAX_PIETY / 2) + (good ? size : -size);
const char *newfavour = describe_xom_favour();
if (strcmp(origfavour, newfavour))
{
// Dampen oscillation across announcement boundaries.
size += delta * 2;
you.piety = (MAX_PIETY / 2) + (good ? size : -size);
}
// ...but he gets bored... (I re-use gift_timeout for this
// instead of making a separate field because I don't want
// to learn how to save and restore a new field). In this
// usage, the "gift" is the gift you give to Xom of
// something interesting happening.
if (you.gift_timeout == 1)
{
simple_god_message(" is getting BORED.");
you.gift_timeout = 0;
}
else if (you.gift_timeout > 1)
you.gift_timeout -= random2(2);
if (one_chance_in(20))
xom_acts(abs(you.piety - 100));
xom_tick();
Xom is a wild and unpredictable God of chaos, who seeks not worshippers but playthings to toy with. Many choose to follow Xom in the hope of receiving fabulous rewards and mighty powers, but Xom is nothing if not capricious.
Xom is a wild and unpredictable God of chaos, who seeks not worshippers but playthings with which to toy. Many choose to follow Xom in the hope of receiving fabulous rewards and mighty powers, but Xom is nothing if not capricious.