summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-07 20:56:57 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-07 20:56:57 +0000
commit61aa2965b3dbd9f20ea7cedcb85d143ccf5c4e7d (patch)
treeeb4e12a6c13caec0594e7618a386c8e416a80a92 /crawl-ref/source
parent0f8343ac425faa15cc6bb912c6282d0fe97d46fd (diff)
downloadcrawl-ref-61aa2965b3dbd9f20ea7cedcb85d143ccf5c4e7d.tar.gz
crawl-ref-61aa2965b3dbd9f20ea7cedcb85d143ccf5c4e7d.zip
Consolidate the routines to remove the player's condensation shield into
one function. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7403 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/acr.cc24
-rw-r--r--crawl-ref/source/cloud.cc7
-rw-r--r--crawl-ref/source/delay.cc9
-rw-r--r--crawl-ref/source/ouch.cc15
-rw-r--r--crawl-ref/source/player.cc2
-rw-r--r--crawl-ref/source/player.h3
-rw-r--r--crawl-ref/source/spells1.cc23
-rw-r--r--crawl-ref/source/spells3.cc6
-rw-r--r--crawl-ref/source/spells4.cc15
-rw-r--r--crawl-ref/source/spells4.h2
10 files changed, 45 insertions, 61 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 73b67f2bdb..4c22598b33 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -95,6 +95,7 @@
#include "spells1.h"
#include "spells2.h"
#include "spells3.h"
+#include "spells4.h"
#include "spl-book.h"
#include "spl-cast.h"
#include "spl-util.h"
@@ -2553,11 +2554,7 @@ static void _decrement_durations()
}
if (you.duration[DUR_CONDENSATION_SHIELD] > 0)
- {
- mpr("Your icy shield dissipates!", MSGCH_DURATION);
- you.duration[DUR_CONDENSATION_SHIELD] = 0;
- you.redraw_armour_class = true;
- }
+ remove_condensation_shield();
}
if (_decrement_a_duration(DUR_ICY_ARMOUR,
@@ -2713,15 +2710,12 @@ static void _decrement_durations()
// handled elsewhere
_decrement_a_duration(DUR_TELEPATHY, "You feel less empathic.");
- if (_decrement_a_duration(DUR_CONDENSATION_SHIELD,
- "Your icy shield evaporates."))
- {
- you.redraw_armour_class = true;
- }
+ if (_decrement_a_duration(DUR_CONDENSATION_SHIELD))
+ remove_condensation_shield();
if (you.duration[DUR_CONDENSATION_SHIELD] > 0 && player_res_cold() < 0)
{
- mpr( "You feel very cold." );
+ mpr("You feel very cold.");
ouch(2 + random2avg(13, 2), NON_MONSTER, KILLED_BY_FREEZING);
}
@@ -2732,9 +2726,7 @@ static void _decrement_durations()
}
if (_decrement_a_duration(DUR_STONESKIN, "Your skin feels tender."))
- {
you.redraw_armour_class = true;
- }
if (_decrement_a_duration(DUR_TELEPORT))
{
@@ -2806,7 +2798,7 @@ static void _decrement_durations()
if (_decrement_a_duration(DUR_BERSERKER, "You are no longer berserk."))
{
//jmf: Guilty for berserking /after/ berserk.
- did_god_conduct( DID_STIMULANTS, 6 + random2(6) );
+ did_god_conduct(DID_STIMULANTS, 6 + random2(6));
// Sometimes berserk leaves us physically drained.
//
@@ -2901,10 +2893,10 @@ static void _decrement_durations()
if (!you.permanent_levitation() && !you.permanent_flight())
{
- if ( _decrement_a_duration(DUR_LEVITATION,
+ if (_decrement_a_duration(DUR_LEVITATION,
"You float gracefully downwards.",
10, random2(6),
- "You are starting to lose your buoyancy!") )
+ "You are starting to lose your buoyancy!"))
{
burden_change();
// Landing kills controlled flight.
diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc
index 5dd3ec65f8..6229485d19 100644
--- a/crawl-ref/source/cloud.cc
+++ b/crawl-ref/source/cloud.cc
@@ -21,6 +21,7 @@
#include "ouch.h"
#include "place.h"
#include "player.h"
+#include "spells4.h"
#include "stuff.h"
#include "terrain.h"
#include "view.h"
@@ -454,11 +455,7 @@ void in_a_cloud()
int resist;
if (you.duration[DUR_CONDENSATION_SHIELD] > 0)
- {
- mpr("Your icy shield dissipates!", MSGCH_DURATION);
- you.duration[DUR_CONDENSATION_SHIELD] = 0;
- you.redraw_armour_class = true;
- }
+ remove_condensation_shield();
switch (env.cloud[cl].type)
{
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index 8ffc76b8a8..1ecb5c8cf0 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -35,6 +35,7 @@
#include "player.h"
#include "randart.h"
#include "religion.h"
+#include "spells4.h"
#include "spl-util.h"
#include "stash.h"
#include "state.h"
@@ -1274,11 +1275,9 @@ void armour_wear_effects(const int item_slot)
}
else if (eq_slot == EQ_SHIELD)
{
- if (you.duration[DUR_CONDENSATION_SHIELD])
- {
- mpr( "Your icy shield evaporates.", MSGCH_DURATION );
- you.duration[DUR_CONDENSATION_SHIELD] = 0;
- }
+ if (you.duration[DUR_CONDENSATION_SHIELD] > 0)
+ remove_condensation_shield();
+
you.equip[EQ_SHIELD] = item_slot;
}
else if (!melded)
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index 1d3a209196..f38eca7e9b 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -56,6 +56,7 @@
#include "religion.h"
#include "shopping.h"
#include "skills2.h"
+#include "spells4.h"
#include "state.h"
#include "stuff.h"
#include "tutorial.h"
@@ -81,11 +82,7 @@ int check_your_resists(int hurted, beam_type flavour)
|| flavour == BEAM_HELLFIRE || flavour == BEAM_FRAG)
{
if (you.duration[DUR_CONDENSATION_SHIELD] > 0)
- {
- mpr( "Your icy shield dissipates!", MSGCH_DURATION );
- you.duration[DUR_CONDENSATION_SHIELD] = 0;
- you.redraw_armour_class = true;
- }
+ remove_condensation_shield();
}
switch (flavour)
@@ -601,14 +598,10 @@ void expose_player_to_element(beam_type flavour, int strength)
|| flavour == BEAM_STEAM)
{
if (you.duration[DUR_CONDENSATION_SHIELD] > 0)
- {
- mprf(MSGCH_DURATION, "Your icy shield dissipates!");
- you.duration[DUR_CONDENSATION_SHIELD] = 0;
- you.redraw_armour_class = true;
- }
+ remove_condensation_shield();
}
- if (strength)
+ if (strength > 0)
_expose_invent_to_element( flavour, strength );
}
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 06d42bb039..9cf81785db 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -2535,7 +2535,9 @@ int player_shield_class(void) //jmf: changes for new spell
if (!you.duration[DUR_FIRE_SHIELD] &&
you.duration[DUR_CONDENSATION_SHIELD])
+ {
base_shield += 2 + (you.skills[SK_ICE_MAGIC] / 6); // max 6
+ }
}
else
{
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index e466e2f172..1637c6a849 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -420,6 +420,9 @@ void curare_hits_player(int agent, int degree);
bool poison_player(int amount, bool force = false);
void reduce_poison_player(int amount);
+bool napalm_player(int amount);
+void dec_napalm_player();
+
bool confuse_player(int amount, bool resistable = true);
void reduce_confuse_player(int amount);
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index aa10be5b51..b26296c2de 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -182,11 +182,8 @@ int blink(int pow, bool high_level_controlled_blink, bool wizard_blink)
contaminate_player( 1, true );
}
- if (you.duration[DUR_CONDENSATION_SHIELD] > 0 && !wizard_blink)
- {
- you.duration[DUR_CONDENSATION_SHIELD] = 0;
- you.redraw_armour_class = true;
- }
+ if (!wizard_blink && you.duration[DUR_CONDENSATION_SHIELD] > 0)
+ remove_condensation_shield();
}
crawl_state.cancel_cmd_again();
@@ -197,8 +194,8 @@ int blink(int pow, bool high_level_controlled_blink, bool wizard_blink)
void random_blink(bool allow_partial_control, bool override_abyss)
{
+ bool success = false;
coord_def target;
- bool succ = false;
if (scan_randarts(RAP_PREVENT_TELEPORTATION))
mpr("You feel a weird sense of stasis.");
@@ -222,10 +219,9 @@ void random_blink(bool allow_partial_control, bool override_abyss)
{
mpr("You may select the general direction of your translocation.");
cast_semi_controlled_blink(100);
- succ = true;
+ success = true;
}
#endif
-
else
{
mpr("You blink.");
@@ -233,22 +229,19 @@ void random_blink(bool allow_partial_control, bool override_abyss)
// No longer held in net.
clear_trapping_net();
- succ = true;
+ success = true;
you.moveto(target);
if (you.level_type == LEVEL_ABYSS)
{
- abyss_teleport( false );
+ abyss_teleport(false);
if (you.pet_target != MHITYOU)
you.pet_target = MHITNOT;
}
}
- if (succ && you.duration[DUR_CONDENSATION_SHIELD] > 0)
- {
- you.duration[DUR_CONDENSATION_SHIELD] = 0;
- you.redraw_armour_class = true;
- }
+ if (success && you.duration[DUR_CONDENSATION_SHIELD] > 0)
+ remove_condensation_shield();
}
bool fireball(int pow, bolt &beam)
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index af2330a23a..01fa548890 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -42,6 +42,7 @@
#include "randart.h"
#include "religion.h"
#include "spells1.h"
+#include "spells4.h"
#include "spl-cast.h"
#include "spl-util.h"
#include "stash.h"
@@ -1245,10 +1246,7 @@ static bool _teleport_player( bool allow_control, bool new_abyss_area )
StashTrack.update_stash();
if (you.duration[DUR_CONDENSATION_SHIELD] > 0)
- {
- you.duration[DUR_CONDENSATION_SHIELD] = 0;
- you.redraw_armour_class = true;
- }
+ remove_condensation_shield();
if (you.level_type == LEVEL_ABYSS)
{
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index bf66ec1c74..670a9eb99f 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -2381,6 +2381,13 @@ bool cast_sandblast(int pow, bolt &beam)
return (success);
}
+void remove_condensation_shield()
+{
+ mpr("Your icy shield dissipates!", MSGCH_DURATION);
+ you.duration[DUR_CONDENSATION_SHIELD] = 0;
+ you.redraw_armour_class = true;
+}
+
void cast_condensation_shield(int pow)
{
if (you.shield() || you.duration[DUR_FIRE_SHIELD])
@@ -2395,16 +2402,13 @@ void cast_condensation_shield(int pow)
else
{
mpr("A crackling disc of dense vapour forms in the air!");
- you.redraw_armour_class = true;
-
you.duration[DUR_CONDENSATION_SHIELD] = 10 + roll_dice(2, pow / 5);
+ you.redraw_armour_class = true;
}
if (you.duration[DUR_CONDENSATION_SHIELD] > 30)
you.duration[DUR_CONDENSATION_SHIELD] = 30;
}
-
- return;
}
void remove_divine_shield()
@@ -2424,7 +2428,8 @@ void cast_divine_shield()
if (!you.duration[DUR_DIVINE_SHIELD])
{
you.redraw_armour_class = true;
- if (you.shield() || you.duration[DUR_FIRE_SHIELD]
+ if (you.shield()
+ || you.duration[DUR_FIRE_SHIELD]
|| you.duration[DUR_CONDENSATION_SHIELD])
{
mprf("Your shield is strengthened by %s's divine power.",
diff --git a/crawl-ref/source/spells4.h b/crawl-ref/source/spells4.h
index 9226fdb10c..375b3d6e8a 100644
--- a/crawl-ref/source/spells4.h
+++ b/crawl-ref/source/spells4.h
@@ -12,6 +12,7 @@
#include "externs.h"
+struct dist;
struct bolt;
bool backlight_monsters(coord_def where, int pow, int garbage);
@@ -21,6 +22,7 @@ int make_a_normal_cloud(coord_def where, int pow, int spread_rate,
int disperse_monsters(coord_def where, int pow, int message);
void cast_bend(int pow);
+void remove_condensation_shield();
void cast_condensation_shield(int pow);
void remove_divine_shield();
void cast_divine_shield();