summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-other.cc
diff options
context:
space:
mode:
authorChris Campbell <chriscampbell89@gmail.com>2014-07-23 05:03:43 +0100
committerChris Campbell <chriscampbell89@gmail.com>2014-07-23 07:05:21 +0100
commit603939af70ec593653f9cd693764068f71aef34b (patch)
treeb91f80e2c9739e8cc7c6ea6bf737cc21e4643e91 /crawl-ref/source/spl-other.cc
parentb62d1063ba2c848a43ec9d01fa300eeb48055f6d (diff)
downloadcrawl-ref-603939af70ec593653f9cd693764068f71aef34b.tar.gz
crawl-ref-603939af70ec593653f9cd693764068f71aef34b.zip
Make Sublimation of Blood only effective when cast on the player
Having a spell work in two completely different ways depending on context is unintuitive, and self-casting it is the much more interesting use. Makes the spell unmemorisable for species without blood (Gargoyle, Ghoul, Mummy). Species that can't bleed get both level 1 spells from the first Kiku gift. Has some ugly duplication of lists of species that can't bleed, because using player::can_bleed won't correctly handle statue- or lich- formed players even with allow_tran = false, due to them changing the player's holiness.
Diffstat (limited to 'crawl-ref/source/spl-other.cc')
-rw-r--r--crawl-ref/source/spl-other.cc113
1 files changed, 33 insertions, 80 deletions
diff --git a/crawl-ref/source/spl-other.cc b/crawl-ref/source/spl-other.cc
index 85886dc579..713b1909ab 100644
--- a/crawl-ref/source/spl-other.cc
+++ b/crawl-ref/source/spl-other.cc
@@ -58,99 +58,52 @@ spret_type cast_sublimation_of_blood(int pow, bool fail)
{
bool success = false;
- int wielded = you.equip[EQ_WEAPON];
-
- if (wielded != -1)
+ if (you.duration[DUR_DEATHS_DOOR])
{
- if (you.inv[wielded].base_type == OBJ_FOOD
- && you.inv[wielded].sub_type == FOOD_CHUNK)
- {
- fail_check();
- success = true;
-
- mpr("The chunk of flesh you are holding crumbles to dust.");
-
- mpr("A flood of magical energy pours into your mind!");
-
- inc_mp(5 + random2(2 + pow / 15));
-
- dec_inv_item_quantity(wielded, 1);
+ mpr("A conflicting enchantment prevents the spell from coming into "
+ "effect.");
+ }
+ else if (!you.can_bleed())
+ {
+ if (you.species == SP_VAMPIRE)
+ mpr("You don't have enough blood to draw power from your own body.");
+ else
+ mpr("Your body is bloodless.");
+ }
+ else if (!enough_hp(2, true))
+ mpr("Your attempt to draw power from your own body fails.");
+ else
+ {
+ int food = 0;
+ // Take at most 90% of currhp.
+ const int minhp = max(div_rand_round(you.hp, 10), 1);
- if (mons_genus(you.inv[wielded].mon_type) == MONS_ORC)
- did_god_conduct(DID_DESECRATE_ORCISH_REMAINS, 2);
- if (mons_class_holiness(you.inv[wielded].mon_type) == MH_HOLY)
- did_god_conduct(DID_DESECRATE_HOLY_REMAINS, 2);
- }
- else if (is_blood_potion(you.inv[wielded])
- && item_type_known(you.inv[wielded]))
+ while (you.magic_points < you.max_magic_points && you.hp > minhp
+ && (you.is_undead != US_SEMI_UNDEAD
+ || you.hunger - food >= HUNGER_SATIATED))
{
fail_check();
success = true;
- mprf("The blood within %s froths and boils.",
- you.inv[wielded].quantity > 1 ? "one of your flasks"
- : "the flask you are holding");
+ inc_mp(1);
+ dec_hp(1, false);
- mpr("A flood of magical energy pours into your mind!");
+ if (you.is_undead == US_SEMI_UNDEAD)
+ food += 15;
- inc_mp(5 + random2(2 + pow / 15));
+ for (int loopy = 0; loopy < (you.hp > minhp ? 3 : 0); ++loopy)
+ if (x_chance_in_y(6, pow))
+ dec_hp(1, false);
- remove_oldest_blood_potion(you.inv[wielded]);
- dec_inv_item_quantity(wielded, 1);
+ if (x_chance_in_y(6, pow))
+ break;
}
+ if (success)
+ mpr("You draw magical energy from your own body!");
else
- wielded = -1;
- }
-
- if (wielded == -1)
- {
- if (you.duration[DUR_DEATHS_DOOR])
- {
- mpr("A conflicting enchantment prevents the spell from "
- "coming into effect.");
- }
- else if (!you.can_bleed())
- {
- if (you.species == SP_VAMPIRE)
- mpr("You don't have enough blood to draw power from your own body.");
- else
- mpr("Your body is bloodless.");
- }
- else if (!enough_hp(2, true))
mpr("Your attempt to draw power from your own body fails.");
- else
- {
- int food = 0;
- // Take at most 90% of currhp.
- const int minhp = max(div_rand_round(you.hp, 10), 1);
- while (you.magic_points < you.max_magic_points && you.hp > minhp
- && (you.is_undead != US_SEMI_UNDEAD
- || you.hunger - food >= HUNGER_SATIATED))
- {
- fail_check();
- success = true;
-
- inc_mp(1);
- dec_hp(1, false);
-
- if (you.is_undead == US_SEMI_UNDEAD)
- food += 15;
-
- for (int loopy = 0; loopy < (you.hp > minhp ? 3 : 0); ++loopy)
- if (x_chance_in_y(6, pow))
- dec_hp(1, false);
-
- if (x_chance_in_y(6, pow))
- break;
- }
- if (success)
- mpr("You draw magical energy from your own body!");
- else
- mpr("Your attempt to draw power from your own body fails.");
-
- make_hungry(food, false);
- }
+ make_hungry(food, false);
}
return success ? SPRET_SUCCESS : SPRET_ABORT;