sight, a la Beogh and orcs; the more pious the follower is, the greater the chance (piety > random2(200)). Additional chances to turn holy beings neutral come up when the follower works off all penance or gains a new piety level.
The neutrality check will fail half the time if the follower wields an evil weapon, and if the follower switches to an evil god, all neutral and friendly holy beings will turn hostile.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3397 c06c8d41-db1a-0410-9941-cceddc491573
PEXHYCLRKDG2PVOJ3DDCMUZUK2HTSPU5WKH4MODFL4FTBQRQTY5QC
IR6KD4I2DWCXMZ6ANWMHCHCBN35S4FELVAAC36MLAQ3XL6SY6ILAC
LZUTEJNAVTXSZJX35HC4VIHNIHPCJ7WNQUNWB2SUE6IY7A5HAC7AC
BWHU47MJ7KAVKMKMRBVYLOHUCASSNVCGPC3SPMNBAC7DLI6XX2YQC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
PFEJ4LMDNEKLMGRCMWQ7EIRVU4JMYGICI4G7X4WVWOROVXQCBZ7QC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
MG6LLF3XYCOEBQRX7TJ4MUTKM3IROYWUMZGCMYVW4TGDG36CJMJQC
XMX2Y7QSEXGV2SPDOFDNM2BQJH3S3WTMYLJYUREYV72NWTURHMSQC
V4DWL5WBO2JCODVS5QQNWXDH4DAYZN3D5V3UDCHM2KKOMADOTEDQC
P52QVYEFQXNK6IXNN2EMZIBLOIHHGQ7LODWIGWPJLANGVIPQK5IAC
CQ24AVAI6SW3AHTIDMLPSTRRBEU6FHRF5I5FD6G5QIYE6PO4BQMQC
2SU35FKBXMKAYJY76OXAC55R6JWTSHQSHBNBR3ICWUQREJME2ZSAC
SWOYPTHJAWFEDBMB3ROT33VQZIXGZD5UOXEV456DDUENW2HGA66QC
RRNEVUYOK5S4M4QH77N34IXSSNUXVQAIZQLXAQKQCRITMPUKGP6AC
NLQNXH3SVJ52CWXEV35FSSZP32VHC4QFGN3HINF4KO5GZHZMOBKQC
J6APXOT4QOGQFONWB7G546VTVF6QG42HVOROMHF7YBDJPR4K26OAC
static void good_god_follower_convert(monsters *monster)
{
if (you.is_undead || you.species == SP_DEMONSPAWN)
return;
const bool is_holy = mons_class_holiness(monster->type) == MH_HOLY;
// for followers of good gods, decide whether holy beings will be
// neutral towards you
if (is_good_god(you.religion)
&& monster->foe == MHITYOU
&& !(monster->flags & MF_CONVERT_ATTEMPT)
&& is_holy
&& !mons_neutral(monster)
&& !mons_friendly(monster)
&& mons_player_visible(monster) && !mons_is_sleeping(monster)
&& !mons_is_confused(monster) && !mons_is_paralysed(monster)
&& !mons_is_caught(monster))
{
monster->flags |= MF_CONVERT_ATTEMPT;
if (you.piety > random2(200) && !you.penance[you.religion])
{
int wpn = you.equip[EQ_WEAPON];
if (wpn != -1
&& you.inv[wpn].base_type == OBJ_WEAPONS
&& is_evil_weapon( you.inv[wpn] )
&& coinflip()) // 50% chance of conversion failing
{
msg::stream << monster->name(DESC_CAP_THE)
<< " glares at your weapon."
<< std::endl;
return;
}
good_god_convert_holy(monster);
stop_running();
}
}
else if (is_holy
&& is_evil_god(you.religion)
&& (monster->attitude == ATT_NEUTRAL
|| monster->attitude == ATT_FRIENDLY)
&& (monster->flags & MF_CONVERT_ATTEMPT)
&& mons_player_visible(monster) && !mons_is_sleeping(monster)
&& !mons_is_confused(monster) && !mons_is_paralysed(monster)
&& !mons_is_caught(monster))
{ // reconversion if evil god
monster->attitude = ATT_HOSTILE;
behaviour_event(monster, ME_ALERT, MHITYOU);
// CREATED_FRIENDLY stays -> no piety bonus on killing these
// give message only sometimes
if (player_monster_visible(monster) && random2(4))
{
msg::streams(MSGCH_MONSTER_ENCHANT)
<< monster->name(DESC_CAP_THE)
<< " turns against you."
<< std::endl;
}
}
}
}
static bool holy_beings_on_level_reconvert()
{
bool success = false;
for ( int i = 0; i < MAX_MONSTERS; ++i )
{
monsters *monster = &menv[i];
if (monster->type != -1
&& mons_class_holiness(monster->type) == MH_HOLY)
{
#ifdef DEBUG_DIAGNOSTICS
mprf(MSGCH_DIAGNOSTICS, "Reconverting: %s on level %d, branch %d",
monster->name(DESC_PLAIN).c_str(),
static_cast<int>(you.your_level),
static_cast<int>(you.where_are_you));
#endif
// If you worship a good god, you get another chance to make
// hostile holy beings neutral.
if (is_good_god(you.religion))
{
if ((monster->flags & MF_CONVERT_ATTEMPT)
&& monster->attitude == ATT_HOSTILE)
{
monster->flags &= ~MF_CONVERT_ATTEMPT;
success = true;
}
}
// If you worship an exil god, you make all neutral and
// friendly holy beings hostile.
if (is_evil_god(you.religion))
{
if (monster->attitude == ATT_NEUTRAL ||
monster->attitude == ATT_FRIENDLY)
{
monster->attitude = ATT_HOSTILE;
monster->behaviour = BEH_HOSTILE;
// for now CREATED_FRIENDLY stays
success = true;
}
}
}
}
return success;
}
static bool holy_beings_reconvert()
{
return apply_to_all_dungeons(holy_beings_on_level_reconvert);
chan << std::endl;
if (!one_chance_in(3))
{
std::ostream& tchan = msg::streams(MSGCH_TALK);
tchan << holy->pronoun(PRONOUN_CAP) << " ";
switch (random2(3))
{
case 0:
tchan << "shouts, \"Continue thy quest, mortal!\"";
break;
case 1:
tchan << "says, \"Forge ahead, servant of "
<< god_name(you.religion) << "!\"";
break;
case 2:
tchan << "says, \"Carry on, mortal.\"";
break;
}
tchan << std::endl;
}
}
void good_god_convert_holy(monsters *holy)
{
ASSERT(mons_class_holiness(holy->type) == MH_HOLY);
if (player_monster_visible(holy)) // show reaction
{
std::ostream& chan = msg::streams(MSGCH_MONSTER_ENCHANT);
chan << holy->name(DESC_CAP_THE);
good_god_holy_being_conversion_speech(chan, holy);
}
holy->attitude = ATT_NEUTRAL;
// to avoid immobile "followers"
behaviour_event(holy, ME_ALERT, MHITNOT);
// When you leave one of the good gods for an evil god, you make
// all neutral and friendly holy beings hostile.
if (you.penance[GOD_ZIN] || you.penance[GOD_SHINING_ONE] ||
you.penance[GOD_ELYVILON])
{
if (holy_beings_reconvert())
mpr("The divine host forsakes you.", MSGCH_MONSTER_ENCHANT);
}