Some code reindenting and housekeeping.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1587 c06c8d41-db1a-0410-9941-cceddc491573
YATODO2EN3AW7IXW5PL25HHK34YHF6Y32QBMOUZXEATZZ4YQQWZQC
WW6THKR7JN447YC23YYHYYNH7ABMCFFSECNUFTIJBZX6JHX6W7TAC
CQ24AVAI6SW3AHTIDMLPSTRRBEU6FHRF5I5FD6G5QIYE6PO4BQMQC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
KFULGQQOHWUTXOM3BXCCYPGGVGGY4Z6265XUFRCBPNLTZAEHJZSQC
2Q3P7FHAAZRJ337GTR2ZLD72ECBUDJ42MROKVCNKNDV6CGMQOSYAC
6L4EP4ZRWWYLT55PD5KTTJON5J2JB5VV5MWNHF5VPZQZ5BKEYZ4QC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
YHSVOROKPYS33Y4RYZRVZTE3G5LXOFX52HEDNLV6HIXOJYNOKH3QC
34C4U6EQWERY75GZJKUCM5KVGU2OUICETS5LGZF6RMKMZT4R5SQAC
43ZTEB57FU7KE5EVMYWZONNVJBZCGF3JEAJZIY25LC4LGE65PG5QC
T3V75V2CMAABSOXKSGCC6ZTI2WBKSVSGUEF2QAGM2BWLVRIL6SQQC
RISMOCQM6BKK4XSIRKYLOBB2UPDYJNDAL6OGIIR5GGNZQAK5YSZAC
R22TTMI6WXWULC7ODKFF3QCB7MOTETQQ6IR4BUCUPOCQKQNCTT5AC
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);
}
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);
}
case 0: // smiting (25%)
case 1:
divine_hurt = 10 + random2(10);
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));
case 0: // smiting (25%)
case 1:
divine_hurt = 10 + random2(10);
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));
}
else
{
simple_god_message( " smites you!", god );
ouch( divine_hurt, 0, KILLED_BY_BEOGH_SMITING );
dec_penance( GOD_BEOGH, 1 );
}
break;
}
else
{
simple_god_message( " smites you!", god );
ouch( divine_hurt, 0, KILLED_BY_BEOGH_SMITING );
dec_penance( GOD_BEOGH, 1 );
}
break;
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++)
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)
bool created = false;
// first create item
int it = get_item_slot();
if (it != NON_ITEM)
{
item_def &item = mitm[it];
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);
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);
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 );
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 );
// 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++;
// 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++;
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)
{
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)
{
// "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;
// "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;
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;
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);
break;
}
}
god_type str_to_god(std::string god)
{
if (god.empty())
return (GOD_NO_GOD);
lowercase(god);
if (god == "random")
return (GOD_RANDOM);
for (int i = GOD_NO_GOD; i < NUM_GODS; ++i)
{
if (lowercase_string(god_name(static_cast<god_type>(i))) == god)
return (static_cast<god_type>(i));
}
return (GOD_NO_GOD);
if (field == "zin")
priest = GOD_ZIN;
else if (field == "yredelemnul")
priest = GOD_YREDELEMNUL;
else if (field == "random")
priest = str_to_god(field);
if (!is_priest_god(priest))
}
static god_type str_to_god(const std::string &god)
{
if (god.empty())
return GOD_NO_GOD;
for (int i = GOD_NO_GOD; i < NUM_GODS; ++i)
{
if (god_name(static_cast<god_type>(i)) == god)
return (static_cast<god_type>(i));
}
return (GOD_NO_GOD);