git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1789 c06c8d41-db1a-0410-9941-cceddc491573
SS6MUIJYTGIVBYU356Z563QJWLJ47QNHSJWS7GJTS7EATZH2ESJQC
SWOYPTHJAWFEDBMB3ROT33VQZIXGZD5UOXEV456DDUENW2HGA66QC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
CQ24AVAI6SW3AHTIDMLPSTRRBEU6FHRF5I5FD6G5QIYE6PO4BQMQC
WHY6LRRJ5T2NSBE3IUCR4X3TOAH7TTK5NPUPUIFT7TPNJ6J4HBDAC
4HATGRJJE7Q6LXHJ3ZGYTNBLG542KAUEK6ERKARIYRKRWY6VTDKQC
DTO3EUKWHZ5RJNGNCFYXSOVTIPVXPP637F2W7WFGYKJ7JK7VNKNQC
3KAINFIXO7WNWGUGZB43EUNFRS2ZPBLQZDTY456QACMRHYIJ7WDAC
JP7SVXCIKEPVDD4Q5CDYDATPK7X5XOYW3T6QK2Y6EWHFH52LBK3QC
// first create item
const 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 ( slot == -1 )
continue;
item_def& item = mitm[slot];
set_item_ego_type( item, OBJ_WEAPONS, SPWPN_ORC_SLAYING );
// manually override plusses
item.plus = random2(3);
item.plus2 = random2(3);
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 );
// let the player see that he's being attacked by
// orc slayers
set_ident_flags( item, ISFLAG_KNOW_TYPE );
// 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_created++;
// hand item information over to monster
if (mons != -1)
{
menv[mons].inv[MSLOT_WEAPON] = slot;
num_created++;
// 50% chance of weapon disappearing on "death"
if (coinflip())
menv[mons].flags |= MF_HARD_RESET;
}
// 50% chance of weapon disappearing on "death"
if (coinflip())
menv[mons].flags |= MF_HARD_RESET;
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;
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;
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))
{
num_followers++;
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 )
{
monsters *monster = &menv[targ_monst];
if ( mons_species(monster->type) == MONS_ORC
&& monster->attitude == ATT_FRIENDLY
&& (monster->flags & MF_CONVERT_ATTEMPT))
{
num_followers++;
}
}
}
}
}
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 (reconvert) // maybe all of them invisible
{
std::string mesg = god_name(GOD_BEOGH);
mesg += " booms out: \"Who do you think you are?\"";
god_speaks(GOD_BEOGH, mesg.c_str());
std::string how_many;
if (num_reconvert == 1 and num_followers > 1)
how_many = "One of your";
else if (num_reconvert == num_followers)
how_many = "Your";
else
how_many = "Some of your";
snprintf(info, INFO_SIZE, "%s follower%s decide%s to abandon you.",
how_many.c_str(),
(num_reconvert > 1) ? "s" : "",
(num_reconvert > 1) ? "" : "s");
mpr(info, MSGCH_MONSTER_ENCHANT);
return 1;
std::ostream& chan = msg::streams(MSGCH_MONSTER_ENCHANT);
if (num_reconvert == 1 && num_followers > 1)
chan << "One of your followers decides to abandon you.";
else
{
if (num_reconvert == num_followers)
chan << "Your";
else
chan << "Some of your";
chan << " followers decide to abandon you.";
}
chan << std::endl;
return true;