summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-08 16:56:49 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-08 16:56:49 +0000
commit1ae58f4e6c97657d8777457da0a78adaa19c6b17 (patch)
tree9743c27e0835aa801219a38095ae21122da3df10 /crawl-ref
parent073c543794a6c722916775207213877500167327 (diff)
downloadcrawl-ref-1ae58f4e6c97657d8777457da0a78adaa19c6b17.tar.gz
crawl-ref-1ae58f4e6c97657d8777457da0a78adaa19c6b17.zip
Clean up "Sublimation of Blood" and "Death Channel".
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5599 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/spells3.cc91
-rw-r--r--crawl-ref/source/spells3.h16
-rw-r--r--crawl-ref/source/spl-cast.cc16
3 files changed, 65 insertions, 58 deletions
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 028fced8e3..231bb6ad8a 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -328,33 +328,38 @@ bool cast_bone_shards(int power, bolt &beam)
return (success);
}
-void sublimation(int power)
+bool cast_sublimation_of_blood(int pow)
{
+ bool success = false;
+
int wielded = you.equip[EQ_WEAPON];
+
if (wielded != -1)
{
if (you.inv[wielded].base_type == OBJ_FOOD
&& you.inv[wielded].sub_type == FOOD_CHUNK)
{
mpr("The chunk of flesh you are holding crumbles to dust.");
+
mpr("A flood of magical energy pours into your mind!");
- inc_mp( 7 + random2(7), false );
+ inc_mp(7 + random2(7), false);
- dec_inv_item_quantity( wielded, 1 );
+ dec_inv_item_quantity(wielded, 1);
}
else if (is_blood_potion(you.inv[wielded]))
{
mprf("The blood within %s frothes and boils.",
- you.inv[wielded].quantity == 1 ? "the flask you are holding"
- : "one of your flasks");
-
- split_potions_into_decay( wielded, 1, false );
+ you.inv[wielded].quantity > 1 ? "one of your flasks"
+ : "the flask you are holding");
mpr("A flood of magical energy pours into your mind!");
- inc_mp( 7 + random2(7), false );
+
+ inc_mp(7 + random2(7), false);
+
+ split_potions_into_decay(wielded, 1, false);
}
- else // no appropriate item wielded
+ else
wielded = -1;
}
@@ -370,38 +375,42 @@ void sublimation(int power)
mpr("You don't have enough blood to draw power from your "
"own body.");
}
- else if (!enough_hp( 2, true ))
- {
+ else if (!enough_hp(2, true))
mpr("Your attempt to draw power from your own body fails.");
- }
else
{
+ // For vampires.
+ int food = 0;
+
mpr("You draw magical energy from your own body!");
- unsigned char loopy = 0; // general purpose loop variable {dlb}
- int food = 0; // for Vampires
while (you.magic_points < you.max_magic_points && you.hp > 1
&& (you.species != SP_VAMPIRE || you.hunger - food >= 7000))
{
+ success = true;
+
inc_mp(1, false);
dec_hp(1, false);
if (you.species == SP_VAMPIRE)
food += 15;
- for (loopy = 0; loopy < (you.hp > 1 ? 3 : 0); loopy++)
- if (random2(power) < 6)
+ for (int loopy = 0; loopy < (you.hp > 1 ? 3 : 0); ++loopy)
+ {
+ if (random2(pow) < 6)
dec_hp(1, false);
+ }
- if (random2(power) < 6)
+ if (random2(pow) < 6)
break;
}
+
make_hungry(food, false);
}
}
- return;
-} // end sublimation()
+ return (success);
+}
// Simulacrum
//
@@ -469,6 +478,27 @@ bool simulacrum(int pow, bool god_gift)
return (false);
}
+bool cast_death_channel(int pow)
+{
+ bool success = false;
+
+ if (you.duration[DUR_DEATH_CHANNEL] < 30)
+ {
+ mpr("Malign forces permeate your being, awaiting release.");
+
+ you.duration[DUR_DEATH_CHANNEL] += 15 + random2(1 + (pow / 3));
+
+ if (you.duration[DUR_DEATH_CHANNEL] > 100)
+ you.duration[DUR_DEATH_CHANNEL] = 100;
+
+ success = true;
+ }
+ else
+ canned_msg(MSG_NOTHING_HAPPENS);
+
+ return (success);
+}
+
// This function returns true if the player can use controlled teleport
// here.
bool allow_control_teleport(bool quiet)
@@ -1203,26 +1233,3 @@ int portal()
return (1);
}
-
-bool cast_death_channel(int power)
-{
- bool success = false;
-
- if (you.duration[DUR_DEATH_CHANNEL] < 30)
- {
- mpr("Malign forces permeate your being, awaiting release.");
-
- you.duration[DUR_DEATH_CHANNEL] += 15 + random2(1 + (power / 3));
-
- if (you.duration[DUR_DEATH_CHANNEL] > 100)
- you.duration[DUR_DEATH_CHANNEL] = 100;
-
- success = true;
- }
- else
- {
- canned_msg(MSG_NOTHING_HAPPENS);
- }
-
- return (success);
-} // end cast_death_channel()
diff --git a/crawl-ref/source/spells3.h b/crawl-ref/source/spells3.h
index 52aa5f8866..a887a91a1b 100644
--- a/crawl-ref/source/spells3.h
+++ b/crawl-ref/source/spells3.h
@@ -41,13 +41,6 @@ bool cast_bone_shards(int power, bolt &);
// updated 24may2000 {dlb}
/* ***********************************************************************
- * called from: spell - spells1
- * *********************************************************************** */
-bool cast_death_channel(int power);
-
-
-// updated 24may2000 {dlb}
-/* ***********************************************************************
* called from: spell
* *********************************************************************** */
void cast_poison_ammo(void);
@@ -117,7 +110,7 @@ bool remove_curse(bool suppress_msg);
/* ***********************************************************************
* called from: spell
* *********************************************************************** */
-void sublimation(int power);
+bool cast_sublimation_of_blood(int pow);
// updated Oct 2 -- bwr
@@ -129,6 +122,13 @@ bool simulacrum(int pow, bool god_gift = false);
// updated 24may2000 {dlb}
/* ***********************************************************************
+ * called from: spell - spells1
+ * *********************************************************************** */
+bool cast_death_channel(int pow);
+
+
+// updated 24may2000 {dlb}
+/* ***********************************************************************
* called from: ability - beam - decks - fight - item_use - spell
* *********************************************************************** */
void you_teleport(void);
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 954ca4e4b7..75749cfa09 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1545,10 +1545,18 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
dancing_weapon(powc);
break;
+ case SPELL_SUBLIMATION_OF_BLOOD:
+ cast_sublimation_of_blood(powc);
+ break;
+
case SPELL_SIMULACRUM:
simulacrum(powc);
break;
+ case SPELL_DEATH_CHANNEL:
+ cast_death_channel(powc);
+ break;
+
case SPELL_OZOCUBUS_ARMOUR:
ice_armour(powc, false);
break;
@@ -1609,10 +1617,6 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
return (SPRET_ABORT);
break;
- case SPELL_SUBLIMATION_OF_BLOOD:
- sublimation(powc);
- break;
-
case SPELL_HELLFIRE:
// Should only be available from:
// staff of Dispater & Sceptre of Asmodeus
@@ -1806,10 +1810,6 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
transform(powc, TRAN_LICH);
break;
- case SPELL_DEATH_CHANNEL:
- cast_death_channel(powc);
- break;
-
case SPELL_SYMBOL_OF_TORMENT:
torment(TORMENT_SPELL, you.x_pos, you.y_pos);
break;