summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Feinberg <pleasingfung@gmail.com>2014-07-13 20:13:21 -0700
committerNicholas Feinberg <pleasingfung@gmail.com>2014-07-13 20:13:21 -0700
commit257f14127322a5881d1b4f275062f79d76afd95b (patch)
treec46c6b9debad78ffa240efb53e32a4689aafd3e9
parentec5d89f7485c7bd1b4ccfd8c706516f1b501baa4 (diff)
downloadcrawl-ref-257f14127322a5881d1b4f275062f79d76afd95b.tar.gz
crawl-ref-257f14127322a5881d1b4f275062f79d76afd95b.zip
Make draining temporary (for monsters)
The hit dice-reduction effect of draining has historically had several problems. It reduced monsters' maximum hp, which made it look like they were getting *less* injured, since they had a higher proportion of hp remaining. It lowered monster XP & piety gains, which was irrelevant but misled new players who somehow learned about it. It occasionally led to "degenerate" hit-and-run tactics. And most damningly of all, it hardly ever mattered - it triggered on ~13% of hits, which meant that on low HD monsters the extra damage would kill them before the effect was noticeable, and against high HD monsters, the effect would only ever be noticeable at all with the aforementioned hit-and-run tactics. So, to fix those problems, draining now gives a "drained" status, that reduces monster HD for most combat-related purposes (spellcasting, accuracy, damage, etc.), but not max hp, xp, or piety. This is temporary, but will last 20-30 turns, and refreshes every time the drain triggers - essentially, it should last until you kill the monster, unless you run away. The temp-status is now applied to the monster every time they get drained; the chance of the drain brand activating has been reduced to 1/2, from 2/3. This should focus the effects of the brand more on the unique part of it, the draining/weakening effect. As a bonus, this also means that players can no longer have their followers permanently weakened by draining effects. Beogh buff!
-rw-r--r--crawl-ref/source/attack.cc2
-rw-r--r--crawl-ref/source/enum.h1
-rw-r--r--crawl-ref/source/mon-act.cc4
-rw-r--r--crawl-ref/source/mon-ench.cc16
-rw-r--r--crawl-ref/source/mon-info.cc10
-rw-r--r--crawl-ref/source/mon-info.h2
-rw-r--r--crawl-ref/source/monster.cc15
7 files changed, 33 insertions, 17 deletions
diff --git a/crawl-ref/source/attack.cc b/crawl-ref/source/attack.cc
index db5a5b43a7..feb4302735 100644
--- a/crawl-ref/source/attack.cc
+++ b/crawl-ref/source/attack.cc
@@ -1055,7 +1055,7 @@ void attack::do_miscast()
void attack::drain_defender()
{
- if (defender->is_monster() && one_chance_in(3))
+ if (defender->is_monster() && coinflip())
return;
if (defender->holiness() != MH_NATURAL)
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 7adc0d9781..9cb4a84d88 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1870,6 +1870,7 @@ enum enchant_type
ENCH_PERMA_BRIBED,
ENCH_CORROSION,
ENCH_GOLD_LUST,
+ ENCH_DRAINED,
// Update enchantment names in mon-ench.cc when adding or removing
// enchantments.
NUM_ENCHANTMENTS
diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc
index 949493ee6d..2787cb1c37 100644
--- a/crawl-ref/source/mon-act.cc
+++ b/crawl-ref/source/mon-act.cc
@@ -87,8 +87,8 @@ static coord_def mmov;
int monster::get_hit_dice() const
{
const int base_hd = get_experience_level();
- //TODO: add the ench!
- return base_hd;
+ const mon_enchant drain_ench = get_ench(ENCH_DRAINED);
+ return max(base_hd - drain_ench.degree, 1);
}
/**
diff --git a/crawl-ref/source/mon-ench.cc b/crawl-ref/source/mon-ench.cc
index 2f3f5d5da8..3b4132b248 100644
--- a/crawl-ref/source/mon-ench.cc
+++ b/crawl-ref/source/mon-ench.cc
@@ -1001,6 +1001,11 @@ void monster::remove_enchantment_effect(const mon_enchant &me, bool quiet)
simple_monster_message(this, " is no longer distracted by gold.");
break;
+ case ENCH_DRAINED:
+ if (!quiet)
+ simple_monster_message(this, " seems less drained.");
+ break;
+
default:
break;
}
@@ -1272,7 +1277,8 @@ void monster::apply_enchantment(const mon_enchant &me)
break;
}
- // Deliberate fall through.
+ decay_enchantment(en);
+ break;
case ENCH_SLOW:
case ENCH_HASTE:
@@ -1319,7 +1325,6 @@ void monster::apply_enchantment(const mon_enchant &me)
case ENCH_SAP_MAGIC:
case ENCH_CORROSION:
case ENCH_GOLD_LUST:
- // case ENCH_ROLLING:
decay_enchantment(en);
break;
@@ -1341,6 +1346,7 @@ void monster::apply_enchantment(const mon_enchant &me)
case ENCH_BATTLE_FRENZY:
case ENCH_ROUSED:
+ case ENCH_DRAINED:
decay_enchantment(en, false);
break;
@@ -2077,7 +2083,7 @@ static const char *enchant_names[] =
"poison_vuln", "icemail", "agile",
"frozen", "ephemeral_infusion", "black_mark", "grand_avatar",
"sap magic", "shroud", "phantom_mirror", "bribed", "permabribed",
- "corrosion", "gold_lust", "buggy",
+ "corrosion", "gold_lust", "drained", "buggy",
};
static const char *_mons_enchantment_name(enchant_type ench)
@@ -2141,8 +2147,8 @@ void mon_enchant::merge_killer(kill_category k, mid_t m)
void mon_enchant::cap_degree()
{
- // Sickness is not capped.
- if (ench == ENCH_SICK)
+ // Sickness & draining are not capped.
+ if (ench == ENCH_SICK || ench == ENCH_DRAINED)
return;
// Hard cap to simulate old enum behaviour, we should really throw this
diff --git a/crawl-ref/source/mon-info.cc b/crawl-ref/source/mon-info.cc
index 052d3712e5..a37001ff8e 100644
--- a/crawl-ref/source/mon-info.cc
+++ b/crawl-ref/source/mon-info.cc
@@ -193,6 +193,12 @@ static monster_info_flags ench_to_mb(const monster& mons, enchant_type ench)
return MB_SHROUD;
case ENCH_CORROSION:
return MB_CORROSION;
+ case ENCH_DRAINED:
+ {
+ const bool heavily_drained = mons.get_ench(ench).degree
+ >= mons.get_experience_level() / 2;
+ return heavily_drained ? MB_HEAVILY_DRAINED : MB_LIGHTLY_DRAINED;
+ }
default:
return NUM_MB_FLAGS;
}
@@ -1604,6 +1610,10 @@ vector<string> monster_info::attributes() const
v.push_back("ghostly");
if (is(MB_SLOW_MOVEMENT))
v.push_back("covering ground slowly");
+ if (is(MB_LIGHTLY_DRAINED))
+ v.push_back("lightly drained");
+ if (is(MB_HEAVILY_DRAINED))
+ v.push_back("heavily drained");
return v;
}
diff --git a/crawl-ref/source/mon-info.h b/crawl-ref/source/mon-info.h
index 2418931f06..eab5a53b1b 100644
--- a/crawl-ref/source/mon-info.h
+++ b/crawl-ref/source/mon-info.h
@@ -126,6 +126,8 @@ enum monster_info_flags
MB_CORROSION,
MB_SPECTRALISED,
MB_SLOW_MOVEMENT,
+ MB_LIGHTLY_DRAINED,
+ MB_HEAVILY_DRAINED,
NUM_MB_FLAGS
};
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index cab7b88615..3d90ff9c81 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -4247,15 +4247,12 @@ bool monster::drain_exp(actor *agent, bool quiet, int pow)
if (alive())
{
- if (one_chance_in(5))
- {
- if (hit_dice > 1)
- hit_dice--;
- experience = 0;
- }
-
- max_hit_points -= 2 + random2(3);
- hit_points = min(max_hit_points, hit_points);
+ const int dur = min(200 + random2(100),
+ 300 - get_ench(ENCH_DRAINED).duration
+ - random2(50));
+ const mon_enchant drain_ench = mon_enchant(ENCH_DRAINED, 1, agent,
+ dur);
+ add_ench(drain_ench);
}
return true;