Attached Files |
missile_deflection.patch [^] (5,115 bytes) 2013-11-05 21:36 [Show Content] [Hide Content]diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 8441247..06e1c04 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -3314,6 +3314,7 @@ bool bolt::misses_player()
// active voice to imply stronger effect
mprf(defl == 1 ? "The %s is repelled." : "You deflect the %s!",
name.c_str());
+ you.decrement_deflection();
}
else if (!_test_beam_hit(real_tohit, dodge, is_beam, defl, r))
{
diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc
index 81b9926..c02a357 100644
--- a/crawl-ref/source/main.cc
+++ b/crawl-ref/source/main.cc
@@ -2420,16 +2420,6 @@ static void _decrement_durations()
_decrement_a_duration(DUR_SILENCE, delay, "Your hearing returns.");
- _decrement_a_duration(DUR_REPEL_MISSILES, delay,
- "You feel less protected from missiles.",
- coinflip(),
- "Your repel missiles spell is about to expire...");
-
- _decrement_a_duration(DUR_DEFLECT_MISSILES, delay,
- "You feel less protected from missiles.",
- coinflip(),
- "Your deflect missiles spell is about to expire...");
-
if (_decrement_a_duration(DUR_REGENERATION, delay,
NULL, coinflip(),
"Your skin is crawling a little less now."))
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 9bb224e..15e09dc 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -4061,6 +4061,10 @@ int get_expiration_threshold(duration_type dur)
case DUR_PETRIFYING:
return (1 * BASELINE_DELAY);
+ case DUR_REPEL_MISSILES:
+ case DUR_DEFLECT_MISSILES:
+ return (2 * BASELINE_DELAY);
+
case DUR_QUAD_DAMAGE:
return (3 * BASELINE_DELAY); // per client.qc
@@ -4068,8 +4072,6 @@ int get_expiration_threshold(duration_type dur)
case DUR_SILENCE: // no message
return (5 * BASELINE_DELAY);
- case DUR_DEFLECT_MISSILES:
- case DUR_REPEL_MISSILES:
case DUR_REGENERATION:
case DUR_RESISTANCE:
case DUR_SWIFTNESS:
@@ -6368,6 +6370,43 @@ int player::missile_deflection() const
return 0;
}
+static void _decrement_a_deflection(duration_type dur,
+ const char* endmsg = NULL,
+ const char* expiremsg = NULL,
+ msg_channel_type chan = MSGCH_DURATION)
+{
+ // use BASELINE_DELAY since set_duration scales it up by that.
+ you.duration[dur] -= BASELINE_DELAY;
+ if (you.duration[dur] < 0)
+ you.duration[dur] = 0;
+
+ if (you.duration[dur] == 2 * BASELINE_DELAY)
+ {
+ if (need_expiration_warning(dur))
+ mprf(MSGCH_DANGER, "Careful! %s", expiremsg);
+ else
+ mpr(expiremsg, chan);
+ }
+ else if (you.duration[dur] == 0)
+ mpr(endmsg, chan);
+}
+
+void player::decrement_deflection()
+{
+ if (duration[DUR_DEFLECT_MISSILES] > 0)
+ {
+ _decrement_a_deflection(DUR_DEFLECT_MISSILES,
+ "You feel less protected from missiles.",
+ "Your deflect missiles spell is about to expire...");
+ }
+ else if (duration[DUR_REPEL_MISSILES] > 0)
+ {
+ _decrement_a_deflection(DUR_REPEL_MISSILES,
+ "You feel less protected from missiles.",
+ "Your repel missiles spell is about to expire...");
+ }
+}
+
int player::unadjusted_body_armour_penalty() const
{
const item_def *body_armour = slot_item(EQ_BODY_ARMOUR, false);
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index a2173b1..55f00d3 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -694,6 +694,7 @@ public:
int shield_bypass_ability(int tohit) const;
void shield_block_succeeded(actor *foe);
int missile_deflection() const;
+ void decrement_deflection();
// Combat-related adjusted penalty calculation methods
int unadjusted_body_armour_penalty() const;
diff --git a/crawl-ref/source/spl-selfench.cc b/crawl-ref/source/spl-selfench.cc
index 4bcbd79..68abbae 100644
--- a/crawl-ref/source/spl-selfench.cc
+++ b/crawl-ref/source/spl-selfench.cc
@@ -113,7 +113,7 @@ spret_type ice_armour(int pow, bool fail)
spret_type missile_prot(int pow, bool fail)
{
fail_check();
- you.increase_duration(DUR_REPEL_MISSILES, 8 + roll_dice(2, pow), 100,
+ you.set_duration(DUR_REPEL_MISSILES, 2 + roll_dice(2, pow / 16 + 1), 100,
"You feel protected from missiles.");
return SPRET_SUCCESS;
}
@@ -121,7 +121,7 @@ spret_type missile_prot(int pow, bool fail)
spret_type deflection(int pow, bool fail)
{
fail_check();
- you.increase_duration(DUR_DEFLECT_MISSILES, 15 + random2(pow), 100,
+ you.set_duration(DUR_DEFLECT_MISSILES, 3 + roll_dice(2, pow / 8 + 1), 100,
"You feel very safe from missiles.");
return SPRET_SUCCESS;
}
0001-Don-t-timeout-repel-deflect-missiles.patch [^] (5,867 bytes) 2013-11-23 02:54 [Show Content] [Hide Content]From a69d08bdd16aefda2a5fc616d9244a1d944fd11e Mon Sep 17 00:00:00 2001
From: argonaut <none>
Date: Tue, 5 Nov 2013 21:36:00 +0000
Subject: [PATCH 1/3] Don't timeout repel/deflect missiles
Instead they'll deflect a set (random) number when cast.
This does 2 things: prevents the tedium of recasting while travelling,
and makes it more likely that you'll need to recast in combat (since
that's the only time it goes away).
---
crawl-ref/source/beam.cc | 1 +
crawl-ref/source/main.cc | 10 ---------
crawl-ref/source/player.cc | 43 ++++++++++++++++++++++++++++++++++++--
crawl-ref/source/player.h | 1 +
crawl-ref/source/spl-selfench.cc | 4 ++--
5 files changed, 45 insertions(+), 14 deletions(-)
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 2e8b312..0ad3d4f 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -3322,6 +3322,7 @@ bool bolt::misses_player()
// active voice to imply stronger effect
mprf(defl == 1 ? "The %s is repelled." : "You deflect the %s!",
name.c_str());
+ you.decrement_deflection();
}
else if (!_test_beam_hit(real_tohit, dodge, is_beam, defl, r))
{
diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc
index 291f231..9466513 100644
--- a/crawl-ref/source/main.cc
+++ b/crawl-ref/source/main.cc
@@ -2425,16 +2425,6 @@ static void _decrement_durations()
_decrement_a_duration(DUR_SILENCE, delay, "Your hearing returns.");
- _decrement_a_duration(DUR_REPEL_MISSILES, delay,
- "You feel less protected from missiles.",
- coinflip(),
- "Your repel missiles spell is about to expire...");
-
- _decrement_a_duration(DUR_DEFLECT_MISSILES, delay,
- "You feel less protected from missiles.",
- coinflip(),
- "Your deflect missiles spell is about to expire...");
-
if (_decrement_a_duration(DUR_TROGS_HAND, delay,
NULL, coinflip(),
"You feel the effects of Trog's Hand fading."))
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index eb5a697..9722ff3 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -3972,6 +3972,10 @@ int get_expiration_threshold(duration_type dur)
case DUR_PETRIFYING:
return 1 * BASELINE_DELAY;
+ case DUR_REPEL_MISSILES:
+ case DUR_DEFLECT_MISSILES:
+ return (2 * BASELINE_DELAY);
+
case DUR_QUAD_DAMAGE:
return 3 * BASELINE_DELAY; // per client.qc
@@ -3979,8 +3983,6 @@ int get_expiration_threshold(duration_type dur)
case DUR_SILENCE: // no message
return 5 * BASELINE_DELAY;
- case DUR_DEFLECT_MISSILES:
- case DUR_REPEL_MISSILES:
case DUR_REGENERATION:
case DUR_RESISTANCE:
case DUR_SWIFTNESS:
@@ -6289,6 +6291,43 @@ int player::missile_deflection() const
return 0;
}
+static void _decrement_a_deflection(duration_type dur,
+ const char* endmsg = NULL,
+ const char* expiremsg = NULL,
+ msg_channel_type chan = MSGCH_DURATION)
+{
+ // use BASELINE_DELAY since set_duration scales it up by that.
+ you.duration[dur] -= BASELINE_DELAY;
+ if (you.duration[dur] < 0)
+ you.duration[dur] = 0;
+
+ if (you.duration[dur] == 2 * BASELINE_DELAY)
+ {
+ if (need_expiration_warning(dur))
+ mprf(MSGCH_DANGER, "Careful! %s", expiremsg);
+ else
+ mpr(expiremsg, chan);
+ }
+ else if (you.duration[dur] == 0)
+ mpr(endmsg, chan);
+}
+
+void player::decrement_deflection()
+{
+ if (duration[DUR_DEFLECT_MISSILES] > 0)
+ {
+ _decrement_a_deflection(DUR_DEFLECT_MISSILES,
+ "You feel less protected from missiles.",
+ "Your deflect missiles spell is about to expire...");
+ }
+ else if (duration[DUR_REPEL_MISSILES] > 0)
+ {
+ _decrement_a_deflection(DUR_REPEL_MISSILES,
+ "You feel less protected from missiles.",
+ "Your repel missiles spell is about to expire...");
+ }
+}
+
int player::unadjusted_body_armour_penalty() const
{
const item_def *body_armour = slot_item(EQ_BODY_ARMOUR, false);
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index d65df58..2b48f3e 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -696,6 +696,7 @@ public:
int shield_bypass_ability(int tohit) const;
void shield_block_succeeded(actor *foe);
int missile_deflection() const;
+ void decrement_deflection();
// Combat-related adjusted penalty calculation methods
int unadjusted_body_armour_penalty() const;
diff --git a/crawl-ref/source/spl-selfench.cc b/crawl-ref/source/spl-selfench.cc
index 905f520..3b785db 100644
--- a/crawl-ref/source/spl-selfench.cc
+++ b/crawl-ref/source/spl-selfench.cc
@@ -113,7 +113,7 @@ spret_type ice_armour(int pow, bool fail)
spret_type missile_prot(int pow, bool fail)
{
fail_check();
- you.increase_duration(DUR_REPEL_MISSILES, 8 + roll_dice(2, pow), 100,
+ you.set_duration(DUR_REPEL_MISSILES, 2 + roll_dice(2, pow / 16 + 1), 100,
"You feel protected from missiles.");
return SPRET_SUCCESS;
}
@@ -121,7 +121,7 @@ spret_type missile_prot(int pow, bool fail)
spret_type deflection(int pow, bool fail)
{
fail_check();
- you.increase_duration(DUR_DEFLECT_MISSILES, 15 + random2(pow), 100,
+ you.set_duration(DUR_DEFLECT_MISSILES, 3 + roll_dice(2, pow / 8 + 1), 100,
"You feel very safe from missiles.");
return SPRET_SUCCESS;
}
--
1.7.10.4
0002-Save-compat-scale-down-old-RD-Msl-durations.patch [^] (1,526 bytes) 2013-11-23 02:55 [Show Content] [Hide Content]From e24cde4e13c0572eb547a149ff1e5e3a28d27adf Mon Sep 17 00:00:00 2001
From: Neil Moore <neil@s-z.org>
Date: Fri, 22 Nov 2013 20:49:27 -0500
Subject: [PATCH 2/3] Save compat: scale down old [RD]Msl durations.
---
crawl-ref/source/tag-version.h | 1 +
crawl-ref/source/tags.cc | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/crawl-ref/source/tag-version.h b/crawl-ref/source/tag-version.h
index 21637b4..75b07b1 100644
--- a/crawl-ref/source/tag-version.h
+++ b/crawl-ref/source/tag-version.h
@@ -71,6 +71,7 @@ enum tag_minor_version
TAG_MINOR_ABYSS_BRANCHES, // Spawn abyss monsters from other branches.
TAG_MINOR_BRANCH_ENTRY, // Store branch entry point (rather than just depth).
TAG_MINOR_16_BIT_TABLE, // Increase the limit for CrawlVector/HashTable to 65535.
+ TAG_MINOR_UNTIMED_RMSL, // [RD]Msl duration in deflections, not time
#endif
NUM_TAG_MINORS,
TAG_MINOR_VERSION = NUM_TAG_MINORS - 1
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index 85e632e..fc5132b 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -2235,6 +2235,12 @@ static void tag_read_you(reader &th)
#if TAG_MAJOR_VERSION == 34
if (you.species == SP_LAVA_ORC)
you.duration[DUR_STONESKIN] = 0;
+
+ if (th.getMinorVersion() < TAG_MINOR_UNTIMED_RMSL)
+ {
+ you.duration[DUR_DEFLECT_MISSILES] /= 5;
+ you.duration[DUR_REPEL_MISSILES] /= 10;
+ }
#endif
// how many attributes?
--
1.7.10.4
0003-Expire-RD-Msl-with-scroll-of-vulnerability.patch [^] (1,052 bytes) 2013-11-23 02:55 [Show Content] [Hide Content]From b2321121f67c92725df1c91f80956382473193cf Mon Sep 17 00:00:00 2001
From: Neil Moore <neil@s-z.org>
Date: Fri, 22 Nov 2013 20:32:39 -0500
Subject: [PATCH 3/3] Expire [RD]Msl with scroll of vulnerability.
It was being taken down to duration 1, but it doesn't naturally
expire now.
---
crawl-ref/source/spl-goditem.cc | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/crawl-ref/source/spl-goditem.cc b/crawl-ref/source/spl-goditem.cc
index 595d1b8..5a3dc8f 100644
--- a/crawl-ref/source/spl-goditem.cc
+++ b/crawl-ref/source/spl-goditem.cc
@@ -423,6 +423,14 @@ void antimagic()
mpr("You feel strangely stable.", MSGCH_DURATION);
}
+ if (you.duration[DUR_REPEL_MISSILES] > 0
+ || you.duration[DUR_DEFLECT_MISSILES] > 0)
+ {
+ you.duration[DUR_REPEL_MISSILES] = 0;
+ you.duration[DUR_DEFLECT_MISSILES] = 0;
+ mpr("You feel less protected from missiles.", MSGCH_DURATION);
+ }
+
if (you.duration[DUR_PETRIFYING] > 0)
{
you.duration[DUR_PETRIFYING] = 0;
--
1.7.10.4
0004-missile-delection.patch [^] (10,968 bytes) 2013-12-13 20:17 [Show Content] [Hide Content]diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 09326c8..aac13d6 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -3322,6 +3322,7 @@ bool bolt::misses_player()
// active voice to imply stronger effect
mprf(defl == 1 ? "The %s is repelled." : "You deflect the %s!",
name.c_str());
+ you.decrement_deflection();
}
else if (!_test_beam_hit(real_tohit, dodge, is_beam, defl, r))
{
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index a476de1..7fc1101 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -309,6 +309,8 @@ enum attribute_type
ATTR_RECITE_SEED, // Recite text seed.
ATTR_RECITE_HP, // HP on start of recitation.
ATTR_SWIFTNESS, // Duration of future antiswiftness.
+ ATTR_REPEL_MISSILES, // Number of missiles to repel
+ ATTR_DEFLECT_MISSILES, // Number of missiles to deflect
NUM_ATTRIBUTES
};
@@ -1471,7 +1473,7 @@ enum duration_type
DUR_LIQUID_FLAMES,
DUR_ICY_ARMOUR,
- DUR_REPEL_MISSILES,
+ DUR_REPEL_MISSILES, // not used
DUR_JELLY_PRAYER,
DUR_PIETY_POOL, // distribute piety over time
DUR_DIVINE_VIGOUR, // duration of Ely's Divine Vigour
@@ -1487,7 +1489,7 @@ enum duration_type
DUR_BREATH_WEAPON,
DUR_TRANSFORMATION,
DUR_DEATH_CHANNEL,
- DUR_DEFLECT_MISSILES,
+ DUR_DEFLECT_MISSILES, // not used
DUR_PHASE_SHIFT,
#if TAG_MAJOR_VERSION == 34
DUR_SEE_INVISIBLE,
diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc
index 7ec8dd1..8b77c57 100644
--- a/crawl-ref/source/main.cc
+++ b/crawl-ref/source/main.cc
@@ -2427,16 +2427,6 @@ static void _decrement_durations()
_decrement_a_duration(DUR_SILENCE, delay, "Your hearing returns.");
- _decrement_a_duration(DUR_REPEL_MISSILES, delay,
- "You feel less protected from missiles.",
- coinflip(),
- "Your repel missiles spell is about to expire...");
-
- _decrement_a_duration(DUR_DEFLECT_MISSILES, delay,
- "You feel less protected from missiles.",
- coinflip(),
- "Your deflect missiles spell is about to expire...");
-
if (_decrement_a_duration(DUR_TROGS_HAND, delay,
NULL, coinflip(),
"You feel the effects of Trog's Hand fading."))
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 9abd698..8fc777b 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -3951,8 +3951,6 @@ int get_expiration_threshold(duration_type dur)
case DUR_SILENCE: // no message
return 5 * BASELINE_DELAY;
- case DUR_DEFLECT_MISSILES:
- case DUR_REPEL_MISSILES:
case DUR_REGENERATION:
case DUR_RESISTANCE:
case DUR_SWIFTNESS:
@@ -6267,9 +6265,9 @@ void player::shield_block_succeeded(actor *foe)
int player::missile_deflection() const
{
- if (duration[DUR_DEFLECT_MISSILES])
+ if (attribute[ATTR_DEFLECT_MISSILES])
return 2;
- if (duration[DUR_REPEL_MISSILES]
+ if (attribute[ATTR_REPEL_MISSILES]
|| player_mutation_level(MUT_DISTORTION_FIELD) == 3
|| scan_artefacts(ARTP_RMSL, true))
{
@@ -6278,6 +6276,37 @@ int player::missile_deflection() const
return 0;
}
+static void _decrement_a_deflection(attribute_type attr,
+ const char* endmsg = NULL,
+ const char* expiremsg = NULL)
+{
+ you.attribute[attr] -= 1;
+ if (you.attribute[attr] < 0)
+ you.attribute[attr] = 0;
+
+ if (you.attribute[attr] == 1)
+ mprf(MSGCH_DURATION, "%s", expiremsg);
+ else if (you.attribute[attr] == 0)
+ mprf(MSGCH_DURATION, "%s", endmsg);
+}
+
+void player::decrement_deflection()
+{
+ if (attribute[ATTR_DEFLECT_MISSILES] > 0)
+ {
+ _decrement_a_deflection(ATTR_DEFLECT_MISSILES,
+ "Your deflecting charm collapses.",
+ "Your deflecting charm wavers...");
+ }
+ else if (attribute[ATTR_REPEL_MISSILES] > 0)
+ {
+ _decrement_a_deflection(ATTR_REPEL_MISSILES,
+ "Your repelling charm collapses.",
+ "Your repelling charm wavers...");
+ }
+}
+
+
int player::unadjusted_body_armour_penalty() const
{
const item_def *body_armour = slot_item(EQ_BODY_ARMOUR, false);
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index a31dcb4..84cf5b4 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -696,6 +696,7 @@ public:
int shield_bypass_ability(int tohit) const;
void shield_block_succeeded(actor *foe);
int missile_deflection() const;
+ void decrement_deflection();
// Combat-related adjusted penalty calculation methods
int unadjusted_body_armour_penalty() const;
diff --git a/crawl-ref/source/spl-goditem.cc b/crawl-ref/source/spl-goditem.cc
index ad2240c..036d5cd 100644
--- a/crawl-ref/source/spl-goditem.cc
+++ b/crawl-ref/source/spl-goditem.cc
@@ -397,9 +397,8 @@ void antimagic()
{
DUR_INVIS, DUR_CONF, DUR_PARALYSIS, DUR_HASTE, DUR_MIGHT, DUR_AGILITY,
DUR_BRILLIANCE, DUR_CONFUSING_TOUCH, DUR_SURE_BLADE, DUR_CORONA,
- DUR_FIRE_SHIELD, DUR_ICY_ARMOUR, DUR_REPEL_MISSILES,
- DUR_SWIFTNESS, DUR_CONTROL_TELEPORT,
- DUR_TRANSFORMATION, DUR_DEATH_CHANNEL, DUR_DEFLECT_MISSILES,
+ DUR_FIRE_SHIELD, DUR_ICY_ARMOUR, DUR_SWIFTNESS, DUR_CONTROL_TELEPORT,
+ DUR_TRANSFORMATION, DUR_DEATH_CHANNEL,
DUR_PHASE_SHIFT, DUR_WEAPON_BRAND, DUR_SILENCE,
DUR_CONDENSATION_SHIELD, DUR_STONESKIN, DUR_RESISTANCE,
DUR_SLAYING, DUR_STEALTH,
@@ -429,6 +428,14 @@ void antimagic()
mprf(MSGCH_DURATION, "You feel limber!");
}
+ if (you.attribute[ATTR_REPEL_MISSILES] > 0
+ || you.attribute[ATTR_DEFLECT_MISSILES] > 0)
+ {
+ you.attribute[ATTR_REPEL_MISSILES] = 0;
+ you.attribute[ATTR_DEFLECT_MISSILES] = 0;
+ mprf(MSGCH_DURATION, "You feel less protected from missiles.");
+ }
+
if (you.attribute[ATTR_DELAYED_FIREBALL])
{
you.attribute[ATTR_DELAYED_FIREBALL] = 0;
@@ -451,6 +458,7 @@ void antimagic()
}
}
+
bool danger = need_expiration_warning(you.pos());
if (need_msg)
diff --git a/crawl-ref/source/spl-selfench.cc b/crawl-ref/source/spl-selfench.cc
index f4daa80..e7e1056 100644
--- a/crawl-ref/source/spl-selfench.cc
+++ b/crawl-ref/source/spl-selfench.cc
@@ -112,16 +112,26 @@ spret_type ice_armour(int pow, bool fail)
spret_type missile_prot(int pow, bool fail)
{
fail_check();
- you.increase_duration(DUR_REPEL_MISSILES, 8 + roll_dice(2, pow), 100,
- "You feel protected from missiles.");
+ if (you.attribute[ATTR_REPEL_MISSILES] > 1)
+ {
+ mpr("This spell is already in effect.");
+ return SPRET_ABORT;
+ }
+ you.attribute[ATTR_REPEL_MISSILES] = 2 + min(10, random2(pow / 4));
+ mpr("You feel protected from missiles.");
return SPRET_SUCCESS;
}
spret_type deflection(int pow, bool fail)
{
fail_check();
- you.increase_duration(DUR_DEFLECT_MISSILES, 15 + random2(pow), 100,
- "You feel very safe from missiles.");
+ if (you.attribute[ATTR_DEFLECT_MISSILES] > 1)
+ {
+ mpr("This spell is already in effect.");
+ return SPRET_ABORT;
+ }
+ you.attribute[ATTR_DEFLECT_MISSILES] = 3 + random2avg(pow / 3, 2);
+ mpr("You feel very safe from missiles.");
return SPRET_SUCCESS;
}
diff --git a/crawl-ref/source/status.cc b/crawl-ref/source/status.cc
index 6855bf5..e6ecf51 100644
--- a/crawl-ref/source/status.cc
+++ b/crawl-ref/source/status.cc
@@ -1073,7 +1073,7 @@ static void _describe_missiles(status_info* inf)
inf->light_text = "DMsl";
inf->short_text = "deflect missiles";
inf->long_text = "You deflect missiles.";
- expiring = dur_expiring(DUR_DEFLECT_MISSILES);
+ expiring = (you.attribute[ATTR_DEFLECT_MISSILES] == 1);
}
else
{
@@ -1083,7 +1083,7 @@ static void _describe_missiles(status_info* inf)
inf->light_text = "RMsl";
inf->short_text = "repel missiles";
inf->long_text = "You repel missiles.";
- expiring = (!perm && dur_expiring(DUR_REPEL_MISSILES));
+ expiring = (!perm && (you.attribute[ATTR_REPEL_MISSILES] == 1));
}
inf->light_colour = _dur_colour(inf->light_colour, expiring);
diff --git a/crawl-ref/source/tag-version.h b/crawl-ref/source/tag-version.h
index 2d5ad85..da2864a 100644
--- a/crawl-ref/source/tag-version.h
+++ b/crawl-ref/source/tag-version.h
@@ -73,6 +73,7 @@ enum tag_minor_version
TAG_MINOR_16_BIT_TABLE, // Increase the limit for CrawlVector/HashTable to 65535.
TAG_MINOR_ABIL_1000, // Start god ability enums at 1000.
TAG_MINOR_CLASS_HP_0, // Base class maxhp at 0.
+ TAG_MINOR_UNTIMED_RMSL, // [RD]Msl duration in deflections, not time
#endif
NUM_TAG_MINORS,
TAG_MINOR_VERSION = NUM_TAG_MINORS - 1
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index f1d4117..7047d16 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -1955,6 +1955,11 @@ static void tag_read_you(reader &th)
int i,j;
int count;
+#if TAG_MAJOR_VERSION == 34
+ int attr_repel = 0;
+ int attr_deflect = 0;
+#endif
+
ASSERT(is_valid_species(you.species));
ASSERT(you.char_class < NUM_JOBS);
ASSERT_RANGE(you.experience_level, 1, 28);
@@ -2246,6 +2251,21 @@ static void tag_read_you(reader &th)
#if TAG_MAJOR_VERSION == 34
if (you.species == SP_LAVA_ORC)
you.duration[DUR_STONESKIN] = 0;
+
+ if (th.getMinorVersion() < TAG_MINOR_UNTIMED_RMSL)
+ {
+ if (you.duration[DUR_DEFLECT_MISSILES])
+ {
+ you.duration[DUR_DEFLECT_MISSILES] = 0;
+ attr_deflect = 4;
+ }
+ if (you.duration[DUR_REPEL_MISSILES])
+ {
+ you.duration[DUR_REPEL_MISSILES] = 0;
+ attr_repel = 4;
+ }
+ }
+
#endif
// how many attributes?
@@ -2268,6 +2288,20 @@ static void tag_read_you(reader &th)
unmarshallInt(th);
#if TAG_MAJOR_VERSION == 34
+ if (th.getMinorVersion() < TAG_MINOR_UNTIMED_RMSL)
+ {
+ if (attr_deflect)
+ {
+ you.attribute[ATTR_DEFLECT_MISSILES] = attr_deflect;
+ }
+ if (attr_repel)
+ {
+ you.attribute[ATTR_REPEL_MISSILES] = attr_repel;
+ }
+ }
+#endif
+
+#if TAG_MAJOR_VERSION == 34
if (you.attribute[ATTR_DIVINE_REGENERATION])
{
you.attribute[ATTR_DIVINE_REGENERATION] = 0;
0005-missile-deflection.patch [^] (7,439 bytes) 2014-01-27 19:08 [Show Content] [Hide Content]From d8bdf758b03c3907be4ade187f58156bc58a34c7 Mon Sep 17 00:00:00 2001
Date: Mon, 27 Jan 2014 12:19:40 -0500
Subject: [PATCH] Repel/Deflect missiles don't normally timeout.
They are kept as (short) durations but don't decrement while the corresponding
attribute is set. Each deflection has a chance to clear the attibute -
starting the duration countdown.
---
crawl-ref/source/beam.cc | 1 +
crawl-ref/source/enum.h | 2 ++
crawl-ref/source/main.cc | 10 ++++++++--
crawl-ref/source/player.cc | 20 ++++++++++++++++++++
crawl-ref/source/player.h | 1 +
crawl-ref/source/spl-data.h | 2 +-
crawl-ref/source/spl-goditem.cc | 6 ++++++
crawl-ref/source/spl-selfench.cc | 10 ++++++----
crawl-ref/source/status.cc | 6 ++++--
9 files changed, 49 insertions(+), 9 deletions(-)
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 0fdadc2..e64818a 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -3278,6 +3278,7 @@ bool bolt::misses_player()
// active voice to imply stronger effect
mprf(defl == 1 ? "The %s is repelled." : "You deflect the %s!",
name.c_str());
+ you.ablate_deflection();
}
else if (!_test_beam_hit(real_tohit, dodge, is_beam, defl, r))
{
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 953997e..f595ec0 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -311,6 +311,8 @@ enum attribute_type
ATTR_RECITE_SEED, // Recite text seed.
ATTR_RECITE_HP, // HP on start of recitation.
ATTR_SWIFTNESS, // Duration of future antiswiftness.
+ ATTR_REPEL_MISSILES, // Chance to expire repel missiles
+ ATTR_DEFLECT_MISSILES, // Chance to expire deflect missiles
NUM_ATTRIBUTES
};
diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc
index b3672b2..bbaa2ba 100644
--- a/crawl-ref/source/main.cc
+++ b/crawl-ref/source/main.cc
@@ -2415,15 +2415,21 @@ static void _decrement_durations()
_decrement_a_duration(DUR_SILENCE, delay, "Your hearing returns.");
- _decrement_a_duration(DUR_REPEL_MISSILES, delay,
+ if (you.attribute[ATTR_REPEL_MISSILES] == 0)
+ {
+ _decrement_a_duration(DUR_REPEL_MISSILES, delay,
"You feel less protected from missiles.",
coinflip(),
"Your repel missiles spell is about to expire...");
+ }
- _decrement_a_duration(DUR_DEFLECT_MISSILES, delay,
+ if (you.attribute[ATTR_DEFLECT_MISSILES] == 0)
+ {
+ _decrement_a_duration(DUR_DEFLECT_MISSILES, delay,
"You feel less protected from missiles.",
coinflip(),
"Your deflect missiles spell is about to expire...");
+ }
if (_decrement_a_duration(DUR_TROGS_HAND, delay,
NULL, coinflip(),
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 86de633..692b333 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -6273,6 +6273,26 @@ int player::missile_deflection() const
return 0;
}
+void player::ablate_deflection()
+{
+ if (attribute[ATTR_DEFLECT_MISSILES])
+ {
+ if (one_chance_in(attribute[ATTR_DEFLECT_MISSILES]))
+ {
+ attribute[ATTR_DEFLECT_MISSILES] = 0;
+ mprf(MSGCH_DURATION, "Your deflecting charm wavers...");
+ }
+ }
+ else if (attribute[ATTR_REPEL_MISSILES] && duration[DUR_DEFLECT_MISSILES] == 0)
+ {
+ if (one_chance_in(attribute[ATTR_REPEL_MISSILES]))
+ {
+ attribute[ATTR_REPEL_MISSILES] = 0;
+ mprf(MSGCH_DURATION, "Your repelling charm wavers...");
+ }
+ }
+}
+
int player::unadjusted_body_armour_penalty() const
{
const item_def *body_armour = slot_item(EQ_BODY_ARMOUR, false);
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index f1ddf61..c9c7e3e 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -695,6 +695,7 @@ public:
int shield_bypass_ability(int tohit) const;
void shield_block_succeeded(actor *foe);
int missile_deflection() const;
+ void ablate_deflection();
// Combat-related adjusted penalty calculation methods
int unadjusted_body_armour_penalty() const;
diff --git a/crawl-ref/source/spl-data.h b/crawl-ref/source/spl-data.h
index cdcb3a2..747d524 100644
--- a/crawl-ref/source/spl-data.h
+++ b/crawl-ref/source/spl-data.h
@@ -888,7 +888,7 @@ struct spell_desc
SPTYP_CHARMS | SPTYP_AIR,
SPFLAG_NONE,
2,
- 200,
+ 50,
-1, -1,
0,
NULL,
diff --git a/crawl-ref/source/spl-goditem.cc b/crawl-ref/source/spl-goditem.cc
index 292e9d6..f05e414 100644
--- a/crawl-ref/source/spl-goditem.cc
+++ b/crawl-ref/source/spl-goditem.cc
@@ -434,6 +434,12 @@ void antimagic()
mprf(MSGCH_DURATION, "Your charged fireball dissipates.");
}
+ if (you.attribute[ATTR_REPEL_MISSILES])
+ you.attribute[ATTR_REPEL_MISSILES] = 0;
+
+ if (you.attribute[ATTR_DEFLECT_MISSILES])
+ you.attribute[ATTR_DEFLECT_MISSILES] = 0;
+
if (you.attribute[ATTR_SWIFTNESS] > 0)
you.attribute[ATTR_SWIFTNESS] = 0;
diff --git a/crawl-ref/source/spl-selfench.cc b/crawl-ref/source/spl-selfench.cc
index f4daa80..28eeb8e 100644
--- a/crawl-ref/source/spl-selfench.cc
+++ b/crawl-ref/source/spl-selfench.cc
@@ -112,16 +112,18 @@ spret_type ice_armour(int pow, bool fail)
spret_type missile_prot(int pow, bool fail)
{
fail_check();
- you.increase_duration(DUR_REPEL_MISSILES, 8 + roll_dice(2, pow), 100,
- "You feel protected from missiles.");
+ you.attribute[ATTR_REPEL_MISSILES] = 2 + pow/6;
+ you.set_duration(DUR_REPEL_MISSILES, 3, 50, NULL);
+ mpr("You feel protected from missiles.");
return SPRET_SUCCESS;
}
spret_type deflection(int pow, bool fail)
{
fail_check();
- you.increase_duration(DUR_DEFLECT_MISSILES, 15 + random2(pow), 100,
- "You feel very safe from missiles.");
+ you.attribute[ATTR_DEFLECT_MISSILES] = 1 + pow/5;
+ you.set_duration(DUR_DEFLECT_MISSILES, 5, 50, NULL);
+ mpr("You feel very safe from missiles.");
return SPRET_SUCCESS;
}
diff --git a/crawl-ref/source/status.cc b/crawl-ref/source/status.cc
index 494bc56..6634538 100644
--- a/crawl-ref/source/status.cc
+++ b/crawl-ref/source/status.cc
@@ -1061,7 +1061,8 @@ static void _describe_missiles(status_info* inf)
inf->light_text = "DMsl";
inf->short_text = "deflect missiles";
inf->long_text = "You deflect missiles.";
- expiring = dur_expiring(DUR_DEFLECT_MISSILES);
+ expiring = (you.attribute[ATTR_DEFLECT_MISSILES] == 0
+ && dur_expiring(DUR_DEFLECT_MISSILES));
}
else
{
@@ -1071,7 +1072,8 @@ static void _describe_missiles(status_info* inf)
inf->light_text = "RMsl";
inf->short_text = "repel missiles";
inf->long_text = "You repel missiles.";
- expiring = (!perm && dur_expiring(DUR_REPEL_MISSILES));
+ expiring = (!perm && you.attribute[ATTR_REPEL_MISSILES] == 0
+ && dur_expiring(DUR_REPEL_MISSILES));
}
inf->light_colour = _dur_colour(inf->light_colour, expiring);
--
1.8.3.2
|