summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-08 21:31:51 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-08 21:31:51 +0000
commitca54ca53590788e28c47f0ea7f6c072d65a640d9 (patch)
tree4bcfe3c14e06d51289054a5dde3e28d4fdf4abca
parent1b08247fbd1c4a95902188cd01e5510e8c2e79d3 (diff)
downloadcrawl-ref-ca54ca53590788e28c47f0ea7f6c072d65a640d9.tar.gz
crawl-ref-ca54ca53590788e28c47f0ea7f6c072d65a640d9.zip
Make vampires' spell (and ability) hunger dependent on their hunger state.
Thirsty: 75% Very thirsty: 50% Near Bloodless: 25% Bloodless: None git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4933 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/abl-show.cc9
-rw-r--r--crawl-ref/source/food.cc7
-rw-r--r--crawl-ref/source/food.h4
-rw-r--r--crawl-ref/source/it_use3.cc12
-rw-r--r--crawl-ref/source/mutation.cc20
-rw-r--r--crawl-ref/source/player.cc22
-rw-r--r--crawl-ref/source/player.h1
-rw-r--r--crawl-ref/source/spells3.cc7
-rw-r--r--crawl-ref/source/spl-book.cc4
-rw-r--r--crawl-ref/source/spl-cast.cc16
10 files changed, 55 insertions, 47 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 1ab70b9a0f..98919800d1 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -932,7 +932,8 @@ static bool _activate_talent(const talent& tal)
break;
}
- if (hungerCheck && you.hunger_state == HS_STARVING)
+ if (hungerCheck && you.species != SP_VAMPIRE
+ && you.hunger_state == HS_STARVING)
{
mpr("You're too hungry.");
crawl_state.zero_turns_taken();
@@ -963,7 +964,7 @@ static bool _activate_talent(const talent& tal)
// don't insta-starve the player
// (happens at 100, losing consciousness possible from 500 downward)
- if (hungerCheck)
+ if (hungerCheck && you.species != SP_VAMPIRE)
{
const int expected_hunger = you.hunger - abil.food_cost * 2;
#ifdef DEBUG_DIAGNOSTICS
@@ -1867,7 +1868,7 @@ static void _pay_ability_costs(const ability_def& abil)
// currently only delayed fireball is instantaneous -- bwr
you.turn_is_over = !(abil.flags & ABFLAG_INSTANT);
- const int food_cost = abil.food_cost + random2avg(abil.food_cost, 2);
+ const int food_cost = abil.food_cost + random2avg(abil.food_cost, 2);
const int piety_cost = abil.piety_cost.cost();
#if DEBUG_DIAGNOSTICS
@@ -1890,7 +1891,7 @@ static void _pay_ability_costs(const ability_def& abil)
}
if (food_cost)
- make_hungry( food_cost, false );
+ make_hungry( food_cost, false, true );
if (piety_cost)
lose_piety( piety_cost );
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index 77b99b3569..cccbf8bcbc 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -72,11 +72,14 @@ static void _heal_from_food(int hp_amt, int mp_amt, bool unrot,
**************************************************
*/
-void make_hungry( int hunger_amount, bool suppress_msg )
+void make_hungry( int hunger_amount, bool suppress_msg, bool allow_reducing )
{
if (you.is_undead == US_UNDEAD)
return;
+ if (allow_reducing)
+ hunger_amount = calc_hunger(hunger_amount);
+
if (hunger_amount == 0 && !suppress_msg)
return;
@@ -1842,7 +1845,7 @@ int you_min_hunger()
if (you.is_undead == US_UNDEAD)
return 6000;
- // vampires can never starve to death
+ // Vampires can never starve to death.
if (you.species == SP_VAMPIRE)
return 701;
diff --git a/crawl-ref/source/food.h b/crawl-ref/source/food.h
index 7887258d44..3257ed26f8 100644
--- a/crawl-ref/source/food.h
+++ b/crawl-ref/source/food.h
@@ -60,8 +60,8 @@ bool eat_food(bool run_hook = true, int slot = -1);
/* ***********************************************************************
* called from: abl-show - acr - fight - food - spell
* *********************************************************************** */
-void make_hungry(int hunger_amount, bool suppress_msg);
-
+void make_hungry(int hunger_amount, bool suppress_msg,
+ bool allow_reducing = false);
// last updated 19jun2000 {dlb}
/* ***********************************************************************
diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc
index f3e63901b0..0b9dfabf03 100644
--- a/crawl-ref/source/it_use3.cc
+++ b/crawl-ref/source/it_use3.cc
@@ -473,7 +473,7 @@ bool evoke_wielded()
dec_hp( 5 + random2avg(19, 2), false, "Staff of Dispater" );
dec_mp( 2 + random2avg(5, 2) );
- make_hungry( 100, false );
+ make_hungry(100, false, true);
power = you.skills[SK_EVOCATIONS] * 8;
your_spells( SPELL_HELLFIRE, power, false );
@@ -484,7 +484,7 @@ bool evoke_wielded()
case SPWPN_SCEPTRE_OF_ASMODEUS:
if ( evoke_sceptre_of_asmodeus() )
{
- make_hungry(200, false);
+ make_hungry(200, false, true);
did_work = true;
pract = 1;
}
@@ -498,7 +498,7 @@ bool evoke_wielded()
}
dec_mp(4);
- make_hungry( 50, false );
+ make_hungry(50, false, true);
pract = 1;
did_work = true;
@@ -520,7 +520,7 @@ bool evoke_wielded()
mpr("Magical energy flows into your mind!");
inc_mp( 3 + random2(5) + you.skills[SK_EVOCATIONS] / 3, false );
- make_hungry( 50, false );
+ make_hungry(50, false, true);
pract = 1;
did_work = true;
@@ -559,7 +559,7 @@ bool evoke_wielded()
{
mpr("You channel some magical energy.");
inc_mp( 1 + random2(3), false );
- make_hungry( 50, false );
+ make_hungry(50, false, true);
pract = (one_chance_in(5) ? 1 : 0);
did_work = true;
@@ -701,7 +701,7 @@ static bool efreet_flask(void)
const int efreet =
create_monster(
mgen_data( MONS_EFREET, beha, 0, you.pos(), hitting ) );
-
+
if (efreet != -1)
{
monsters *mon = &menv[efreet];
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index 5d42d5f697..45ce62d218 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -1408,7 +1408,7 @@ static void _display_vampire_attributes()
std::string result;
- std::string column[11][7] =
+ std::string column[12][7] =
{
{" ", "<lightgreen>Alive</lightgreen> ", "<green>Full</green> ",
"Satiated ", "<yellow>Thirsty</yellow> ", "<yellow>Near...</yellow> ",
@@ -1432,7 +1432,9 @@ static void _display_vampire_attributes()
{"Stealth boost ", "none ", "none ", "none ", "minor ", "major ", "large"},
- {"Bat Form ", "no ", "no ", "yes ", "yes ", "yes ", "yes "}
+ {"Bat Form ", "no ", "no ", "yes ", "yes ", "yes ", "yes "},
+
+ {"Spell hunger ", "full ", "full ", "full ", "reduced ", "lowered ", "none "}
};
int current = 0;
@@ -1459,7 +1461,7 @@ static void _display_vampire_attributes()
current = 6;
}
- for (int y = 0; y < 11; y++) // lines (properties)
+ for (int y = 0; y < 12; y++) // lines (properties)
{
for (int x = 0; x < 7; x++) // columns (hunger states)
{
@@ -1471,18 +1473,6 @@ static void _display_vampire_attributes()
}
result += EOL;
}
-/*
- result = " <lightgreen>Alive</lightgreen> <green>Full</green> Satiated "
- "<yellow>Thirsty Near...</yellow> <lightred>Bloodless</lightred>" EOL
- "Metabolism very fast fast fast normal slow none " EOL
- "Regeneration very fast fast normal normal slow none " EOL
- "Poison resistance + + + + " EOL
- "Cold resistance + + ++ " EOL
- "Negative resistance + ++ +++ " EOL
- "Torment resistance + " EOL
- "Mutation effects full capped capped none none none " EOL
- "Stealth boost none none none minor major large" EOL;
-*/
result += EOL EOL;
result += EOL EOL;
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 6101429dc0..9ad4d186e8 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -6003,6 +6003,18 @@ void player::make_hungry(int hunger_increase, bool silent)
::lessen_hunger(-hunger_increase, silent);
}
+// For semi-undead species (Vampire!) reduce food cost for spells and abilities
+// to 75% (hungry), 50% (very hungry), 25% (near starving), or zero (starving).
+int calc_hunger(int food_cost)
+{
+ if (you.is_undead == US_SEMI_UNDEAD && you.hunger_state < HS_SATIATED)
+ {
+ food_cost *= you.hunger_state;
+ food_cost /= 4;
+ }
+ return (food_cost);
+}
+
int player::holy_aura() const
{
return (duration[DUR_REPEL_UNDEAD]? piety : 0);
@@ -6452,10 +6464,12 @@ bool player::can_mutate() const
bool player::can_safely_mutate() const
{
- return (can_mutate()
- && (!you.is_undead
- || (you.is_undead == US_SEMI_UNDEAD
- && you.hunger_state == HS_ENGORGED)));
+ if (!can_mutate())
+ return false;
+
+ return (!you.is_undead
+ || you.is_undead == US_SEMI_UNDEAD
+ && you.hunger_state == HS_ENGORGED);
}
bool player::mutate()
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index 3fa3ebec74..ed7c244819 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -138,6 +138,7 @@ int player_movement_speed(void);
* *********************************************************************** */
int player_hunger_rate(void);
+int calc_hunger(int food_cost);
/* ***********************************************************************
* called from: debug - it_use3 - spells0
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index a1ab61f9e3..704df77fc4 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -327,8 +327,6 @@ int cast_bone_shards(int power, bolt &beam)
void sublimation(int power)
{
- unsigned char loopy = 0; // general purpose loop variable {dlb}
-
int wielded = you.equip[EQ_WEAPON];
if (wielded != -1)
{
@@ -377,6 +375,7 @@ void sublimation(int power)
{
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))
@@ -388,10 +387,8 @@ void sublimation(int power)
food += 15;
for (loopy = 0; loopy < (you.hp > 1 ? 3 : 0); loopy++)
- {
if (random2(power) < 6)
dec_hp(1, false);
- }
if (random2(power) < 6)
break;
@@ -446,7 +443,7 @@ void simulacrum(int power)
for (int i = 0; i < max_num; i++)
{
if (create_monster(
- mgen_data(MONS_SIMULACRUM_SMALL,
+ mgen_data(MONS_SIMULACRUM_SMALL,
BEH_FRIENDLY, 6,
you.pos(), you.pet_target,
0, mons_type)) != -1)
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc
index 6958d365f2..3f0e043702 100644
--- a/crawl-ref/source/spl-book.cc
+++ b/crawl-ref/source/spl-book.cc
@@ -1507,6 +1507,8 @@ int staff_spell( int staff )
food -= 10 * you.skills[SK_EVOCATIONS];
if (food < diff * 5)
food = diff * 5;
+
+ food = calc_hunger(food);
}
if (food && (you.hunger_state == HS_STARVING || you.hunger <= food))
@@ -1539,7 +1541,7 @@ int staff_spell( int staff )
return (-1);
}
- make_hungry( food, true );
+ make_hungry(food, true, true);
istaff.plus -= mana;
you.wield_change = true;
you.turn_is_over = true;
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 705ed3c083..b4ef8f52ff 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -691,7 +691,7 @@ bool cast_a_spell()
if (!staff_energy && you.is_undead != US_UNDEAD)
{
- const int spellh = spell_hunger( spell );
+ const int spellh = calc_hunger( spell_hunger(spell) );
if (spellh > 0)
make_hungry(spellh, true);
}
@@ -2495,7 +2495,7 @@ static void _miscast_summoning(int severity, const char* cause)
case 4:
case 5:
if (create_monster(
- mgen_data(summon_any_demon(DEMON_LESSER),
+ mgen_data(summon_any_demon(DEMON_LESSER),
BEH_HOSTILE, 5, you.pos(), MHITYOU)) != -1)
{
mpr("Something appears in a flash of light!");
@@ -2514,7 +2514,7 @@ static void _miscast_summoning(int severity, const char* cause)
for (int i = 0; i < count; ++i)
{
create_monster(
- mgen_data(MONS_SPATIAL_VORTEX,
+ mgen_data(MONS_SPATIAL_VORTEX,
BEH_HOSTILE, 3,
you.pos(), MHITYOU));
}
@@ -2524,7 +2524,7 @@ static void _miscast_summoning(int severity, const char* cause)
case 1:
case 2:
if (create_monster(
- mgen_data(summon_any_demon(DEMON_COMMON),
+ mgen_data(summon_any_demon(DEMON_COMMON),
BEH_HOSTILE, 5,
you.pos(), MHITYOU)) != -1)
{
@@ -2537,21 +2537,21 @@ static void _miscast_summoning(int severity, const char* cause)
case 5:
mpr("A chorus of chattering voices calls out to you!");
create_monster(
- mgen_data(summon_any_demon(DEMON_LESSER),
+ mgen_data(summon_any_demon(DEMON_LESSER),
BEH_HOSTILE, 5, you.pos(), MHITYOU));
create_monster(
- mgen_data(summon_any_demon(DEMON_LESSER),
+ mgen_data(summon_any_demon(DEMON_LESSER),
BEH_HOSTILE, 5, you.pos(), MHITYOU));
if (coinflip())
create_monster(
- mgen_data(summon_any_demon(DEMON_LESSER),
+ mgen_data(summon_any_demon(DEMON_LESSER),
BEH_HOSTILE, 5, you.pos(), MHITYOU));
if (coinflip())
create_monster(
- mgen_data(summon_any_demon(DEMON_LESSER),
+ mgen_data(summon_any_demon(DEMON_LESSER),
BEH_HOSTILE, 5, you.pos(), MHITYOU));
break;
}