Perhaps we should a note to the docs mentioning the possibility of setting runrest_ignore_message appropriately to make it work well with autoprayer.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1032 c06c8d41-db1a-0410-9941-cceddc491573
BIZDHHK5LIO57S5AKHEPJFLWV5DAFKZIKYBGOUNGICSWTX7DCXKAC
GBUB77EAYHOFY6GQ5IY3ZSBC7FSQFZZKYNBD5QMCQFIKFLYLWHOQC
3NFVCXRVGHN2CHLLWFZES5RBS4R2BCDS4EEQNSDCFYIFQWQK7MUQC
5CNYJQGEILRX2TAYBWMVECJ6D4OPV2CD6YPDIERS2SR77Z4LTZPAC
JDM27QE4HR52AYFSQE763BFF57ANOTF5MXKMO377PP5EXMN7SAOAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
QRD2M37AMG76CPGCALZQ3N2PZ3OZ3MFETMVAEHBJJVVH2BCPVGUAC
77H4BWWPPGLM3PLZH4QTAJRXIZTSDVNCOKZE223I437FN2UJ34RQC
43ZTEB57FU7KE5EVMYWZONNVJBZCGF3JEAJZIY25LC4LGE65PG5QC
3WRAJZ5ZLOSIZHFBUH5552QC4F3GAK7AXF6VIQFVN6VY7PUO6HPQC
}
/* Decides whether autoprayer Right Now is a good idea. */
static bool should_autopray()
{
if ( Options.autoprayer_on == false ||
you.religion == GOD_NO_GOD ||
you.duration[DUR_PRAYER] ||
grid_altar_god( grd[you.x_pos][you.y_pos] ) != GOD_NO_GOD ||
!i_feel_safe() )
return false;
// We already know that we're not praying now. So if you
// just autoprayed, there's a problem.
if ( you.just_autoprayed )
{
mpr("Autoprayer failed, deactivating.", MSGCH_WARN);
Options.autoprayer_on = false;
return false;
}
return true;
/* Actually performs autoprayer. */
bool do_autopray()
{
if ( you.turn_is_over ) // can happen with autopickup, I think
return false;
if ( should_autopray() )
{
pray();
you.just_autoprayed = true;
return true;
}
else
{
you.just_autoprayed = false;
return false;
}
}
if (Options.tutorial_events[TUT_SEEN_MONSTER])
i_feel_safe(); // can trigger tutorial as side effect
if (Options.tutorial_events[TUT_RUN_AWAY]
&& 2*you.hp < you.hp_max && !i_feel_safe())
if ( i_feel_safe() )
tutorial_healing_reminder();
if ( 2*you.hp < you.hp_max
|| 2*you.magic_points < you.max_magic_points )
{
tutorial_healing_reminder();
}
else if (you.running < RMODE_REST_DURATION &&
Options.tutorial_events[TUT_SHIFT_RUN] &&
you.num_turns >= 200)
{
learned_something_new(TUT_SHIFT_RUN);
}
else if (you.running < RMODE_REST_DURATION &&
Options.tutorial_events[TUT_MAP_VIEW] &&
you.num_turns >= 500)
{
learned_something_new(TUT_MAP_VIEW);
}
else if (you.running < RMODE_REST_DURATION &&
Options.tutorial_events[TUT_SHIFT_RUN] &&
you.num_turns >= 200)
{
learned_something_new(TUT_SHIFT_RUN);
}
else if (you.running < RMODE_REST_DURATION &&
Options.tutorial_events[TUT_MAP_VIEW] &&
you.num_turns >= 500)
{
learned_something_new(TUT_MAP_VIEW);
}
if (Options.autoprayer_on && you.duration[DUR_PRAYER] == 0 &&
just_autoprayed == false && you.religion != GOD_NO_GOD &&
grid_altar_god( grd[you.x_pos][you.y_pos] ) == GOD_NO_GOD &&
i_feel_safe())
{
just_autoprayed = true;
about_to_autopray = false;
return CMD_PRAY;
}
if ( just_autoprayed && you.duration[DUR_PRAYER] == 0 )
{
/* oops */
mpr("Autoprayer failed, deactivating.", MSGCH_WARN);
Options.autoprayer_on = false;
}
just_autoprayed = false;
if ( Options.autoprayer_on && about_to_autopray &&
you.religion != GOD_NO_GOD &&
you.duration[DUR_PRAYER] == 0 )
{
mpr("Autoprayer not resuming prayer.", MSGCH_WARN);
about_to_autopray = false;
}