healing. Also add a routine to promote ordinary monsters to priests, mostly based on code in monster_polymorph(), and (rarely) use it as a blessing.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3771 c06c8d41-db1a-0410-9941-cceddc491573
RIIO4BI64ECFXSRLBP3RA24QOPYXJVWMSFHLNTKUZS5YCLISLVJQC
if (priest_type != MONS_PROGRAM_BUG)
{
// Turn an ordinary monster into a priestly monster, preserving
// important characteristics. Keep this as generic as possible,
// in case more promotions are added.
const unsigned long old_flags = mon->flags;
const int old_hp = mon->hit_points;
const int old_hp_max = mon->max_hit_points;
const char old_ench_countdown = mon->ench_countdown;
mon_enchant abj = mon->get_ench(ENCH_ABJ);
mon_enchant shifter = mon->get_ench(ENCH_GLOWING_SHAPESHIFTER,
ENCH_SHAPESHIFTER);
const bool old_mon_caught = mons_is_caught(mon);
mon->type = priest_type;
define_monster(monster_index(mon));
mon->flags = old_flags;
mon->hit_points = mon->max_hit_points *
((old_hp * 100) / old_hp_max) / 100;
mon->ench_countdown = old_ench_countdown;
mon->add_ench(abj);
mon->add_ench(shifter);
if (old_mon_caught)
mon->add_ench(ENCH_HELD);
if (mons_class_flag(mon->type, M_INVIS))
mon->add_ench(ENCH_INVIS);
mon->fix_speed();
return true;
}
return false;
}
const char *result;
bool healing = false;
bool vigour = true;
// Full healing.
healing = heal_monster(mon, mon->max_hit_points, false);
// 5% chance: Turn a monster into a priestly monster, if
// possible. This is currently only used for Beogh.
case 0:
case 1:
case 2:
case 3:
case 4:
if (god == GOD_BEOGH && promote_to_priest(mon))
{
result = "priesthood";
break;
}
// Deliberate fall through.