Attached Files:
|
0001-Resist-messages-based-off-chance-of-resisting-rather.patch [^] (3,722 bytes) 2013-12-20 21:13 [Show Content] [Hide Content]From d6e09b5bdea33f7d0e37c214f00b875451eaabea Mon Sep 17 00:00:00 2001
From: Keanan Smith <keanan.smith@gmail.com>
Date: Fri, 20 Dec 2013 12:47:23 -0700
Subject: [PATCH] Resist messages based off chance of resisting rather than
roll
---
crawl-ref/source/beam.cc | 36 ++++++++++++++++++++++++++++--------
crawl-ref/source/mon-util.cc | 15 +++++++++------
2 files changed, 37 insertions(+), 14 deletions(-)
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 31746f4..deb364d 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -3368,8 +3368,24 @@ void bolt::affect_player_enchantment()
}
}
if (need_msg)
- canned_msg(MSG_YOU_RESIST);
-
+ {
+ // canned_msg(MSG_YOU_RESIST);
+ // replace canned message with one that reflects the level of difficulty resisting.
+ int margin;
+ margin = you.res_magic() - ench_power;
+ if (margin >= 30)
+ mpr("You resist with almost no effort.");
+ else if (margin >= 15)
+ mpr("You easily resist.");
+ else if (margin >= 0)
+ mpr("You resist.");
+ else if (margin >= -14)
+ mpr("You resist with significant effort.");
+ else if (margin >= -30)
+ mpr("You struggle to resist.");
+ else
+ mpr("You strain under the huge effort it takes to resist.");
+ }
// You *could* have gotten a free teleportation in the Abyss,
// but no, you resisted.
if (flavour == BEAM_TELEPORT && player_in_branch(BRANCH_ABYSS))
@@ -4964,16 +4980,16 @@ bool enchant_monster_invisible(monster* mon, const string &how)
mon_resist_type bolt::try_enchant_monster(monster* mon, int &res_margin)
{
+ int margin;
// Early out if the enchantment is meaningless.
if (!_ench_flavour_affects_monster(flavour, mon))
return MON_UNAFFECTED;
-
- // Check magic resistance.
+ // Check magic resistance.
if (has_saving_throw())
{
if (mons_immune_magic(mon))
return MON_UNAFFECTED;
-
+
// (Very) ugly things and shapeshifters will never resist
// polymorph beams.
if (flavour == BEAM_POLYMORPH
@@ -4986,9 +5002,13 @@ mon_resist_type bolt::try_enchant_monster(monster* mon, int &res_margin)
// Chaos effects don't get a resistance check to match melee chaos.
else if (real_flavour != BEAM_CHAOS)
{
- res_margin = mon->check_res_magic(ench_power);
- if (res_margin > 0)
- return MON_RESIST;
+ margin = mon->check_res_magic(ench_power);
+ if (margin > 0)
+ {
+ // Note only actually used by messages in this case.
+ res_margin = mon->res_magic() - ench_power;
+ return MON_RESIST;
+ }
}
}
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index cf06b84..3cc6ba5 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -1749,12 +1749,15 @@ static int _mons_damage(monster_type mc, int rt)
const char* resist_margin_phrase(int margin)
{
- ASSERT(margin > 0);
-
- return (margin >= 40) ? " easily resists." :
- (margin >= 24) ? " resists." :
- (margin >= 12) ? " resists with some effort."
- : " struggles to resist.";
+ //ASSERT(margin > 0);
+
+ return (margin >= 30) ? " resists with almost no effort." :
+ (margin >= 15) ? " easily resists." :
+ (margin >= 0) ? " resists." :
+ (margin >= -14) ? " resists with significant effort.":
+ (margin >= -30) ? " struggles to resist.":
+ " strains under the huge effort it takes to resist."
+ ;
}
bool mons_immune_magic(const monster* mon)
--
1.8.1.2
|