1.) If Beogh can't find a nearby follower in LOS to bless, try again without the LOS restriction (but still nearby). If this also fails, recall a small amount of followers (1 + rnd(4) + rnd(4)) on the level. I don't think there's much harm in Beogh actively doing something you already have as an invocation as long as it doesn't make the invocation superfluous (and this doesn't). In this case, the chance of this happening should probably be lowered, and actual reinforcement should be rarer still.
2.) Identify magical staves if you have at least 4 skill levels in the corresponding spell school when wielding it, or gain the 4th level while wielding it. (I decided on 4 because that is what most mages start out with in their special school, and it seems a good enough treshold.) Prior to that, there's still the random identification chance at casting an appropriate spell, as before.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4639 c06c8d41-db1a-0410-9941-cceddc491573
POP6UTTHSJGDU5NU7ENQJOZVFUHYM63HJ6HLPXDDLK7XFIP4XEIQC
YSEQJNZHMIMLGMGQ5RLZA3D6PDSKDTFVZOHGYLYZ7NLHIKTF5H6AC
JCWJWGMQIKQGSSFJUQRKNIWW3HBOJSHYDTOPPE5BWOJTIJTDYUTAC
INWKDE6QMV7PUWMZ65IZTUF4WB2G2OR2Q2NPTNID4Y3NVD7JWN3AC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
VDWXI5MMXZLJXWWPZPXJZ2YZIR2OMPQO3VIJO2HMTF4TPYJB2MDQC
AREBCIU2RU2RNHBWD4GARWEBKSL7HDFGDLII22H56OJO2AQUOMLQC
GSS3OCYMI4MYKACCGNLFA267VDH2U7G4QVVDLMOVAUHZTYQ3QJDAC
DDU4A3JGN5IUIPP5IASOODKPR2WBHSDSV4FITZ6HNXNSXXQACWAQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
WG6O475IOLZFMUQSLVR2KHM7XTBF5HH276L2KDGF7UOSESDOAILQC
QVVC7AYGVA6U64PTNA7L27422NLMO327P22BQKXEVIMPZHIHO7MQC
CIPVRZGLOZHCERK6YPOBV3P2E4IAB4H6D5EHLRQE2O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TLGMFJXUDVHF3FTEZZYCRIH4CBZP4MXOBR3HC4QAC
KFULGQQOHWUTXOM3BXCCYPGGVGGY4Z6265XUFRCBPNLTZAEHJZSQC
NWJ5IHZJXYE4I7CKSDNMTLGTIKOWK42LC2UYZL2TLXSZLM67WKRAC
if (spell_typematch(spell, SPTYP_POISON))
total_skill = you.skills[SK_POISON_MAGIC];
if (!chance || spell_typematch(spell, SPTYP_POISON))
relevant_skill = you.skills[SK_POISON_MAGIC];
if (spell_typematch(spell, SPTYP_NECROMANCY))
total_skill = you.skills[SK_NECROMANCY];
if (!chance || spell_typematch(spell, SPTYP_NECROMANCY))
relevant_skill = you.skills[SK_NECROMANCY];
if (spell_typematch(spell, SPTYP_CONJURATION))
total_skill = you.skills[SK_CONJURATIONS];
if (!chance || spell_typematch(spell, SPTYP_CONJURATION))
relevant_skill = you.skills[SK_CONJURATIONS];
if (spell_typematch(spell, SPTYP_ENCHANTMENT))
total_skill = you.skills[SK_ENCHANTMENTS];
if (!chance || spell_typematch(spell, SPTYP_ENCHANTMENT))
relevant_skill = you.skills[SK_ENCHANTMENTS];
if (spell_typematch(spell, SPTYP_SUMMONING))
total_skill = you.skills[SK_SUMMONINGS];
if (!chance || spell_typematch(spell, SPTYP_SUMMONING))
relevant_skill = you.skills[SK_SUMMONINGS];
if (you.skills[SK_SPELLCASTING] > total_skill)
total_skill = you.skills[SK_SPELLCASTING];
if (id_staff)
{
item_def& wpn = you.inv[you.equip[EQ_WEAPON]];
// changed from ISFLAG_KNOW_TYPE
set_ident_flags( wpn, ISFLAG_IDENT_MASK);
mprf("You are wielding %s.", wpn.name(DESC_NOCAP_A).c_str());
more();
if (random2(100) < total_skill)
{
item_def& wpn = you.inv[you.equip[EQ_WEAPON]];
// changed from ISFLAG_KNOW_TYPE
set_ident_flags( wpn, ISFLAG_IDENT_MASK);
mprf("You are wielding %s.", wpn.name(DESC_NOCAP_A).c_str());
more();
you.wield_change = true;
}
return (id_staff);
}
you.wield_change = true;
}
static void _spellcasting_side_effects(spell_type spell, bool idonly = false)
{
if (you.equip[EQ_WEAPON] != -1
&& item_is_staff( you.inv[you.equip[EQ_WEAPON]] ))
{
maybe_identify_staff(you.inv[you.equip[EQ_WEAPON]], spell);
int loopy = 0; // general purpose looping variable {dlb}
bool success = false; // more accurately: "apparent success" {dlb}
int start_count = 0;
int step_value = 1;
int end_count = (MAX_MONSTERS - 1);
int loopy = 0; // general purpose looping variable {dlb}
bool success = false; // more accurately: "apparent success" {dlb}
int start_count = 0;
int step_value = 1;
int end_count = (MAX_MONSTERS - 1);
// clear old cell pointer -- why isn't there a function for moving a monster?
mgrd[monster->x][monster->y] = NON_MONSTER;
// set monster x,y to new value
monster->x = empty[0];
monster->y = empty[1];
// set new monster grid pointer to this monster.
mgrd[monster->x][monster->y] = monster_index(monster);
// experience level (which has a number of problems) so things shouldn't
// seem too different to the player... but we still try to err on the
// experience level (which has a number of problems) so things shouldn't
// seem too different to the player... but we still try to err on the
if (exsk == SK_ARMOUR || exsk == SK_SHIELDS
|| exsk == SK_ICE_MAGIC || exsk == SK_EARTH_MAGIC
|| you.duration[ DUR_TRANSFORMATION ] > 0)
if (exsk == SK_ARMOUR || exsk == SK_SHIELDS
|| exsk == SK_ICE_MAGIC || exsk == SK_EARTH_MAGIC
|| you.duration[ DUR_TRANSFORMATION ] > 0)
// If there are no nearby followers, try to recall some on the level.
static int _beogh_blessing_recalling()
{
std::vector<int> recalled;
FixedVector < char, 2 > empty;
empty[0] = empty[1] = 0;
monsters *mon;
for (int loopy = 0; loopy < MAX_MONSTERS; loopy++)
{
mon = &menv[loopy];
if (mon->type == -1)
continue;
if (!is_orcish_follower(mon))
continue;
recalled.push_back(loopy);
}
if (recalled.empty())
return 0;
int count_recalled = 0;
int total = recalled.size();
int amount = 1 + random2(4) + random2(4);
bool recall_all = (total <= amount);
for (unsigned int loopy = 0; loopy < recalled.size(); loopy++)
{
mon = &menv[recalled[loopy]];
if (!recall_all && total == amount)
recall_all = true;
if (recall_all || random2(total) < amount)
{
if (empty_surrounds(you.x_pos, you.y_pos, DNGN_FLOOR, 3,
false, empty)
&& mon->move_to_pos( coord_def(empty[0], empty[1])) )
{
count_recalled++;
amount--;
}
else
break; // no more room to place monsters
}
total--;
}
return (count_recalled);
}
follower = choose_random_nearby_monster(0, suitable, true);
follower = choose_random_nearby_monster(0, suitable, true, true);
if (follower == NON_MONSTER)
{
// Try again, without the LOS restriction.
follower = choose_random_nearby_monster(0, suitable, false, true);
}
if (reinforced)
{
pronoun = "";
blessed = "you";
result = "reinforcement";
goto blessing_done;
}
break;
}
if (recalled)
result = "recalling";
else if (reinforced)
result = "reinforcement";
else
result = "recalling and reinforcement";
}
bool monsters::move_to_pos(const coord_def &newpos)
{
if (mgrd[newpos.x][newpos.y] != NON_MONSTER
|| you.x_pos == newpos.x && you.y_pos == newpos.y)
{
return (false);
}
// clear old cell pointer
mgrd[x][y] = NON_MONSTER;
// set monster x,y to new value
x = newpos.x;
y = newpos.y;
// set new monster grid pointer to this monster.
mgrd[x][y] = monster_index(this);
return (true);
// Most staves only give curse status when wielded and
// right now that's always "uncursed". -- bwr
set_ident_flags( item, ISFLAG_KNOW_CURSE );
// Give curse status when wielded.
// Right now that's always "uncursed". -- bwr
set_ident_flags( item, ISFLAG_KNOW_CURSE );