From 55957d0f93dfcd45cba025520c239aa4af70a6c5 Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Sun, 4 Oct 2009 11:05:20 +0200 Subject: Merge monster berserk and might; improve ordering of timeout messages. ENCH_BERSERK now implies ENCH_MIGHT as with ENCH_HASTE, and ENCH_MIGHT is responsible for increased damage. ENCH_HASTE gets a timeout message (monster is no longer moving quickly). This unsubmerged a lurking bug where sub-enchantments could time out before or after the master enchantment depending on the ordering of ench_type. ench_type is reordered to have the master enchantments come first and appropriate comments are added Breaks save compatibility. --- crawl-ref/source/enum.h | 27 +++++++++++++++------------ crawl-ref/source/fight.cc | 3 +-- crawl-ref/source/mon-util.cc | 14 ++++++++++---- crawl-ref/source/religion.cc | 6 +++++- 4 files changed, 31 insertions(+), 19 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 0b93720711..439b1373df 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -1256,34 +1256,37 @@ enum duration_type // This list must match the enchant_names array in mon-util.cc or Crawl // will CRASH, we kid you not. +// Enchantments that imply other enchantments should come first +// to avoid timeout message confusion. Currently: +// berserk -> haste, might; fatigue -> slow enum enchant_type { ENCH_NONE = 0, // 0 - ENCH_SLOW, + ENCH_BERSERK, ENCH_HASTE, ENCH_MIGHT, + ENCH_FATIGUE, // Post-berserk fatigue. + ENCH_SLOW, // 5 ENCH_FEAR, - ENCH_CONFUSION, // 5 + ENCH_CONFUSION, ENCH_INVIS, ENCH_POISON, - ENCH_BERSERK, - ENCH_ROT, - ENCH_SUMMON, // 10 + ENCH_ROT, // 10 + ENCH_SUMMON, ENCH_ABJ, ENCH_BACKLIGHT, ENCH_CHARM, - ENCH_STICKY_FLAME, - ENCH_GLOWING_SHAPESHIFTER, // 15 + ENCH_STICKY_FLAME, // 15 + ENCH_GLOWING_SHAPESHIFTER, ENCH_SHAPESHIFTER, ENCH_TP, ENCH_SLEEP_WARY, - ENCH_SUBMERGED, - ENCH_SHORT_LIVED, // 20 + ENCH_SUBMERGED, // 20 + ENCH_SHORT_LIVED, ENCH_PARALYSIS, ENCH_SICK, - ENCH_SLEEPY, // Monster can't wake until this wears off. - ENCH_FATIGUE, // Post-berserk fatigue. - ENCH_HELD, // 25 -- Caught in a net. + ENCH_SLEEPY, // Monster can't wake until this wears off. + ENCH_HELD, // 25 -- Caught in a net. ENCH_BATTLE_FRENZY, // Monster is in a battle frenzy ENCH_NEUTRAL, ENCH_PETRIFYING, diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 5b6a56b6b2..6a579ff73f 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -4187,8 +4187,7 @@ int melee_attack::mons_calc_damage(const mon_attack_def &attk) damage += 1 + random2(attk.damage); // Berserk/mighted/frenzied monsters get bonus damage. - if (attacker_as_monster()->has_ench(ENCH_BERSERK) - || attacker_as_monster()->has_ench(ENCH_MIGHT)) + if (attacker_as_monster()->has_ench(ENCH_MIGHT)) damage = damage * 3 / 2; else if (attacker_as_monster()->has_ench(ENCH_BATTLE_FRENZY)) { diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 828f2fa2c1..89426adf22 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -5880,12 +5880,13 @@ void monsters::go_berserk(bool /* intentional */) make_stringf(" shakes off %s lethargy.", pronoun(PRONOUN_NOCAP_POSSESSIVE).c_str()).c_str()); } - del_ench(ENCH_HASTE); + del_ench(ENCH_HASTE, true); del_ench(ENCH_FATIGUE, true); // Give no additional message. const int duration = 16 + random2avg(13, 2); add_ench(mon_enchant(ENCH_BERSERK, 0, KC_OTHER, duration * 10)); add_ench(mon_enchant(ENCH_HASTE, 0, KC_OTHER, duration * 10)); + add_ench(mon_enchant(ENCH_MIGHT, 0, KC_OTHER, duration * 10)); simple_monster_message( this, " goes berserk!" ); // Xom likes monsters going berserk. @@ -6907,7 +6908,8 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet) speed = 100 + ((speed - 100) / 2); else speed /= 2; - + if (!quiet) + simple_monster_message(this, " is no longer moving quickly."); break; case ENCH_MIGHT: @@ -7230,7 +7232,8 @@ void monsters::timeout_enchantments(int levels) case ENCH_BERSERK: del_ench(i->first); - del_ench(ENCH_HASTE); + del_ench(ENCH_HASTE, true); + del_ench(ENCH_MIGHT, true); break; case ENCH_FATIGUE: @@ -7337,7 +7340,8 @@ void monsters::apply_enchantment(const mon_enchant &me) if (decay_enchantment(me)) { simple_monster_message(this, " is no longer berserk."); - del_ench(ENCH_HASTE); + del_ench(ENCH_HASTE, true); + del_ench(ENCH_MIGHT, true); const int duration = random_range(70, 130); add_ench(mon_enchant(ENCH_FATIGUE, 0, KC_OTHER, duration)); add_ench(mon_enchant(ENCH_SLOW, 0, KC_OTHER, duration)); @@ -7770,6 +7774,8 @@ void monsters::apply_enchantments() if (enchantments.empty()) return; + // The ordering in enchant_type makes sure that "super-enchantments" + // like berserk time out before their parts. const mon_enchant_list ec = enchantments; for (mon_enchant_list::const_iterator i = ec.begin(); i != ec.end(); ++i) { diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 5ca5c8ae88..11fa48009e 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -8176,7 +8176,11 @@ int get_tension(god_type god, bool count_travelling) } if (mons->has_ench(ENCH_BERSERK)) - exper *= 2; + { + // in addition to haste and might bonuses above + exper *= 3; + exper /= 2; + } total += exper; } -- cgit v1.2.3-54-g00ecf