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DQFAEQGQUZJHFWXJC7ZKG2WURZGL566UDM4YXFSWQC
// for followers of Beogh, decide whether orcs will join you
if (mons_species(monster->type) == MONS_ORC
&& you.religion == GOD_BEOGH
&& !(monster->flags & MF_CONVERT_ATTEMPT)
// && !mons_is_unique(monster->type) // does not work on Blork
&& monster->foe == MHITYOU
&& mons_player_visible(monster) && !mons_is_sleeping(monster)
&& !mons_is_confused(monster) && !mons_is_paralysed(monster))
{
monster->flags |= MF_CONVERT_ATTEMPT;
int hd = monster->hit_dice;
if (you.piety >= 75 && !you.penance[GOD_BEOGH] &&
random2(you.piety/9) > random2(hd) + hd + random2(5))
{
int wpn = you.equip[EQ_WEAPON];
if (wpn != -1
&& you.inv[wpn].base_type == OBJ_WEAPONS
&& get_weapon_brand( you.inv[wpn] ) == SPWPN_ORC_SLAYING
&& coinflip()) // 50% chance of conversion failing
{
snprintf(info, INFO_SIZE, "%s flinches from your weapon.",
monster->name(DESC_CAP_THE).c_str());
mpr(info);
continue;
}
if (player_monster_visible(monster)) // show reaction
{
std::string reaction;
switch (random2(3))
{
case 1: reaction = " stares at you in amazement and kneels.";
break;
case 2: reaction = " relaxes his fighting stance and smiles at you.";
break;
default: reaction = " falls on his knees before you.";
}
snprintf(info, INFO_SIZE, "%s%s",
monster->name(DESC_CAP_THE).c_str(),reaction.c_str());
mpr(info, MSGCH_MONSTER_ENCHANT);
if (random2(3))
{
switch (random2(4))
{
case 0: reaction = "shouts, \"I'll follow thee gladly!\"";
break;
case 1: reaction = "shouts, \"Surely Beogh must have sent you!\"";
break;
case 2: reaction = "asks, \"Are you our saviour?\"";
break;
default: reaction = "says, \"I'm so glad you are here now.\"";
}
snprintf(info, INFO_SIZE, "He %s", reaction.c_str());
mpr(info, MSGCH_TALK);
}
}
monster->attitude = ATT_FRIENDLY;
monster->behaviour = BEH_GOD_GIFT; // alternative to BEH_FRIENDLY
// not really "created" friendly, but should it become
// hostile later on, it won't count as a good kill
monster->flags |= MF_CREATED_FRIENDLY;
monster->flags |= MF_GOD_GIFT;
}
}
else if (mons_species(monster->type) == MONS_ORC
&& you.species == SP_HILL_ORC
&& !(you.religion == GOD_BEOGH)
// && monster->foe == MHITYOU
&& monster->attitude == ATT_FRIENDLY
&& (monster->flags & MF_CONVERT_ATTEMPT)
&& (monster->flags & MF_GOD_GIFT)
&& mons_player_visible(monster) && !mons_is_sleeping(monster)
&& !mons_is_confused(monster) && !mons_is_paralysed(monster))
{ // reconversion if no longer Beogh
monster->attitude = ATT_HOSTILE;
monster->behaviour = BEH_HOSTILE;
// CREATED_FRIENDLY stays -> no piety bonus on killing these
// give message only sometimes
if (player_monster_visible(monster) && random2(4))
{
snprintf(info, INFO_SIZE, "%s deserts you.",
monster->name(DESC_CAP_THE).c_str());
mpr(info, MSGCH_MONSTER_ENCHANT);
}
} // end of Beogh routine
for (loopy = 0; loopy < 5; loopy++)
divine_hurt += random2( you.experience_level );
if (!player_under_penance() && you.piety > random2(400))
{
snprintf(info, INFO_SIZE, "Mortal, I have averted the wrath "
"of %s... this time.", god_name(GOD_BEOGH));
god_speaks(you.religion, info);
}
else
{
simple_god_message( " smites you!", god );
ouch( divine_hurt, 0, KILLED_BY_BEOGH_SMITING );
dec_penance( GOD_BEOGH, 1 );
}
break;
// taken from makeitem.cc and spells3.cc:
case 2: // send out one or two dancing weapons of orc slaying (12.5%)
{
// check num of (hostile) orcs around
int num_wpn = 0;
for (int i=0 ;i <= random2(2); i++)
{
bool created = false;
// first create item
int it = get_item_slot();
if (it != NON_ITEM)
{
item_def &item = mitm[it];
item.quantity = 1;
item.base_type = OBJ_WEAPONS;
// any melee weapon
item.sub_type = WPN_CLUB + random2(13);
set_item_ego_type( item, OBJ_WEAPONS, SPWPN_ORC_SLAYING );
// just how good should this weapon be?
item.plus = random2(3);
item.plus2 = random2(3);
if (coinflip())
item.flags |= ISFLAG_CURSED;
set_ident_type( item.base_type, item.sub_type, ID_KNOWN_TYPE );
// for debugging + makes things more interesting
// (doesn't seem to have any effect, though)
set_ident_flags( item, ISFLAG_KNOW_PLUSES );
set_ident_flags( item, ISFLAG_IDENT_MASK );
// now create monster
int mons = create_monster( MONS_DANCING_WEAPON, 0,
BEH_HOSTILE, you.x_pos, you.y_pos, MHITYOU, 250 );
// hand item information over to monster
if (mons != -1 && mons != NON_MONSTER)
{
mitm[it] = item;
mitm[it].quantity = 1;
mitm[it].x = 0;
mitm[it].y = 0;
mitm[it].link = NON_ITEM;
menv[mons].inv[MSLOT_WEAPON] = it;
created = true;
num_wpn++;
if (coinflip()) // 50% chance of weapon disappearing on "death"
menv[mons].flags |= MF_HARD_RESET;
}
}
if (!created) // didn't work out! delete item
{
mitm[it].base_type = OBJ_UNASSIGNED;
mitm[it].quantity = 0;
}
}
if (num_wpn > 0)
{
snprintf(info, INFO_SIZE, " throws %s of orc slaying at you.",
num_wpn > 1 ? "implements" : "an implement");
simple_god_message(info, god);
break;
} // else fall through
}
default: // send orcs after you (5/8)
{
int points = you.experience_level * 2 + 3
+ random2(you.experience_level * 3);
// "natural" bands
if (points >= 30) // min: lvl 6, always: lvl 15
punisher = MONS_ORC_HIGH_PRIEST;
else if (points >= 24) // min: lvl 5, always: lvl 11
punisher = MONS_ORC_KNIGHT;
else if (points >= 18) // min: lvl 4, always: lvl 8
punisher = MONS_ORC_WARLORD;
else if (points >= 12) // min: lvl 2, always: lvl 5
punisher = MONS_ORC_WARRIOR;
else
punisher = MONS_ORC;
int mons = create_monster(punisher, 0, BEH_HOSTILE, you.x_pos,
you.y_pos, MHITYOU, 250, true);
if (mons != -1 && mons != NON_MONSTER)
simple_god_message(" sends forth an army of orcs.", god);
else
simple_god_message(" is still gathering forces against you.", god);
/*
success = false;
int count = 0;
int points = 3 + you.experience_level * 3;
// artificial choice of band members
while (points > 0 || count <= 1)
{
if (points > 30 && coinflip())
{
// quick reduction for large values
punisher = MONS_ORC_HIGH_PRIEST;
points -= 25;
break;
}
else
{
switch (random2(15))
{
case 0: //(1/15)
punisher = MONS_ORC_SORCERER;
points -= 20;
break;
case 1: //(1/15)
punisher = MONS_ORC_WARLORD;
points -= 18;
break;
case 2: //(1/15)
punisher = MONS_ORC_KNIGHT;
points -= 15;
break;
case 3:
case 4: //(2/15)
punisher = MONS_ORC_WARRIOR;
points -= 10;
break;
case 5:
case 6:
case 7: //(1/5)
punisher = MONS_ORC_PRIEST;
points -= 7;
break;
case 8:
case 9: //(2/15)
punisher = MONS_ORC_WIZARD;
punisher -= 5;
break;
default: //(1/3)
punisher = MONS_ORC;
points -= 3;
}
}
int mons = create_monster(punisher, 0, BEH_HOSTILE,
you.x_pos, you.y_pos, MHITYOU, 250);
if (mons != -1 && mons != NON_MONSTER)
{
count++;
success = true;
// just to make sure
menv[mons].flags |= MF_CONVERT_ATTEMPT;
}
}
if (success)
{
std::string army_size;
if (count > 5)
army_size = "an army of";
else
army_size = "some";
snprintf(info, INFO_SIZE, " sends forth %s orcs.", army_size.c_str());
simple_god_message(info, god);
}
else
simple_god_message(" is still gathering forces against you.", god);
*/
}
break;
}
break;
// upon excommunication, (now ex) Beogh adepts lose their orcish followers
int followers_abandon_you()
{
int ystart = you.y_pos - 9, xstart = you.x_pos - 9;
int yend = you.y_pos + 9, xend = you.x_pos + 9;
if ( xstart < 0 ) xstart = 0;
if ( ystart < 0 ) ystart = 0;
if ( xend >= GXM ) xend = GXM;
if ( ystart >= GYM ) yend = GYM;
bool reconvert = false;
int num_reconvert = 0;
std::vector<const monsters *> mons;
// monster check
for ( int y = ystart; y < yend; ++y )
{
for ( int x = xstart; x < xend; ++x )
{
const unsigned char targ_monst = mgrd[x][y];
if ( targ_monst != NON_MONSTER )
{
struct monsters *monster = &menv[targ_monst];
if ( mons_species(monster->type) == MONS_ORC
&& monster->attitude == ATT_FRIENDLY
&& (monster->flags & MF_CONVERT_ATTEMPT))
{
if (mons_player_visible(monster)
&& !mons_is_confused(monster)
&& !mons_is_paralysed(monster))
{
monster->attitude = ATT_HOSTILE;
monster->behaviour = BEH_HOSTILE;
// for now CREATED_FRIENDLY stays
if (player_monster_visible(monster))
{
num_reconvert++; // only visible ones
}
reconvert = true;
}
}
}
}
}
if (reconvert) // maybe all of them invisible
{
snprintf(info, INFO_SIZE, "%s booms out: \"Who do you think you are?\"",
god_name(GOD_BEOGH));
god_speaks(GOD_BEOGH, info);
if (num_reconvert > 0)
{
snprintf(info, INFO_SIZE, "Your follower%s decide%s to abandon you.",
(num_reconvert > 1) ? "s" : "", (num_reconvert > 1) ? "" : "s");
mpr(info, MSGCH_MONSTER_ENCHANT);
return 1;
}
}
return 0;
}
case GOD_BEOGH:
simple_god_message( " does not appreciate desertion!", old_god );
followers_abandon_you(); // check if friendly orcs around -> hostile
// Penance has to come before retribution to prevent "mollify"
inc_penance( old_god, 50 );
divine_retribution( old_god );
break;
// an additional bonus for Beogh worshippers
if (you.religion == GOD_BEOGH && !you.penance[GOD_BEOGH])
{
if (you.piety >= 120)
racial_bonus *= 6;
else if (you.piety >= 100)
racial_bonus *= 5;
else if (you.piety >= 75)
racial_bonus *= 4;
else if (you.piety >= 50)
racial_bonus *= 3;
else if (you.piety >= 30)
racial_bonus *= 2;
}
case GOD_BEOGH:
description = "Beogh is a deity worshipped by the cave orcs native to parts of the dungeon." EOL
"Only proper orcs may devote their service to Beogh, proving their devotion " EOL
"with kills and remnants. Pious orcs may gain the priestly power of smiting. " EOL
"Also, there are rumours that the orcs still look out for their Messiah. ";
break;
case GOD_BEOGH:
cprintf ( (you.piety >= 120) ? "Saint" :
(you.piety >= 100) ? "High Priest" :
(you.piety >= 75) ? "Missionary" :
(you.piety >= 50) ? "Priest" :
(you.piety >= 30) ? "Disciple" :
(you.piety > 5) ? "Believer"
: "Sinner" );
break;