git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5592 c06c8d41-db1a-0410-9941-cceddc491573
VIDWXDHI4PJJ7EMJIYWZBNFKGEJTJLFFZBY5ER4M2ZJXLVWMV4BQC
GCYAMDQEKNSIITXQG5DSMDUDEVC7L45XT44XIGW7O2WIZDPXVNOAC
N3NXT75G2JYKVON7ZTE3TG34BBWITCL2HHVQ6H7QREYCDTVQFSGAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
GPEJOT73KMACP33IPAKFR5ROGHCOIP22VXZMQNYTGLEA2OSZUM2AC
IE3INS4WUXZOBVXB5VWRBYPVPXADD2U2W5H3TBTOYNWJ3EGRSGQQC
X5WLJCJVW55SXZVP7IKP7ADCJIGNKN4PKAXFECVR6TNK7XSMZR7QC
HHKRUVC6WMVKQRUQRYB5VAEDXUS6TMAKO7BSTBGVVL2AUOEBFUJAC
// but restricted so that the situation doesn't get too gross.
// Each of these will explode for 3d20 damage. -- bwr
if (num > 8)
num = 8;
bool summoned = false;
for (int i = 0; i < num; i++)
{
int tx = -1, ty = -1;
for (int j = 0; j < 10; j++)
{
if (!random_near_space( you.x_pos, you.y_pos, tx, ty, true, true)
&& distance( you.x_pos, you.y_pos, tx, ty ) <= 5)
{
break;
}
}
// if we fail, we'll try the ol' summon next to player trick.
if (tx == -1 || ty == -1)
{
tx = you.x_pos;
ty = you.y_pos;
}
int mon =
mons_place(
mgen_data( MONS_BALL_LIGHTNING, BEH_FRIENDLY, 0,
coord_def(tx, ty) ));
if (mon != -1)
{
menv[mon].add_ench(ENCH_SHORT_LIVED);
summoned = true;
}
}
if (summoned)
mpr( "You create some ball lightning!" );
else
canned_msg( MSG_NOTHING_HAPPENS );
}
}
else
canned_msg(MSG_NOTHING_HAPPENS);
return (success);
}
bool cast_conjure_ball_lightning(int pow, bool god_gift)
{
bool success = false;
// Restricted so that the situation doesn't get too gross. Each of
// these will explode for 3d20 damage. -- bwr
const int how_many = std::min(8, 3 + random2(2 + pow / 50));
for (int i = 0; i < how_many; ++i)
{
int tx = -1, ty = -1;
for (int j = 0; j < 10; ++j)
{
if (!random_near_space(you.x_pos, you.y_pos, tx, ty, true, true)
&& distance(you.x_pos, you.y_pos, tx, ty) <= 5)
{
break;
}
}
// If we fail, we'll try the ol' summon next to player trick.
if (tx == -1 || ty == -1)
{
tx = you.x_pos;
ty = you.y_pos;
}
int monster =
mons_place(
mgen_data(MONS_BALL_LIGHTNING, BEH_FRIENDLY, 0,
coord_def(tx, ty), MHITNOT,
god_gift ? MF_GOD_GIFT : 0));
if (monster != -1)
{
success = true;
menv[monster].add_ench(ENCH_SHORT_LIVED);
}