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XTJW5IBRWIF4F4BJC3BGKJAGWYRGD7LQBG6FW3PTO7BGTU6OAPAC
OTNWGNENMUSNAMPPLXIXDBES2TIEQJMZ3QW4QV4NWRB6BIHR2PLQC
PJWXE2ZLK4YCJM77CENEMB5XKVFTXFPMJEWC3TAMOTPZ5HSD3JZAC
SUGQXSK6UN6W4WQQHRG2X6QYC5JRWEIYPATYRCP4ADD6DUMACNFQC
XM4T7BGR7RJCXTKMZP32DK5HB7DP6ROLWOJO5NACMHATYMA4475AC
L5KQH3FHNYTFE4D2L3ZGWCBCMW3PAR7EHD5555GSKJGVK7HQWPXAC
CRU7JBTVJWTTVQ5JTRA2B3X2FPKPJ2RRR33IK2OG536VMOEZJYJAC
2TFYJ7D72JY4DYQW3GSPEONA2WYIVHAJXTIQ2QRDIWF65XN2QFGAC
}
static bool _increase_ench_duration(monsters *mon,
mon_enchant ench,
const int increase)
{
// Durations are saved as 16-bit signed ints, so clamp at the largest such.
const int MARSHALL_MAX = (1 << 15) - 1;
const int newdur = std::min(ench.duration + increase, MARSHALL_MAX);
if (ench.duration >= newdur)
return false;
ench.duration = newdur;
mon->update_ench(ench);
return true;
const int increase = 300 + random2(300);
const int threshold = (increase + random2(increase)) * 2;
// Extend the time an abjurable monster has before disappearing.
abj.duration += increase;
// If the extended stay is long enough, make it permanent. Note
// that we have to delete the enchantment without removing the
// enchantment effect, in order to keep the monster from
// disappearing.
if (abj.duration >= threshold)
{
mon->del_ench(ENCH_ABJ, true, false);
return 2;
}
else
mon->update_ench(abj);
return 1;
// [ds] Disabling permanence for balance reasons, but extending duration
// increase. These numbers are tenths of a player turn. Holy monsters
// get a much bigger boost than random beasties.
const int base_increase = mon->holiness() == MH_HOLY? 1100 : 500;
const int increase = base_increase + random2(base_increase);
return _increase_ench_duration(mon, abj, increase);
mon->attitude = ATT_FRIENDLY;
// The monster is not really *created* friendly, but should it
// become hostile later on, it won't count as a good kill.
mon->flags |= MF_CREATED_FRIENDLY;
mons_make_god_gift(mon, GOD_SHINING_ONE);
// If the monster is charmed, make it permanently friendly. Note
// that we have to delete the enchantment without removing the
// enchantment effect, in order to keep the monster from turning
// hostile.
mon->del_ench(ENCH_CHARM, true, false);
return (true);
// [ds] Just increase charm duration, no permanent friendliness.
const int base_increase = 700;
return _increase_ench_duration(mon, mon->get_ench(ENCH_CHARM),
base_increase + random2(base_increase));